From b809dfecfdb5426003ea0870345699cf8e99adb0 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 21 May 2022 19:04:07 +0200 Subject: [PATCH] comment #77 - Group notifications for boost and fav when they target the same message and are following them in the timeline --- .../ui/drawer/NotificationAdapter.java | 11 +++++++--- .../FragmentMastodonNotification.java | 10 +++++++-- app/src/main/res/layout/drawer_account.xml | 4 ++-- .../res/layout/drawer_status_notification.xml | 21 +++++++++++++++---- .../layout/notifications_related_accounts.xml | 4 ++++ app/src/main/res/values/strings.xml | 2 ++ 6 files changed, 41 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java index 0937b3c10..21a312ade 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java @@ -167,11 +167,16 @@ public class NotificationAdapter extends RecyclerView.Adapter 0) { - holderStatus.bindingNotification.otherAccounts.removeAllViews(); + if (notification.type.equals("favourite")) { + holderStatus.bindingNotification.typeOfConcat.setText(R.string.also_favourite_by); + } else if (notification.type.equals("reblog")) { + holderStatus.bindingNotification.typeOfConcat.setText(R.string.also_boosted_by); + } + holderStatus.bindingNotification.relatedAccounts.removeAllViews(); for (Notification relativeNotif : notification.relatedNotifications) { NotificationsRelatedAccountsBinding notificationsRelatedAccountsBinding = NotificationsRelatedAccountsBinding.inflate(LayoutInflater.from(context)); MastodonHelper.loadPPMastodon(notificationsRelatedAccountsBinding.profilePicture, relativeNotif.account); - notificationsRelatedAccountsBinding.acc.setText(relativeNotif.account.acct); + notificationsRelatedAccountsBinding.acc.setText(relativeNotif.account.username); notificationsRelatedAccountsBinding.relatedAccountContainer.setOnClickListener(v -> { Intent intent = new Intent(context, ProfileActivity.class); Bundle b = new Bundle(); @@ -182,7 +187,7 @@ public class NotificationAdapter extends RecyclerView.Adapter 0) { if (notificationList.get(notificationList.size() - 1).relatedNotifications == null) { notificationList.get(notificationList.size() - 1).relatedNotifications = new ArrayList<>(); @@ -269,6 +272,9 @@ public class FragmentMastodonNotification extends Fragment { binding.loadingNextElements.setVisibility(View.GONE); if (currentFragment.notifications != null && fetched_notifications != null && fetched_notifications.notifications != null) { flagLoading = fetched_notifications.notifications.size() < MastodonHelper.notificationsPerCall(requireActivity()); + if (aggregateNotification) { + fetched_notifications.notifications = aggregateNotifications(fetched_notifications.notifications); + } int startId = 0; //There are some statuses present in the timeline if (currentFragment.notifications.size() > 0) { diff --git a/app/src/main/res/layout/drawer_account.xml b/app/src/main/res/layout/drawer_account.xml index 482dc5da5..eb3b454a0 100644 --- a/app/src/main/res/layout/drawer_account.xml +++ b/app/src/main/res/layout/drawer_account.xml @@ -19,8 +19,8 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginHorizontal="12dp" - android:layout_marginTop="12dp" + android:layout_marginHorizontal="6dp" + android:layout_marginTop="6dp" app:cardElevation="2dp"> + android:layout_weight="1"> + + + + app:layout_constraintStart_toStartOf="parent" /> + \ No newline at end of file diff --git a/app/src/main/res/layout/notifications_related_accounts.xml b/app/src/main/res/layout/notifications_related_accounts.xml index 762d71347..b1a9ea55b 100644 --- a/app/src/main/res/layout/notifications_related_accounts.xml +++ b/app/src/main/res/layout/notifications_related_accounts.xml @@ -3,15 +3,19 @@ android:id="@+id/related_account_container" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginStart="5dp" android:orientation="horizontal"> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7b45b2427..eff9bccdf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1599,6 +1599,8 @@ Display Bottom menu Top bar menu + "Also favourited by: " + Also boosted by: