Loading packages/SystemUI/res/drawable/ic_notification_block.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2016 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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24.0dp" android:height="24.0dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:fillColor="#FFFFFFFF" android:pathData="M12.0,2.0C6.48,2.0 2.0,6.48 2.0,12.0s4.48,10.0 10.0,10.0 10.0,-4.48 10.0,-10.0S17.52,2.0 12.0,2.0zM4.0,12.0c0.0,-4.42 3.58,-8.0 8.0,-8.0 1.85,0.0 3.5,0.63 4.9,1.69L5.69,16.9C4.63,15.55 4.0,13.85 4.0,12.0zm8.0,8.0c-1.85,0.0 -3.55,-0.63 -4.9,-1.69L18.31,7.1C19.37,8.45 20.0,10.15 20.0,12.0c0.0,4.42 -3.58,8.0 -8.0,8.0z"/> </vector> packages/SystemUI/res/drawable/ic_notifications_alert.xml 0 → 100644 +24 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2018 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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24.0dp" android:height="24.0dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:pathData="M7.58 4.08L6.15 2.65C3.75 4.48 2.17 7.3 2.03 10.5h2c.15-2.65 1.51-4.97 3.55-6.42zm12.39 6.42h2c-.15-3.2-1.73-6.02-4.12-7.85l-1.42 1.43c2.02 1.45 3.39 3.77 3.54 6.42zM18 11c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2v-5zm-6 11c.14 0 .27-.01.4-.04.65-.14 1.18-.58 1.44-1.18.1-.24.15-.5.15-.78h-4c.01 1.1.9 2 2.01 2z" android:fillColor="#FF000000"/> </vector> packages/SystemUI/res/drawable/ic_notifications_silence.xml 0 → 100644 +28 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2018 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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24.0dp" android:height="24.0dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:pathData="M0 0h24v24H0z" /> <path android:pathData="M20 18.69L7.84 6.14 5.27 3.49 4 4.76l2.8 2.8v.01c-.52.99-.8 2.16-.8 3.42v5l-2 2v1h13.73l2 2L21 19.72l-1-1.03zM12 22c1.11 0 2-.89 2-2h-4c0 1.11.89 2 2 2zm6-7.32V11c0-3.08-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68c-.15.03-.29.08-.42.12-.1.03-.2.07-.3.11h-.01c-.01 0-.01 0-.02.01-.23.09-.46.2-.68.31 0 0-.01 0-.01.01L18 14.68z" android:fillColor="#FF000000" /> </vector> packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java +77 −25 Original line number Diff line number Diff line Loading @@ -17,13 +17,16 @@ package com.android.systemui.statusbar.notification.row; import static com.android.systemui.SwipeHelper.SWIPED_FAR_ENOUGH_SIZE_FRACTION; import static com.android.systemui.statusbar.notification.row.NotificationInfo.ACTION_BLOCK; import static com.android.systemui.statusbar.notification.row.NotificationInfo.ACTION_NONE; import static com.android.systemui.statusbar.notification.row.NotificationInfo.ACTION_TOGGLE_SILENT; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.annotation.Nullable; import android.app.Notification; import android.app.NotificationManager; import android.content.Context; import android.content.res.Resources; import android.graphics.drawable.Drawable; Loading @@ -41,6 +44,7 @@ import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.statusbar.AlphaOptimizedImageView; import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.notification.row.NotificationGuts.GutsContent; import com.android.systemui.statusbar.notification.row.NotificationInfo.NotificationInfoAction; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; Loading Loading @@ -69,7 +73,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl private Context mContext; private FrameLayout mMenuContainer; private MenuItem mInfoItem; private NotificationInfoMenuItem mInfoItem; private MenuItem mAppOpsItem; private MenuItem mSnoozeItem; private ArrayList<MenuItem> mLeftMenuItems; Loading Loading @@ -172,7 +176,9 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl @Override public void createMenu(ViewGroup parent, StatusBarNotification sbn) { mParent = (ExpandableNotificationRow) parent; createMenuViews(true /* resetState */); createMenuViews(true /* resetState */, sbn != null && (sbn.getNotification().flags & Notification.FLAG_FOREGROUND_SERVICE) != 0); } @Override Loading Loading @@ -216,7 +222,8 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl // Menu hasn't been created yet, no need to do anything. return; } createMenuViews(!isMenuVisible() /* resetState */); createMenuViews(!isMenuVisible() /* resetState */, (sbn.getNotification().flags & Notification.FLAG_FOREGROUND_SERVICE) != 0); } @Override Loading @@ -231,30 +238,47 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl mParent.removeListener(); } private void createMenuViews(boolean resetState) { private void createMenuViews(boolean resetState, final boolean isForeground) { final Resources res = mContext.getResources(); mHorizSpaceForIcon = res.getDimensionPixelSize(R.dimen.notification_menu_icon_size); mVertSpaceForIcons = res.getDimensionPixelSize(R.dimen.notification_min_height); mLeftMenuItems.clear(); mRightMenuItems.clear(); // Construct the menu items based on the notification if (mParent != null && mParent.getStatusBarNotification() != null) { int flags = mParent.getStatusBarNotification().getNotification().flags; boolean isForeground = (flags & Notification.FLAG_FOREGROUND_SERVICE) != 0; if (!isForeground) { // Only show snooze for non-foreground notifications mSnoozeItem = createSnoozeItem(mContext); mLeftMenuItems.add(mSnoozeItem); mRightMenuItems.add(mSnoozeItem); } } mInfoItem = createInfoItem(mContext); if (!NotificationUtils.useNewInterruptionModel(mContext)) { mLeftMenuItems.add(mInfoItem); mRightMenuItems.add(mInfoItem); } mAppOpsItem = createAppOpsItem(mContext); mLeftMenuItems.add(mAppOpsItem); mRightMenuItems.add(mAppOpsItem); if (NotificationUtils.useNewInterruptionModel(mContext)) { if (!mParent.getIsNonblockable()) { mRightMenuItems.add(createBlockItem(mContext, mInfoItem.getGutsView())); } // TODO(kprevas): this is duplicated logic // but it's currently spread across NotificationGutsManager and NotificationInfo. // Try to consolidate and reuse here. boolean canToggleSilent = !mParent.getIsNonblockable() && !isForeground && mParent.getEntry().noisy; if (canToggleSilent) { int channelImportance = mParent.getEntry().channel.getImportance(); int effectiveImportance = channelImportance == NotificationManager.IMPORTANCE_UNSPECIFIED ? mParent.getEntry().importance : channelImportance; mRightMenuItems.add(createToggleSilentItem(mContext, mInfoItem.getGutsView(), effectiveImportance < NotificationManager.IMPORTANCE_DEFAULT)); } } else { mRightMenuItems.addAll(mLeftMenuItems); } populateMenuViews(); if (resetState) { Loading Loading @@ -597,7 +621,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl // TODO -- handle / allow custom menu items! } public static MenuItem createSnoozeItem(Context context) { static MenuItem createSnoozeItem(Context context) { Resources res = context.getResources(); NotificationSnooze content = (NotificationSnooze) LayoutInflater.from(context) .inflate(R.layout.notification_snooze, null, false); Loading @@ -607,17 +631,16 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl return snooze; } public static MenuItem createInfoItem(Context context) { static NotificationInfoMenuItem createInfoItem(Context context) { Resources res = context.getResources(); String infoDescription = res.getString(R.string.notification_menu_gear_description); NotificationInfo infoContent = (NotificationInfo) LayoutInflater.from(context).inflate( R.layout.notification_info, null, false); MenuItem info = new NotificationInfoMenuItem(context, infoDescription, infoContent, return new NotificationInfoMenuItem(context, infoDescription, infoContent, R.drawable.ic_settings, ACTION_NONE); return info; } public static MenuItem createAppOpsItem(Context context) { static MenuItem createAppOpsItem(Context context) { AppOpsInfo appOpsContent = (AppOpsInfo) LayoutInflater.from(context).inflate( R.layout.app_ops_info, null, false); MenuItem info = new NotificationMenuItem(context, null, appOpsContent, Loading @@ -625,6 +648,29 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl return info; } private static MenuItem createBlockItem(Context context, NotificationInfo gutsView) { return new NotificationInfoMenuItem( context, context.getResources().getString(R.string.inline_stop_button), gutsView, R.drawable.ic_notification_block, ACTION_BLOCK); } private static MenuItem createToggleSilentItem(Context context, NotificationInfo gutsView, boolean isCurrentlySilent) { return new NotificationInfoMenuItem( context, isCurrentlySilent ? context.getResources().getString(R.string.inline_silent_button_alert) : context.getResources().getString(R.string.inline_silent_button_silent), gutsView, isCurrentlySilent ? R.drawable.ic_notifications_alert : R.drawable.ic_notifications_silence, ACTION_TOGGLE_SILENT); } private void addMenuView(MenuItem item, ViewGroup parent) { View menuView = item.getMenuView(); if (menuView != null) { Loading Loading @@ -706,7 +752,8 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl * Add a new 'guts' panel. If iconResId < 0 it will not appear in the slow swipe menu * but can still be exposed via other affordances. */ public NotificationMenuItem(Context context, String s, GutsContent content, int iconResId) { public NotificationMenuItem(Context context, String contentDescription, GutsContent content, int iconResId) { Resources res = context.getResources(); int padding = res.getDimensionPixelSize(R.dimen.notification_menu_icon_padding); int tint = res.getColor(R.color.notification_gear_color); Loading @@ -719,7 +766,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl iv.setAlpha(1f); mMenuView = iv; } mContentDescription = s; mContentDescription = contentDescription; mGutsContent = content; } Loading @@ -746,11 +793,16 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl @NotificationInfoAction int mAction; public NotificationInfoMenuItem(Context context, String s, public NotificationInfoMenuItem(Context context, String contentDescription, NotificationInfo content, int iconResId, @NotificationInfoAction int action) { super(context, s, content, iconResId); super(context, contentDescription, content, iconResId); this.mAction = action; } @Override public NotificationInfo getGutsView() { return (NotificationInfo) super.getGutsView(); } } } Loading
packages/SystemUI/res/drawable/ic_notification_block.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2016 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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24.0dp" android:height="24.0dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:fillColor="#FFFFFFFF" android:pathData="M12.0,2.0C6.48,2.0 2.0,6.48 2.0,12.0s4.48,10.0 10.0,10.0 10.0,-4.48 10.0,-10.0S17.52,2.0 12.0,2.0zM4.0,12.0c0.0,-4.42 3.58,-8.0 8.0,-8.0 1.85,0.0 3.5,0.63 4.9,1.69L5.69,16.9C4.63,15.55 4.0,13.85 4.0,12.0zm8.0,8.0c-1.85,0.0 -3.55,-0.63 -4.9,-1.69L18.31,7.1C19.37,8.45 20.0,10.15 20.0,12.0c0.0,4.42 -3.58,8.0 -8.0,8.0z"/> </vector>
packages/SystemUI/res/drawable/ic_notifications_alert.xml 0 → 100644 +24 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2018 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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24.0dp" android:height="24.0dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:pathData="M7.58 4.08L6.15 2.65C3.75 4.48 2.17 7.3 2.03 10.5h2c.15-2.65 1.51-4.97 3.55-6.42zm12.39 6.42h2c-.15-3.2-1.73-6.02-4.12-7.85l-1.42 1.43c2.02 1.45 3.39 3.77 3.54 6.42zM18 11c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2v-5zm-6 11c.14 0 .27-.01.4-.04.65-.14 1.18-.58 1.44-1.18.1-.24.15-.5.15-.78h-4c.01 1.1.9 2 2.01 2z" android:fillColor="#FF000000"/> </vector>
packages/SystemUI/res/drawable/ic_notifications_silence.xml 0 → 100644 +28 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2018 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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24.0dp" android:height="24.0dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:pathData="M0 0h24v24H0z" /> <path android:pathData="M20 18.69L7.84 6.14 5.27 3.49 4 4.76l2.8 2.8v.01c-.52.99-.8 2.16-.8 3.42v5l-2 2v1h13.73l2 2L21 19.72l-1-1.03zM12 22c1.11 0 2-.89 2-2h-4c0 1.11.89 2 2 2zm6-7.32V11c0-3.08-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68c-.15.03-.29.08-.42.12-.1.03-.2.07-.3.11h-.01c-.01 0-.01 0-.02.01-.23.09-.46.2-.68.31 0 0-.01 0-.01.01L18 14.68z" android:fillColor="#FF000000" /> </vector>
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java +77 −25 Original line number Diff line number Diff line Loading @@ -17,13 +17,16 @@ package com.android.systemui.statusbar.notification.row; import static com.android.systemui.SwipeHelper.SWIPED_FAR_ENOUGH_SIZE_FRACTION; import static com.android.systemui.statusbar.notification.row.NotificationInfo.ACTION_BLOCK; import static com.android.systemui.statusbar.notification.row.NotificationInfo.ACTION_NONE; import static com.android.systemui.statusbar.notification.row.NotificationInfo.ACTION_TOGGLE_SILENT; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.annotation.Nullable; import android.app.Notification; import android.app.NotificationManager; import android.content.Context; import android.content.res.Resources; import android.graphics.drawable.Drawable; Loading @@ -41,6 +44,7 @@ import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.statusbar.AlphaOptimizedImageView; import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.notification.row.NotificationGuts.GutsContent; import com.android.systemui.statusbar.notification.row.NotificationInfo.NotificationInfoAction; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; Loading Loading @@ -69,7 +73,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl private Context mContext; private FrameLayout mMenuContainer; private MenuItem mInfoItem; private NotificationInfoMenuItem mInfoItem; private MenuItem mAppOpsItem; private MenuItem mSnoozeItem; private ArrayList<MenuItem> mLeftMenuItems; Loading Loading @@ -172,7 +176,9 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl @Override public void createMenu(ViewGroup parent, StatusBarNotification sbn) { mParent = (ExpandableNotificationRow) parent; createMenuViews(true /* resetState */); createMenuViews(true /* resetState */, sbn != null && (sbn.getNotification().flags & Notification.FLAG_FOREGROUND_SERVICE) != 0); } @Override Loading Loading @@ -216,7 +222,8 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl // Menu hasn't been created yet, no need to do anything. return; } createMenuViews(!isMenuVisible() /* resetState */); createMenuViews(!isMenuVisible() /* resetState */, (sbn.getNotification().flags & Notification.FLAG_FOREGROUND_SERVICE) != 0); } @Override Loading @@ -231,30 +238,47 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl mParent.removeListener(); } private void createMenuViews(boolean resetState) { private void createMenuViews(boolean resetState, final boolean isForeground) { final Resources res = mContext.getResources(); mHorizSpaceForIcon = res.getDimensionPixelSize(R.dimen.notification_menu_icon_size); mVertSpaceForIcons = res.getDimensionPixelSize(R.dimen.notification_min_height); mLeftMenuItems.clear(); mRightMenuItems.clear(); // Construct the menu items based on the notification if (mParent != null && mParent.getStatusBarNotification() != null) { int flags = mParent.getStatusBarNotification().getNotification().flags; boolean isForeground = (flags & Notification.FLAG_FOREGROUND_SERVICE) != 0; if (!isForeground) { // Only show snooze for non-foreground notifications mSnoozeItem = createSnoozeItem(mContext); mLeftMenuItems.add(mSnoozeItem); mRightMenuItems.add(mSnoozeItem); } } mInfoItem = createInfoItem(mContext); if (!NotificationUtils.useNewInterruptionModel(mContext)) { mLeftMenuItems.add(mInfoItem); mRightMenuItems.add(mInfoItem); } mAppOpsItem = createAppOpsItem(mContext); mLeftMenuItems.add(mAppOpsItem); mRightMenuItems.add(mAppOpsItem); if (NotificationUtils.useNewInterruptionModel(mContext)) { if (!mParent.getIsNonblockable()) { mRightMenuItems.add(createBlockItem(mContext, mInfoItem.getGutsView())); } // TODO(kprevas): this is duplicated logic // but it's currently spread across NotificationGutsManager and NotificationInfo. // Try to consolidate and reuse here. boolean canToggleSilent = !mParent.getIsNonblockable() && !isForeground && mParent.getEntry().noisy; if (canToggleSilent) { int channelImportance = mParent.getEntry().channel.getImportance(); int effectiveImportance = channelImportance == NotificationManager.IMPORTANCE_UNSPECIFIED ? mParent.getEntry().importance : channelImportance; mRightMenuItems.add(createToggleSilentItem(mContext, mInfoItem.getGutsView(), effectiveImportance < NotificationManager.IMPORTANCE_DEFAULT)); } } else { mRightMenuItems.addAll(mLeftMenuItems); } populateMenuViews(); if (resetState) { Loading Loading @@ -597,7 +621,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl // TODO -- handle / allow custom menu items! } public static MenuItem createSnoozeItem(Context context) { static MenuItem createSnoozeItem(Context context) { Resources res = context.getResources(); NotificationSnooze content = (NotificationSnooze) LayoutInflater.from(context) .inflate(R.layout.notification_snooze, null, false); Loading @@ -607,17 +631,16 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl return snooze; } public static MenuItem createInfoItem(Context context) { static NotificationInfoMenuItem createInfoItem(Context context) { Resources res = context.getResources(); String infoDescription = res.getString(R.string.notification_menu_gear_description); NotificationInfo infoContent = (NotificationInfo) LayoutInflater.from(context).inflate( R.layout.notification_info, null, false); MenuItem info = new NotificationInfoMenuItem(context, infoDescription, infoContent, return new NotificationInfoMenuItem(context, infoDescription, infoContent, R.drawable.ic_settings, ACTION_NONE); return info; } public static MenuItem createAppOpsItem(Context context) { static MenuItem createAppOpsItem(Context context) { AppOpsInfo appOpsContent = (AppOpsInfo) LayoutInflater.from(context).inflate( R.layout.app_ops_info, null, false); MenuItem info = new NotificationMenuItem(context, null, appOpsContent, Loading @@ -625,6 +648,29 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl return info; } private static MenuItem createBlockItem(Context context, NotificationInfo gutsView) { return new NotificationInfoMenuItem( context, context.getResources().getString(R.string.inline_stop_button), gutsView, R.drawable.ic_notification_block, ACTION_BLOCK); } private static MenuItem createToggleSilentItem(Context context, NotificationInfo gutsView, boolean isCurrentlySilent) { return new NotificationInfoMenuItem( context, isCurrentlySilent ? context.getResources().getString(R.string.inline_silent_button_alert) : context.getResources().getString(R.string.inline_silent_button_silent), gutsView, isCurrentlySilent ? R.drawable.ic_notifications_alert : R.drawable.ic_notifications_silence, ACTION_TOGGLE_SILENT); } private void addMenuView(MenuItem item, ViewGroup parent) { View menuView = item.getMenuView(); if (menuView != null) { Loading Loading @@ -706,7 +752,8 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl * Add a new 'guts' panel. If iconResId < 0 it will not appear in the slow swipe menu * but can still be exposed via other affordances. */ public NotificationMenuItem(Context context, String s, GutsContent content, int iconResId) { public NotificationMenuItem(Context context, String contentDescription, GutsContent content, int iconResId) { Resources res = context.getResources(); int padding = res.getDimensionPixelSize(R.dimen.notification_menu_icon_padding); int tint = res.getColor(R.color.notification_gear_color); Loading @@ -719,7 +766,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl iv.setAlpha(1f); mMenuView = iv; } mContentDescription = s; mContentDescription = contentDescription; mGutsContent = content; } Loading @@ -746,11 +793,16 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl @NotificationInfoAction int mAction; public NotificationInfoMenuItem(Context context, String s, public NotificationInfoMenuItem(Context context, String contentDescription, NotificationInfo content, int iconResId, @NotificationInfoAction int action) { super(context, s, content, iconResId); super(context, contentDescription, content, iconResId); this.mAction = action; } @Override public NotificationInfo getGutsView() { return (NotificationInfo) super.getGutsView(); } } }