From 33f577cfea7b5cc7c7167716522bf74c5e3219da Mon Sep 17 00:00:00 2001 From: William Bourke Date: Fri, 17 Oct 2014 11:13:11 -0700 Subject: Modified lollipop Easter egg for TV compatibility Bug: 17997922 Change-Id: I0e2e34245183cdd146ecca02ab09b2c4867770ec --- .../com/android/internal/app/PlatLogoActivity.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'core/java/com') diff --git a/core/java/com/android/internal/app/PlatLogoActivity.java b/core/java/com/android/internal/app/PlatLogoActivity.java index f92fd55..80bc5fe 100644 --- a/core/java/com/android/internal/app/PlatLogoActivity.java +++ b/core/java/com/android/internal/app/PlatLogoActivity.java @@ -36,6 +36,7 @@ import android.provider.Settings; import android.util.DisplayMetrics; import android.util.Log; import android.view.Gravity; +import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewOutlineProvider; @@ -54,6 +55,7 @@ public class PlatLogoActivity extends Activity { }; FrameLayout mLayout; int mTapCount; + int mKeyCount; PathInterpolator mInterpolator = new PathInterpolator(0f, 0f, 0.5f, 1f); static int newColorIndex() { @@ -203,6 +205,28 @@ public class PlatLogoActivity extends Activity { } }); + // Enable hardware keyboard input for TV compatibility. + im.setFocusable(true); + im.requestFocus(); + im.setOnKeyListener(new View.OnKeyListener() { + @Override + public boolean onKey(View v, int keyCode, KeyEvent event) { + if (keyCode != KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) { + ++mKeyCount; + if (mKeyCount > 2) { + if (mTapCount > 5) { + im.performLongClick(); + } else { + im.performClick(); + } + } + return true; + } else { + return false; + } + } + }); + mLayout.addView(im, new FrameLayout.LayoutParams(size, size, Gravity.CENTER)); im.animate().scaleX(0.3f).scaleY(0.3f) -- cgit v1.1