* commit '8c8387d235b780c4a78a54d8240fe1f5a17c6af5': "I tried to think of the most harmless thing."
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Copyright (C) 2014 The Android Open Source Project
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -14,30 +14,20 @@ Copyright (C) 2014 The Android Open Source Project
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="480dp"
|
||||
android:height="480dp"
|
||||
android:width="48dp"
|
||||
android:height="48dp"
|
||||
android:viewportWidth="48.0"
|
||||
android:viewportHeight="48.0">
|
||||
<path
|
||||
android:pathData="M24.0,2.0C11.8,2.0 2.0,11.8 2.0,24.0c0.0,6.1 2.5,11.6 6.4,15.6L39.6,8.4C35.6,4.5 30.1,2.0 24.0,2.0z"
|
||||
android:fillColor="#F57C00"/>
|
||||
<path
|
||||
android:pathData="M39.6,8.4L8.4,39.6c4.0,4.0 9.5,6.4 15.6,6.4c12.2,0.0 22.0,-9.8 22.0,-22.0C46.0,17.9 43.5,12.4 39.6,8.4z"
|
||||
android:fillColor="#FF9800"/>
|
||||
<path
|
||||
android:pathData="M45.9,25.9L34.0,14.0L14.0,34.0l11.9,11.9C36.5,45.0 45.0,36.5 45.9,25.9z"
|
||||
android:fillAlpha="0.33"
|
||||
android:fillColor="#F57C00"/>
|
||||
<path
|
||||
android:pathData="M24.0,24.0c0.0,0.0 0.0,2.2 0.0,5.0s0.0,5.0 0.0,5.0l10.0,-10.0L34.0,14.0L24.0,24.0z"
|
||||
android:pathData="M34.9,13.2c-0.8,-0.8,-4.2,-2.4,-10.9,-2.4s-10.1,1.6,-10.9,2.4c-0.8,0.8,-2.4,4.2,-2.4,10.9s1.6,10.1,2.4,10.9 c0.8,0.8,4.2,2.4,10.9,2.4s10.1,-1.6,10.9,-2.4c0.8,-0.8,2.4,-4.2,2.4,-10.9S35.6,14,34.9,13.2z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
<path
|
||||
android:pathData="M24.0,24.0L14.0,14.0l0.0,10.0l10.0,10.0c0.0,0.0 0.0,-2.2 0.0,-5.0S24.0,24.0 24.0,24.0z"
|
||||
android:fillColor="#EEEEEE"/>
|
||||
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"/>
|
||||
<path
|
||||
android:pathData="M14.0,34.0l10.0,0.0 -10.0,-10.0z"
|
||||
android:fillColor="#DDDDDD"/>
|
||||
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"/>
|
||||
<path
|
||||
android:pathData="M34.0,34.0l0.0,-10.0 -10.0,10.0z"
|
||||
android:fillColor="#DDDDDD"/>
|
||||
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"/>
|
||||
</vector>
|
||||
|
||||
37
core/res/res/drawable-nodpi/platlogo_m.xml
Normal file
37
core/res/res/drawable-nodpi/platlogo_m.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<!--
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="48dp"
|
||||
android:height="48dp"
|
||||
android:viewportWidth="48.0"
|
||||
android:viewportHeight="48.0">
|
||||
<path
|
||||
android:fillColor="#08000000"
|
||||
android:pathData="M13.5,34.5l13.3,13.3c11,-1.3,19.7,-10,21,-21L34.5,13.5L13.5,34.5z"
|
||||
/>
|
||||
<path
|
||||
android:pathData="M24,24c0,0,0,2.4,0,5.2s0,5.2,0,5.2L34.5,24V13.5L24,24z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
<path
|
||||
android:pathData="M24,24L13.5,13.5V24L24,34.5c0,0,0,-2.4,0,-5.2S24,24,24,24z"
|
||||
android:fillColor="#EEEEEE"/>
|
||||
<path
|
||||
android:pathData="M13.5,34.5l10.5,0.0l-10.5,-10.5z"
|
||||
android:fillColor="#DDDDDD"/>
|
||||
<path
|
||||
android:pathData="M34.5,34.5l0.0,-10.5l-10.5,10.5z"
|
||||
android:fillColor="#DDDDDD"/>
|
||||
</vector>
|
||||
@@ -19,6 +19,18 @@ Copyright (C) 2014 The Android Open Source Project
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12.0,12.0l-10.0,-10.0 0.0,10.0 0.0,10.0 10.0,0.0 10.0,0.0 0.0,-10.0 0.0,-10.0z"/>
|
||||
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"/>
|
||||
<path
|
||||
android:pathData="M15.6,5.3c0.0,0.0 -0.1,0.0 -0.1,0.0c-0.3,-0.1 -0.4,-0.3 -0.4,-0.6L16.0,1.4C16.0,1.1 16.3,0.9 16.6,1.0c0.3,0.1 0.4,0.3 0.4,0.6l-0.8,3.3C16.1,5.1 15.9,5.3 15.6,5.3z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
<path
|
||||
android:pathData="M18.6,5.4c-0.1,-0.1 -0.2,-0.1 -0.3,-0.2c0.2,0.2 0.3,0.3 0.3,0.5c0.0,0.9 -2.9,1.7 -6.6,1.7S5.4,6.7 5.4,5.7c0.0,-0.2 0.1,-0.3 0.3,-0.5C5.6,5.3 5.5,5.4 5.4,5.4C5.0,5.9 4.0,8.0 4.0,12.0s1.0,6.1 1.4,6.6C5.9,19.0 8.0,20.0 12.0,20.0s6.1,-1.0 6.6,-1.4C19.0,18.1 20.0,16.0 20.0,12.0S19.0,5.9 18.6,5.4zM8.0,13.0c-0.6,0.0 -1.0,-0.4 -1.0,-1.0c0.0,-0.6 0.4,-1.0 1.0,-1.0s1.0,0.4 1.0,1.0C9.0,12.6 8.6,13.0 8.0,13.0zM16.0,13.0c-0.6,0.0 -1.0,-0.4 -1.0,-1.0c0.0,-0.6 0.4,-1.0 1.0,-1.0s1.0,0.4 1.0,1.0C17.0,12.6 16.6,13.0 16.0,13.0z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
<path
|
||||
android:pathData="M5.35,5.7
|
||||
a 6.6 1.75 0 1 1 13.25 0
|
||||
a 6.6 1.75 0 1 1 -13.25 0
|
||||
z"
|
||||
android:fillColor="#BBFFFFFF" />
|
||||
</vector>
|
||||
|
||||
Reference in New Issue
Block a user