Merge "FooterView color logic cleanup" into sc-qpr1-dev am: 3e7384fbe2
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15549419 Change-Id: I7b92058ba3fee7ab415c95803493f81d85f98793
This commit is contained in:
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.android.systemui.statusbar.notification.row;
|
package com.android.systemui.statusbar.notification.row;
|
||||||
|
|
||||||
import android.annotation.ColorInt;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
@@ -28,15 +27,12 @@ import com.android.systemui.statusbar.notification.stack.ExpandableViewState;
|
|||||||
import com.android.systemui.statusbar.notification.stack.ViewState;
|
import com.android.systemui.statusbar.notification.stack.ViewState;
|
||||||
|
|
||||||
public class FooterView extends StackScrollerDecorView {
|
public class FooterView extends StackScrollerDecorView {
|
||||||
private final int mClearAllTopPadding;
|
|
||||||
private FooterViewButton mDismissButton;
|
private FooterViewButton mDismissButton;
|
||||||
private FooterViewButton mManageButton;
|
private FooterViewButton mManageButton;
|
||||||
private boolean mShowHistory;
|
private boolean mShowHistory;
|
||||||
|
|
||||||
public FooterView(Context context, AttributeSet attrs) {
|
public FooterView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
mClearAllTopPadding = context.getResources().getDimensionPixelSize(
|
|
||||||
R.dimen.clear_all_padding_top);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -55,11 +51,6 @@ public class FooterView extends StackScrollerDecorView {
|
|||||||
mManageButton = findViewById(R.id.manage_text);
|
mManageButton = findViewById(R.id.manage_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTextColor(@ColorInt int color) {
|
|
||||||
mManageButton.setTextColor(color);
|
|
||||||
mDismissButton.setTextColor(color);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setManageButtonClickListener(OnClickListener listener) {
|
public void setManageButtonClickListener(OnClickListener listener) {
|
||||||
mManageButton.setOnClickListener(listener);
|
mManageButton.setOnClickListener(listener);
|
||||||
}
|
}
|
||||||
@@ -95,21 +86,25 @@ public class FooterView extends StackScrollerDecorView {
|
|||||||
@Override
|
@Override
|
||||||
protected void onConfigurationChanged(Configuration newConfig) {
|
protected void onConfigurationChanged(Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
int textColor = getResources().getColor(R.color.notif_pill_text);
|
updateColors();
|
||||||
Resources.Theme theme = getContext().getTheme();
|
|
||||||
mDismissButton.setBackground(
|
|
||||||
getResources().getDrawable(R.drawable.notif_footer_btn_background, theme));
|
|
||||||
mDismissButton.setTextColor(textColor);
|
|
||||||
mManageButton.setBackground(
|
|
||||||
getResources().getDrawable(R.drawable.notif_footer_btn_background, theme));
|
|
||||||
mManageButton = findViewById(R.id.manage_text);
|
|
||||||
mDismissButton.setText(R.string.clear_all_notifications_text);
|
mDismissButton.setText(R.string.clear_all_notifications_text);
|
||||||
mManageButton.setTextColor(textColor);
|
|
||||||
mDismissButton.setContentDescription(
|
mDismissButton.setContentDescription(
|
||||||
mContext.getString(R.string.accessibility_clear_all));
|
mContext.getString(R.string.accessibility_clear_all));
|
||||||
showHistory(mShowHistory);
|
showHistory(mShowHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the text and background colors for the current color palette and night mode setting.
|
||||||
|
*/
|
||||||
|
public void updateColors() {
|
||||||
|
Resources.Theme theme = mContext.getTheme();
|
||||||
|
int textColor = getResources().getColor(R.color.notif_pill_text, theme);
|
||||||
|
mDismissButton.setBackground(theme.getDrawable(R.drawable.notif_footer_btn_background));
|
||||||
|
mDismissButton.setTextColor(textColor);
|
||||||
|
mManageButton.setBackground(theme.getDrawable(R.drawable.notif_footer_btn_background));
|
||||||
|
mManageButton.setTextColor(textColor);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExpandableViewState createExpandableViewState() {
|
public ExpandableViewState createExpandableViewState() {
|
||||||
return new FooterViewState();
|
return new FooterViewState();
|
||||||
|
|||||||
@@ -4243,7 +4243,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
final @ColorInt int textColor =
|
final @ColorInt int textColor =
|
||||||
Utils.getColorAttrDefaultColor(mContext, android.R.attr.textColorPrimary);
|
Utils.getColorAttrDefaultColor(mContext, android.R.attr.textColorPrimary);
|
||||||
mSectionsManager.setHeaderForegroundColor(textColor);
|
mSectionsManager.setHeaderForegroundColor(textColor);
|
||||||
mFooterView.setTextColor(textColor);
|
mFooterView.updateColors();
|
||||||
mEmptyShadeView.setTextColor(textColor);
|
mEmptyShadeView.setTextColor(textColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user