diff options
author | Dan Sandler <dsandler@android.com> | 2014-05-08 06:49:30 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-05-08 06:49:30 +0000 |
commit | 327f0add841172d973e21e64fba76f24d9a8c94f (patch) | |
tree | 520c409a9c291cbdebf9e34bbebb42f72d5c4902 /core | |
parent | ce311f62ca5e35f1485257d4fe75f5ae1dc9d58a (diff) | |
parent | d30195a613cc06debf80a115e0110715ce1a03c7 (diff) | |
download | frameworks_base-327f0add841172d973e21e64fba76f24d9a8c94f.zip frameworks_base-327f0add841172d973e21e64fba76f24d9a8c94f.tar.gz frameworks_base-327f0add841172d973e21e64fba76f24d9a8c94f.tar.bz2 |
am cea92759: Merge "L: WIP."
* commit 'cea92759f0c6e174b57883f9586f2868f2c9a7f3':
L: WIP.
Diffstat (limited to 'core')
-rw-r--r-- | core/java/com/android/internal/app/PlatLogoActivity.java | 230 | ||||
-rw-r--r-- | core/res/res/drawable-hdpi/stat_sys_adb_am.png | bin | 213 -> 0 bytes | |||
-rw-r--r-- | core/res/res/drawable-ldpi/stat_sys_adb_am.png | bin | 414 -> 0 bytes | |||
-rw-r--r-- | core/res/res/drawable-mdpi/stat_sys_adb_am.png | bin | 161 -> 0 bytes | |||
-rw-r--r-- | core/res/res/drawable-nodpi/platlogo.png | bin | 39802 -> 0 bytes | |||
-rw-r--r-- | core/res/res/drawable-nodpi/platlogo.xml | 39 | ||||
-rw-r--r-- | core/res/res/drawable-nodpi/stat_sys_adb.xml | 30 | ||||
-rw-r--r-- | core/res/res/drawable-xhdpi/stat_sys_adb_am.png | bin | 255 -> 0 bytes | |||
-rw-r--r-- | core/res/res/drawable-xxhdpi/stat_sys_adb_am.png | bin | 327 -> 0 bytes | |||
-rw-r--r-- | core/res/res/drawable/stat_sys_adb.xml | 23 |
10 files changed, 167 insertions, 155 deletions
diff --git a/core/java/com/android/internal/app/PlatLogoActivity.java b/core/java/com/android/internal/app/PlatLogoActivity.java index 8cdaf91..abd1791 100644 --- a/core/java/com/android/internal/app/PlatLogoActivity.java +++ b/core/java/com/android/internal/app/PlatLogoActivity.java @@ -18,156 +18,122 @@ package com.android.internal.app; 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.provider.Settings; import android.os.Build; import android.os.Bundle; -import android.os.Handler; -import android.text.method.AllCapsTransformationMethod; +import android.provider.Settings; +import android.util.AttributeSet; import android.util.DisplayMetrics; import android.view.Gravity; import android.view.View; -import android.view.animation.AccelerateInterpolator; -import android.view.animation.AnticipateOvershootInterpolator; -import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; -import android.widget.ImageView; import android.widget.TextView; public class PlatLogoActivity extends Activity { - FrameLayout mContent; - int mCount; - final Handler mHandler = new Handler(); - static final int BGCOLOR = 0xffed1d24; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - DisplayMetrics metrics = new DisplayMetrics(); - getWindowManager().getDefaultDisplay().getMetrics(metrics); - - Typeface bold = Typeface.create("sans-serif", Typeface.BOLD); - Typeface light = Typeface.create("sans-serif-light", Typeface.NORMAL); - - mContent = new FrameLayout(this); - mContent.setBackgroundColor(0xC0000000); - - final FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams( - FrameLayout.LayoutParams.WRAP_CONTENT, - FrameLayout.LayoutParams.WRAP_CONTENT); - lp.gravity = Gravity.CENTER; - - final ImageView logo = new ImageView(this); - logo.setImageResource(com.android.internal.R.drawable.platlogo); - logo.setScaleType(ImageView.ScaleType.CENTER_INSIDE); - logo.setVisibility(View.INVISIBLE); - - final View bg = new View(this); - bg.setBackgroundColor(BGCOLOR); - bg.setAlpha(0f); - - final TextView letter = new TextView(this); - - letter.setTypeface(bold); - letter.setTextSize(300); - letter.setTextColor(0xFFFFFFFF); - letter.setGravity(Gravity.CENTER); - letter.setText(String.valueOf(Build.ID).substring(0, 1)); - - final int p = (int)(4 * metrics.density); - - final TextView tv = new TextView(this); - if (light != null) tv.setTypeface(light); - tv.setTextSize(30); - tv.setPadding(p, p, p, p); - tv.setTextColor(0xFFFFFFFF); - tv.setGravity(Gravity.CENTER); - tv.setTransformationMethod(new AllCapsTransformationMethod(this)); - tv.setText("Android " + Build.VERSION.RELEASE); - tv.setVisibility(View.INVISIBLE); - - mContent.addView(bg); - mContent.addView(letter, lp); - mContent.addView(logo, lp); + private static class Torso extends FrameLayout { + boolean mAnimate = false; + TextView mText; + + 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); + + for (int i=0; i<2; i++) { + final View v = new View(context); + v.setBackgroundColor(i % 2 == 0 ? Color.BLUE : Color.RED); + addView(v); + } - final FrameLayout.LayoutParams lp2 = new FrameLayout.LayoutParams(lp); - lp2.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; - lp2.bottomMargin = 10*p; + mText = new TextView(context); + mText.setTextColor(Color.BLACK); + mText.setTextSize(14 /* sp */); + mText.setTypeface(Typeface.create("monospace", Typeface.BOLD)); - mContent.addView(tv, lp2); + addView(mText, new FrameLayout.LayoutParams( + FrameLayout.LayoutParams.MATCH_PARENT, + FrameLayout.LayoutParams.WRAP_CONTENT, + Gravity.BOTTOM | Gravity.LEFT + )); + } - mContent.setOnClickListener(new View.OnClickListener() { - int clicks; + private Runnable mRunnable = new Runnable() { @Override - public void onClick(View v) { - clicks++; - if (clicks >= 6) { - mContent.performLongClick(); - return; + 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<N; i++) { + final View v = getChildAt(i); + if (v instanceof TextView) continue; + + final int w = (int) (Math.random() * parentw); + final int h = (int) (Math.random() * parenth); + v.setLayoutParams(new FrameLayout.LayoutParams(w, h)); + + v.setX((float) Math.random() * (parentw - w)); + v.setY((float) Math.random() * (parenth - h)); } - letter.animate().cancel(); - final float offset = (int)letter.getRotation() % 360; - letter.animate() - .rotationBy((Math.random() > 0.5f ? 360 : -360) - offset) - .setInterpolator(new DecelerateInterpolator()) - .setDuration(700).start(); - } - }); - mContent.setOnLongClickListener(new View.OnLongClickListener() { - @Override - public boolean onLongClick(View v) { - if (logo.getVisibility() != View.VISIBLE) { - bg.setScaleX(0.01f); - bg.animate().alpha(1f).scaleX(1f).setStartDelay(500).start(); - letter.animate().alpha(0f).scaleY(0.5f).scaleX(0.5f) - .rotationBy(360) - .setInterpolator(new AccelerateInterpolator()) - .setDuration(1000) - .start(); - logo.setAlpha(0f); - logo.setVisibility(View.VISIBLE); - logo.setScaleX(0.5f); - logo.setScaleY(0.5f); - logo.animate().alpha(1f).scaleX(1f).scaleY(1f) - .setDuration(1000).setStartDelay(500) - .setInterpolator(new AnticipateOvershootInterpolator()) - .start(); - tv.setAlpha(0f); - tv.setVisibility(View.VISIBLE); - tv.animate().alpha(1f).setDuration(1000).setStartDelay(1000).start(); - return true; - } - return false; + if (mAnimate) postDelayed(this, 1000); } - }); + }; + @Override + protected void onAttachedToWindow() { + mAnimate = true; + post(mRunnable); + } + @Override + protected void onDetachedFromWindow() { + mAnimate = false; + removeCallbacks(mRunnable); + } + } - logo.setOnLongClickListener(new View.OnLongClickListener() { - @Override - public boolean onLongClick(View v) { - if (Settings.System.getLong(getContentResolver(), Settings.System.EGG_MODE, 0) - == 0) { - // For posterity: the moment this user unlocked the easter egg - Settings.System.putLong(getContentResolver(), - Settings.System.EGG_MODE, - System.currentTimeMillis()); - } - try { - startActivity(new Intent(Intent.ACTION_MAIN) - .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK - | Intent.FLAG_ACTIVITY_CLEAR_TASK - | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) - .addCategory("com.android.internal.category.PLATLOGO")); - } catch (ActivityNotFoundException ex) { - android.util.Log.e("PlatLogoActivity", "Couldn't catch a break."); - } - finish(); - return true; - } - }); - - setContentView(mContent); + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + final Torso t = new Torso(this); + t.setBackgroundColor(Color.WHITE); + + t.getChildAt(0) + .setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + final ContentResolver cr = getContentResolver(); + if (Settings.System.getLong(cr, Settings.System.EGG_MODE, 0) + == 0) { + // For posterity: the moment this user unlocked the easter egg + Settings.System.putLong(cr, + Settings.System.EGG_MODE, + System.currentTimeMillis()); + } + try { + startActivity(new Intent(Intent.ACTION_MAIN) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK + | Intent.FLAG_ACTIVITY_CLEAR_TASK + | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) + .addCategory("com.android.internal.category.PLATLOGO")); + } catch (ActivityNotFoundException ex) { + android.util.Log.e("PlatLogoActivity", "Couldn't catch a break."); + } + finish(); + return true; + } + }); + + setContentView(t); } } diff --git a/core/res/res/drawable-hdpi/stat_sys_adb_am.png b/core/res/res/drawable-hdpi/stat_sys_adb_am.png Binary files differdeleted file mode 100644 index dad614c..0000000 --- a/core/res/res/drawable-hdpi/stat_sys_adb_am.png +++ /dev/null diff --git a/core/res/res/drawable-ldpi/stat_sys_adb_am.png b/core/res/res/drawable-ldpi/stat_sys_adb_am.png Binary files differdeleted file mode 100644 index 0171adb..0000000 --- a/core/res/res/drawable-ldpi/stat_sys_adb_am.png +++ /dev/null diff --git a/core/res/res/drawable-mdpi/stat_sys_adb_am.png b/core/res/res/drawable-mdpi/stat_sys_adb_am.png Binary files differdeleted file mode 100644 index 5482f34..0000000 --- a/core/res/res/drawable-mdpi/stat_sys_adb_am.png +++ /dev/null diff --git a/core/res/res/drawable-nodpi/platlogo.png b/core/res/res/drawable-nodpi/platlogo.png Binary files differdeleted file mode 100644 index 6351c2d..0000000 --- a/core/res/res/drawable-nodpi/platlogo.png +++ /dev/null diff --git a/core/res/res/drawable-nodpi/platlogo.xml b/core/res/res/drawable-nodpi/platlogo.xml new file mode 100644 index 0000000..8eb00fa --- /dev/null +++ b/core/res/res/drawable-nodpi/platlogo.xml @@ -0,0 +1,39 @@ +<!-- + Copyright (C) 2014 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" > + <size android:width="400dp" android:height="400dp"/> + + <viewport android:viewportHeight="25" android:viewportWidth="25" /> + + <group> + <path + android:name="shadow" + android:pathData="m12,2.5 a11,11 0 1,0 1,0 + M6.5,7.5 + l5,0 l0,7 l7,0 l0,5 l-12,0 z" + android:fill="#40000000" + /> + <path + android:name="circle-L-ranch" + android:pathData="m12,1.5 a11,11 0 1,0 1,0 + M6.5,6.5 + l5,0 l0,7 l7,0 l0,5 l-12,0 z" + android:fill="#FFFFFF40" + /> + </group> +</vector> + + diff --git a/core/res/res/drawable-nodpi/stat_sys_adb.xml b/core/res/res/drawable-nodpi/stat_sys_adb.xml new file mode 100644 index 0000000..37df348 --- /dev/null +++ b/core/res/res/drawable-nodpi/stat_sys_adb.xml @@ -0,0 +1,30 @@ +<!-- + Copyright (C) 2014 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" > + <size android:width="25dp" android:height="25dp"/> + + <viewport android:viewportHeight="25" android:viewportWidth="25" /> + + <group> + <path + android:name="adb" + android:pathData="m3,3l8,0l0,11l11,0l0,8l-18,0z" + android:fill="#FFFFFFFF" + /> + </group> +</vector> + + diff --git a/core/res/res/drawable-xhdpi/stat_sys_adb_am.png b/core/res/res/drawable-xhdpi/stat_sys_adb_am.png Binary files differdeleted file mode 100644 index e53f498..0000000 --- a/core/res/res/drawable-xhdpi/stat_sys_adb_am.png +++ /dev/null diff --git a/core/res/res/drawable-xxhdpi/stat_sys_adb_am.png b/core/res/res/drawable-xxhdpi/stat_sys_adb_am.png Binary files differdeleted file mode 100644 index d6018dd..0000000 --- a/core/res/res/drawable-xxhdpi/stat_sys_adb_am.png +++ /dev/null diff --git a/core/res/res/drawable/stat_sys_adb.xml b/core/res/res/drawable/stat_sys_adb.xml deleted file mode 100644 index dfc8563..0000000 --- a/core/res/res/drawable/stat_sys_adb.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* - * Copyright 2013, 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. - */ ---> - -<bitmap xmlns:android="http://schemas.android.com/apk/res/android" - android:src="@drawable/stat_sys_adb_am" - android:autoMirrored="true"> -</bitmap> |