diff options
author | Tony Wickham <twickham@google.com> | 2017-06-06 15:42:32 -0700 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2017-06-06 16:34:20 -0700 |
commit | 90038ebab21ce22eb2bdaf72b0dddfcaa81dcd4e (patch) | |
tree | 13fe4379cd80c8980bfb1485d49b837625c7211e | |
parent | 561e53577b150d2f4a8d4c45931bd763f9fbd5ac (diff) | |
download | android_packages_apps_Trebuchet-90038ebab21ce22eb2bdaf72b0dddfcaa81dcd4e.tar.gz android_packages_apps_Trebuchet-90038ebab21ce22eb2bdaf72b0dddfcaa81dcd4e.tar.bz2 android_packages_apps_Trebuchet-90038ebab21ce22eb2bdaf72b0dddfcaa81dcd4e.zip |
Add support for popup dark theme
Bug: 62380473
Change-Id: Ib22e9b82841bf10b7f139638f268f0a878e3c6b9
-rw-r--r-- | res/layout/deep_shortcut.xml | 5 | ||||
-rw-r--r-- | res/layout/horizontal_divider.xml | 2 | ||||
-rw-r--r-- | res/layout/notification.xml | 5 | ||||
-rw-r--r-- | res/layout/notification_footer.xml | 2 | ||||
-rw-r--r-- | res/layout/notification_main.xml | 2 | ||||
-rw-r--r-- | res/layout/system_shortcut.xml | 9 | ||||
-rw-r--r-- | res/layout/system_shortcut_icon_only.xml | 5 | ||||
-rw-r--r-- | res/layout/system_shortcut_icons.xml | 2 | ||||
-rw-r--r-- | res/values-sw720dp/styles.xml | 5 | ||||
-rw-r--r-- | res/values/attrs.xml | 3 | ||||
-rw-r--r-- | res/values/colors.xml | 4 | ||||
-rw-r--r-- | res/values/styles.xml | 15 | ||||
-rw-r--r-- | src/com/android/launcher3/notification/NotificationItemView.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher3/popup/PopupContainerWithArrow.java | 15 |
14 files changed, 43 insertions, 34 deletions
diff --git a/res/layout/deep_shortcut.xml b/res/layout/deep_shortcut.xml index 85caba4a0..4a2ad4225 100644 --- a/res/layout/deep_shortcut.xml +++ b/res/layout/deep_shortcut.xml @@ -18,7 +18,8 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:launcher="http://schemas.android.com/apk/res-auto" android:layout_width="@dimen/bg_popup_item_width" - android:layout_height="@dimen/bg_popup_item_height" > + android:layout_height="@dimen/bg_popup_item_height" + android:theme="@style/PopupItem" > <com.android.launcher3.shortcuts.DeepShortcutTextView style="@style/BaseIcon" @@ -50,6 +51,6 @@ android:layout_height="@dimen/popup_item_divider_height" android:layout_gravity="end|bottom" android:visibility="gone" - android:background="?android:attr/listDivider" /> + android:background="?attr/popupColorTertiary" /> </com.android.launcher3.shortcuts.DeepShortcutView> diff --git a/res/layout/horizontal_divider.xml b/res/layout/horizontal_divider.xml index 33773ebfa..167f8f5d8 100644 --- a/res/layout/horizontal_divider.xml +++ b/res/layout/horizontal_divider.xml @@ -2,4 +2,4 @@ <View xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="@dimen/popup_item_divider_height" - android:background="?android:attr/listDivider"/>
\ No newline at end of file + android:background="?attr/popupColorTertiary" />
\ No newline at end of file diff --git a/res/layout/notification.xml b/res/layout/notification.xml index a183c92f7..085dfa93c 100644 --- a/res/layout/notification.xml +++ b/res/layout/notification.xml @@ -19,6 +19,7 @@ android:id="@+id/notification_view" android:layout_width="@dimen/bg_popup_item_width" android:layout_height="wrap_content" + android:theme="@style/PopupItem" android:elevation="@dimen/deep_shortcuts_elevation"> <RelativeLayout @@ -33,7 +34,7 @@ android:layout_height="@dimen/notification_header_height" android:paddingStart="@dimen/notification_padding_start" android:paddingEnd="@dimen/notification_padding_end" - android:background="@color/popup_background_color" + android:background="?attr/popupColorPrimary" android:elevation="@dimen/notification_elevation"> <TextView android:id="@+id/notification_text" @@ -65,7 +66,7 @@ android:id="@+id/divider" android:layout_width="match_parent" android:layout_height="@dimen/popup_item_divider_height" - android:background="?android:attr/listDivider" + android:background="?attr/popupColorTertiary" android:layout_below="@id/main_view" android:visibility="gone" /> diff --git a/res/layout/notification_footer.xml b/res/layout/notification_footer.xml index ed2212be1..86280e0b6 100644 --- a/res/layout/notification_footer.xml +++ b/res/layout/notification_footer.xml @@ -22,7 +22,7 @@ android:elevation="@dimen/notification_elevation" android:clipChildren="false" android:layout_gravity="center_vertical" - android:background="@color/popup_background_color"> + android:background="?attr/popupColorPrimary"> <LinearLayout android:id="@+id/icon_row" diff --git a/res/layout/notification_main.xml b/res/layout/notification_main.xml index ce4e137f7..b2443f5d9 100644 --- a/res/layout/notification_main.xml +++ b/res/layout/notification_main.xml @@ -28,7 +28,7 @@ android:layout_height="match_parent" android:orientation="vertical" android:gravity="center_vertical" - android:background="@color/popup_background_color" + android:background="?attr/popupColorPrimary" android:paddingStart="@dimen/notification_padding_start" android:paddingEnd="@dimen/notification_main_text_padding_end"> <TextView diff --git a/res/layout/system_shortcut.xml b/res/layout/system_shortcut.xml index 6f702f62b..04f3d027d 100644 --- a/res/layout/system_shortcut.xml +++ b/res/layout/system_shortcut.xml @@ -15,11 +15,11 @@ --> <com.android.launcher3.shortcuts.DeepShortcutView - android:theme="@style/IconWithTextSystemShortcut" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:launcher="http://schemas.android.com/apk/res-auto" android:layout_width="@dimen/bg_popup_item_width" - android:layout_height="@dimen/bg_popup_item_height" > + android:layout_height="@dimen/bg_popup_item_height" + android:theme="@style/PopupItem" > <com.android.launcher3.BubbleTextView style="@style/BaseIcon" @@ -41,7 +41,8 @@ android:layout_width="@dimen/system_shortcut_icon_size" android:layout_height="@dimen/system_shortcut_icon_size" android:layout_marginStart="@dimen/system_shortcut_margin_start" - android:layout_gravity="start|center_vertical" /> + android:layout_gravity="start|center_vertical" + android:backgroundTint="?android:attr/textColorTertiary"/> <View android:id="@+id/divider" @@ -49,6 +50,6 @@ android:layout_height="@dimen/popup_item_divider_height" android:layout_gravity="end|bottom" android:visibility="gone" - android:background="?android:attr/listDivider" /> + android:background="?attr/popupColorTertiary" /> </com.android.launcher3.shortcuts.DeepShortcutView> diff --git a/res/layout/system_shortcut_icon_only.xml b/res/layout/system_shortcut_icon_only.xml index 2b58b92ee..c59cb5331 100644 --- a/res/layout/system_shortcut_icon_only.xml +++ b/res/layout/system_shortcut_icon_only.xml @@ -16,8 +16,9 @@ <ImageView xmlns:android="http://schemas.android.com/apk/res/android" - android:theme="@style/IconOnlySystemShortcut" android:layout_width="@dimen/system_shortcut_header_icon_touch_size" android:layout_height="@dimen/system_shortcut_header_icon_touch_size" android:background="?android:attr/selectableItemBackgroundBorderless" - android:padding="@dimen/system_shortcut_header_icon_padding" /> + android:tint="?android:attr/textColorHint" + android:padding="@dimen/system_shortcut_header_icon_padding" + android:theme="@style/PopupItem" /> diff --git a/res/layout/system_shortcut_icons.xml b/res/layout/system_shortcut_icons.xml index 676be8e69..db59d4962 100644 --- a/res/layout/system_shortcut_icons.xml +++ b/res/layout/system_shortcut_icons.xml @@ -21,4 +21,4 @@ android:layout_height="@dimen/system_shortcut_header_height" android:orientation="horizontal" android:gravity="end|center_vertical" - android:background="@color/popup_header_background_color" /> + android:background="?attr/popupColorSecondary" /> diff --git a/res/values-sw720dp/styles.xml b/res/values-sw720dp/styles.xml index bc65a0e9a..168afec4b 100644 --- a/res/values-sw720dp/styles.xml +++ b/res/values-sw720dp/styles.xml @@ -27,6 +27,11 @@ <item name="android:windowActionModeOverlay">true</item> <item name="android:colorEdgeEffect">?android:attr/textColorSecondary</item> <item name="android:keyboardLayout">@layout/all_apps_search_container</item> + <item name="allAppsScrimColor">#DDFFFFFF</item> + <item name="popupColorPrimary">#FFF</item> + <item name="popupColorSecondary">#F5F5F5</item> <!-- Gray 100 --> + <item name="popupColorTertiary">#E0E0E0</item> <!-- Gray 300 --> + <item name="isPrimaryColorDark">false</item> </style> <!-- Workspace --> diff --git a/res/values/attrs.xml b/res/values/attrs.xml index eaadd475a..b85ba3e6f 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -20,6 +20,9 @@ <!-- Attributes used for launcher theme --> <attr name="allAppsScrimColor" format="color" /> + <attr name="popupColorPrimary" format="color" /> + <attr name="popupColorSecondary" format="color" /> + <attr name="popupColorTertiary" format="color" /> <attr name="isPrimaryColorDark" format="boolean" /> <!-- BubbleTextView specific attributes. --> diff --git a/res/values/colors.xml b/res/values/colors.xml index 6deffc139..9ac248a8e 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -31,12 +31,8 @@ <color name="spring_loaded_highlighted_panel_border_color">#FFF</color> <!-- Popup container --> - <color name="popup_header_background_color">#F5F5F5</color> <!-- Gray 100 --> - <color name="popup_background_color">#FFF</color> <color name="notification_icon_default_color">#757575</color> <!-- Gray 600 --> - <color name="notification_color_beneath">#E0E0E0</color> <!-- Gray 300 --> <color name="badge_color">#1DE9B6</color> <!-- Teal A400 --> - <color name="system_shortcuts_icon_color">@android:color/tertiary_text_light</color> <color name="icon_background">#E0E0E0</color> <!-- Gray 300 --> <color name="legacy_icon_background">#FFFFFF</color> diff --git a/res/values/styles.xml b/res/values/styles.xml index f75ca4eeb..5ef044e98 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -27,12 +27,16 @@ <item name="android:colorEdgeEffect">#FF757575</item> <item name="android:keyboardLayout">@layout/all_apps_search_container</item> <item name="allAppsScrimColor">#DDFFFFFF</item> + <item name="popupColorPrimary">#FFF</item> + <item name="popupColorSecondary">#F5F5F5</item> <!-- Gray 100 --> + <item name="popupColorTertiary">#E0E0E0</item> <!-- Gray 300 --> <item name="isPrimaryColorDark">false</item> </style> <style name="LauncherTheme" parent="@style/BaseLauncherTheme"></style> <style name="LauncherThemeDark" parent="@style/LauncherTheme"> + <item name="android:textColorPrimary">#FFFFFFFF</item> <item name="android:textColorSecondary">#FFFFFFFF</item> <item name="android:textColorTertiary">#CCFFFFFF</item> <item name="android:textColorHint">#A0FFFFFF</item> @@ -40,6 +44,9 @@ <item name="android:colorControlHighlight">#A0FFFFFF</item> <item name="android:colorPrimary">#FF333333</item> <item name="allAppsScrimColor">#33000000</item> + <item name="popupColorPrimary">?android:attr/colorPrimary</item> + <item name="popupColorSecondary">#424242</item> <!-- Gray 800 --> + <item name="popupColorTertiary">#757575</item> <!-- Gray 600 --> <item name="isPrimaryColorDark">true</item> </style> @@ -106,12 +113,8 @@ </style> <!-- Theme for the popup container --> - <!-- TODO: Add support for dark theme in shortcuts and widgets popup --> - <style name="IconOnlySystemShortcut" parent="@style/LauncherTheme"> - <item name="android:tint">?android:attr/textColorHint</item> - </style> - <style name="IconWithTextSystemShortcut" parent="@style/LauncherTheme"> - <item name="android:backgroundTint">?android:attr/textColorTertiary</item> + <style name="PopupItem"> + <item name="android:colorControlHighlight">?attr/popupColorTertiary</item> </style> <!-- Drop targets --> diff --git a/src/com/android/launcher3/notification/NotificationItemView.java b/src/com/android/launcher3/notification/NotificationItemView.java index 416d546ea..20707aa67 100644 --- a/src/com/android/launcher3/notification/NotificationItemView.java +++ b/src/com/android/launcher3/notification/NotificationItemView.java @@ -34,6 +34,7 @@ import com.android.launcher3.graphics.IconPalette; import com.android.launcher3.logging.UserEventDispatcher.LogContainerProvider; import com.android.launcher3.popup.PopupItemView; import com.android.launcher3.userevent.nano.LauncherLogProto; +import com.android.launcher3.util.Themes; import java.util.List; @@ -98,7 +99,7 @@ public class NotificationItemView extends PopupItemView implements LogContainerP if (mNotificationHeaderTextColor == Notification.COLOR_DEFAULT) { mNotificationHeaderTextColor = IconPalette.resolveContrastColor(getContext(), palette.dominantColor, - getResources().getColor(R.color.popup_header_background_color)); + Themes.getAttrColor(getContext(), R.attr.popupColorSecondary)); } mHeaderCount.setTextColor(mNotificationHeaderTextColor); } diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java index fa4caab8b..131abbad9 100644 --- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java +++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java @@ -35,7 +35,6 @@ import android.os.Build; import android.os.Handler; import android.os.Looper; import android.support.annotation.IntDef; -import android.support.v4.content.ContextCompat; import android.util.AttributeSet; import android.view.Gravity; import android.view.LayoutInflater; @@ -75,6 +74,7 @@ import com.android.launcher3.shortcuts.DeepShortcutManager; import com.android.launcher3.shortcuts.DeepShortcutView; import com.android.launcher3.shortcuts.ShortcutsItemView; import com.android.launcher3.util.PackageUserKey; +import com.android.launcher3.util.Themes; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -289,8 +289,7 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra if (shouldUnroundBottomCorners) { roundedCorners &= ~ROUNDED_BOTTOM_CORNERS; } - int backgroundColor = ContextCompat.getColor(getContext(), - R.color.notification_color_beneath); + int backgroundColor = Themes.getAttrColor(mLauncher, R.attr.popupColorTertiary); mNotificationItemView.setBackgroundWithCorners(backgroundColor, roundedCorners); mNotificationItemView.getMainView().setAccessibilityDelegate(mAccessibilityDelegate); @@ -315,9 +314,8 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra addView(item); } } - int backgroundColor = ContextCompat.getColor(getContext(), mNotificationItemView == null - ? R.color.popup_background_color - : R.color.popup_header_background_color); + int backgroundColor = Themes.getAttrColor(mLauncher, mNotificationItemView == null + ? R.attr.popupColorPrimary : R.attr.popupColorSecondary); mShortcutsItemView.setBackgroundWithCorners(backgroundColor, shortcutsItemRoundedCorners); } @@ -544,7 +542,7 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra // since the latter expects the arrow which hasn't been added yet. PopupItemView itemAttachedToArrow = (PopupItemView) (getChildAt(mIsAboveIcon ? getChildCount() - 1 : 0)); - arrowPaint.setColor(ContextCompat.getColor(mLauncher, R.color.popup_background_color)); + arrowPaint.setColor(Themes.getAttrColor(mLauncher, R.attr.popupColorPrimary)); // The corner path effect won't be reflected in the shadow, but shouldn't be noticeable. int radius = getResources().getDimensionPixelSize(R.dimen.popup_arrow_corner_radius); arrowPaint.setPathEffect(new CornerPathEffect(radius)); @@ -671,8 +669,7 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra removeNotification.playSequentially(hideArrow, showArrow); removeNotification.start(); if (mShortcutsItemView != null) { - int backgroundColor = ContextCompat.getColor(getContext(), - R.color.popup_background_color); + int backgroundColor = Themes.getAttrColor(mLauncher, R.attr.popupColorPrimary); // With notifications gone, all corners of shortcuts item should be rounded. mShortcutsItemView.setBackgroundWithCorners(backgroundColor, ROUNDED_TOP_CORNERS | ROUNDED_BOTTOM_CORNERS); |