Add view for browsing and unfollowing followed hashtags (#2794)

* Add view for browsing and unfollowing followed hashtags.
Implements #2785

* Improve list interface

* Remove superfluous suspend modifier

* Migrate to paginated loading for followed tags view

* Update app/src/main/java/com/keylesspalace/tusky/components/followedtags/FollowedTagsViewModel.kt

Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com>

* Fix unhandled exception when opening the followed tags view while offline

Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com>
This commit is contained in:
Levi Bard 2022-12-01 19:24:27 +01:00 committed by GitHub
commit 9362e59d9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 414 additions and 0 deletions

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.keylesspalace.tusky.components.followedtags.FollowedTagsActivity">
<include
android:id="@+id/includedToolbar"
layout="@layout/toolbar_basic" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/followedTagsView"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:itemCount="5"
tools:listitem="@layout/item_followed_hashtag"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
/>
<com.keylesspalace.tusky.view.BackgroundMessageView
android:id="@+id/followedTagsMessageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
/>
<ProgressBar
android:id="@+id/followedTagsProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="72dp"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
>
<ImageButton
android:id="@+id/followed_tag_unfollow"
style="@style/TuskyImageButton"
android:layout_width="32dp"
android:layout_height="32dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/action_unfollow"
android:padding="4dp"
app:srcCompat="@drawable/ic_person_remove_24dp"
/>
<TextView
android:id="@+id/followed_tag"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:gravity="center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="?attr/status_text_medium"
tools:text="#hashtag" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -24,6 +24,7 @@
<string name="error_sender_account_gone">Error sending post.</string>
<string name="error_following_hashtag_format">Error following #%s</string>
<string name="error_unfollowing_hashtag_format">Error unfollowing #%s</string>
<string name="error_following_hashtags_unsupported">This instance does not support following hashtags.</string>
<string name="title_login">Login</string>
<string name="title_home">Home</string>
@ -50,6 +51,7 @@
<string name="title_scheduled_posts">Scheduled posts</string>
<string name="title_announcements">Announcements</string>
<string name="title_licenses">Licenses</string>
<string name="title_followed_hashtags">Followed Hashtags</string>
<string name="post_username_format">\@%s</string>
<string name="post_boosted_format">%s boosted</string>
@ -176,6 +178,7 @@
<string name="confirmation_unblocked">User unblocked</string>
<string name="confirmation_unmuted">User unmuted</string>
<string name="confirmation_domain_unmuted">%s unhidden</string>
<string name="confirmation_hashtag_unfollowed">#%s unfollowed</string>
<string name="post_sent">Sent!</string>
<string name="post_sent_long">Reply sent successfully.</string>
@ -676,5 +679,6 @@
<string name="instance_rule_info">By logging in you agree to the rules of %s.</string>
<string name="instance_rule_title">%s rules</string>
<string name="action_unfollow_hashtag_format">Unfollow #%s?</string>
</resources>