Update header text color when theme changes

Fixes: 150157414
Test: manual, atest
Change-Id: I0ae51dc9e171d1984f38db42093e6a94c547f09b
This commit is contained in:
Steve Elliott
2020-04-02 13:49:36 -04:00
parent 161cdc30ec
commit 577ef7932e
5 changed files with 25 additions and 1 deletions

View File

@@ -43,6 +43,7 @@
android:forceHasOverlappingRendering="false">
<TextView
android:id="@+id/header_label"
style="@style/TextAppearance.NotificationSectionHeaderButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@@ -20,6 +20,7 @@ import static com.android.systemui.statusbar.notification.stack.NotificationStac
import static java.lang.annotation.RetentionPolicy.SOURCE;
import android.annotation.ColorInt;
import android.annotation.IntDef;
import android.annotation.LayoutRes;
import android.annotation.NonNull;
@@ -555,6 +556,12 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section
updateSectionBoundaries();
}
void setHeaderForegroundColor(@ColorInt int color) {
mPeopleHubView.setTextColor(color);
mGentleHeader.setForegroundColor(color);
mAlertingHeader.setForegroundColor(color);
}
/**
* For now, declare the available notification buckets (sections) here so that other
* presentation code can decide what to do based on an entry's buckets

View File

@@ -33,6 +33,7 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.TimeAnimator;
import android.animation.ValueAnimator;
import android.annotation.ColorInt;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -4806,7 +4807,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
mUsingLightTheme = lightTheme;
Context context = new ContextThemeWrapper(mContext,
lightTheme ? R.style.Theme_SystemUI_Light : R.style.Theme_SystemUI);
final int textColor = Utils.getColorAttrDefaultColor(context, R.attr.wallpaperTextColor);
final @ColorInt int textColor =
Utils.getColorAttrDefaultColor(context, R.attr.wallpaperTextColor);
mSectionsManager.setHeaderForegroundColor(textColor);
mFooterView.setTextColor(textColor);
mEmptyShadeView.setTextColor(textColor);
}

View File

@@ -16,11 +16,13 @@
package com.android.systemui.statusbar.notification.stack
import android.annotation.ColorInt
import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import com.android.systemui.R
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin
import com.android.systemui.statusbar.notification.people.DataListener
@@ -31,12 +33,14 @@ class PeopleHubView(context: Context, attrs: AttributeSet) :
StackScrollerDecorView(context, attrs), SwipeableView {
private lateinit var contents: ViewGroup
private lateinit var label: TextView
lateinit var personViewAdapters: Sequence<DataListener<PersonViewModel?>>
private set
override fun onFinishInflate() {
contents = requireViewById(R.id.people_list)
label = requireViewById(R.id.header_label)
personViewAdapters = (0 until contents.childCount)
.asSequence() // so we can map
.mapNotNull { idx ->
@@ -49,6 +53,8 @@ class PeopleHubView(context: Context, attrs: AttributeSet) :
setVisible(true /* nowVisible */, false /* animate */)
}
fun setTextColor(@ColorInt color: Int) = label.setTextColor(color)
override fun findContentView(): View = contents
override fun findSecondaryView(): View? = null

View File

@@ -16,9 +16,11 @@
package com.android.systemui.statusbar.notification.stack;
import android.annotation.ColorInt;
import android.annotation.Nullable;
import android.annotation.StringRes;
import android.content.Context;
import android.content.res.ColorStateList;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
@@ -124,4 +126,9 @@ public class SectionHeaderView extends StackScrollerDecorView {
mLabelTextId = resId;
mLabelView.setText(resId);
}
void setForegroundColor(@ColorInt int color) {
mLabelView.setTextColor(color);
mClearAllButton.setImageTintList(ColorStateList.valueOf(color));
}
}