diff options
| author | 2018-04-06 17:57:00 -0700 | |
|---|---|---|
| committer | 2018-04-23 11:52:51 -0700 | |
| commit | bb662cca943ab8d67053a4c5f10a9d6f3e428289 (patch) | |
| tree | e392067d673b02c50ece8d669b46ec385b6e8c7d | |
| parent | 4f4882f2cedc1d9ab41a53b835acc50bf4769faa (diff) | |
[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
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 dcb8aaf2a6a8..5f73beff92e4 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 @@ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:systemui="http://schemas.android.com/apk/res-auto" android:id="@+id/quick_qs_status_icons" android:layout_width="match_parent" android:layout_height="20dp" android:layout_marginTop="8dp" android:layout_marginBottom="14dp" + android:layout_marginStart="8dp" android:layout_marginEnd="@dimen/notification_side_paddings" android:layout_below="@id/quick_status_bar_system_icons" android:paddingEnd="@dimen/status_bar_padding_end" > + <com.android.systemui.statusbar.policy.DateView + android:id="@+id/date" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="start" + android:gravity="center_vertical" + android:singleLine="true" + android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" + android:textSize="@dimen/qs_time_collapsed_size" + systemui:datePattern="@string/abbrev_wday_month_day_no_year_alarm" /> + <com.android.systemui.statusbar.phone.StatusIconContainer android:id="@+id/statusIcons" android:layout_width="0dp" diff --git a/packages/SystemUI/res/layout/quick_status_bar_header_system_icons.xml b/packages/SystemUI/res/layout/quick_status_bar_header_system_icons.xml index 7b9cd2aee862..a9fe8620cf48 100644 --- a/packages/SystemUI/res/layout/quick_status_bar_header_system_icons.xml +++ b/packages/SystemUI/res/layout/quick_status_bar_header_system_icons.xml @@ -41,16 +41,6 @@ android:textAppearance="@style/TextAppearance.StatusBar.Clock" systemui:showDark="false" /> - <com.android.systemui.statusbar.policy.DateView - android:id="@+id/date" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:gravity="center_vertical" - android:singleLine="true" - android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" - android:textSize="@dimen/qs_time_collapsed_size" - systemui:datePattern="@string/abbrev_wday_month_day_no_year_alarm" /> - <android.widget.Space android:id="@+id/space" android:layout_width="0dp" diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 20d883435aef..804ca2cf1db7 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -173,7 +173,7 @@ <style name="TextAppearance.StatusBar.Expanded.Date"> <item name="android:textSize">@dimen/qs_time_expanded_size</item> <item name="android:textStyle">normal</item> - <item name="android:textColor">#ffffffff</item> + <item name="android:textColor">?android:attr/textColorPrimary</item> <item name="android:fontFamily">sans-serif</item> </style> diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java index 2dcb72362b0a..f027c4bfb6d0 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 ef630c7205e1..dcce77c7c355 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 <b>not</b> 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; |