From 5fa81e6c8ad4ffc0afd008dba7e7d087427c54ed Mon Sep 17 00:00:00 2001 From: sk Date: Sat, 12 Nov 2022 01:10:52 +0100 Subject: [PATCH] add accept/decline buttons --- .../fragments/NotificationsListFragment.java | 2 +- .../AccountCardStatusDisplayItem.java | 30 ++++++++++++++++--- .../main/res/layout/item_discover_account.xml | 30 +++++++++++++++++++ .../src/main/res/values-de-rDE/strings.xml | 2 ++ mastodon/src/main/res/values/strings.xml | 2 ++ 5 files changed, 61 insertions(+), 5 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java index 2804be5c4..614edb8aa 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/NotificationsListFragment.java @@ -78,7 +78,7 @@ public class NotificationsListFragment extends BaseStatusListFragment implements ImageLoaderViewHolder{ private final ImageView cover, avatar; private final TextView name, username, bio, followersCount, followingCount, postsCount, followersLabel, followingLabel, postsLabel; - private final ProgressBarButton actionButton; - private final ProgressBar actionProgress; - private final View actionWrap; + private final ProgressBarButton actionButton, rejectButton; + private final ProgressBar actionProgress, rejectProgress; + private final View actionWrap, rejectWrap; private Relationship relationship; @@ -96,6 +99,9 @@ public class AccountCardStatusDisplayItem extends StatusDisplayItem{ actionButton=findViewById(R.id.action_btn); actionProgress=findViewById(R.id.action_progress); actionWrap=findViewById(R.id.action_btn_wrap); + rejectButton=findViewById(R.id.reject_btn); + rejectProgress=findViewById(R.id.reject_progress); + rejectWrap=findViewById(R.id.reject_btn_wrap); View card=findViewById(R.id.card); card.setOutlineProvider(OutlineProviders.roundedRect(6)); @@ -121,7 +127,23 @@ public class AccountCardStatusDisplayItem extends StatusDisplayItem{ relationship=item.parentFragment.getRelationship(item.account.id); if(relationship==null){ actionWrap.setVisibility(View.GONE); + }else if(item.type == Notification.Type.FOLLOW_REQUEST){ + actionWrap.setVisibility(View.VISIBLE); + rejectWrap.setVisibility(View.VISIBLE); + + // i hate that i wasn't able to do this in xml + actionButton.setCompoundDrawableTintList(actionButton.getTextColors()); + actionProgress.setIndeterminateTintList(actionButton.getTextColors()); + actionButton.setContentDescription(item.parentFragment.getString(R.string.accept_follow_request)); + rejectButton.setCompoundDrawableTintList(rejectButton.getTextColors()); + rejectProgress.setIndeterminateTintList(rejectButton.getTextColors()); + rejectButton.setContentDescription(item.parentFragment.getString(R.string.reject_follow_request)); + + actionButton.setOnClickListener(i -> { + + }); }else{ + actionButton.setCompoundDrawables(null, null, null, null); actionWrap.setVisibility(View.VISIBLE); UiUtils.setRelationshipToActionButton(relationship, actionButton); } diff --git a/mastodon/src/main/res/layout/item_discover_account.xml b/mastodon/src/main/res/layout/item_discover_account.xml index b702da02a..540d1529e 100644 --- a/mastodon/src/main/res/layout/item_discover_account.xml +++ b/mastodon/src/main/res/layout/item_discover_account.xml @@ -156,6 +156,35 @@ android:layout_height="1px" android:layout_weight="1"/> + + + + + + + Download (%s) Installieren + Folgeanfrage akzeptieren + Folgeanfrage ablehnen diff --git a/mastodon/src/main/res/values/strings.xml b/mastodon/src/main/res/values/strings.xml index 2ee4d9975..67274a7b9 100644 --- a/mastodon/src/main/res/values/strings.xml +++ b/mastodon/src/main/res/values/strings.xml @@ -387,4 +387,6 @@ Mastodon and your privacy Although the Mastodon app does not collect any data, the server you sign up through may have a different policy. Take a minute to review and agree to the Mastodon app privacy policy and your server\'s privacy policy. I Agree + Accept follow request + Reject follow request \ No newline at end of file