Merge "Notification history updates" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8d3741fbca
@@ -69,7 +69,7 @@
|
|||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:text="@string/notification_history_summary" />
|
android:text="@string/notification_history_off_summary" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@@ -6283,7 +6283,7 @@
|
|||||||
<string name="notification_log_title">Notification log</string>
|
<string name="notification_log_title">Notification log</string>
|
||||||
|
|
||||||
<string name="notification_history_title">Notification history</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_snooze">Snoozed</string>
|
||||||
<string name="notification_history_dismiss">Recently dismissed</string>
|
<string name="notification_history_dismiss">Recently dismissed</string>
|
||||||
|
|
||||||
@@ -8073,19 +8073,19 @@
|
|||||||
<string name="asst_capabilities_actions_replies_summary">Automatically show suggested actions & replies</string>
|
<string name="asst_capabilities_actions_replies_summary">Automatically show suggested actions & replies</string>
|
||||||
|
|
||||||
<!-- Configure notifications: settings summary [CHAR LIMIT=NONE] -->
|
<!-- 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] -->
|
<!-- Configure notifications: settings title [CHAR LIMIT=100] -->
|
||||||
<string name="notification_history">Notification history</string>
|
<string name="notification_history">Notification history</string>
|
||||||
|
|
||||||
<!-- Configure notifications: settings title [CHAR LIMIT=100] -->
|
<!-- 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] -->
|
<!-- Notification history screen; title when history is off [CHAR LIMIT=200] -->
|
||||||
<string name="notification_history_turn_off">Turn off history</string>
|
<string name="notification_history_off_title_extended">Notification history turned off</string>
|
||||||
|
|
||||||
<!-- Notification history screen; summary when history is off [CHAR LIMIT=200] -->
|
<!-- Notification history screen; summary when history is off [CHAR LIMIT=NONE] -->
|
||||||
<string name="notification_history_off_title_extended">Notification history is turned off</string>
|
<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] -->
|
<!-- 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>
|
<string name="notification_history_view_settings">view notification settings</string>
|
||||||
|
@@ -116,6 +116,7 @@ public class NotificationHistoryActivity extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
setTitle(R.string.notification_history);
|
||||||
setContentView(R.layout.notification_history);
|
setContentView(R.layout.notification_history);
|
||||||
mTodayView = findViewById(R.id.apps);
|
mTodayView = findViewById(R.id.apps);
|
||||||
mSnoozeView = findViewById(R.id.snoozed_list);
|
mSnoozeView = findViewById(R.id.snoozed_list);
|
||||||
@@ -161,8 +162,8 @@ public class NotificationHistoryActivity extends Activity {
|
|||||||
private void bindSwitch() {
|
private void bindSwitch() {
|
||||||
SwitchBar bar = findViewById(R.id.switch_bar);
|
SwitchBar bar = findViewById(R.id.switch_bar);
|
||||||
if (bar != null) {
|
if (bar != null) {
|
||||||
bar.setSwitchBarText(R.string.notification_history_turn_off,
|
bar.setSwitchBarText(R.string.notification_history_toggle,
|
||||||
R.string.notification_history_turn_on);
|
R.string.notification_history_toggle);
|
||||||
bar.show();
|
bar.show();
|
||||||
try {
|
try {
|
||||||
bar.addOnSwitchChangeListener(mOnSwitchClickListener);
|
bar.addOnSwitchChangeListener(mOnSwitchClickListener);
|
||||||
|
@@ -23,6 +23,8 @@ import static android.os.UserHandle.USER_ALL;
|
|||||||
import static android.os.UserHandle.USER_CURRENT;
|
import static android.os.UserHandle.USER_CURRENT;
|
||||||
|
|
||||||
import android.annotation.ColorInt;
|
import android.annotation.ColorInt;
|
||||||
|
import android.annotation.UserIdInt;
|
||||||
|
import android.app.ActivityManager;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
@@ -46,6 +48,7 @@ import com.android.internal.util.ContrastColorUtil;
|
|||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Currency;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -60,6 +63,7 @@ public class NotificationSbnAdapter extends
|
|||||||
private PackageManager mPm;
|
private PackageManager mPm;
|
||||||
private @ColorInt int mBackgroundColor;
|
private @ColorInt int mBackgroundColor;
|
||||||
private boolean mInNightMode;
|
private boolean mInNightMode;
|
||||||
|
private @UserIdInt int mCurrentUser;
|
||||||
|
|
||||||
public NotificationSbnAdapter(Context context, PackageManager pm) {
|
public NotificationSbnAdapter(Context context, PackageManager pm) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@@ -71,6 +75,7 @@ public class NotificationSbnAdapter extends
|
|||||||
Configuration currentConfig = mContext.getResources().getConfiguration();
|
Configuration currentConfig = mContext.getResources().getConfiguration();
|
||||||
mInNightMode = (currentConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK)
|
mInNightMode = (currentConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK)
|
||||||
== Configuration.UI_MODE_NIGHT_YES;
|
== Configuration.UI_MODE_NIGHT_YES;
|
||||||
|
mCurrentUser = ActivityManager.getCurrentUser();
|
||||||
setHasStableIds(true);
|
setHasStableIds(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +193,7 @@ public class NotificationSbnAdapter extends
|
|||||||
private int normalizeUserId(StatusBarNotification sbn) {
|
private int normalizeUserId(StatusBarNotification sbn) {
|
||||||
int userId = sbn.getUserId();
|
int userId = sbn.getUserId();
|
||||||
if (userId == USER_ALL) {
|
if (userId == USER_ALL) {
|
||||||
userId = USER_CURRENT;
|
userId = mCurrentUser;
|
||||||
}
|
}
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user