diff options
author | Thomas <tschneider.ac@gmail.com> | 2023-03-09 15:35:12 +0100 |
---|---|---|
committer | Thomas <tschneider.ac@gmail.com> | 2023-03-09 15:35:12 +0100 |
commit | 7c1d5a4830c0a669dd3f4f1d46dcdfc45c7a446f (patch) | |
tree | ddbc8e120744778ca6a1410989c742799a6fd6fb | |
parent | 7f9d6ca2d503182e11fa24165d2b9d389e1bb6cd (diff) |
Follow Request By
7 files changed, 52 insertions, 8 deletions
diff --git a/app/src/main/java/app/fedilab/android/mastodon/activities/ProfileActivity.java b/app/src/main/java/app/fedilab/android/mastodon/activities/ProfileActivity.java index 02eb56c53..ccb980f65 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/activities/ProfileActivity.java +++ b/app/src/main/java/app/fedilab/android/mastodon/activities/ProfileActivity.java @@ -625,18 +625,18 @@ public class ProfileActivity extends BaseActivity { binding.accountFollow.setContentDescription(getString(R.string.action_disabled)); } - if (relationship.requested) { - binding.accountFollowRequest.setVisibility(View.VISIBLE); - binding.accountFollow.setIconResource(R.drawable.ic_baseline_hourglass_full_24); - binding.accountFollow.setVisibility(View.VISIBLE); - binding.accountFollow.setContentDescription(getString(R.string.follow_request)); - doAction = action.UNFOLLOW; - } + if (relationship.followed_by) { binding.accountFollowedBy.setVisibility(View.VISIBLE); } else { binding.accountFollowedBy.setVisibility(View.GONE); } + if (relationship.requested_by) { + binding.accountRequestedBy.setVisibility(View.VISIBLE); + } else { + binding.accountRequestedBy.setVisibility(View.GONE); + } + binding.accountFollowRequest.setVisibility(View.GONE); if (relationship.following) { binding.accountFollow.setIconResource(R.drawable.ic_baseline_person_remove_24); binding.accountFollow.setBackgroundTintList(ColorStateList.valueOf(ThemeHelper.getAttColor(this, R.attr.colorError))); @@ -649,12 +649,20 @@ public class ProfileActivity extends BaseActivity { doAction = action.UNBLOCK; binding.accountFollow.setVisibility(View.VISIBLE); binding.accountFollow.setContentDescription(getString(R.string.action_unblock)); + } else if (relationship.requested) { + binding.accountFollowRequest.setVisibility(View.VISIBLE); + binding.accountFollow.setIconResource(R.drawable.ic_baseline_hourglass_full_24); + binding.accountFollow.setVisibility(View.VISIBLE); + binding.accountFollow.setContentDescription(getString(R.string.follow_request)); + doAction = action.UNFOLLOW; } else { binding.accountFollow.setIconResource(R.drawable.ic_baseline_person_add_24); doAction = action.FOLLOW; binding.accountFollow.setVisibility(View.VISIBLE); binding.accountFollow.setContentDescription(getString(R.string.action_follow)); } + + //The value for account is from same server so id can be used if (account.id.equals(currentAccount.user_id)) { diff --git a/app/src/main/java/app/fedilab/android/mastodon/client/entities/api/RelationShip.java b/app/src/main/java/app/fedilab/android/mastodon/client/entities/api/RelationShip.java index 035b57d9c..98065fc38 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/client/entities/api/RelationShip.java +++ b/app/src/main/java/app/fedilab/android/mastodon/client/entities/api/RelationShip.java @@ -32,6 +32,9 @@ public class RelationShip { public boolean followed_by; @SerializedName("blocking") public boolean blocking; + + @SerializedName("requested_by") + public boolean requested_by; @SerializedName("blocked_by") public boolean blocked_by; @SerializedName("muting") diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/AccountAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/AccountAdapter.java index 023490f1a..27107b8c3 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/AccountAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/AccountAdapter.java @@ -148,6 +148,11 @@ public class AccountAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder } else { accountViewHolder.binding.followIndicator.setVisibility(View.GONE); } + if (account.relationShip.requested_by) { + accountViewHolder.binding.requestIndicator.setVisibility(View.VISIBLE); + } else { + accountViewHolder.binding.requestIndicator.setVisibility(View.GONE); + } if (account.relationShip.blocking) { accountViewHolder.binding.block.setBackgroundTintList(ColorStateList.valueOf(ThemeHelper.getAttColor(context, R.attr.colorError))); accountViewHolder.binding.block.setIconResource(R.drawable.ic_baseline_lock_open_24); diff --git a/app/src/main/res/layouts/mastodon/layout/activity_profile.xml b/app/src/main/res/layouts/mastodon/layout/activity_profile.xml index 431f8332c..67fe4ae1f 100644 --- a/app/src/main/res/layouts/mastodon/layout/activity_profile.xml +++ b/app/src/main/res/layouts/mastodon/layout/activity_profile.xml @@ -320,6 +320,18 @@ android:visibility="gone" /> <androidx.appcompat.widget.AppCompatTextView + android:id="@+id/account_requested_by" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="3dp" + android:layout_marginEnd="3dp" + android:background="@drawable/red_border" + android:singleLine="true" + android:text="@string/requested_by" + android:textColor="?colorError" + android:visibility="gone" /> + + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/account_follow_request" android:layout_width="wrap_content" android:layout_height="wrap_content" diff --git a/app/src/main/res/layouts/mastodon/layout/drawer_account.xml b/app/src/main/res/layouts/mastodon/layout/drawer_account.xml index 5813be76c..7b7b5e107 100644 --- a/app/src/main/res/layouts/mastodon/layout/drawer_account.xml +++ b/app/src/main/res/layouts/mastodon/layout/drawer_account.xml @@ -87,6 +87,19 @@ app:layout_constraintTop_toBottomOf="@id/avatar" tools:visibility="visible" /> + <androidx.appcompat.widget.AppCompatTextView + android:id="@+id/request_indicator" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="4dp" + android:background="@drawable/red_border" + android:text="@string/requested_by" + android:textColor="?colorError" + android:visibility="gone" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/avatar" + tools:visibility="visible" /> + <com.google.android.material.textview.MaterialTextView android:id="@+id/bio" android:layout_width="match_parent" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 96206434a..63fb8cf91 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -240,6 +240,7 @@ <string name="action_unmute">Unmute</string> <string name="request_sent">Request sent</string> <string name="followed_by">Follows you</string> + <string name="requested_by">Requested to follow you</string> <string name="set_capitalize">First letter in capital for replies</string> <string name="set_resize_picture">Resize pictures</string> <string name="set_resize_video">Resize videos</string> diff --git a/src/fdroid/fastlane/metadata/android/en/changelogs/484.txt b/src/fdroid/fastlane/metadata/android/en/changelogs/484.txt index f28fa2182..3511a7370 100644 --- a/src/fdroid/fastlane/metadata/android/en/changelogs/484.txt +++ b/src/fdroid/fastlane/metadata/android/en/changelogs/484.txt @@ -1,9 +1,11 @@ Added: - Add a button to fetch remote media when it fails - Add a settings to automatically fetch remote media when it fails (default: disabled) +- Display on profiles & list of accounts if users have requested to follow you Changed: - Warn when there are missing descriptions enabled by default Fixed: -- Some settings not properly restored (multiple choices)
\ No newline at end of file +- Some settings not properly restored (multiple choices) +- Cancel a follow request
\ No newline at end of file |