Loading res/layout/notification_history.xml +7 −21 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ limitations under the License. --> <ScrollView <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scroll" android:layout_width="match_parent" Loading Loading @@ -124,22 +124,15 @@ android:textColor="?android:attr/textColorPrimary" android:textAppearance="?android:attr/textAppearanceMedium" android:paddingBottom="16dp" /> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/list_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:clipChildren="true" android:elevation="3dp" android:background="@drawable/rounded_bg"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/notification_list" android:elevation="3dp" android:background="@drawable/rounded_bg" android:layout_width="match_parent" android:layout_height="wrap_content" android:clipChildren="true" android:scrollbars="none"/> </androidx.constraintlayout.widget.ConstraintLayout> </LinearLayout> <LinearLayout Loading @@ -156,21 +149,14 @@ android:textColor="?android:attr/textColorPrimary" android:textAppearance="?android:attr/textAppearanceMedium" android:paddingBottom="16dp" /> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/list_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:elevation="3dp" android:clipChildren="true" android:background="@drawable/rounded_bg"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/notification_list" android:elevation="3dp" android:background="@drawable/rounded_bg" android:layout_width="match_parent" android:layout_height="wrap_content" android:clipChildren="true" android:scrollbars="none"/> </androidx.constraintlayout.widget.ConstraintLayout> </LinearLayout> <LinearLayout Loading Loading @@ -198,4 +184,4 @@ </LinearLayout> </LinearLayout> </ScrollView> No newline at end of file </androidx.core.widget.NestedScrollView> No newline at end of file res/layout/notification_history_app_layout.xml +1 −7 Original line number Diff line number Diff line Loading @@ -73,18 +73,12 @@ android:layout_height="1dp" android:background="?android:attr/listDivider"/> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/list_container" android:layout_width="match_parent" android:clipChildren="true" android:layout_height="wrap_content"> <com.android.settings.notification.history.NotificationHistoryRecyclerView android:id="@+id/notification_list" android:layout_width="match_parent" android:layout_height="wrap_content" android:clipChildren="true" android:importantForAccessibility="yes" android:scrollbars="none"/> </androidx.constraintlayout.widget.ConstraintLayout> </LinearLayout> No newline at end of file src/com/android/settings/notification/history/NotificationHistoryActivity.java +1 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ public class NotificationHistoryActivity extends Activity { View viewForPackage = LayoutInflater.from(this) .inflate(R.layout.notification_history_app_layout, null); final View container = viewForPackage.findViewById(R.id.list_container); 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 Loading src/com/android/settings/notification/history/NotificationHistoryAdapter.java +40 −2 Original line number Diff line number Diff line Loading @@ -16,13 +16,22 @@ package com.android.settings.notification.history; import static android.provider.Settings.EXTRA_APP_PACKAGE; import static android.provider.Settings.EXTRA_CHANNEL_ID; import static android.provider.Settings.EXTRA_CONVERSATION_ID; import android.app.INotificationManager; import android.app.NotificationHistory.HistoricalNotification; import android.content.Intent; import android.os.Bundle; import android.os.RemoteException; import android.os.UserHandle; import android.provider.Settings; import android.util.Slog; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityNodeInfo; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; Loading Loading @@ -63,8 +72,37 @@ public class NotificationHistoryAdapter extends holder.setTitle(hn.getTitle()); holder.setSummary(hn.getText()); holder.setPostedTime(hn.getPostedTimeMs()); holder.addOnClick(hn.getPackage(), hn.getUserId(), hn.getChannelId(), hn.getConversationId()); holder.itemView.setOnClickListener(v -> { Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS) .putExtra(EXTRA_APP_PACKAGE, hn.getPackage()) .putExtra(EXTRA_CHANNEL_ID, hn.getChannelId()) .putExtra(EXTRA_CONVERSATION_ID, hn.getConversationId()); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); holder.itemView.getContext().startActivityAsUser(intent, UserHandle.of(hn.getUserId())); }); holder.itemView.setAccessibilityDelegate(new View.AccessibilityDelegate() { @Override public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(host, info); CharSequence description = host.getResources().getText(R.string.notification_history_view_settings); AccessibilityNodeInfo.AccessibilityAction customClick = new AccessibilityNodeInfo.AccessibilityAction( AccessibilityNodeInfo.ACTION_CLICK, description); info.addAction(customClick); //info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_DISMISS); } @Override public boolean performAccessibilityAction(View host, int action, Bundle args) { if (action == AccessibilityNodeInfo.AccessibilityAction.ACTION_DISMISS.getId()) { onItemSwipeDeleted(position); return true; } return false; } }); } @Override Loading src/com/android/settings/notification/history/NotificationHistoryRecyclerView.java +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ public class NotificationHistoryRecyclerView extends RecyclerView { ItemTouchHelper touchHelper = new ItemTouchHelper( new DismissTouchHelper(0, ItemTouchHelper.START | ItemTouchHelper.END)); touchHelper.attachToRecyclerView(this); setNestedScrollingEnabled(false); } public void setOnItemSwipeDeleteListener(OnItemSwipeDeleteListener listener) { Loading Loading
res/layout/notification_history.xml +7 −21 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ limitations under the License. --> <ScrollView <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scroll" android:layout_width="match_parent" Loading Loading @@ -124,22 +124,15 @@ android:textColor="?android:attr/textColorPrimary" android:textAppearance="?android:attr/textAppearanceMedium" android:paddingBottom="16dp" /> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/list_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:clipChildren="true" android:elevation="3dp" android:background="@drawable/rounded_bg"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/notification_list" android:elevation="3dp" android:background="@drawable/rounded_bg" android:layout_width="match_parent" android:layout_height="wrap_content" android:clipChildren="true" android:scrollbars="none"/> </androidx.constraintlayout.widget.ConstraintLayout> </LinearLayout> <LinearLayout Loading @@ -156,21 +149,14 @@ android:textColor="?android:attr/textColorPrimary" android:textAppearance="?android:attr/textAppearanceMedium" android:paddingBottom="16dp" /> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/list_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:elevation="3dp" android:clipChildren="true" android:background="@drawable/rounded_bg"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/notification_list" android:elevation="3dp" android:background="@drawable/rounded_bg" android:layout_width="match_parent" android:layout_height="wrap_content" android:clipChildren="true" android:scrollbars="none"/> </androidx.constraintlayout.widget.ConstraintLayout> </LinearLayout> <LinearLayout Loading Loading @@ -198,4 +184,4 @@ </LinearLayout> </LinearLayout> </ScrollView> No newline at end of file </androidx.core.widget.NestedScrollView> No newline at end of file
res/layout/notification_history_app_layout.xml +1 −7 Original line number Diff line number Diff line Loading @@ -73,18 +73,12 @@ android:layout_height="1dp" android:background="?android:attr/listDivider"/> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/list_container" android:layout_width="match_parent" android:clipChildren="true" android:layout_height="wrap_content"> <com.android.settings.notification.history.NotificationHistoryRecyclerView android:id="@+id/notification_list" android:layout_width="match_parent" android:layout_height="wrap_content" android:clipChildren="true" android:importantForAccessibility="yes" android:scrollbars="none"/> </androidx.constraintlayout.widget.ConstraintLayout> </LinearLayout> No newline at end of file
src/com/android/settings/notification/history/NotificationHistoryActivity.java +1 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ public class NotificationHistoryActivity extends Activity { View viewForPackage = LayoutInflater.from(this) .inflate(R.layout.notification_history_app_layout, null); final View container = viewForPackage.findViewById(R.id.list_container); 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 Loading
src/com/android/settings/notification/history/NotificationHistoryAdapter.java +40 −2 Original line number Diff line number Diff line Loading @@ -16,13 +16,22 @@ package com.android.settings.notification.history; import static android.provider.Settings.EXTRA_APP_PACKAGE; import static android.provider.Settings.EXTRA_CHANNEL_ID; import static android.provider.Settings.EXTRA_CONVERSATION_ID; import android.app.INotificationManager; import android.app.NotificationHistory.HistoricalNotification; import android.content.Intent; import android.os.Bundle; import android.os.RemoteException; import android.os.UserHandle; import android.provider.Settings; import android.util.Slog; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityNodeInfo; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; Loading Loading @@ -63,8 +72,37 @@ public class NotificationHistoryAdapter extends holder.setTitle(hn.getTitle()); holder.setSummary(hn.getText()); holder.setPostedTime(hn.getPostedTimeMs()); holder.addOnClick(hn.getPackage(), hn.getUserId(), hn.getChannelId(), hn.getConversationId()); holder.itemView.setOnClickListener(v -> { Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS) .putExtra(EXTRA_APP_PACKAGE, hn.getPackage()) .putExtra(EXTRA_CHANNEL_ID, hn.getChannelId()) .putExtra(EXTRA_CONVERSATION_ID, hn.getConversationId()); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); holder.itemView.getContext().startActivityAsUser(intent, UserHandle.of(hn.getUserId())); }); holder.itemView.setAccessibilityDelegate(new View.AccessibilityDelegate() { @Override public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(host, info); CharSequence description = host.getResources().getText(R.string.notification_history_view_settings); AccessibilityNodeInfo.AccessibilityAction customClick = new AccessibilityNodeInfo.AccessibilityAction( AccessibilityNodeInfo.ACTION_CLICK, description); info.addAction(customClick); //info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_DISMISS); } @Override public boolean performAccessibilityAction(View host, int action, Bundle args) { if (action == AccessibilityNodeInfo.AccessibilityAction.ACTION_DISMISS.getId()) { onItemSwipeDeleted(position); return true; } return false; } }); } @Override Loading
src/com/android/settings/notification/history/NotificationHistoryRecyclerView.java +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ public class NotificationHistoryRecyclerView extends RecyclerView { ItemTouchHelper touchHelper = new ItemTouchHelper( new DismissTouchHelper(0, ItemTouchHelper.START | ItemTouchHelper.END)); touchHelper.attachToRecyclerView(this); setNestedScrollingEnabled(false); } public void setOnItemSwipeDeleteListener(OnItemSwipeDeleteListener listener) { Loading