From bb662cca943ab8d67053a4c5f10a9d6f3e428289 Mon Sep 17 00:00:00 2001 From: Rohan Shah Date: Fri, 6 Apr 2018 17:57:00 -0700 Subject: [PATCH] [QS] Move date view to QS panel The date view is currently in the quick status bar - we are moving it into the QSPanel on the left of the icons. So that it works with dark wallpapers, changed text color to colorPrimary attribute. Bug: 74394377 Test: visually verified Change-Id: I8aec54b600a85442d61696ee2375cbfe8362943c --- .../res/layout/quick_qs_status_icons.xml | 13 ++++++++ .../quick_status_bar_header_system_icons.xml | 10 ------ packages/SystemUI/res/values/styles.xml | 2 +- .../systemui/qs/QuickStatusBarHeader.java | 7 ++--- .../systemui/statusbar/policy/DateView.java | 31 ------------------- 5 files changed, 16 insertions(+), 47 deletions(-) diff --git a/packages/SystemUI/res/layout/quick_qs_status_icons.xml b/packages/SystemUI/res/layout/quick_qs_status_icons.xml index dcb8aaf2a6a88..5f73beff92e45 100644 --- a/packages/SystemUI/res/layout/quick_qs_status_icons.xml +++ b/packages/SystemUI/res/layout/quick_qs_status_icons.xml @@ -15,15 +15,28 @@ --> + + - - @dimen/qs_time_expanded_size normal - #ffffffff + ?android:attr/textColorPrimary sans-serif diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java index 2dcb72362b0a3..f027c4bfb6d0c 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java @@ -98,7 +98,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements private View mSystemIconsView; private View mQuickQsStatusIcons; - private View mDate; private View mHeaderTextContainerView; /** View containing the next alarm and ringer mode info. */ private View mStatusContainer; @@ -148,8 +147,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements super.onFinishInflate(); mHeaderQsPanel = findViewById(R.id.quick_qs_panel); - mDate = findViewById(R.id.date); - mDate.setOnClickListener(this); mSystemIconsView = findViewById(R.id.quick_status_bar_system_icons); mQuickQsStatusIcons = findViewById(R.id.quick_qs_status_icons); StatusIconContainer iconContainer = findViewById(R.id.statusIcons); @@ -183,6 +180,7 @@ public class QuickStatusBarHeader extends RelativeLayout implements mBatteryMeterView.setForceShowPercent(true); mClockView = findViewById(R.id.clock); mDateView = findViewById(R.id.date); + mDateView.setOnClickListener(this); } private void updateStatusText() { @@ -261,7 +259,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE; mBatteryMeterView.useWallpaperTextColor(shouldUseWallpaperTextColor); mClockView.useWallpaperTextColor(shouldUseWallpaperTextColor); - mDateView.useWallpaperTextColor(shouldUseWallpaperTextColor); } @Override @@ -415,7 +412,7 @@ public class QuickStatusBarHeader extends RelativeLayout implements @Override public void onClick(View v) { - if(v == mDate){ + if(v == mDateView){ Dependency.get(ActivityStarter.class).postStartActivityDismissingKeyguard(new Intent( AlarmClock.ACTION_SHOW_ALARMS),0); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java index ef630c7205e17..dcce77c7c3551 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java @@ -43,17 +43,6 @@ public class DateView extends TextView { private String mLastText; private String mDatePattern; - /** - * Whether we should use colors that adapt based on wallpaper/the scrim behind quick settings - * for text. - */ - private boolean mUseWallpaperTextColor; - - /** - * Color to be set on this {@link TextView}, when wallpaperTextColor is not utilized. - */ - private int mNonAdaptedTextColor; - private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -74,7 +63,6 @@ public class DateView extends TextView { public DateView(Context context, AttributeSet attrs) { super(context, attrs); - mNonAdaptedTextColor = getCurrentTextColor(); TypedArray a = context.getTheme().obtainStyledAttributes( attrs, R.styleable.DateView, @@ -130,25 +118,6 @@ public class DateView extends TextView { } } - /** - * Sets whether the date view uses the wallpaperTextColor. If we're not using it, we'll revert - * back to dark-mode-based/tinted colors. - * - * @param shouldUseWallpaperTextColor whether we should use wallpaperTextColor for text color - */ - public void useWallpaperTextColor(boolean shouldUseWallpaperTextColor) { - if (shouldUseWallpaperTextColor == mUseWallpaperTextColor) { - return; - } - mUseWallpaperTextColor = shouldUseWallpaperTextColor; - - if (mUseWallpaperTextColor) { - setTextColor(Utils.getColorAttr(mContext, R.attr.wallpaperTextColor)); - } else { - setTextColor(mNonAdaptedTextColor); - } - } - public void setDatePattern(String pattern) { if (TextUtils.equals(pattern, mDatePattern)) { return;