Loading core/java/com/android/internal/app/PlatLogoActivity.java +60 −13 Original line number Diff line number Diff line Loading @@ -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); mContent.setOnTouchListener(new View.OnTouchListener() { @Override public boolean dispatchTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_UP) { 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 super.dispatchTouchEvent(ev); } return true; } }); setContentView(mContent); } } core/res/res/drawable-nodpi/platlogo.png −43.7 KiB (1.63 KiB) Loading image diff... packages/SystemUI/AndroidManifest.xml +16 −0 Original line number Diff line number Diff line Loading @@ -101,5 +101,21 @@ android:taskAffinity="com.android.systemui.net" android:excludeFromRecents="true" /> <!-- started from ... somewhere --> <activity android:name=".Nyandroid" android:exported="true" android:label="Nyandroid" android:icon="@drawable/nyandroid04" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" android:hardwareAccelerated="true" android:launchMode="singleInstance" android:excludeFromRecents="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DREAM" /> </intent-filter> </activity> </application> </manifest> packages/SystemUI/res/drawable-nodpi/nyandroid00.png 0 → 100644 +622 B Loading image diff... packages/SystemUI/res/drawable-nodpi/nyandroid01.png 0 → 100644 +574 B Loading image diff... Loading
core/java/com/android/internal/app/PlatLogoActivity.java +60 −13 Original line number Diff line number Diff line Loading @@ -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); mContent.setOnTouchListener(new View.OnTouchListener() { @Override public boolean dispatchTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_UP) { 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 super.dispatchTouchEvent(ev); } return true; } }); setContentView(mContent); } }
packages/SystemUI/AndroidManifest.xml +16 −0 Original line number Diff line number Diff line Loading @@ -101,5 +101,21 @@ android:taskAffinity="com.android.systemui.net" android:excludeFromRecents="true" /> <!-- started from ... somewhere --> <activity android:name=".Nyandroid" android:exported="true" android:label="Nyandroid" android:icon="@drawable/nyandroid04" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" android:hardwareAccelerated="true" android:launchMode="singleInstance" android:excludeFromRecents="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DREAM" /> </intent-filter> </activity> </application> </manifest>