Loading core/java/com/android/internal/app/PlatLogoActivity.java +2 −2 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ public class PlatLogoActivity extends Activity { getWindowManager().getDefaultDisplay().getMetrics(metrics); mContent = new ImageView(this); mContent.setImageResource(com.android.internal.R.drawable.platlogo); mContent.setImageResource(com.android.internal.R.drawable.platlogo_alt); mContent.setScaleType(ImageView.ScaleType.CENTER_INSIDE); final int p = (int)(32 * metrics.density); Loading @@ -102,7 +102,7 @@ public class PlatLogoActivity extends Activity { @Override public void onClick(View v) { mToast.show(); mContent.setImageResource(com.android.internal.R.drawable.platlogo_alt); mContent.setImageResource(com.android.internal.R.drawable.platlogo); } }); Loading core/res/res/drawable-nodpi/platlogo.png +5.07 KiB (43.5 KiB) Loading image diff... core/res/res/drawable-nodpi/platlogo_alt.png −5.07 KiB (38.4 KiB) Loading image diff... packages/SystemUI/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ android:allowBackup="false" android:hardwareAccelerated="true" android:label="@string/app_label" android:icon="@drawable/ic_launcher_settings"> android:icon="@*android:drawable/platlogo"> <!-- Broadcast receiver that gets the broadcast at boot time and starts up everything else. Loading packages/SystemUI/src/com/android/systemui/BeanBag.java +35 −50 Original line number Diff line number Diff line Loading @@ -81,6 +81,10 @@ public class BeanBag extends Activity { return (float) Math.sqrt(x*x+y*y); } static float clamp(float x, float a, float b) { return ((x<a)?a:((x>b)?b:x)); } static float dot(float x1, float y1, float x2, float y2) { return x1*x2+y1+y2; } Loading Loading @@ -149,6 +153,7 @@ public class BeanBag extends Activity { public boolean grabbed; public float grabx, graby; public long grabtime; private float grabx_offset, graby_offset; public Bean(Context context, AttributeSet as) { super(context, as); Loading Loading @@ -236,17 +241,20 @@ public class BeanBag extends Activity { switch (e.getAction()) { case MotionEvent.ACTION_DOWN: grabbed = true; grabx_offset = e.getRawX() - x; graby_offset = e.getRawY() - y; va = 0; // fall case MotionEvent.ACTION_MOVE: grabx = e.getRawX(); graby = e.getRawY(); grabx = e.getRawX() - grabx_offset; graby = e.getRawY() - graby_offset; grabtime = e.getEventTime(); break; case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: grabbed = false; va = randfrange(-5,5); float a = randsign() * clamp(mag(vx, vy) * 0.33f, 0, 1080f); va = randfrange(a*0.5f, a); break; } return true; Loading Loading @@ -308,47 +316,6 @@ public class BeanBag extends Activity { if (!(v2 instanceof Bean)) continue; Bean nv2 = (Bean) v2; final float overlap = nv.overlap(nv2); if (false && overlap < 0) { // angle pointing from nv2 to nv final float dx = nv.x - nv2.x; final float dy = nv.y - nv2.y; final float ang = (float) Math.atan2(dx, dy); if (false) { nv.vx -= Math.cos(ang) * overlap * 0.5f; nv.vy -= Math.sin(ang) * overlap * 0.5f; nv2.vx += Math.cos(ang) * overlap * 0.5f; nv2.vy += Math.sin(ang) * overlap * 0.5f; } // first, move them apart nv.x -= Math.cos(ang) * overlap/2; nv.y -= Math.sin(ang) * overlap/2; nv2.x += Math.cos(ang) * overlap/2; nv2.y += Math.sin(ang) * overlap/2; // next, figure out velocities final float sap = 0f; // randfrange(0,0.25f); final float mag1 = mag(nv.vx, nv.vy) * (1f-sap); final float mag2 = mag(nv2.vx, nv2.vy) * (1f-sap); // hacky way to transfer "momentum" nv.vx = mag2 * (float)Math.cos(ang); nv.vy = mag2 * (float)Math.sin(ang); nv2.vx = -mag1 * (float)Math.cos(ang); nv2.vy = -mag1 * (float)Math.sin(ang); final float totalva = nv.va + nv2.va; final float frac = randfrange(0.25f,0.75f); nv.va = totalva * frac; nv2.va = totalva * (1f-frac); // nv.va += randfrange(-20,20); // nv2.va += randfrange(-20,20); } } nv.setRotation(nv.a); Loading @@ -375,17 +342,28 @@ public class BeanBag extends Activity { boardWidth = w; boardHeight = h; // android.util.Log.d("Nyandroid", "resized: " + w + "x" + h); } public void startAnimation() { stopAnimation(); if (mAnim == null) { post(new Runnable() { public void run() { reset(); mAnim.start(); startAnimation(); } }); } else { mAnim.start(); } } public void stopAnimation() { if (mAnim != null) mAnim.cancel(); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); mAnim.cancel(); stopAnimation(); } @Override Loading Loading @@ -428,12 +406,19 @@ public class BeanBag extends Activity { WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED ); mBoard = new Board(this, null); setContentView(mBoard); } @Override public void onPause() { super.onPause(); mBoard.stopAnimation(); } @Override public void onResume() { super.onResume(); mBoard = new Board(this, null); setContentView(mBoard); mBoard.startAnimation(); } } Loading
core/java/com/android/internal/app/PlatLogoActivity.java +2 −2 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ public class PlatLogoActivity extends Activity { getWindowManager().getDefaultDisplay().getMetrics(metrics); mContent = new ImageView(this); mContent.setImageResource(com.android.internal.R.drawable.platlogo); mContent.setImageResource(com.android.internal.R.drawable.platlogo_alt); mContent.setScaleType(ImageView.ScaleType.CENTER_INSIDE); final int p = (int)(32 * metrics.density); Loading @@ -102,7 +102,7 @@ public class PlatLogoActivity extends Activity { @Override public void onClick(View v) { mToast.show(); mContent.setImageResource(com.android.internal.R.drawable.platlogo_alt); mContent.setImageResource(com.android.internal.R.drawable.platlogo); } }); Loading
packages/SystemUI/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ android:allowBackup="false" android:hardwareAccelerated="true" android:label="@string/app_label" android:icon="@drawable/ic_launcher_settings"> android:icon="@*android:drawable/platlogo"> <!-- Broadcast receiver that gets the broadcast at boot time and starts up everything else. Loading
packages/SystemUI/src/com/android/systemui/BeanBag.java +35 −50 Original line number Diff line number Diff line Loading @@ -81,6 +81,10 @@ public class BeanBag extends Activity { return (float) Math.sqrt(x*x+y*y); } static float clamp(float x, float a, float b) { return ((x<a)?a:((x>b)?b:x)); } static float dot(float x1, float y1, float x2, float y2) { return x1*x2+y1+y2; } Loading Loading @@ -149,6 +153,7 @@ public class BeanBag extends Activity { public boolean grabbed; public float grabx, graby; public long grabtime; private float grabx_offset, graby_offset; public Bean(Context context, AttributeSet as) { super(context, as); Loading Loading @@ -236,17 +241,20 @@ public class BeanBag extends Activity { switch (e.getAction()) { case MotionEvent.ACTION_DOWN: grabbed = true; grabx_offset = e.getRawX() - x; graby_offset = e.getRawY() - y; va = 0; // fall case MotionEvent.ACTION_MOVE: grabx = e.getRawX(); graby = e.getRawY(); grabx = e.getRawX() - grabx_offset; graby = e.getRawY() - graby_offset; grabtime = e.getEventTime(); break; case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: grabbed = false; va = randfrange(-5,5); float a = randsign() * clamp(mag(vx, vy) * 0.33f, 0, 1080f); va = randfrange(a*0.5f, a); break; } return true; Loading Loading @@ -308,47 +316,6 @@ public class BeanBag extends Activity { if (!(v2 instanceof Bean)) continue; Bean nv2 = (Bean) v2; final float overlap = nv.overlap(nv2); if (false && overlap < 0) { // angle pointing from nv2 to nv final float dx = nv.x - nv2.x; final float dy = nv.y - nv2.y; final float ang = (float) Math.atan2(dx, dy); if (false) { nv.vx -= Math.cos(ang) * overlap * 0.5f; nv.vy -= Math.sin(ang) * overlap * 0.5f; nv2.vx += Math.cos(ang) * overlap * 0.5f; nv2.vy += Math.sin(ang) * overlap * 0.5f; } // first, move them apart nv.x -= Math.cos(ang) * overlap/2; nv.y -= Math.sin(ang) * overlap/2; nv2.x += Math.cos(ang) * overlap/2; nv2.y += Math.sin(ang) * overlap/2; // next, figure out velocities final float sap = 0f; // randfrange(0,0.25f); final float mag1 = mag(nv.vx, nv.vy) * (1f-sap); final float mag2 = mag(nv2.vx, nv2.vy) * (1f-sap); // hacky way to transfer "momentum" nv.vx = mag2 * (float)Math.cos(ang); nv.vy = mag2 * (float)Math.sin(ang); nv2.vx = -mag1 * (float)Math.cos(ang); nv2.vy = -mag1 * (float)Math.sin(ang); final float totalva = nv.va + nv2.va; final float frac = randfrange(0.25f,0.75f); nv.va = totalva * frac; nv2.va = totalva * (1f-frac); // nv.va += randfrange(-20,20); // nv2.va += randfrange(-20,20); } } nv.setRotation(nv.a); Loading @@ -375,17 +342,28 @@ public class BeanBag extends Activity { boardWidth = w; boardHeight = h; // android.util.Log.d("Nyandroid", "resized: " + w + "x" + h); } public void startAnimation() { stopAnimation(); if (mAnim == null) { post(new Runnable() { public void run() { reset(); mAnim.start(); startAnimation(); } }); } else { mAnim.start(); } } public void stopAnimation() { if (mAnim != null) mAnim.cancel(); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); mAnim.cancel(); stopAnimation(); } @Override Loading Loading @@ -428,12 +406,19 @@ public class BeanBag extends Activity { WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED ); mBoard = new Board(this, null); setContentView(mBoard); } @Override public void onPause() { super.onPause(); mBoard.stopAnimation(); } @Override public void onResume() { super.onResume(); mBoard = new Board(this, null); setContentView(mBoard); mBoard.startAnimation(); } }