Merge "[QS] Move date view to QS panel" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ef61802559
@@ -15,15 +15,28 @@
|
|||||||
-->
|
-->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
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:id="@+id/quick_qs_status_icons"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="20dp"
|
android:layout_height="20dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginBottom="14dp"
|
android:layout_marginBottom="14dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
android:layout_marginEnd="@dimen/notification_side_paddings"
|
android:layout_marginEnd="@dimen/notification_side_paddings"
|
||||||
android:layout_below="@id/quick_status_bar_system_icons"
|
android:layout_below="@id/quick_status_bar_system_icons"
|
||||||
android:paddingEnd="@dimen/status_bar_padding_end" >
|
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
|
<com.android.systemui.statusbar.phone.StatusIconContainer
|
||||||
android:id="@+id/statusIcons"
|
android:id="@+id/statusIcons"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|||||||
@@ -41,16 +41,6 @@
|
|||||||
android:textAppearance="@style/TextAppearance.StatusBar.Clock"
|
android:textAppearance="@style/TextAppearance.StatusBar.Clock"
|
||||||
systemui:showDark="false" />
|
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.widget.Space
|
||||||
android:id="@+id/space"
|
android:id="@+id/space"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|||||||
@@ -173,7 +173,7 @@
|
|||||||
<style name="TextAppearance.StatusBar.Expanded.Date">
|
<style name="TextAppearance.StatusBar.Expanded.Date">
|
||||||
<item name="android:textSize">@dimen/qs_time_expanded_size</item>
|
<item name="android:textSize">@dimen/qs_time_expanded_size</item>
|
||||||
<item name="android:textStyle">normal</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>
|
<item name="android:fontFamily">sans-serif</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements
|
|||||||
|
|
||||||
private View mSystemIconsView;
|
private View mSystemIconsView;
|
||||||
private View mQuickQsStatusIcons;
|
private View mQuickQsStatusIcons;
|
||||||
private View mDate;
|
|
||||||
private View mHeaderTextContainerView;
|
private View mHeaderTextContainerView;
|
||||||
/** View containing the next alarm and ringer mode info. */
|
/** View containing the next alarm and ringer mode info. */
|
||||||
private View mStatusContainer;
|
private View mStatusContainer;
|
||||||
@@ -148,8 +147,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements
|
|||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
|
|
||||||
mHeaderQsPanel = findViewById(R.id.quick_qs_panel);
|
mHeaderQsPanel = findViewById(R.id.quick_qs_panel);
|
||||||
mDate = findViewById(R.id.date);
|
|
||||||
mDate.setOnClickListener(this);
|
|
||||||
mSystemIconsView = findViewById(R.id.quick_status_bar_system_icons);
|
mSystemIconsView = findViewById(R.id.quick_status_bar_system_icons);
|
||||||
mQuickQsStatusIcons = findViewById(R.id.quick_qs_status_icons);
|
mQuickQsStatusIcons = findViewById(R.id.quick_qs_status_icons);
|
||||||
StatusIconContainer iconContainer = findViewById(R.id.statusIcons);
|
StatusIconContainer iconContainer = findViewById(R.id.statusIcons);
|
||||||
@@ -183,6 +180,7 @@ public class QuickStatusBarHeader extends RelativeLayout implements
|
|||||||
mBatteryMeterView.setForceShowPercent(true);
|
mBatteryMeterView.setForceShowPercent(true);
|
||||||
mClockView = findViewById(R.id.clock);
|
mClockView = findViewById(R.id.clock);
|
||||||
mDateView = findViewById(R.id.date);
|
mDateView = findViewById(R.id.date);
|
||||||
|
mDateView.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateStatusText() {
|
private void updateStatusText() {
|
||||||
@@ -261,7 +259,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements
|
|||||||
newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE;
|
newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE;
|
||||||
mBatteryMeterView.useWallpaperTextColor(shouldUseWallpaperTextColor);
|
mBatteryMeterView.useWallpaperTextColor(shouldUseWallpaperTextColor);
|
||||||
mClockView.useWallpaperTextColor(shouldUseWallpaperTextColor);
|
mClockView.useWallpaperTextColor(shouldUseWallpaperTextColor);
|
||||||
mDateView.useWallpaperTextColor(shouldUseWallpaperTextColor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -415,7 +412,7 @@ public class QuickStatusBarHeader extends RelativeLayout implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if(v == mDate){
|
if(v == mDateView){
|
||||||
Dependency.get(ActivityStarter.class).postStartActivityDismissingKeyguard(new Intent(
|
Dependency.get(ActivityStarter.class).postStartActivityDismissingKeyguard(new Intent(
|
||||||
AlarmClock.ACTION_SHOW_ALARMS),0);
|
AlarmClock.ACTION_SHOW_ALARMS),0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,17 +43,6 @@ public class DateView extends TextView {
|
|||||||
private String mLastText;
|
private String mLastText;
|
||||||
private String mDatePattern;
|
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() {
|
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
@@ -74,7 +63,6 @@ public class DateView extends TextView {
|
|||||||
|
|
||||||
public DateView(Context context, AttributeSet attrs) {
|
public DateView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
mNonAdaptedTextColor = getCurrentTextColor();
|
|
||||||
TypedArray a = context.getTheme().obtainStyledAttributes(
|
TypedArray a = context.getTheme().obtainStyledAttributes(
|
||||||
attrs,
|
attrs,
|
||||||
R.styleable.DateView,
|
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) {
|
public void setDatePattern(String pattern) {
|
||||||
if (TextUtils.equals(pattern, mDatePattern)) {
|
if (TextUtils.equals(pattern, mDatePattern)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user