summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/java/com/android/internal/widget/SizeAdaptiveLayout.java13
-rw-r--r--core/res/res/drawable/notification_bg.xml (renamed from packages/SystemUI/res/drawable/notification_row_bg.xml)0
-rw-r--r--core/res/res/layout/notification_template_base.xml2
-rw-r--r--core/res/res/layout/notification_template_big_picture.xml2
-rw-r--r--core/res/res/layout/notification_template_big_text.xml2
-rw-r--r--core/res/res/values/colors.xml2
-rw-r--r--core/res/res/values/public.xml1
-rw-r--r--core/tests/coretests/res/drawable/size_adaptive_statelist.xml21
-rw-r--r--core/tests/coretests/res/layout/size_adaptive_color_statelist.xml41
-rw-r--r--core/tests/coretests/src/com/android/internal/widget/SizeAdaptiveLayoutTest.java12
-rw-r--r--packages/SystemUI/res/drawable/notification_row_legacy_bg.xml2
-rw-r--r--packages/SystemUI/res/drawable/status_bar_item_background.xml2
-rw-r--r--packages/SystemUI/res/drawable/ticker_background.xml2
-rw-r--r--packages/SystemUI/res/layout/status_bar_notification_row.xml6
-rw-r--r--packages/SystemUI/res/values/colors.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java2
16 files changed, 98 insertions, 14 deletions
diff --git a/core/java/com/android/internal/widget/SizeAdaptiveLayout.java b/core/java/com/android/internal/widget/SizeAdaptiveLayout.java
index adfd3dc..0a99f17 100644
--- a/core/java/com/android/internal/widget/SizeAdaptiveLayout.java
+++ b/core/java/com/android/internal/widget/SizeAdaptiveLayout.java
@@ -26,8 +26,11 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet;
import android.util.Log;
+import android.util.StateSet;
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
@@ -90,8 +93,14 @@ public class SizeAdaptiveLayout extends ViewGroup {
private void initialize() {
mModestyPanel = new View(getContext());
// If the SizeAdaptiveLayout has a solid background, use it as a transition hint.
- if (getBackground() instanceof ColorDrawable) {
- mModestyPanel.setBackgroundDrawable(getBackground());
+ Drawable background = getBackground();
+ if (background instanceof StateListDrawable) {
+ StateListDrawable sld = (StateListDrawable) background;
+ sld.setState(StateSet.WILD_CARD);
+ background = sld.getCurrent();
+ }
+ if (background instanceof ColorDrawable) {
+ mModestyPanel.setBackgroundDrawable(background);
} else {
mModestyPanel.setBackgroundColor(Color.BLACK);
}
diff --git a/packages/SystemUI/res/drawable/notification_row_bg.xml b/core/res/res/drawable/notification_bg.xml
index 1bb2172..1bb2172 100644
--- a/packages/SystemUI/res/drawable/notification_row_bg.xml
+++ b/core/res/res/drawable/notification_bg.xml
diff --git a/core/res/res/layout/notification_template_base.xml b/core/res/res/layout/notification_template_base.xml
index bd26232..af05aed 100644
--- a/core/res/res/layout/notification_template_base.xml
+++ b/core/res/res/layout/notification_template_base.xml
@@ -16,7 +16,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:internal="http://schemas.android.com/apk/prv/res/android"
- android:background="@android:color/background_dark"
+ android:background="@android:drawable/notification_bg"
android:id="@+id/status_bar_latest_event_content"
android:layout_width="match_parent"
android:layout_height="64dp"
diff --git a/core/res/res/layout/notification_template_big_picture.xml b/core/res/res/layout/notification_template_big_picture.xml
index 2150096..51e46b2 100644
--- a/core/res/res/layout/notification_template_big_picture.xml
+++ b/core/res/res/layout/notification_template_big_picture.xml
@@ -16,7 +16,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:internal="http://schemas.android.com/apk/prv/res/android"
- android:background="@android:color/background_dark"
+ android:background="@android:drawable/notification_bg"
android:id="@+id/status_bar_latest_event_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/core/res/res/layout/notification_template_big_text.xml b/core/res/res/layout/notification_template_big_text.xml
index 3a0bfc7..b6d71e1 100644
--- a/core/res/res/layout/notification_template_big_text.xml
+++ b/core/res/res/layout/notification_template_big_text.xml
@@ -15,7 +15,7 @@
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:internal="http://schemas.android.com/apk/prv/res/android"
- android:background="@android:color/background_dark"
+ android:background="@android:drawable/notification_bg"
android:id="@+id/status_bar_latest_event_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index 5ff2c01..e23e3c6 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -22,6 +22,8 @@
<drawable name="screen_background_dark">#ff000000</drawable>
<drawable name="status_bar_closed_default_background">#ff000000</drawable>
<drawable name="status_bar_opened_default_background">#ff000000</drawable>
+ <drawable name="notification_item_background_color">#ff111111</drawable>
+ <drawable name="notification_item_background_color_pressed">#ff257390</drawable>
<drawable name="search_bar_default_color">#ff000000</drawable>
<drawable name="safe_mode_background">#60000000</drawable>
<!-- Background drawable that can be used for a transparent activity to
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 3f8036b..57a4b29 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1002,6 +1002,7 @@
<java-symbol type="drawable" name="ic_lockscreen_silent" />
<java-symbol type="drawable" name="ic_lockscreen_unlock" />
<java-symbol type="drawable" name="ic_lockscreen_search" />
+ <java-symbol type="drawable" name="notification_bg" />
<java-symbol type="layout" name="action_bar_home" />
<java-symbol type="layout" name="action_bar_title_item" />
diff --git a/core/tests/coretests/res/drawable/size_adaptive_statelist.xml b/core/tests/coretests/res/drawable/size_adaptive_statelist.xml
new file mode 100644
index 0000000..aaa2de7
--- /dev/null
+++ b/core/tests/coretests/res/drawable/size_adaptive_statelist.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+
+ <item android:state_pressed="true" android:drawable="@drawable/blue" />
+ <item android:state_pressed="false" android:drawable="@drawable/red" />
+</selector>
diff --git a/core/tests/coretests/res/layout/size_adaptive_color_statelist.xml b/core/tests/coretests/res/layout/size_adaptive_color_statelist.xml
new file mode 100644
index 0000000..d24df5b
--- /dev/null
+++ b/core/tests/coretests/res/layout/size_adaptive_color_statelist.xml
@@ -0,0 +1,41 @@
+<?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.
+-->
+<com.android.internal.widget.SizeAdaptiveLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:internal="http://schemas.android.com/apk/prv/res/android"
+ android:background="@drawable/size_adaptive_statelist"
+ android:id="@+id/multi1"
+ android:layout_width="match_parent"
+ android:layout_height="64dp" >
+
+ <include
+ android:id="@+id/one_u"
+ layout="@layout/size_adaptive_one_u"
+ android:layout_width="fill_parent"
+ android:layout_height="64dp"
+ internal:layout_minHeight="64dp"
+ internal:layout_maxHeight="64dp"
+ />
+
+ <include
+ android:id="@+id/four_u"
+ layout="@layout/size_adaptive_four_u"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ internal:layout_minHeight="65dp"
+ internal:layout_maxHeight="unbounded"/>
+
+</com.android.internal.widget.SizeAdaptiveLayout>
diff --git a/core/tests/coretests/src/com/android/internal/widget/SizeAdaptiveLayoutTest.java b/core/tests/coretests/src/com/android/internal/widget/SizeAdaptiveLayoutTest.java
index fc83e4a..a937f65 100644
--- a/core/tests/coretests/src/com/android/internal/widget/SizeAdaptiveLayoutTest.java
+++ b/core/tests/coretests/src/com/android/internal/widget/SizeAdaptiveLayoutTest.java
@@ -19,6 +19,7 @@ package com.android.internal.widget;
import com.android.frameworks.coretests.R;
import android.content.Context;
+import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
@@ -428,6 +429,17 @@ public class SizeAdaptiveLayoutTest extends AndroidTestCase {
}
@SmallTest
+ public void testModestyPanelTracksStateListColor() {
+ inflate(R.layout.size_adaptive_color_statelist);
+ View panel = mSizeAdaptiveLayout.getModestyPanel();
+ assertEquals("ModestyPanel should have a ColorDrawable background" ,
+ panel.getBackground().getClass(), ColorDrawable.class);
+ ColorDrawable panelColor = (ColorDrawable) panel.getBackground();
+ assertEquals("ModestyPanel color should match the SizeAdaptiveLayout",
+ panelColor.getColor(), Color.RED);
+ }
+
+ @SmallTest
public void testModestyPanelHasDefault() {
inflate(R.layout.size_adaptive);
View panel = mSizeAdaptiveLayout.getModestyPanel();
diff --git a/packages/SystemUI/res/drawable/notification_row_legacy_bg.xml b/packages/SystemUI/res/drawable/notification_row_legacy_bg.xml
index ce3372e..0e1bdd3 100644
--- a/packages/SystemUI/res/drawable/notification_row_legacy_bg.xml
+++ b/packages/SystemUI/res/drawable/notification_row_legacy_bg.xml
@@ -17,6 +17,6 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
- <item android:state_pressed="true" android:drawable="@drawable/notification_item_background_color_pressed" />
+ <item android:state_pressed="true" android:drawable="@*android:drawable/notification_item_background_color_pressed" />
<item android:state_pressed="false" android:drawable="@drawable/notification_item_background_legacy_color" />
</selector>
diff --git a/packages/SystemUI/res/drawable/status_bar_item_background.xml b/packages/SystemUI/res/drawable/status_bar_item_background.xml
index 3a50aa9..b82fed9 100644
--- a/packages/SystemUI/res/drawable/status_bar_item_background.xml
+++ b/packages/SystemUI/res/drawable/status_bar_item_background.xml
@@ -19,7 +19,7 @@
android:opacity="translucent"
>
<item
- android:drawable="@drawable/notification_item_background_color"
+ android:drawable="@*android:drawable/notification_item_background_color"
/>
</layer-list>
diff --git a/packages/SystemUI/res/drawable/ticker_background.xml b/packages/SystemUI/res/drawable/ticker_background.xml
index 7320fa0..07b44ca 100644
--- a/packages/SystemUI/res/drawable/ticker_background.xml
+++ b/packages/SystemUI/res/drawable/ticker_background.xml
@@ -20,7 +20,7 @@
>
<!-- the large icon extends 12dp beyond the edge of the status bar -->
<item
- android:drawable="@drawable/notification_item_background_color"
+ android:drawable="@*android:drawable/notification_item_background_color"
android:top="12dp"
/>
</layer-list>
diff --git a/packages/SystemUI/res/layout/status_bar_notification_row.xml b/packages/SystemUI/res/layout/status_bar_notification_row.xml
index a0d1b08..275d652 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_row.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_row.xml
@@ -1,6 +1,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:background="@*android:drawable/notification_bg"
>
<Button
@@ -20,11 +21,10 @@
android:layout_marginBottom="@dimen/notification_divider_height"
android:focusable="true"
android:clickable="true"
- android:background="@drawable/notification_row_bg"
>
<com.android.internal.widget.SizeAdaptiveLayout android:id="@+id/adaptive"
- android:background="@android:color/background_dark"
+ android:background="@*android:drawable/notification_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
@@ -34,7 +34,7 @@
android:layout_width="match_parent"
android:layout_height="@dimen/notification_divider_height"
android:gravity="bottom"
- android:background="@drawable/status_bar_notification_row_background_color"
+ android:background="@*android:drawable/notification_bg"
/>
</FrameLayout>
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index c8e3fad..2e55786 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -18,8 +18,6 @@
-->
<resources>
<drawable name="notification_number_text_color">#ffffffff</drawable>
- <drawable name="notification_item_background_color">#ff111111</drawable>
- <drawable name="notification_item_background_color_pressed">#ff257390</drawable>
<drawable name="ticker_background_color">#ff1d1d1d</drawable>
<drawable name="status_bar_background">#ff000000</drawable>
<drawable name="status_bar_recents_app_thumbnail_background">#88000000</drawable>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 3803092..ee22eac 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -213,7 +213,7 @@ public abstract class BaseStatusBar extends SystemUI implements
if (version > 0 && version < Build.VERSION_CODES.GINGERBREAD) {
content.setBackgroundResource(R.drawable.notification_row_legacy_bg);
} else {
- content.setBackgroundResource(R.drawable.notification_row_bg);
+ content.setBackgroundResource(com.android.internal.R.drawable.notification_bg);
}
}
}