diff options
16 files changed, 111 insertions, 9 deletions
diff --git a/core/java/com/android/internal/app/PlatLogoActivity.java b/core/java/com/android/internal/app/PlatLogoActivity.java index 3a2b647..bac8e21 100644 --- a/core/java/com/android/internal/app/PlatLogoActivity.java +++ b/core/java/com/android/internal/app/PlatLogoActivity.java @@ -84,7 +84,7 @@ public class PlatLogoActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - + final boolean isCid = getIntent().hasExtra("is_cid"); mToast = Toast.makeText(this, "", Toast.LENGTH_LONG); mToast.setView(makeView()); @@ -92,7 +92,8 @@ public class PlatLogoActivity extends Activity { getWindowManager().getDefaultDisplay().getMetrics(metrics); mContent = new ImageView(this); - mContent.setImageResource(com.android.internal.R.drawable.platlogo_alt); + mContent.setImageResource(isCid ? com.android.internal.R.drawable.cidlogo + : com.android.internal.R.drawable.platlogo_alt); mContent.setScaleType(ImageView.ScaleType.CENTER_INSIDE); final int p = (int)(32 * metrics.density); @@ -102,7 +103,8 @@ public class PlatLogoActivity extends Activity { @Override public void onClick(View v) { mToast.show(); - mContent.setImageResource(com.android.internal.R.drawable.platlogo); + mContent.setImageResource(isCid ? com.android.internal.R.drawable.cidlogo_alt + : com.android.internal.R.drawable.platlogo); } }); @@ -114,6 +116,7 @@ public class PlatLogoActivity extends Activity { .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) + .putExtra("is_cid", isCid) .addCategory("com.android.internal.category.PLATLOGO")); //.setClassName("com.android.systemui","com.android.systemui.BeanBag")); } catch (ActivityNotFoundException ex) { diff --git a/core/res/res/drawable-nodpi/cidlogo.png b/core/res/res/drawable-nodpi/cidlogo.png Binary files differnew file mode 100644 index 0000000..ceb2246 --- /dev/null +++ b/core/res/res/drawable-nodpi/cidlogo.png diff --git a/core/res/res/drawable-nodpi/cidlogo_alt.png b/core/res/res/drawable-nodpi/cidlogo_alt.png Binary files differnew file mode 100644 index 0000000..e5c03ed --- /dev/null +++ b/core/res/res/drawable-nodpi/cidlogo_alt.png diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 66e1b40..7faa65c 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -974,6 +974,8 @@ <java-symbol type="drawable" name="picture_emergency" /> <java-symbol type="drawable" name="platlogo" /> <java-symbol type="drawable" name="platlogo_alt" /> + <java-symbol type="drawable" name="cidlogo" /> + <java-symbol type="drawable" name="cidlogo_alt" /> <java-symbol type="drawable" name="stat_notify_sync_error" /> <java-symbol type="drawable" name="stat_notify_wifi_in_range" /> <java-symbol type="drawable" name="stat_notify_rssi_in_range" /> diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index b590292..9bf15c1 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -217,8 +217,20 @@ <action android:name="android.service.dreams.DreamService" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> + <meta-data + android:name="android.service.dream" + android:resource="@xml/dream_info" /> </service> + <activity android:name=".BeanBagDreamSettings" + android:taskAffinity="" + android:excludeFromRecents="true" + android:exported="true"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + </intent-filter> + </activity> + <activity android:name=".Somnambulator" android:label="@string/start_dreams" android:icon="@mipmap/ic_launcher_dreams" diff --git a/packages/SystemUI/res/drawable-nodpi/cid_angry.png b/packages/SystemUI/res/drawable-nodpi/cid_angry.png Binary files differnew file mode 100644 index 0000000..008d279 --- /dev/null +++ b/packages/SystemUI/res/drawable-nodpi/cid_angry.png diff --git a/packages/SystemUI/res/drawable-nodpi/cid_confused.png b/packages/SystemUI/res/drawable-nodpi/cid_confused.png Binary files differnew file mode 100644 index 0000000..4c51d18 --- /dev/null +++ b/packages/SystemUI/res/drawable-nodpi/cid_confused.png diff --git a/packages/SystemUI/res/drawable-nodpi/cid_normal.png b/packages/SystemUI/res/drawable-nodpi/cid_normal.png Binary files differnew file mode 100644 index 0000000..6425389 --- /dev/null +++ b/packages/SystemUI/res/drawable-nodpi/cid_normal.png diff --git a/packages/SystemUI/res/drawable-nodpi/cidlogo.png b/packages/SystemUI/res/drawable-nodpi/cidlogo.png Binary files differnew file mode 100644 index 0000000..ceb2246 --- /dev/null +++ b/packages/SystemUI/res/drawable-nodpi/cidlogo.png diff --git a/packages/SystemUI/res/drawable-nodpi/cidlogo_alt.png b/packages/SystemUI/res/drawable-nodpi/cidlogo_alt.png Binary files differnew file mode 100644 index 0000000..e5c03ed --- /dev/null +++ b/packages/SystemUI/res/drawable-nodpi/cidlogo_alt.png diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 67de09d..ab883ce 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -457,6 +457,8 @@ <!-- Name of the Jelly Bean platlogo screensaver --> <string name="jelly_bean_dream_name">BeanFlinger</string> + <string name="bean_dream_settings_cid_title">Use CID head</string> + <string name="bean_dream_settings_cid_summary">Use CID head instead of jellybean inside the dream</string> <!-- Name of the launcher shortcut icon that allows dreams to be started immediately [CHAR LIMIT=20] --> <string name="start_dreams">Daydream</string> diff --git a/packages/SystemUI/res/xml/dream_info.xml b/packages/SystemUI/res/xml/dream_info.xml new file mode 100644 index 0000000..df51bc4 --- /dev/null +++ b/packages/SystemUI/res/xml/dream_info.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<dream xmlns:android="http://schemas.android.com/apk/res/android" + android:settingsActivity="com.android.systemui/com.android.systemui.BeanBagDreamSettings" +/> diff --git a/packages/SystemUI/res/xml/dream_settings.xml b/packages/SystemUI/res/xml/dream_settings.xml new file mode 100644 index 0000000..43fdc7f --- /dev/null +++ b/packages/SystemUI/res/xml/dream_settings.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012 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. +--> + +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + android:title="@string/jelly_bean_dream_name"> + <CheckBoxPreference + android:key="beanbag_dream_cid" + android:title="@string/bean_dream_settings_cid_title" + android:summary="@string/bean_dream_settings_cid_summary" + android:defaultValue="false" /> +</PreferenceScreen> diff --git a/packages/SystemUI/src/com/android/systemui/BeanBag.java b/packages/SystemUI/src/com/android/systemui/BeanBag.java index f5a90ca..73136f3 100644 --- a/packages/SystemUI/src/com/android/systemui/BeanBag.java +++ b/packages/SystemUI/src/com/android/systemui/BeanBag.java @@ -137,6 +137,28 @@ public class BeanBag extends Activity { 0xFF333333, }; + static int CIDS[] = { + R.drawable.cid_angry, + R.drawable.cid_angry, + R.drawable.cid_angry, + R.drawable.cid_angry, + R.drawable.cid_normal, + R.drawable.cid_normal, + R.drawable.cid_confused, + }; + + static int CIDCOLORS[] = { + 0xFF0099CC, + 0xFF33B5E5, + 0xFF669900, + 0xFF99CC00, + 0xFFCC0000, + 0xFFFF8800, + 0xFFFFBB33, + 0xFF9933CC, + 0xFFAA66CC, + }; + public class Bean extends ImageView { public static final float VMAX = 1000.0f; public static final float VMIN = 100.0f; @@ -167,7 +189,7 @@ public class BeanBag extends Activity { } private void pickBean() { - int beanId = pickInt(BEANS); + int beanId = pickInt(mIsCid ? CIDS : BEANS); if (randfrange(0,1) <= LUCKY) { beanId = R.drawable.jandycane; } @@ -182,7 +204,7 @@ public class BeanBag extends Activity { this.setImageDrawable(bean); Paint pt = new Paint(); - final int color = pickInt(COLORS); + final int color = pickInt(mIsCid ? CIDCOLORS : COLORS); ColorMatrix CM = new ColorMatrix(); float[] M = CM.getArray(); // we assume the color information is in the red channel @@ -266,10 +288,11 @@ public class BeanBag extends Activity { TimeAnimator mAnim; private int boardWidth; private int boardHeight; + private boolean mIsCid; - public Board(Context context, AttributeSet as) { + public Board(Context context, AttributeSet as, boolean isCid) { super(context, as); - + mIsCid = isCid; setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); setWillNotDraw(!DEBUG); @@ -413,7 +436,7 @@ public class BeanBag extends Activity { WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED ); - mBoard = new Board(this, null); + mBoard = new Board(this, null, getIntent().getBooleanExtra("is_cid", false)); setContentView(mBoard); } diff --git a/packages/SystemUI/src/com/android/systemui/BeanBagDream.java b/packages/SystemUI/src/com/android/systemui/BeanBagDream.java index 39e4727..85c42d2 100644 --- a/packages/SystemUI/src/com/android/systemui/BeanBagDream.java +++ b/packages/SystemUI/src/com/android/systemui/BeanBagDream.java @@ -16,6 +16,8 @@ package com.android.systemui; +import android.content.SharedPreferences; +import android.preference.PreferenceManager; import android.service.dreams.DreamService; import com.android.systemui.BeanBag.Board; @@ -29,7 +31,8 @@ public class BeanBagDream extends DreamService { super.onAttachedToWindow(); setInteractive(true); setFullscreen(true); - mBoard = new Board(this, null); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); + mBoard = new Board(this, null, prefs.getBoolean("beanbag_dream_cid", false)); setContentView(mBoard); } diff --git a/packages/SystemUI/src/com/android/systemui/BeanBagDreamSettings.java b/packages/SystemUI/src/com/android/systemui/BeanBagDreamSettings.java new file mode 100644 index 0000000..171e8f4 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/BeanBagDreamSettings.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2009 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. + */ + +package com.android.systemui; + +import android.os.Bundle; +import android.preference.PreferenceActivity; + +import com.android.systemui.R; + +public class BeanBagDreamSettings extends PreferenceActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.dream_settings); + } +} |
