diff --git a/packages/SystemUI/res/layout/status_bar_notification_section_header.xml b/packages/SystemUI/res/layout/status_bar_notification_section_header.xml
index 44c409e08e828..b5822c889f1cb 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_section_header.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_section_header.xml
@@ -35,7 +35,34 @@
android:forceHasOverlappingRendering="false"
android:clipChildren="false"
>
-
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/layout/status_bar_notification_section_header_contents.xml b/packages/SystemUI/res/layout/status_bar_notification_section_header_contents.xml
deleted file mode 100644
index 3b9c44d1b5df8..0000000000000
--- a/packages/SystemUI/res/layout/status_bar_notification_section_header_contents.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java
index 42a7c6a07e0fa..f6f836335c458 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java
@@ -447,7 +447,6 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section
}
}
-
@VisibleForTesting
ExpandableView getGentleHeaderView() {
return mGentleHeader;
@@ -471,7 +470,7 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section
private final ConfigurationListener mConfigurationListener = new ConfigurationListener() {
@Override
public void onLocaleListChanged() {
- mGentleHeader.reinflateContents();
+ reinflateViews(LayoutInflater.from(mParent.getContext()));
}
};
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/PeopleHubView.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/PeopleHubView.kt
index 1b4f98f84c5b4..bc25c71e4fe5c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/PeopleHubView.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/PeopleHubView.kt
@@ -76,9 +76,7 @@ class PeopleHubView(context: Context, attrs: AttributeSet) :
}
}
- override fun needsClippingToShelf(): Boolean {
- return true
- }
+ override fun needsClippingToShelf(): Boolean = true
override fun applyContentTransformation(contentAlpha: Float, translationY: Float) {
super.applyContentTransformation(contentAlpha, translationY)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java
index deb5532ca0f21..a3d8eecdfd68b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java
@@ -20,7 +20,6 @@ import android.annotation.Nullable;
import android.annotation.StringRes;
import android.content.Context;
import android.util.AttributeSet;
-import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -30,16 +29,17 @@ import android.widget.TextView;
import com.android.systemui.R;
import com.android.systemui.statusbar.notification.row.StackScrollerDecorView;
-import java.util.Objects;
-
/**
- * Similar in size and appearance to the NotificationShelf, appears at the beginning of some
- * notification sections. Currently only used for gentle notifications.
+ * Header displayed above a notification section in the shade. Currently used for Alerting and
+ * Silent sections.
*/
public class SectionHeaderView extends StackScrollerDecorView {
+
private ViewGroup mContents;
private TextView mLabelView;
private ImageView mClearAllButton;
+ @StringRes @Nullable private Integer mLabelTextId;
+ @Nullable private View.OnClickListener mLabelClickListener = null;
@Nullable private View.OnClickListener mOnClearClickListener = null;
public SectionHeaderView(Context context, AttributeSet attrs) {
@@ -48,18 +48,24 @@ public class SectionHeaderView extends StackScrollerDecorView {
@Override
protected void onFinishInflate() {
- mContents = Objects.requireNonNull(findViewById(R.id.content));
+ mContents = requireViewById(R.id.content);
bindContents();
super.onFinishInflate();
setVisible(true /* nowVisible */, false /* animate */);
}
private void bindContents() {
- mLabelView = Objects.requireNonNull(findViewById(R.id.header_label));
- mClearAllButton = Objects.requireNonNull(findViewById(R.id.btn_clear_all));
+ mLabelView = requireViewById(R.id.header_label);
+ mClearAllButton = requireViewById(R.id.btn_clear_all);
if (mOnClearClickListener != null) {
mClearAllButton.setOnClickListener(mOnClearClickListener);
}
+ if (mLabelClickListener != null) {
+ mLabelView.setOnClickListener(mLabelClickListener);
+ }
+ if (mLabelTextId != null) {
+ mLabelView.setText(mLabelTextId);
+ }
}
@Override
@@ -72,21 +78,6 @@ public class SectionHeaderView extends StackScrollerDecorView {
return null;
}
- /**
- * Destroys and reinflates the visible contents of the section header. For use on configuration
- * changes or any other time that layout values might need to be re-evaluated.
- *
- * Does not reinflate the base content view itself ({@link #findContentView()} or any of the
- * decorator views, such as the background view or shadow view.
- */
- void reinflateContents() {
- mContents.removeAllViews();
- LayoutInflater.from(getContext()).inflate(
- R.layout.status_bar_notification_section_header_contents,
- mContents);
- bindContents();
- }
-
@Override
public boolean isTransparent() {
return true;
@@ -105,6 +96,7 @@ public class SectionHeaderView extends StackScrollerDecorView {
* Fired whenever the user clicks on the body of the header (e.g. no sub-buttons or anything).
*/
void setOnHeaderClickListener(View.OnClickListener listener) {
+ mLabelClickListener = listener;
mLabelView.setOnClickListener(listener);
}
@@ -129,6 +121,7 @@ public class SectionHeaderView extends StackScrollerDecorView {
}
void setHeaderText(@StringRes int resId) {
+ mLabelTextId = resId;
mLabelView.setText(resId);
}
}