From deafeedc811160513f570f4ba305e26cbcc92d3b Mon Sep 17 00:00:00 2001 From: Dan Sandler Date: Mon, 3 Aug 2015 17:42:54 -0400 Subject: "I tried to think of the most harmless thing." Bug: 21984798 Change-Id: I33ffabb72c831ff814363601a82ac9a388cb1e99 --- .../com/android/internal/app/PlatLogoActivity.java | 64 +++++++++++++++++++++- core/res/res/drawable-nodpi/platlogo.xml | 30 ++++------ core/res/res/drawable-nodpi/platlogo_m.xml | 37 +++++++++++++ core/res/res/drawable-nodpi/stat_sys_adb.xml | 16 +++++- core/res/res/values/symbols.xml | 2 + 5 files changed, 124 insertions(+), 25 deletions(-) create mode 100644 core/res/res/drawable-nodpi/platlogo_m.xml (limited to 'core') 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(); + } + } diff --git a/core/res/res/drawable-nodpi/platlogo.xml b/core/res/res/drawable-nodpi/platlogo.xml index f5d945a..bb423fef5 100644 --- a/core/res/res/drawable-nodpi/platlogo.xml +++ b/core/res/res/drawable-nodpi/platlogo.xml @@ -1,5 +1,5 @@ - - - + android:pathData="M34.7,13.7c0,0.8,-1.2,1.5,-3.1,2.1c-1.9,0.5,-4.6,0.8,-7.6,0.8s-5.6,-0.3,-7.6,-0.8 c-1.9,-0.5,-3.1,-1.2,-3.1,-2.1s1.2,-1.5,3.1,-2.1c1.9,-0.5,4.6,-0.8,7.6,-0.8s5.6,0.3,7.6,0.8C33.5,12.1,34.7,12.9,34.7,13.7z" + android:fillColor="#EBEBEB"/> + android:pathData="M30,13c-0.1,0,-0.1,0,-0.2,0c-0.4,-0.1,-0.7,-0.6,-0.6,-1l1.3,-5.5c0.1,-0.4,0.6,-0.7,1,-0.6c0.4,0.1,0.7,0.6,0.6,1 l-1.3,5.5C30.7,12.7,30.4,13,30,13z" + android:fillColor="#FFFFFF"/> + android:pathData="M18,13c-0.4,0,-0.7,-0.3,-0.8,-0.6l-1.3,-5.5c-0.1,-0.4,0.2,-0.9,0.6,-1c0.4,-0.1,0.9,0.2,1,0.6l1.3,5.5 c0.1,0.4,-0.2,0.9,-0.6,1C18.1,13,18.1,13,18,13z" + android:fillColor="#FFFFFF"/> diff --git a/core/res/res/drawable-nodpi/platlogo_m.xml b/core/res/res/drawable-nodpi/platlogo_m.xml new file mode 100644 index 0000000..f19e045 --- /dev/null +++ b/core/res/res/drawable-nodpi/platlogo_m.xml @@ -0,0 +1,37 @@ + + + + + + + + diff --git a/core/res/res/drawable-nodpi/stat_sys_adb.xml b/core/res/res/drawable-nodpi/stat_sys_adb.xml index 8f5109d..8cc9961 100644 --- a/core/res/res/drawable-nodpi/stat_sys_adb.xml +++ b/core/res/res/drawable-nodpi/stat_sys_adb.xml @@ -19,6 +19,18 @@ Copyright (C) 2014 The Android Open Source Project android:viewportWidth="24.0" android:viewportHeight="24.0"> + android:pathData="M8.4,5.3c-0.2,0.0 -0.4,-0.2 -0.5,-0.4L7.1,1.6C7.0,1.4 7.2,1.1 7.4,1.0C7.7,0.9 8.0,1.1 8.0,1.4l0.8,3.3c0.1,0.3 -0.1,0.5 -0.4,0.6C8.5,5.3 8.4,5.3 8.4,5.3z" + android:fillColor="#FFFFFF"/> + + + diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index ee61944..262aa76 100755 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2318,4 +2318,6 @@ + + -- cgit v1.1