[automerger skipped] Import translations. DO NOT MERGE am: 2532f0b32c -s ours am: 35632cb1c2 -s ours am: 0e7fdac130 -s ours
am skip reason: subject contains skip directive
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/12147777
Change-Id: I3b00968bc0b9079dbd022cc18bd877f6d7646cb8
diff --git a/res/layout/bubble_preference.xml b/res/layout/bubble_preference.xml
index 8a64716..08f25b4 100644
--- a/res/layout/bubble_preference.xml
+++ b/res/layout/bubble_preference.xml
@@ -44,7 +44,7 @@
android:id="@+id/bubble_all_icon"
android:src="@drawable/ic_bubble_all"
android:background="@android:color/transparent"
- android:layout_gravity="center"
+ android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
@@ -53,6 +53,7 @@
android:id="@+id/bubble_all_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
android:ellipsize="end"
android:maxLines="2"
android:clickable="false"
@@ -75,7 +76,7 @@
android:id="@+id/bubble_selected_icon"
android:src="@drawable/ic_bubble_selected"
android:background="@android:color/transparent"
- android:layout_gravity="center"
+ android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
@@ -84,6 +85,7 @@
android:id="@+id/bubble_selected_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
android:ellipsize="end"
android:maxLines="2"
android:clickable="false"
@@ -106,7 +108,7 @@
android:id="@+id/bubble_none_icon"
android:src="@drawable/ic_bubble_none"
android:background="@android:color/transparent"
- android:layout_gravity="center"
+ android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
@@ -115,6 +117,7 @@
android:id="@+id/bubble_none_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
android:ellipsize="end"
android:maxLines="2"
android:clickable="false"
@@ -125,4 +128,4 @@
android:text="@string/bubble_app_setting_none"/>
</com.android.settings.notification.NotificationButtonRelativeLayout>
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/res/layout/notification_history_app_layout.xml b/res/layout/notification_history_app_layout.xml
index a1b3be7..481253a 100644
--- a/res/layout/notification_history_app_layout.xml
+++ b/res/layout/notification_history_app_layout.xml
@@ -24,6 +24,7 @@
android:id="@+id/app_header"
android:layout_height="wrap_content"
android:layout_width="match_parent"
+ android:background="@drawable/button_ripple_radius"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingStart="16dp">
@@ -58,13 +59,14 @@
android:paddingTop="8dp"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title"/>
</LinearLayout>
- <ImageButton
+ <ImageView
android:id="@+id/expand"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_height="48dp"
android:layout_width="48dp"
- android:background="@drawable/button_ripple_radius"
+ android:scaleType="center"
+ android:contentDescription="@null"
android:src="@*android:drawable/ic_expand_more"/>
</RelativeLayout>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index c74a1a2..1be8ba0 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -618,7 +618,7 @@
<style name="TextAppearance.NotificationImportanceButton">
<item name="android:textSize">@dimen/notification_importance_button_text</item>
- <item name="android:fontFamily">@*android:string/config_bodyFontFamilyMedium</item>
+ <item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>
<item name="android:gravity">center</item>
</style>
diff --git a/src/com/android/settings/notification/app/BlockPreferenceController.java b/src/com/android/settings/notification/app/BlockPreferenceController.java
index f55ea8c..2738962 100644
--- a/src/com/android/settings/notification/app/BlockPreferenceController.java
+++ b/src/com/android/settings/notification/app/BlockPreferenceController.java
@@ -106,8 +106,11 @@
// It's always safe to override the importance if it's meant to be blocked or if
// it was blocked and we are unblocking it.
if (blocked || originalImportance == IMPORTANCE_NONE) {
- final int importance = blocked ? IMPORTANCE_NONE
- : isDefaultChannel() ? IMPORTANCE_UNSPECIFIED : IMPORTANCE_DEFAULT;
+ final int importance = blocked
+ ? IMPORTANCE_NONE
+ : isDefaultChannel()
+ ? IMPORTANCE_UNSPECIFIED
+ : mChannel.getOriginalImportance();
mChannel.setImportance(importance);
saveChannel();
}
diff --git a/src/com/android/settings/notification/app/BubblePreference.java b/src/com/android/settings/notification/app/BubblePreference.java
index 7e071ff..f0046d7 100644
--- a/src/com/android/settings/notification/app/BubblePreference.java
+++ b/src/com/android/settings/notification/app/BubblePreference.java
@@ -45,8 +45,6 @@
private int mSelectedPreference;
private Context mContext;
- private Drawable mSelectedBackground;
- private Drawable mUnselectedBackground;
private ButtonViewHolder mBubbleAllButton;
private ButtonViewHolder mBubbleSelectedButton;
@@ -72,8 +70,6 @@
mHelper = new RestrictedPreferenceHelper(context, this, attrs);
mHelper.useAdminDisabledSummary(true);
mContext = context;
- mSelectedBackground = mContext.getDrawable(R.drawable.button_border_selected);
- mUnselectedBackground = mContext.getDrawable(R.drawable.button_border_unselected);
setLayoutResource(R.layout.bubble_preference);
}
@@ -167,7 +163,9 @@
}
void setSelected(Context context, boolean selected) {
- mView.setBackground(selected ? mSelectedBackground : mUnselectedBackground);
+ mView.setBackground(mContext.getDrawable(selected
+ ? R.drawable.button_border_selected
+ : R.drawable.button_border_unselected));
mView.setSelected(selected);
ColorStateList stateList = selected
diff --git a/src/com/android/settings/notification/app/ChannelListPreferenceController.java b/src/com/android/settings/notification/app/ChannelListPreferenceController.java
index b19fc71..8a34672 100644
--- a/src/com/android/settings/notification/app/ChannelListPreferenceController.java
+++ b/src/com/android/settings/notification/app/ChannelListPreferenceController.java
@@ -207,17 +207,14 @@
channelPref.setOnPreferenceChangeListener(
(preference, o) -> {
boolean value = (Boolean) o;
- int importance = value ? IMPORTANCE_LOW : IMPORTANCE_NONE;
+ int importance = value ? channel.getOriginalImportance() : IMPORTANCE_NONE;
channel.setImportance(importance);
- channel.lockFields(
- NotificationChannel.USER_LOCKED_IMPORTANCE);
+ channel.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE);
MasterSwitchPreference channelPref1 = (MasterSwitchPreference) preference;
channelPref1.setIcon(null);
if (channel.getImportance() > IMPORTANCE_LOW) {
channelPref1.setIcon(getAlertingIcon());
}
- toggleBehaviorIconState(channelPref1.getIcon(),
- importance != IMPORTANCE_NONE);
mBackend.updateChannel(mAppRow.pkg, mAppRow.uid, channel);
return true;
@@ -234,24 +231,6 @@
return icon;
}
- private void toggleBehaviorIconState(Drawable icon, boolean enabled) {
- if (icon == null) return;
-
- LayerDrawable layerDrawable = (LayerDrawable) icon;
- GradientDrawable background =
- (GradientDrawable) layerDrawable.findDrawableByLayerId(R.id.back);
-
- if (background == null) return;
-
- if (enabled) {
- background.clearColorFilter();
- } else {
- background.setColorFilter(new BlendModeColorFilter(
- mContext.getColor(R.color.material_grey_300),
- BlendMode.SRC_IN));
- }
- }
-
protected void onGroupBlockStateChanged(NotificationChannelGroup group) {
if (group == null) {
return;
diff --git a/src/com/android/settings/notification/history/NotificationHistoryActivity.java b/src/com/android/settings/notification/history/NotificationHistoryActivity.java
index 7635a4f..b184740 100644
--- a/src/com/android/settings/notification/history/NotificationHistoryActivity.java
+++ b/src/com/android/settings/notification/history/NotificationHistoryActivity.java
@@ -155,21 +155,22 @@
final View container = viewForPackage.findViewById(R.id.notification_list);
container.setVisibility(View.GONE);
- ImageButton expand = viewForPackage.findViewById(R.id.expand);
- expand.setContentDescription(container.getVisibility() == View.VISIBLE
+ View header = viewForPackage.findViewById(R.id.app_header);
+ ImageView expand = viewForPackage.findViewById(R.id.expand);
+ header.setStateDescription(container.getVisibility() == View.VISIBLE
? getString(R.string.condition_expand_hide)
: getString(R.string.condition_expand_show));
int finalI = i;
- expand.setOnClickListener(v -> {
+ header.setOnClickListener(v -> {
container.setVisibility(container.getVisibility() == View.VISIBLE
? View.GONE : View.VISIBLE);
expand.setImageResource(container.getVisibility() == View.VISIBLE
? R.drawable.ic_expand_less
: com.android.internal.R.drawable.ic_expand_more);
- expand.setContentDescription(container.getVisibility() == View.VISIBLE
+ header.setStateDescription(container.getVisibility() == View.VISIBLE
? getString(R.string.condition_expand_hide)
: getString(R.string.condition_expand_show));
- expand.sendAccessibilityEvent(TYPE_VIEW_ACCESSIBILITY_FOCUSED);
+ header.sendAccessibilityEvent(TYPE_VIEW_ACCESSIBILITY_FOCUSED);
mUiEventLogger.logWithPosition(
(container.getVisibility() == View.VISIBLE)
? NotificationHistoryEvent.NOTIFICATION_HISTORY_PACKAGE_HISTORY_OPEN
diff --git a/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java
index d203c47..2ea240e 100644
--- a/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java
@@ -368,6 +368,7 @@
public void testOnSwitchChanged_channel_nonDefault() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = new NotificationChannel("a", "a", IMPORTANCE_HIGH);
+ channel.setOriginalImportance(IMPORTANCE_HIGH);
mController.onResume(appRow, channel, null, null, null, null);
mController.updateState(mPreference);
@@ -375,7 +376,7 @@
assertEquals(IMPORTANCE_NONE, channel.getImportance());
mController.onSwitchChanged(null, true);
- assertEquals(IMPORTANCE_DEFAULT, channel.getImportance());
+ assertEquals(IMPORTANCE_HIGH, channel.getImportance());
verify(mBackend, times(2)).updateChannel(any(), anyInt(), any());
}