Loading packages/SystemUI/res/layout/status_bar_notification_section_header.xml +28 −1 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,34 @@ android:forceHasOverlappingRendering="false" android:forceHasOverlappingRendering="false" android:clipChildren="false" android:clipChildren="false" > > <include layout="@layout/status_bar_notification_section_header_contents"/> <FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="start|center_vertical" android:layout_weight="1"> <TextView style="@style/TextAppearance.NotificationSectionHeaderButton" android:id="@+id/header_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:forceHasOverlappingRendering="false" android:text="@string/notification_section_header_gentle" /> </FrameLayout> <ImageView android:id="@+id/btn_clear_all" android:layout_width="48dp" android:layout_height="48dp" android:src="@drawable/status_bar_notification_section_header_clear_btn" android:contentDescription="@string/accessibility_notification_section_header_gentle_clear_all" android:scaleType="center" android:tint="?attr/wallpaperTextColor" android:tintMode="src_in" android:visibility="gone" android:forceHasOverlappingRendering="false" /> </LinearLayout> </LinearLayout> </com.android.systemui.statusbar.notification.stack.SectionHeaderView> </com.android.systemui.statusbar.notification.stack.SectionHeaderView> packages/SystemUI/res/layout/status_bar_notification_section_header_contents.xmldeleted 100644 → 0 +0 −47 Original line number Original line Diff line number Diff line <!-- ~ Copyright (C) 2019 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License --> <!-- Used by both status_bar_notification_header and SectionHeaderView --> <merge xmlns:android="http://schemas.android.com/apk/res/android" > <FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="start|center_vertical" android:layout_weight="1"> <TextView style="@style/TextAppearance.NotificationSectionHeaderButton" android:id="@+id/header_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:forceHasOverlappingRendering="false" android:text="@string/notification_section_header_gentle" /> </FrameLayout> <ImageView android:id="@+id/btn_clear_all" android:layout_width="48dp" android:layout_height="48dp" android:src="@drawable/status_bar_notification_section_header_clear_btn" android:contentDescription="@string/accessibility_notification_section_header_gentle_clear_all" android:scaleType="center" android:tint="?attr/wallpaperTextColor" android:tintMode="src_in" android:visibility="gone" android:forceHasOverlappingRendering="false" /> </merge> packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java +1 −2 Original line number Original line Diff line number Diff line Loading @@ -447,7 +447,6 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section } } } } @VisibleForTesting @VisibleForTesting ExpandableView getGentleHeaderView() { ExpandableView getGentleHeaderView() { return mGentleHeader; return mGentleHeader; Loading @@ -471,7 +470,7 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section private final ConfigurationListener mConfigurationListener = new ConfigurationListener() { private final ConfigurationListener mConfigurationListener = new ConfigurationListener() { @Override @Override public void onLocaleListChanged() { public void onLocaleListChanged() { mGentleHeader.reinflateContents(); reinflateViews(LayoutInflater.from(mParent.getContext())); } } }; }; Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/PeopleHubView.kt +1 −3 Original line number Original line Diff line number Diff line Loading @@ -76,9 +76,7 @@ class PeopleHubView(context: Context, attrs: AttributeSet) : } } } } override fun needsClippingToShelf(): Boolean { override fun needsClippingToShelf(): Boolean = true return true } override fun applyContentTransformation(contentAlpha: Float, translationY: Float) { override fun applyContentTransformation(contentAlpha: Float, translationY: Float) { super.applyContentTransformation(contentAlpha, translationY) super.applyContentTransformation(contentAlpha, translationY) Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java +16 −23 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.annotation.Nullable; import android.annotation.StringRes; import android.annotation.StringRes; import android.content.Context; import android.content.Context; import android.util.AttributeSet; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.MotionEvent; import android.view.View; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup; Loading @@ -30,16 +29,17 @@ import android.widget.TextView; import com.android.systemui.R; import com.android.systemui.R; import com.android.systemui.statusbar.notification.row.StackScrollerDecorView; 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 * Header displayed above a notification section in the shade. Currently used for Alerting and * notification sections. Currently only used for gentle notifications. * Silent sections. */ */ public class SectionHeaderView extends StackScrollerDecorView { public class SectionHeaderView extends StackScrollerDecorView { private ViewGroup mContents; private ViewGroup mContents; private TextView mLabelView; private TextView mLabelView; private ImageView mClearAllButton; private ImageView mClearAllButton; @StringRes @Nullable private Integer mLabelTextId; @Nullable private View.OnClickListener mLabelClickListener = null; @Nullable private View.OnClickListener mOnClearClickListener = null; @Nullable private View.OnClickListener mOnClearClickListener = null; public SectionHeaderView(Context context, AttributeSet attrs) { public SectionHeaderView(Context context, AttributeSet attrs) { Loading @@ -48,18 +48,24 @@ public class SectionHeaderView extends StackScrollerDecorView { @Override @Override protected void onFinishInflate() { protected void onFinishInflate() { mContents = Objects.requireNonNull(findViewById(R.id.content)); mContents = requireViewById(R.id.content); bindContents(); bindContents(); super.onFinishInflate(); super.onFinishInflate(); setVisible(true /* nowVisible */, false /* animate */); setVisible(true /* nowVisible */, false /* animate */); } } private void bindContents() { private void bindContents() { mLabelView = Objects.requireNonNull(findViewById(R.id.header_label)); mLabelView = requireViewById(R.id.header_label); mClearAllButton = Objects.requireNonNull(findViewById(R.id.btn_clear_all)); mClearAllButton = requireViewById(R.id.btn_clear_all); if (mOnClearClickListener != null) { if (mOnClearClickListener != null) { mClearAllButton.setOnClickListener(mOnClearClickListener); mClearAllButton.setOnClickListener(mOnClearClickListener); } } if (mLabelClickListener != null) { mLabelView.setOnClickListener(mLabelClickListener); } if (mLabelTextId != null) { mLabelView.setText(mLabelTextId); } } } @Override @Override Loading @@ -72,21 +78,6 @@ public class SectionHeaderView extends StackScrollerDecorView { return null; 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 @Override public boolean isTransparent() { public boolean isTransparent() { return true; return true; Loading @@ -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). * Fired whenever the user clicks on the body of the header (e.g. no sub-buttons or anything). */ */ void setOnHeaderClickListener(View.OnClickListener listener) { void setOnHeaderClickListener(View.OnClickListener listener) { mLabelClickListener = listener; mLabelView.setOnClickListener(listener); mLabelView.setOnClickListener(listener); } } Loading @@ -129,6 +121,7 @@ public class SectionHeaderView extends StackScrollerDecorView { } } void setHeaderText(@StringRes int resId) { void setHeaderText(@StringRes int resId) { mLabelTextId = resId; mLabelView.setText(resId); mLabelView.setText(resId); } } } } Loading
packages/SystemUI/res/layout/status_bar_notification_section_header.xml +28 −1 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,34 @@ android:forceHasOverlappingRendering="false" android:forceHasOverlappingRendering="false" android:clipChildren="false" android:clipChildren="false" > > <include layout="@layout/status_bar_notification_section_header_contents"/> <FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="start|center_vertical" android:layout_weight="1"> <TextView style="@style/TextAppearance.NotificationSectionHeaderButton" android:id="@+id/header_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:forceHasOverlappingRendering="false" android:text="@string/notification_section_header_gentle" /> </FrameLayout> <ImageView android:id="@+id/btn_clear_all" android:layout_width="48dp" android:layout_height="48dp" android:src="@drawable/status_bar_notification_section_header_clear_btn" android:contentDescription="@string/accessibility_notification_section_header_gentle_clear_all" android:scaleType="center" android:tint="?attr/wallpaperTextColor" android:tintMode="src_in" android:visibility="gone" android:forceHasOverlappingRendering="false" /> </LinearLayout> </LinearLayout> </com.android.systemui.statusbar.notification.stack.SectionHeaderView> </com.android.systemui.statusbar.notification.stack.SectionHeaderView>
packages/SystemUI/res/layout/status_bar_notification_section_header_contents.xmldeleted 100644 → 0 +0 −47 Original line number Original line Diff line number Diff line <!-- ~ Copyright (C) 2019 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License --> <!-- Used by both status_bar_notification_header and SectionHeaderView --> <merge xmlns:android="http://schemas.android.com/apk/res/android" > <FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="start|center_vertical" android:layout_weight="1"> <TextView style="@style/TextAppearance.NotificationSectionHeaderButton" android:id="@+id/header_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:forceHasOverlappingRendering="false" android:text="@string/notification_section_header_gentle" /> </FrameLayout> <ImageView android:id="@+id/btn_clear_all" android:layout_width="48dp" android:layout_height="48dp" android:src="@drawable/status_bar_notification_section_header_clear_btn" android:contentDescription="@string/accessibility_notification_section_header_gentle_clear_all" android:scaleType="center" android:tint="?attr/wallpaperTextColor" android:tintMode="src_in" android:visibility="gone" android:forceHasOverlappingRendering="false" /> </merge>
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSectionsManager.java +1 −2 Original line number Original line Diff line number Diff line Loading @@ -447,7 +447,6 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section } } } } @VisibleForTesting @VisibleForTesting ExpandableView getGentleHeaderView() { ExpandableView getGentleHeaderView() { return mGentleHeader; return mGentleHeader; Loading @@ -471,7 +470,7 @@ public class NotificationSectionsManager implements StackScrollAlgorithm.Section private final ConfigurationListener mConfigurationListener = new ConfigurationListener() { private final ConfigurationListener mConfigurationListener = new ConfigurationListener() { @Override @Override public void onLocaleListChanged() { public void onLocaleListChanged() { mGentleHeader.reinflateContents(); reinflateViews(LayoutInflater.from(mParent.getContext())); } } }; }; Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/PeopleHubView.kt +1 −3 Original line number Original line Diff line number Diff line Loading @@ -76,9 +76,7 @@ class PeopleHubView(context: Context, attrs: AttributeSet) : } } } } override fun needsClippingToShelf(): Boolean { override fun needsClippingToShelf(): Boolean = true return true } override fun applyContentTransformation(contentAlpha: Float, translationY: Float) { override fun applyContentTransformation(contentAlpha: Float, translationY: Float) { super.applyContentTransformation(contentAlpha, translationY) super.applyContentTransformation(contentAlpha, translationY) Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java +16 −23 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.annotation.Nullable; import android.annotation.StringRes; import android.annotation.StringRes; import android.content.Context; import android.content.Context; import android.util.AttributeSet; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.MotionEvent; import android.view.View; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup; Loading @@ -30,16 +29,17 @@ import android.widget.TextView; import com.android.systemui.R; import com.android.systemui.R; import com.android.systemui.statusbar.notification.row.StackScrollerDecorView; 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 * Header displayed above a notification section in the shade. Currently used for Alerting and * notification sections. Currently only used for gentle notifications. * Silent sections. */ */ public class SectionHeaderView extends StackScrollerDecorView { public class SectionHeaderView extends StackScrollerDecorView { private ViewGroup mContents; private ViewGroup mContents; private TextView mLabelView; private TextView mLabelView; private ImageView mClearAllButton; private ImageView mClearAllButton; @StringRes @Nullable private Integer mLabelTextId; @Nullable private View.OnClickListener mLabelClickListener = null; @Nullable private View.OnClickListener mOnClearClickListener = null; @Nullable private View.OnClickListener mOnClearClickListener = null; public SectionHeaderView(Context context, AttributeSet attrs) { public SectionHeaderView(Context context, AttributeSet attrs) { Loading @@ -48,18 +48,24 @@ public class SectionHeaderView extends StackScrollerDecorView { @Override @Override protected void onFinishInflate() { protected void onFinishInflate() { mContents = Objects.requireNonNull(findViewById(R.id.content)); mContents = requireViewById(R.id.content); bindContents(); bindContents(); super.onFinishInflate(); super.onFinishInflate(); setVisible(true /* nowVisible */, false /* animate */); setVisible(true /* nowVisible */, false /* animate */); } } private void bindContents() { private void bindContents() { mLabelView = Objects.requireNonNull(findViewById(R.id.header_label)); mLabelView = requireViewById(R.id.header_label); mClearAllButton = Objects.requireNonNull(findViewById(R.id.btn_clear_all)); mClearAllButton = requireViewById(R.id.btn_clear_all); if (mOnClearClickListener != null) { if (mOnClearClickListener != null) { mClearAllButton.setOnClickListener(mOnClearClickListener); mClearAllButton.setOnClickListener(mOnClearClickListener); } } if (mLabelClickListener != null) { mLabelView.setOnClickListener(mLabelClickListener); } if (mLabelTextId != null) { mLabelView.setText(mLabelTextId); } } } @Override @Override Loading @@ -72,21 +78,6 @@ public class SectionHeaderView extends StackScrollerDecorView { return null; 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 @Override public boolean isTransparent() { public boolean isTransparent() { return true; return true; Loading @@ -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). * Fired whenever the user clicks on the body of the header (e.g. no sub-buttons or anything). */ */ void setOnHeaderClickListener(View.OnClickListener listener) { void setOnHeaderClickListener(View.OnClickListener listener) { mLabelClickListener = listener; mLabelView.setOnClickListener(listener); mLabelView.setOnClickListener(listener); } } Loading @@ -129,6 +121,7 @@ public class SectionHeaderView extends StackScrollerDecorView { } } void setHeaderText(@StringRes int resId) { void setHeaderText(@StringRes int resId) { mLabelTextId = resId; mLabelView.setText(resId); mLabelView.setText(resId); } } } }