diff options
author | Daniel Sandler <dsandler@android.com> | 2011-10-12 13:11:13 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-10-12 13:11:13 -0700 |
commit | fd8f6f2f7557c414466f7634391821e59c1ce040 (patch) | |
tree | 4bb2fea590921f1cdd392ade4f209307696f7a78 /core/java/com | |
parent | 075e4c3d2e6a8a9eb3506dfedc8da938fb65fb65 (diff) | |
parent | 5f839f8ee426cc42af3ee0eaf5236f2f6930dd15 (diff) | |
download | frameworks_base-fd8f6f2f7557c414466f7634391821e59c1ce040.zip frameworks_base-fd8f6f2f7557c414466f7634391821e59c1ce040.tar.gz frameworks_base-fd8f6f2f7557c414466f7634391821e59c1ce040.tar.bz2 |
Merge "Fix obsolete Honeycomb platlogo." into ics-mr0
Diffstat (limited to 'core/java/com')
-rw-r--r-- | core/java/com/android/internal/app/PlatLogoActivity.java | 73 |
1 files changed, 60 insertions, 13 deletions
diff --git a/core/java/com/android/internal/app/PlatLogoActivity.java b/core/java/com/android/internal/app/PlatLogoActivity.java index 9fbbb3d..a0e125a 100644 --- a/core/java/com/android/internal/app/PlatLogoActivity.java +++ b/core/java/com/android/internal/app/PlatLogoActivity.java @@ -17,32 +17,79 @@ package com.android.internal.app; import android.app.Activity; +import android.content.ActivityNotFoundException; +import android.content.Intent; import android.os.Bundle; +import android.os.Handler; +import android.os.Vibrator; import android.view.MotionEvent; +import android.view.View; +import android.view.ViewConfiguration; import android.widget.ImageView; import android.widget.Toast; public class PlatLogoActivity extends Activity { Toast mToast; + ImageView mContent; + Vibrator mZzz = new Vibrator(); + int mCount; + final Handler mHandler = new Handler(); + + Runnable mSuperLongPress = new Runnable() { + public void run() { + mCount++; + mZzz.vibrate(50 * mCount); + final float scale = 1f + 0.25f * mCount * mCount; + mContent.setScaleX(scale); + mContent.setScaleY(scale); + + if (mCount <= 3) { + mHandler.postDelayed(mSuperLongPress, ViewConfiguration.getLongPressTimeout()); + } else { + try { + startActivity(new Intent(Intent.ACTION_MAIN) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK + | Intent.FLAG_ACTIVITY_CLEAR_TASK + | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) + .setClassName("com.android.systemui","com.android.systemui.Nyandroid")); + } catch (ActivityNotFoundException ex) { + android.util.Log.e("PlatLogoActivity", "Couldn't find platlogo screensaver."); + } + finish(); + } + } + }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - mToast = Toast.makeText(this, "REZZZZZZZ...", Toast.LENGTH_SHORT); + mToast = Toast.makeText(this, "Android 4.0: Ice Cream Sandwich", Toast.LENGTH_SHORT); - ImageView content = new ImageView(this); - content.setImageResource(com.android.internal.R.drawable.platlogo); - content.setScaleType(ImageView.ScaleType.CENTER_INSIDE); - - setContentView(content); - } + mContent = new ImageView(this); + mContent.setImageResource(com.android.internal.R.drawable.platlogo); + mContent.setScaleType(ImageView.ScaleType.CENTER_INSIDE); - @Override - public boolean dispatchTouchEvent(MotionEvent ev) { - if (ev.getAction() == MotionEvent.ACTION_UP) { - mToast.show(); - } - return super.dispatchTouchEvent(ev); + mContent.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View v, MotionEvent event) { + final int action = event.getAction(); + if (action == MotionEvent.ACTION_DOWN) { + mContent.setPressed(true); + mHandler.removeCallbacks(mSuperLongPress); + mCount = 0; + mHandler.postDelayed(mSuperLongPress, 2*ViewConfiguration.getLongPressTimeout()); + } else if (action == MotionEvent.ACTION_UP) { + if (mContent.isPressed()) { + mContent.setPressed(false); + mHandler.removeCallbacks(mSuperLongPress); + mToast.show(); + } + } + return true; + } + }); + + setContentView(mContent); } } |