diff --git a/core/java/com/android/internal/app/PlatLogoActivity.java b/core/java/com/android/internal/app/PlatLogoActivity.java index abd17916e810d..f92fd5567cced 100644 --- a/core/java/com/android/internal/app/PlatLogoActivity.java +++ b/core/java/com/android/internal/app/PlatLogoActivity.java @@ -16,124 +16,199 @@ package com.android.internal.app; +import android.animation.ObjectAnimator; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.ContentResolver; -import android.content.Context; import android.content.Intent; -import android.graphics.Color; -import android.graphics.Typeface; -import android.os.Build; +import android.content.res.ColorStateList; +import android.graphics.Canvas; +import android.graphics.Outline; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; +import android.graphics.drawable.RippleDrawable; +import android.graphics.drawable.ShapeDrawable; +import android.graphics.drawable.shapes.OvalShape; import android.os.Bundle; import android.provider.Settings; -import android.util.AttributeSet; import android.util.DisplayMetrics; +import android.util.Log; import android.view.Gravity; import android.view.View; +import android.view.ViewGroup; +import android.view.ViewOutlineProvider; +import android.view.animation.PathInterpolator; import android.widget.FrameLayout; -import android.widget.TextView; +import android.widget.ImageView; public class PlatLogoActivity extends Activity { - private static class Torso extends FrameLayout { - boolean mAnimate = false; - TextView mText; + final static int[] FLAVORS = { + 0xFF9C27B0, 0xFFBA68C8, // grape + 0xFFFF9800, 0xFFFFB74D, // orange + 0xFFF06292, 0xFFF8BBD0, // bubblegum + 0xFFAFB42B, 0xFFCDDC39, // lime + 0xFFFFEB3B, 0xFFFFF176, // lemon + 0xFF795548, 0xFFA1887F, // mystery flavor + }; + FrameLayout mLayout; + int mTapCount; + PathInterpolator mInterpolator = new PathInterpolator(0f, 0f, 0.5f, 1f); - public Torso(Context context) { - this(context, null); - } - public Torso(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - public Torso(Context context, AttributeSet attrs, int flags) { - super(context, attrs, flags); + static int newColorIndex() { + return 2*((int) (Math.random()*FLAVORS.length/2)); + } - for (int i=0; i<2; i++) { - final View v = new View(context); - v.setBackgroundColor(i % 2 == 0 ? Color.BLUE : Color.RED); - addView(v); - } - - mText = new TextView(context); - mText.setTextColor(Color.BLACK); - mText.setTextSize(14 /* sp */); - mText.setTypeface(Typeface.create("monospace", Typeface.BOLD)); - - addView(mText, new FrameLayout.LayoutParams( - FrameLayout.LayoutParams.MATCH_PARENT, - FrameLayout.LayoutParams.WRAP_CONTENT, - Gravity.BOTTOM | Gravity.LEFT - )); - } - - private Runnable mRunnable = new Runnable() { - @Override - public void run() { - mText.setText(String.format("android_%s.flv - build %s", - Build.VERSION.CODENAME, - Build.VERSION.INCREMENTAL)); - final int N = getChildCount(); - final float parentw = getMeasuredWidth(); - final float parenth = getMeasuredHeight(); - for (int i=0; i - - + android:width="560.0dp" + android:height="560.0dp" + android:viewportWidth="560.0" + android:viewportHeight="560.0"> - + android:pathData="M264.079987,240.736l0.0,9.82c7.31,-7.15 17.139999,-11.56 28.07,-11.56c22.639999,0.0 40.799999,18.48 40.799999,41.12c0.0,22.48 -18.16,40.880 -40.799999,40.880c-10.93,0.0 -20.280,-4.09 -27.59,-10.93L264.559998,339.0l-11.32,0.0l0.0,-98.269997L264.079987,240.731zM265.809998,264.869995c-0.47,0.79 -1.26,2.04 -1.26,4.79l0.0,21.07c0.0,1.97 0.47,3.07 1.1,4.17c5.19,8.88 14.78,14.94 25.63,14.94c16.43,0.0 29.950,-13.44 29.950,-29.870c0.0,-16.280 -13.52,-29.799999 -29.950,-29.799999C280.51,250.169998 271.0,256.059998 265.809998,264.869995z" + android:fillColor="#FFFFFF"/> - + android:pathData="M445.731,240.736l0.0,9.82c7.31,-7.15 17.139999,-11.56 28.07,-11.56c22.639999,0.0 40.799999,18.48 40.799999,41.12c0.0,22.48 -18.16,40.880 -40.799999,40.880c-10.93,0.0 -20.280,-4.09 -27.59,-10.93L446.210052,339.0l-11.32,0.0l0.0,-98.269997L445.731,240.731zM447.459991,264.869995c-0.47,0.79 -1.26,2.04 -1.26,4.79l0.0,21.07c0.0,1.97 0.47,3.07 1.1,4.17c5.19,8.88 14.78,14.94 25.63,14.94c16.43,0.0 29.950,-13.44 29.950,-29.870c0.0,-16.280 -13.52,-29.799999 -29.950,-29.799999C462.160004,250.169998 452.649994,256.059998 447.459991,264.869995z" + android:fillColor="#FFFFFF"/> - + android:pathData="M169.490005,279.880005c0.0,22.639999 -18.32,41.12 -40.810,41.12c-22.639999,0.0 -41.040,-18.48 -41.040,-41.12c0.0,-22.48 18.389999,-40.880 41.040,-40.880C151.169998,239.0 169.490005,257.399994 169.490005,279.880005zM158.089996,280.040009c0.0,-16.43 -13.13,-29.870 -29.41,-29.870c-16.51,0.0 -29.4,13.44 -29.4,29.870c0.0,16.280 12.89,29.799999 29.4,29.799999C144.960007,309.8387 158.089996,296.309998 158.089996,280.040009z" + android:fillColor="#FFFFFF"/> + + + + + + - - diff --git a/core/res/res/drawable-nodpi/stat_sys_adb.xml b/core/res/res/drawable-nodpi/stat_sys_adb.xml index 1fee2df3af4b1..d89d1f922a0e1 100644 --- a/core/res/res/drawable-nodpi/stat_sys_adb.xml +++ b/core/res/res/drawable-nodpi/stat_sys_adb.xml @@ -1,10 +1,11 @@ - - + android:width="24.0dp" + android:height="24.0dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> - - + android:pathData="M19.000000,10.000000c0.000000,3.866000 -3.134000,7.000000 -7.000000,7.000000s-7.000000,-3.134000 -7.000000,-7.000000c0.000000,-2.318000 1.131000,-4.367000 2.867000,-5.641000L5.778000,2.270000l0.824000,-0.825000l2.290000,2.290000C9.830000,3.269000 10.882000,3.000000 12.000000,3.000000c1.118000,0.000000 2.170000,0.269000 3.107000,0.734000l2.290000,-2.290000l0.824000,0.825000l-2.089000,2.090000C17.868000,5.633000 19.000000,7.682000 19.000000,10.000000zM10.000000,8.000000c0.000000,-0.552000 -0.447000,-1.000000 -1.000000,-1.000000S8.000000,7.448000 8.000000,8.000000s0.447000,1.000000 1.000000,1.000000S10.000000,8.552000 10.000000,8.000000zM16.000000,8.000000c0.000000,-0.552000 -0.447000,-1.000000 -1.000000,-1.000000s-1.000000,0.448000 -1.000000,1.000000s0.447000,1.000000 1.000000,1.000000S16.000000,8.552000 16.000000,8.000000z" + android:fillColor="#FFFFFF"/> + - - diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index eeb79b9cb38d7..b3e60d1dae05e 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -121,7 +121,7 @@ android:allowBackup="false" android:hardwareAccelerated="true" android:label="@string/app_label" - android:icon="@*android:drawable/platlogo" + android:icon="@drawable/icon" android:process="com.android.systemui" android:supportsRtl="true" android:theme="@style/systemui_theme"> @@ -288,7 +288,7 @@ + + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/drawable-nodpi/lollipop.xml b/packages/SystemUI/res/drawable-nodpi/lollipop.xml new file mode 100644 index 0000000000000..cb63af02d786d --- /dev/null +++ b/packages/SystemUI/res/drawable-nodpi/lollipop.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/packages/SystemUI/res/drawable/placeholder.xml b/packages/SystemUI/res/drawable/placeholder.xml deleted file mode 100644 index 19331456ebb22..0000000000000 --- a/packages/SystemUI/res/drawable/placeholder.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/packages/SystemUI/res/drawable/pop_belt.xml b/packages/SystemUI/res/drawable/pop_belt.xml new file mode 100644 index 0000000000000..5c0c3d7f89f51 --- /dev/null +++ b/packages/SystemUI/res/drawable/pop_belt.xml @@ -0,0 +1,33 @@ + + + + + + + diff --git a/packages/SystemUI/res/drawable/pop_droid.xml b/packages/SystemUI/res/drawable/pop_droid.xml new file mode 100644 index 0000000000000..eed325c6541c3 --- /dev/null +++ b/packages/SystemUI/res/drawable/pop_droid.xml @@ -0,0 +1,33 @@ + + + + + + + diff --git a/packages/SystemUI/res/drawable/pop_pizza.xml b/packages/SystemUI/res/drawable/pop_pizza.xml new file mode 100644 index 0000000000000..b6d2bb30b3d91 --- /dev/null +++ b/packages/SystemUI/res/drawable/pop_pizza.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + diff --git a/packages/SystemUI/res/drawable/pop_stripes.xml b/packages/SystemUI/res/drawable/pop_stripes.xml new file mode 100644 index 0000000000000..ef6c8e88e2bfe --- /dev/null +++ b/packages/SystemUI/res/drawable/pop_stripes.xml @@ -0,0 +1,36 @@ + + + + + + + + diff --git a/packages/SystemUI/res/drawable/pop_swirl.xml b/packages/SystemUI/res/drawable/pop_swirl.xml new file mode 100644 index 0000000000000..acd6d3ddb5f3c --- /dev/null +++ b/packages/SystemUI/res/drawable/pop_swirl.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + diff --git a/packages/SystemUI/res/drawable/pop_vortex.xml b/packages/SystemUI/res/drawable/pop_vortex.xml new file mode 100644 index 0000000000000..faefcb1e89196 --- /dev/null +++ b/packages/SystemUI/res/drawable/pop_vortex.xml @@ -0,0 +1,27 @@ + + + + + diff --git a/packages/SystemUI/res/drawable/pop_vortex2.xml b/packages/SystemUI/res/drawable/pop_vortex2.xml new file mode 100644 index 0000000000000..0a96b74cf476e --- /dev/null +++ b/packages/SystemUI/res/drawable/pop_vortex2.xml @@ -0,0 +1,27 @@ + + + + + diff --git a/packages/SystemUI/res/values/lland_config.xml b/packages/SystemUI/res/values/lland_config.xml index 56125a57f96c9..5d740824b63db 100644 --- a/packages/SystemUI/res/values/lland_config.xml +++ b/packages/SystemUI/res/values/lland_config.xml @@ -20,10 +20,11 @@ 380dp 100dp - 600dp + 550dp 40dp 40dp - 80dp + 90dp + 12dp 170dp 40dp 20dp @@ -38,8 +39,8 @@ 30dp 1000dp 6dp - 15dp - 15dp - 18dp + 18dp + 18dp + 20dp 35dp diff --git a/packages/SystemUI/src/com/android/systemui/egg/LLand.java b/packages/SystemUI/src/com/android/systemui/egg/LLand.java index d1c02dd38d952..cdfe6e578a9f0 100644 --- a/packages/SystemUI/src/com/android/systemui/egg/LLand.java +++ b/packages/SystemUI/src/com/android/systemui/egg/LLand.java @@ -19,26 +19,37 @@ package com.android.systemui.egg; import android.animation.TimeAnimator; import android.content.Context; import android.content.res.Resources; -import android.graphics.*; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Matrix; +import android.graphics.Outline; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.PorterDuff; +import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.graphics.drawable.GradientDrawable; import android.util.AttributeSet; import android.util.Log; -import android.view.*; +import android.view.Gravity; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewOutlineProvider; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; -import java.util.ArrayList; - import com.android.systemui.R; +import java.util.ArrayList; + public class LLand extends FrameLayout { public static final String TAG = "LLand"; public static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); - public static final boolean DEBUG_DRAW = false && DEBUG; + public static final boolean DEBUG_DRAW = false; // DEBUG public static final void L(String s, Object ... objects) { if (DEBUG) { @@ -52,13 +63,24 @@ public class LLand extends FrameLayout { public static final float DEBUG_SPEED_MULTIPLIER = 1f; // 0.1f; public static final boolean DEBUG_IDDQD = false; + final static int[] POPS = { + // resid // spinny! + R.drawable.pop_belt, 0, + R.drawable.pop_droid, 0, + R.drawable.pop_pizza, 1, + R.drawable.pop_stripes, 0, + R.drawable.pop_swirl, 1, + R.drawable.pop_vortex, 1, + R.drawable.pop_vortex2, 1, + }; + private static class Params { public float TRANSLATION_PER_SEC; public int OBSTACLE_SPACING, OBSTACLE_PERIOD; public int BOOST_DV; public int PLAYER_HIT_SIZE; public int PLAYER_SIZE; - public int OBSTACLE_WIDTH; + public int OBSTACLE_WIDTH, OBSTACLE_STEM_WIDTH; public int OBSTACLE_GAP; public int OBSTACLE_MIN; public int BUILDING_WIDTH_MIN, BUILDING_WIDTH_MAX; @@ -76,6 +98,7 @@ public class LLand extends FrameLayout { PLAYER_HIT_SIZE = res.getDimensionPixelSize(R.dimen.player_hit_size); PLAYER_SIZE = res.getDimensionPixelSize(R.dimen.player_size); OBSTACLE_WIDTH = res.getDimensionPixelSize(R.dimen.obstacle_width); + OBSTACLE_STEM_WIDTH = res.getDimensionPixelSize(R.dimen.obstacle_stem_width); OBSTACLE_GAP = res.getDimensionPixelSize(R.dimen.obstacle_gap); OBSTACLE_MIN = res.getDimensionPixelSize(R.dimen.obstacle_height_min); BUILDING_HEIGHT_MIN = res.getDimensionPixelSize(R.dimen.building_height_min); @@ -112,6 +135,7 @@ public class LLand extends FrameLayout { private int mWidth, mHeight; private boolean mAnimating, mPlaying; private boolean mFrozen; // after death, a short backoff + private boolean mFlipped; private int mTimeOfDay; private static final int DAY = 0, NIGHT = 1, TWILIGHT = 2, SUNSET = 3; @@ -119,7 +143,7 @@ public class LLand extends FrameLayout { { 0xFFc0c0FF, 0xFFa0a0FF }, // DAY { 0xFF000010, 0xFF000000 }, // NIGHT { 0xFF000040, 0xFF000010 }, // TWILIGHT - { 0xFF805010, 0xFF202080 }, // SUNSET + { 0xFFa08020, 0xFF204080 }, // SUNSET }; private static Params PARAMS; @@ -183,7 +207,8 @@ public class LLand extends FrameLayout { sky.setDither(true); setBackground(sky); - setScaleX(frand() > 0.5f ? 1 : -1); + mFlipped = frand() > 0.5f; + setScaleX(mFlipped ? -1 : 1); setScore(0); @@ -276,9 +301,7 @@ public class LLand extends FrameLayout { mDroid.setX(mWidth / 2); mDroid.setY(mHeight / 2); addView(mDroid, new LayoutParams(PARAMS.PLAYER_SIZE, PARAMS.PLAYER_SIZE)); - if (mAnim != null) { - Log.wtf(TAG, "reseting while animating??!?"); - } + mAnim = new TimeAnimator(); mAnim.setTimeListener(new TimeAnimator.TimeListener() { @Override @@ -303,7 +326,8 @@ public class LLand extends FrameLayout { mPlaying = true; t = 0; - mLastPipeTime = getGameTime() - PARAMS.OBSTACLE_PERIOD; // queue up a obstacle + // there's a sucker born every OBSTACLE_PERIOD + mLastPipeTime = getGameTime() - PARAMS.OBSTACLE_PERIOD; if (mSplash != null && mSplash.getAlpha() > 0f) { mSplash.setTranslationZ(PARAMS.HUD_Z); @@ -407,7 +431,7 @@ public class LLand extends FrameLayout { L("player hit an obstacle"); stop(); } else if (ob.cleared(mDroid)) { - passedBarrier = true; + if (ob instanceof Stem) passedBarrier = true; mObstaclesInPlay.remove(j); } } @@ -438,52 +462,91 @@ public class LLand extends FrameLayout { final int obstacley = (int) (Math.random() * (mHeight - 2*PARAMS.OBSTACLE_MIN - PARAMS.OBSTACLE_GAP)) + PARAMS.OBSTACLE_MIN; - final Obstacle p1 = new Obstacle(getContext(), obstacley); + final int inset = (PARAMS.OBSTACLE_WIDTH - PARAMS.OBSTACLE_STEM_WIDTH) / 2; + final int yinset = PARAMS.OBSTACLE_WIDTH/2; + + final int d1 = irand(0,250); + final Obstacle s1 = new Stem(getContext(), obstacley - yinset, false); + addView(s1, new LayoutParams( + PARAMS.OBSTACLE_STEM_WIDTH, + (int) s1.h, + Gravity.TOP|Gravity.LEFT)); + s1.setTranslationX(mWidth+inset); + s1.setTranslationY(-s1.h-yinset); + s1.setTranslationZ(PARAMS.OBSTACLE_Z*0.75f); + s1.animate() + .translationY(0) + .setStartDelay(d1) + .setDuration(250); + mObstaclesInPlay.add(s1); + + final Obstacle p1 = new Pop(getContext(), PARAMS.OBSTACLE_WIDTH); addView(p1, new LayoutParams( PARAMS.OBSTACLE_WIDTH, - mHeight, + PARAMS.OBSTACLE_WIDTH, Gravity.TOP|Gravity.LEFT)); p1.setTranslationX(mWidth); - p1.setTranslationY(-mHeight); - p1.setTranslationZ(0); + p1.setTranslationY(-PARAMS.OBSTACLE_WIDTH); + p1.setTranslationZ(PARAMS.OBSTACLE_Z); + p1.setScaleX(0.25f); + p1.setScaleY(0.25f); p1.animate() - .translationY(-mHeight+p1.h) - .translationZ(PARAMS.OBSTACLE_Z) - .setStartDelay(irand(0,250)) + .translationY(s1.h-inset) + .scaleX(1f) + .scaleY(1f) + .setStartDelay(d1) .setDuration(250); mObstaclesInPlay.add(p1); - final Obstacle p2 = new Obstacle(getContext(), - mHeight - obstacley - PARAMS.OBSTACLE_GAP); + final int d2 = irand(0,250); + final Obstacle s2 = new Stem(getContext(), + mHeight - obstacley - PARAMS.OBSTACLE_GAP - yinset, + true); + addView(s2, new LayoutParams( + PARAMS.OBSTACLE_STEM_WIDTH, + (int) s2.h, + Gravity.TOP|Gravity.LEFT)); + s2.setTranslationX(mWidth+inset); + s2.setTranslationY(mHeight+yinset); + s2.setTranslationZ(PARAMS.OBSTACLE_Z*0.75f); + s2.animate() + .translationY(mHeight-s2.h) + .setStartDelay(d2) + .setDuration(400); + mObstaclesInPlay.add(s2); + + final Obstacle p2 = new Pop(getContext(), PARAMS.OBSTACLE_WIDTH); addView(p2, new LayoutParams( PARAMS.OBSTACLE_WIDTH, - mHeight, + PARAMS.OBSTACLE_WIDTH, Gravity.TOP|Gravity.LEFT)); p2.setTranslationX(mWidth); p2.setTranslationY(mHeight); - p2.setTranslationZ(0); + p2.setTranslationZ(PARAMS.OBSTACLE_Z); + p2.setScaleX(0.25f); + p2.setScaleY(0.25f); p2.animate() - .translationY(mHeight-p2.h) - .translationZ(PARAMS.OBSTACLE_Z) - .setStartDelay(irand(0,100)) + .translationY(mHeight-s2.h-yinset) + .scaleX(1f) + .scaleY(1f) + .setStartDelay(d2) .setDuration(400); mObstaclesInPlay.add(p2); } - if (DEBUG) { - final Rect r = new Rect(); - mDroid.getHitRect(r); - r.inset(-4, -4); - invalidate(r); - } + if (DEBUG_DRAW) invalidate(); } @Override public boolean onTouchEvent(MotionEvent ev) { if (DEBUG) L("touch: %s", ev); - if (ev.getAction() == MotionEvent.ACTION_DOWN) { - poke(); - return true; + switch (ev.getAction()) { + case MotionEvent.ACTION_DOWN: + poke(); + return true; + case MotionEvent.ACTION_UP: + unpoke(); + return true; } return false; } @@ -491,9 +554,13 @@ public class LLand extends FrameLayout { @Override public boolean onTrackballEvent(MotionEvent ev) { if (DEBUG) L("trackball: %s", ev); - if (ev.getAction() == MotionEvent.ACTION_DOWN) { - poke(); - return true; + switch (ev.getAction()) { + case MotionEvent.ACTION_DOWN: + poke(); + return true; + case MotionEvent.ACTION_UP: + unpoke(); + return true; } return false; } @@ -513,6 +580,21 @@ public class LLand extends FrameLayout { return false; } + @Override + public boolean onKeyUp(int keyCode, KeyEvent ev) { + if (DEBUG) L("keyDown: %d", keyCode); + switch (keyCode) { + case KeyEvent.KEYCODE_DPAD_CENTER: + case KeyEvent.KEYCODE_DPAD_UP: + case KeyEvent.KEYCODE_SPACE: + case KeyEvent.KEYCODE_ENTER: + case KeyEvent.KEYCODE_BUTTON_A: + unpoke(); + return true; + } + return false; + } + @Override public boolean onGenericMotionEvent (MotionEvent ev) { if (DEBUG) L("generic: %s", ev); @@ -535,6 +617,13 @@ public class LLand extends FrameLayout { } } + private void unpoke() { + L("unboost"); + if (mFrozen) return; + if (!mAnimating) return; + mDroid.unboost(); + } + @Override public void onDraw(Canvas c) { super.onDraw(c); @@ -555,15 +644,23 @@ public class LLand extends FrameLayout { pt); } + pt.setStyle(Paint.Style.STROKE); + pt.setStrokeWidth(getResources().getDisplayMetrics().density); + final int M = getChildCount(); - pt.setColor(0x6000FF00); + pt.setColor(0x8000FF00); for (int i=0; i PARAMS.MAX_V) dv = PARAMS.MAX_V; @@ -652,15 +755,28 @@ public class LLand extends FrameLayout { } public void boost() { + mBoosting = true; dv = -PARAMS.BOOST_DV; - setTranslationZ(PARAMS.PLAYER_Z_BOOST); + + animate().cancel(); + animate() + .scaleX(1.25f) + .scaleY(1.25f) + .translationZ(PARAMS.PLAYER_Z_BOOST) + .setDuration(100); setScaleX(1.25f); setScaleY(1.25f); + } + + public void unboost() { + mBoosting = false; + + animate().cancel(); animate() - .scaleX(1f) - .scaleY(1f) - .translationZ(PARAMS.PLAYER_Z) - .setDuration(200); + .scaleX(1f) + .scaleY(1f) + .translationZ(PARAMS.PLAYER_Z) + .setDuration(200); } } @@ -671,7 +787,7 @@ public class LLand extends FrameLayout { public Obstacle(Context context, float h) { super(context); - setBackgroundResource(R.drawable.placeholder); + setBackgroundColor(0xFFFF0000); this.h = h; } @@ -701,6 +817,91 @@ public class LLand extends FrameLayout { } } + private class Pop extends Obstacle { + int mRotate; + int cx, cy, r; + public Pop(Context context, float h) { + super(context, h); + int idx = 2*irand(0, POPS.length/2); + setBackgroundResource(POPS[idx]); + setScaleX(frand() < 0.5f ? -1 : 1); + mRotate = POPS[idx+1] == 0 ? 0 : (frand() < 0.5f ? -1 : 1); + setOutlineProvider(new ViewOutlineProvider() { + @Override + public void getOutline(View view, Outline outline) { + final int pad = (int) (getWidth() * 0.02f); + outline.setOval(pad, pad, getWidth()-pad, getHeight()-pad); + } + }); + } + + public boolean intersects(Player p) { + final int N = p.corners.length/2; + for (int i=0; i