From 9a6e7329be0fd4dc68c4167898a876c9ade3a68a Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Wed, 13 May 2020 14:03:40 -0400 Subject: [PATCH] Remove divider after last items Fixes: 155890866 Test: manual Change-Id: Ie0e3f7ad8c1868bda7623718dd60926c300fa353 --- res/layout/notification_sbn_log_row.xml | 221 +++++++++--------- .../history/NotificationHistoryActivity.java | 6 - .../history/NotificationSbnAdapter.java | 1 + .../history/NotificationSbnViewHolder.java | 6 + 4 files changed, 124 insertions(+), 110 deletions(-) diff --git a/res/layout/notification_sbn_log_row.xml b/res/layout/notification_sbn_log_row.xml index 3b731ac4f8f..049e940532c 100644 --- a/res/layout/notification_sbn_log_row.xml +++ b/res/layout/notification_sbn_log_row.xml @@ -14,119 +14,132 @@ limitations under the License. --> - - - - - - - - - - - - - - - + - + android:minHeight="@*android:dimen/status_bar_icon_size" + android:paddingBottom="6dp"> - + + + + + + + + + + + + android:orientation="vertical" + android:layout_marginStart="30dp" + android:layout_marginBottom="6dp" + > + + + + + + - + + \ No newline at end of file diff --git a/src/com/android/settings/notification/history/NotificationHistoryActivity.java b/src/com/android/settings/notification/history/NotificationHistoryActivity.java index c45242ece25..8b4bc9d8368 100644 --- a/src/com/android/settings/notification/history/NotificationHistoryActivity.java +++ b/src/com/android/settings/notification/history/NotificationHistoryActivity.java @@ -266,9 +266,6 @@ public class NotificationHistoryActivity extends Activity { mSnoozedRv.setLayoutManager(lm); mSnoozedRv.setAdapter( new NotificationSbnAdapter(NotificationHistoryActivity.this, mPm)); - DividerItemDecoration dividerItemDecoration = new DividerItemDecoration( - mSnoozedRv.getContext(), lm.getOrientation()); - mSnoozedRv.addItemDecoration(dividerItemDecoration); mSnoozedRv.setNestedScrollingEnabled(false); if (snoozed == null || snoozed.length == 0) { @@ -284,9 +281,6 @@ public class NotificationHistoryActivity extends Activity { mDismissedRv.setLayoutManager(dismissLm); mDismissedRv.setAdapter( new NotificationSbnAdapter(NotificationHistoryActivity.this, mPm)); - DividerItemDecoration dismissDivider = new DividerItemDecoration( - mDismissedRv.getContext(), dismissLm.getOrientation()); - mDismissedRv.addItemDecoration(dismissDivider); mDismissedRv.setNestedScrollingEnabled(false); if (dismissed == null || dismissed.length == 0) { diff --git a/src/com/android/settings/notification/history/NotificationSbnAdapter.java b/src/com/android/settings/notification/history/NotificationSbnAdapter.java index c7f68abac14..5d4e7166710 100644 --- a/src/com/android/settings/notification/history/NotificationSbnAdapter.java +++ b/src/com/android/settings/notification/history/NotificationSbnAdapter.java @@ -94,6 +94,7 @@ public class NotificationSbnAdapter extends holder.setTitle(getTitleString(sbn.getNotification())); holder.setSummary(getTextString(mContext, sbn.getNotification())); holder.setPostedTime(sbn.getPostTime()); + holder.setDividerVisible(position < (mValues.size() -1)); int userId = normalizeUserId(sbn); if (!mUserBadgeCache.containsKey(userId)) { Drawable profile = mContext.getPackageManager().getUserBadgeForDensity( diff --git a/src/com/android/settings/notification/history/NotificationSbnViewHolder.java b/src/com/android/settings/notification/history/NotificationSbnViewHolder.java index 42a210057a8..3f1197d7b95 100644 --- a/src/com/android/settings/notification/history/NotificationSbnViewHolder.java +++ b/src/com/android/settings/notification/history/NotificationSbnViewHolder.java @@ -45,6 +45,7 @@ public class NotificationSbnViewHolder extends RecyclerView.ViewHolder { private final TextView mTitle; private final TextView mSummary; private final ImageView mProfileBadge; + private final View mDivider; NotificationSbnViewHolder(View itemView) { super(itemView); @@ -54,6 +55,7 @@ public class NotificationSbnViewHolder extends RecyclerView.ViewHolder { mTitle = itemView.findViewById(R.id.title); mSummary = itemView.findViewById(R.id.text); mProfileBadge = itemView.findViewById(R.id.profile_badge); + mDivider = itemView.findViewById(R.id.divider); } void setSummary(CharSequence summary) { @@ -85,6 +87,10 @@ public class NotificationSbnViewHolder extends RecyclerView.ViewHolder { mProfileBadge.setVisibility(badge != null ? View.VISIBLE : View.GONE); } + void setDividerVisible(boolean visible) { + mDivider.setVisibility(visible ? View.VISIBLE : View.GONE); + } + void addOnClick(String pkg, int userId, PendingIntent pi) { Intent appIntent = itemView.getContext().getPackageManager() .getLaunchIntentForPackage(pkg);