summaryrefslogtreecommitdiffstats
path: root/core/java/com
diff options
context:
space:
mode:
authorDan Sandler <dsandler@android.com>2015-08-16 02:36:17 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-16 02:36:17 +0000
commit415c6cb2358a0ad4821ec58c287b1de94de78d72 (patch)
treed552b246966d88646f1bd98e59124aae622936ab /core/java/com
parenta5e012e6236aaeabd6d00fa7c6b29ec146ffd764 (diff)
parent8c8387d235b780c4a78a54d8240fe1f5a17c6af5 (diff)
downloadframeworks_base-415c6cb2358a0ad4821ec58c287b1de94de78d72.zip
frameworks_base-415c6cb2358a0ad4821ec58c287b1de94de78d72.tar.gz
frameworks_base-415c6cb2358a0ad4821ec58c287b1de94de78d72.tar.bz2
am 8c8387d2: resolved conflicts (again!) for merge of 8ad3e817 to mnc-dr-dev
* commit '8c8387d235b780c4a78a54d8240fe1f5a17c6af5': "I tried to think of the most harmless thing."
Diffstat (limited to 'core/java/com')
-rw-r--r--core/java/com/android/internal/app/PlatLogoActivity.java64
1 files changed, 61 insertions, 3 deletions
diff --git a/core/java/com/android/internal/app/PlatLogoActivity.java b/core/java/com/android/internal/app/PlatLogoActivity.java
index 49230c1..2595fe0 100644
--- a/core/java/com/android/internal/app/PlatLogoActivity.java
+++ b/core/java/com/android/internal/app/PlatLogoActivity.java
@@ -16,16 +16,23 @@
package com.android.internal.app;
+import android.animation.Animator;
import android.animation.ObjectAnimator;
+import android.annotation.Nullable;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ContentResolver;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.ColorFilter;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.Path;
+import android.graphics.PixelFormat;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.RippleDrawable;
@@ -73,19 +80,54 @@ public class PlatLogoActivity extends Activity {
im.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
- final int pad = (int) (8*dp);
- outline.setOval(pad, pad, view.getWidth()-pad, view.getHeight()-pad);
+ final int pad = (int) (8 * dp);
+ outline.setOval(pad, pad, view.getWidth() - pad, view.getHeight() - pad);
}
});
- final Drawable platlogo = getDrawable(com.android.internal.R.drawable.platlogo);
+ final float hue = (float) Math.random();
+ final Paint bgPaint = new Paint();
+ bgPaint.setColor(Color.HSBtoColor(hue, 0.4f, 1f));
+ final Paint fgPaint = new Paint();
+ fgPaint.setColor(Color.HSBtoColor(hue, 0.5f, 1f));
+ final Drawable M = getDrawable(com.android.internal.R.drawable.platlogo_m);
+ final Drawable platlogo = new Drawable() {
+ @Override
+ public void setAlpha(int alpha) { }
+
+ @Override
+ public void setColorFilter(@Nullable ColorFilter colorFilter) { }
+
+ @Override
+ public int getOpacity() {
+ return PixelFormat.TRANSLUCENT;
+ }
+
+ @Override
+ public void draw(Canvas c) {
+ final float r = c.getWidth() / 2f;
+ c.drawCircle(r, r, r, bgPaint);
+ c.drawArc(0, 0, 2 * r, 2 * r, 135, 180, false, fgPaint);
+ M.setBounds(0, 0, c.getWidth(), c.getHeight());
+ M.draw(c);
+ }
+ };
im.setBackground(new RippleDrawable(
ColorStateList.valueOf(0xFFFFFFFF),
platlogo,
null));
+ im.setOutlineProvider(new ViewOutlineProvider() {
+ @Override
+ public void getOutline(View view, Outline outline) {
+ outline.setOval(0, 0, view.getWidth(), view.getHeight());
+ }
+ });
im.setClickable(true);
im.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ if (mTapCount == 0) {
+ showMarshmallow(im);
+ }
im.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
@@ -132,6 +174,9 @@ public class PlatLogoActivity extends Activity {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode != KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
+ if (mKeyCount == 0) {
+ showMarshmallow(im);
+ }
++mKeyCount;
if (mKeyCount > 2) {
if (mTapCount > 5) {
@@ -155,4 +200,17 @@ public class PlatLogoActivity extends Activity {
.setStartDelay(800)
.start();
}
+
+ public void showMarshmallow(View im) {
+ final Drawable fg = getDrawable(com.android.internal.R.drawable.platlogo);
+ fg.setBounds(0, 0, im.getWidth(), im.getHeight());
+ fg.setAlpha(0);
+ im.getOverlay().add(fg);
+
+ final Animator fadeIn = ObjectAnimator.ofInt(fg, "alpha", 255);
+ fadeIn.setInterpolator(mInterpolator);
+ fadeIn.setDuration(300);
+ fadeIn.start();
+ }
+
}