[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
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user