Loading packages/SystemUI/res/layout/promoted_notification_info.xml +24 −12 Original line number Diff line number Diff line Loading @@ -323,31 +323,43 @@ asked for it --> android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="60dp" android:layout_marginTop="@dimen/notification_importance_button_separation" android:gravity="center_vertical" android:paddingStart="4dp" android:paddingEnd="4dp" android:background="@drawable/rounded_corners" android:backgroundTint="@androidprv:color/materialColorPrimaryContainer" > <TextView android:id="@+id/promoted_demote" android:text="@string/notification_inline_disable_promotion" android:layout_width="wrap_content" android:id="@+id/promoted_explain_title" android:text="@string/live_notifications_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentStart="true" android:gravity="start|center_vertical" android:minWidth="@dimen/notification_importance_toggle_size" android:minHeight="@dimen/notification_importance_toggle_size" android:maxWidth="200dp" android:padding="16dp" android:color="@androidprv:color/materialColorOnPrimary" style="@style/TextAppearance.NotificationInfo.Button"/> <TextView android:id="@+id/promoted_dismiss" android:text="@string/notification_inline_dismiss" android:id="@+id/promoted_explain" android:text="@string/live_notifications_desc" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/promoted_explain_title" android:gravity="start|center_vertical" android:maxWidth="200dp" android:padding="16dp" style="@style/TextAppearance.NotificationImportanceDetail"/> <TextView android:id="@+id/promoted_demote" android:text="@string/notification_inline_disable_promotion" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/promoted_explain" android:layout_alignParentEnd="true" android:gravity="end|center_vertical" android:padding="16dp" android:gravity="start|center_vertical" android:minWidth="@dimen/notification_importance_toggle_size" android:minHeight="@dimen/notification_importance_toggle_size" android:maxWidth="125dp" android:maxWidth="200dp" style="@style/TextAppearance.NotificationInfo.Button"/> </RelativeLayout> Loading packages/SystemUI/res/values/strings.xml +7 −1 Original line number Diff line number Diff line Loading @@ -2098,7 +2098,13 @@ <string name="notification_inline_dismiss">Dismiss</string> <!-- [CHAR LIMIT=30] Text shown in button used to prevent app from showing Live Updates, for this notification and all future ones --> <string name="notification_inline_disable_promotion">Don\'t show again</string> <string name="notification_inline_disable_promotion">Don\'t show as pinned</string> <!-- Text accompanying the "Show live updates" switch explaining the purpose of the setting --> <string name="live_notifications_title">Showing Live Updates</string> <!-- Text accompanying the "Show live updates" switch explaining the purpose of the setting --> <string name="live_notifications_desc">Pinned notifications display live info from apps, and always appear on the status bar and lock screen</string> <!-- Notification: Control panel: Label that displays when the app's notifications cannot be blocked. --> <string name="notification_unblockable_desc">These notifications can\'t be modified.</string> Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedNotificationInfo.java +9 −13 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry; public class PromotedNotificationInfo extends NotificationInfo { private static final String TAG = "PromotedNotifInfoGuts"; private INotificationManager mNotificationManager; private NotificationGuts mGutsContainer; public PromotedNotificationInfo(Context context, AttributeSet attrs) { super(context, attrs); Loading Loading @@ -71,32 +72,27 @@ public class PromotedNotificationInfo extends NotificationInfo { mNotificationManager = iNotificationManager; bindDismiss(entry.getSbn(), onCloseClick); bindDemote(entry.getSbn(), pkg); } protected void bindDismiss(StatusBarNotification sbn, View.OnClickListener onCloseClick) { View dismissButton = findViewById(R.id.promoted_dismiss); dismissButton.setOnClickListener(onCloseClick); dismissButton.setVisibility(!sbn.isNonDismissable() && dismissButton.hasOnClickListeners() ? VISIBLE : GONE); } protected void bindDemote(StatusBarNotification sbn, String packageName) { View demoteButton = findViewById(R.id.promoted_demote); demoteButton.setOnClickListener(getDemoteClickListener(sbn, packageName)); demoteButton.setVisibility(demoteButton.hasOnClickListeners() ? VISIBLE : GONE); } @Override public void setGutsParent(NotificationGuts guts) { mGutsContainer = guts; super.setGutsParent(guts); } private OnClickListener getDemoteClickListener(StatusBarNotification sbn, String packageName) { return ((View unusedView) -> { return ((View v) -> { try { // TODO(b/391661009): Signal AutomaticPromotionCoordinator here mNotificationManager.setCanBePromoted(packageName, sbn.getUid(), false, true); mGutsContainer.closeControls(v, true); } catch (RemoteException e) { Log.e(TAG, "Couldn't revoke live update permission", e); } Loading Loading
packages/SystemUI/res/layout/promoted_notification_info.xml +24 −12 Original line number Diff line number Diff line Loading @@ -323,31 +323,43 @@ asked for it --> android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="60dp" android:layout_marginTop="@dimen/notification_importance_button_separation" android:gravity="center_vertical" android:paddingStart="4dp" android:paddingEnd="4dp" android:background="@drawable/rounded_corners" android:backgroundTint="@androidprv:color/materialColorPrimaryContainer" > <TextView android:id="@+id/promoted_demote" android:text="@string/notification_inline_disable_promotion" android:layout_width="wrap_content" android:id="@+id/promoted_explain_title" android:text="@string/live_notifications_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentStart="true" android:gravity="start|center_vertical" android:minWidth="@dimen/notification_importance_toggle_size" android:minHeight="@dimen/notification_importance_toggle_size" android:maxWidth="200dp" android:padding="16dp" android:color="@androidprv:color/materialColorOnPrimary" style="@style/TextAppearance.NotificationInfo.Button"/> <TextView android:id="@+id/promoted_dismiss" android:text="@string/notification_inline_dismiss" android:id="@+id/promoted_explain" android:text="@string/live_notifications_desc" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/promoted_explain_title" android:gravity="start|center_vertical" android:maxWidth="200dp" android:padding="16dp" style="@style/TextAppearance.NotificationImportanceDetail"/> <TextView android:id="@+id/promoted_demote" android:text="@string/notification_inline_disable_promotion" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/promoted_explain" android:layout_alignParentEnd="true" android:gravity="end|center_vertical" android:padding="16dp" android:gravity="start|center_vertical" android:minWidth="@dimen/notification_importance_toggle_size" android:minHeight="@dimen/notification_importance_toggle_size" android:maxWidth="125dp" android:maxWidth="200dp" style="@style/TextAppearance.NotificationInfo.Button"/> </RelativeLayout> Loading
packages/SystemUI/res/values/strings.xml +7 −1 Original line number Diff line number Diff line Loading @@ -2098,7 +2098,13 @@ <string name="notification_inline_dismiss">Dismiss</string> <!-- [CHAR LIMIT=30] Text shown in button used to prevent app from showing Live Updates, for this notification and all future ones --> <string name="notification_inline_disable_promotion">Don\'t show again</string> <string name="notification_inline_disable_promotion">Don\'t show as pinned</string> <!-- Text accompanying the "Show live updates" switch explaining the purpose of the setting --> <string name="live_notifications_title">Showing Live Updates</string> <!-- Text accompanying the "Show live updates" switch explaining the purpose of the setting --> <string name="live_notifications_desc">Pinned notifications display live info from apps, and always appear on the status bar and lock screen</string> <!-- Notification: Control panel: Label that displays when the app's notifications cannot be blocked. --> <string name="notification_unblockable_desc">These notifications can\'t be modified.</string> Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedNotificationInfo.java +9 −13 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry; public class PromotedNotificationInfo extends NotificationInfo { private static final String TAG = "PromotedNotifInfoGuts"; private INotificationManager mNotificationManager; private NotificationGuts mGutsContainer; public PromotedNotificationInfo(Context context, AttributeSet attrs) { super(context, attrs); Loading Loading @@ -71,32 +72,27 @@ public class PromotedNotificationInfo extends NotificationInfo { mNotificationManager = iNotificationManager; bindDismiss(entry.getSbn(), onCloseClick); bindDemote(entry.getSbn(), pkg); } protected void bindDismiss(StatusBarNotification sbn, View.OnClickListener onCloseClick) { View dismissButton = findViewById(R.id.promoted_dismiss); dismissButton.setOnClickListener(onCloseClick); dismissButton.setVisibility(!sbn.isNonDismissable() && dismissButton.hasOnClickListeners() ? VISIBLE : GONE); } protected void bindDemote(StatusBarNotification sbn, String packageName) { View demoteButton = findViewById(R.id.promoted_demote); demoteButton.setOnClickListener(getDemoteClickListener(sbn, packageName)); demoteButton.setVisibility(demoteButton.hasOnClickListeners() ? VISIBLE : GONE); } @Override public void setGutsParent(NotificationGuts guts) { mGutsContainer = guts; super.setGutsParent(guts); } private OnClickListener getDemoteClickListener(StatusBarNotification sbn, String packageName) { return ((View unusedView) -> { return ((View v) -> { try { // TODO(b/391661009): Signal AutomaticPromotionCoordinator here mNotificationManager.setCanBePromoted(packageName, sbn.getUid(), false, true); mGutsContainer.closeControls(v, true); } catch (RemoteException e) { Log.e(TAG, "Couldn't revoke live update permission", e); } Loading