Merge "Update history flow" into rvc-dev

This commit is contained in:
Julia Reynolds
2020-04-06 13:37:33 +00:00
committed by Android (Google) Code Review
3 changed files with 52 additions and 1 deletions

View File

@@ -72,6 +72,35 @@
android:focusable="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/notification_history_off_summary" />
<TextView
android:id="@+id/history_toggled_on_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/history_image"
android:layout_marginTop="48dp"
android:layout_marginStart="48dp"
android:layout_marginEnd="48dp"
android:layout_gravity="center_horizontal"
android:focusable="true"
android:visibility="gone"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/history_toggled_on_title" />
<TextView
android:id="@+id/history_toggled_on_summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/history_off_title"
android:layout_marginStart="48dp"
android:layout_marginEnd="48dp"
android:layout_marginTop="16dp"
android:layout_gravity="center_horizontal"
android:textAlignment="center"
android:focusable="true"
android:visibility="gone"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/history_toggled_on_summary" />
</LinearLayout>
<LinearLayout

View File

@@ -8112,6 +8112,12 @@
<!-- 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; title when history is newly turned on [CHAR LIMIT=200] -->
<string name="history_toggled_on_title">No recent notifications</string>
<!-- Notification history screen; summary when history is newly turned on [CHAR LIMIT=NONE] -->
<string name="history_toggled_on_summary">Your recent and snoozed notifications will appear here</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

@@ -70,6 +70,8 @@ public class NotificationHistoryActivity extends Activity {
private PackageManager mPm;
private HistoryLoader.OnHistoryLoaderListener mOnHistoryLoaderListener = notifications -> {
findViewById(R.id.today_list).setVisibility(
notifications.isEmpty() ? View.GONE : View.VISIBLE);
// for each package, new header and recycler view
for (NotificationHistoryPackage nhp : notifications) {
View viewForPackage = LayoutInflater.from(this)
@@ -182,6 +184,10 @@ public class NotificationHistoryActivity extends Activity {
} else {
mHistoryOn.setVisibility(View.GONE);
mHistoryOff.setVisibility(View.VISIBLE);
mHistoryOff.findViewById(R.id.history_off_title).setVisibility(View.VISIBLE);
mHistoryOff.findViewById(R.id.history_off_summary).setVisibility(View.VISIBLE);
mHistoryOff.findViewById(R.id.history_toggled_on_title).setVisibility(View.GONE);
mHistoryOff.findViewById(R.id.history_toggled_on_summary).setVisibility(View.GONE);
mTodayView.removeAllViews();
}
}
@@ -232,7 +238,17 @@ public class NotificationHistoryActivity extends Activity {
Settings.Secure.putInt(getContentResolver(),
NOTIFICATION_HISTORY_ENABLED,
isChecked ? 1 : 0);
toggleViews(isChecked);
mHistoryOn.setVisibility(View.GONE);
mHistoryOff.findViewById(R.id.history_off_title).setVisibility(
isChecked ? View.GONE : View.VISIBLE);
mHistoryOff.findViewById(R.id.history_off_summary).setVisibility(
isChecked ? View.GONE : View.VISIBLE);
mHistoryOff.findViewById(R.id.history_toggled_on_title).setVisibility(
isChecked ? View.VISIBLE : View.GONE);
mHistoryOff.findViewById(R.id.history_toggled_on_summary).setVisibility(
isChecked ? View.VISIBLE : View.GONE);
mTodayView.removeAllViews();
mHistoryOff.setVisibility(View.VISIBLE);
};
private final NotificationListenerService mListener = new NotificationListenerService() {