Merge "Notification history updates" into rvc-dev am: 8d3741fbca am: 31f9705a60

Change-Id: Ie8b990fbc370db99e26097612b5d760e51614b75
This commit is contained in:
Julia Reynolds
2020-03-24 21:26:34 +00:00
committed by Automerger Merge Worker
4 changed files with 17 additions and 11 deletions

View File

@@ -69,7 +69,7 @@
android:layout_gravity="center_horizontal"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/notification_history_summary" />
android:text="@string/notification_history_off_summary" />
</LinearLayout>
<LinearLayout

View File

@@ -6283,7 +6283,7 @@
<string name="notification_log_title">Notification log</string>
<string name="notification_history_title">Notification history</string>
<string name="notification_history_today">Today</string>
<string name="notification_history_today">Last 24 hours</string>
<string name="notification_history_snooze">Snoozed</string>
<string name="notification_history_dismiss">Recently dismissed</string>
@@ -8073,19 +8073,19 @@
<string name="asst_capabilities_actions_replies_summary">Automatically show suggested actions &amp; replies</string>
<!-- Configure notifications: settings summary [CHAR LIMIT=NONE] -->
<string name="notification_history_summary">Turn on notification history to keep track of past notifications and snoozed notifications</string>
<string name="notification_history_summary">Show recent and snoozed notifications</string>
<!-- Configure notifications: settings title [CHAR LIMIT=100] -->
<string name="notification_history">Notification history</string>
<!-- Configure notifications: settings title [CHAR LIMIT=100] -->
<string name="notification_history_turn_on">Turn on history</string>
<string name="notification_history_toggle">Use notification history</string>
<!-- Configure notifications: settings title [CHAR LIMIT=100] -->
<string name="notification_history_turn_off">Turn off history</string>
<!-- Notification history screen; title when history is off [CHAR LIMIT=200] -->
<string name="notification_history_off_title_extended">Notification history turned off</string>
<!-- Notification history screen; summary when history is off [CHAR LIMIT=200] -->
<string name="notification_history_off_title_extended">Notification history is turned off</string>
<!-- Notification history screen; summary when history is off [CHAR LIMIT=NONE] -->
<string name="notification_history_off_summary">Turn on notification history to see recent notifications and snoozed notifications</string>
<!-- Notification history screen; content description describing what happens when you tap on a notification history entry [CHAR LIMIT=NONE] -->
<string name="notification_history_view_settings">view notification settings</string>

View File

@@ -116,6 +116,7 @@ public class NotificationHistoryActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(R.string.notification_history);
setContentView(R.layout.notification_history);
mTodayView = findViewById(R.id.apps);
mSnoozeView = findViewById(R.id.snoozed_list);
@@ -161,8 +162,8 @@ public class NotificationHistoryActivity extends Activity {
private void bindSwitch() {
SwitchBar bar = findViewById(R.id.switch_bar);
if (bar != null) {
bar.setSwitchBarText(R.string.notification_history_turn_off,
R.string.notification_history_turn_on);
bar.setSwitchBarText(R.string.notification_history_toggle,
R.string.notification_history_toggle);
bar.show();
try {
bar.addOnSwitchChangeListener(mOnSwitchClickListener);

View File

@@ -23,6 +23,8 @@ import static android.os.UserHandle.USER_ALL;
import static android.os.UserHandle.USER_CURRENT;
import android.annotation.ColorInt;
import android.annotation.UserIdInt;
import android.app.ActivityManager;
import android.app.Notification;
import android.content.Context;
import android.content.pm.ApplicationInfo;
@@ -46,6 +48,7 @@ import com.android.internal.util.ContrastColorUtil;
import com.android.settings.R;
import java.util.ArrayList;
import java.util.Currency;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -60,6 +63,7 @@ public class NotificationSbnAdapter extends
private PackageManager mPm;
private @ColorInt int mBackgroundColor;
private boolean mInNightMode;
private @UserIdInt int mCurrentUser;
public NotificationSbnAdapter(Context context, PackageManager pm) {
mContext = context;
@@ -71,6 +75,7 @@ public class NotificationSbnAdapter extends
Configuration currentConfig = mContext.getResources().getConfiguration();
mInNightMode = (currentConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK)
== Configuration.UI_MODE_NIGHT_YES;
mCurrentUser = ActivityManager.getCurrentUser();
setHasStableIds(true);
}
@@ -188,7 +193,7 @@ public class NotificationSbnAdapter extends
private int normalizeUserId(StatusBarNotification sbn) {
int userId = sbn.getUserId();
if (userId == USER_ALL) {
userId = USER_CURRENT;
userId = mCurrentUser;
}
return userId;
}