Merge "Update header text color when theme changes" into rvc-dev am: 8d0b0290e8 am: 54acf2bbe6

Change-Id: Iec73871db4c785bbdf92886eec9c8eb0a18867a2
This commit is contained in:
Steve Elliott
2020-04-03 20:41:09 +00:00
committed by Automerger Merge Worker
5 changed files with 25 additions and 1 deletions

View File

@@ -43,6 +43,7 @@
android:forceHasOverlappingRendering="false"> android:forceHasOverlappingRendering="false">
<TextView <TextView
android:id="@+id/header_label"
style="@style/TextAppearance.NotificationSectionHeaderButton" style="@style/TextAppearance.NotificationSectionHeaderButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="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 static java.lang.annotation.RetentionPolicy.SOURCE;
import android.annotation.ColorInt;
import android.annotation.IntDef; import android.annotation.IntDef;
import android.annotation.LayoutRes; import android.annotation.LayoutRes;
import android.annotation.NonNull; import android.annotation.NonNull;
@@ -555,6 +556,12 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section
updateSectionBoundaries(); 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 * 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 * 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.AnimatorListenerAdapter;
import android.animation.TimeAnimator; import android.animation.TimeAnimator;
import android.animation.ValueAnimator; import android.animation.ValueAnimator;
import android.annotation.ColorInt;
import android.annotation.IntDef; import android.annotation.IntDef;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
@@ -4806,7 +4807,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
mUsingLightTheme = lightTheme; mUsingLightTheme = lightTheme;
Context context = new ContextThemeWrapper(mContext, Context context = new ContextThemeWrapper(mContext,
lightTheme ? R.style.Theme_SystemUI_Light : R.style.Theme_SystemUI); 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); mFooterView.setTextColor(textColor);
mEmptyShadeView.setTextColor(textColor); mEmptyShadeView.setTextColor(textColor);
} }

View File

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

View File

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