From 4096af2872074f5b2f5a5604d6ac4fae3de0f7e3 Mon Sep 17 00:00:00 2001 From: mjaillot Date: Sat, 20 Mar 2021 12:43:13 +0100 Subject: [PATCH] Profile fixes --- .../h/pixeldroid/profile/ProfileActivity.kt | 17 ----------------- app/src/main/res/layout/activity_profile.xml | 6 ++++-- app/src/main/res/values/strings.xml | 18 ++++++------------ 3 files changed, 10 insertions(+), 31 deletions(-) diff --git a/app/src/main/java/com/h/pixeldroid/profile/ProfileActivity.kt b/app/src/main/java/com/h/pixeldroid/profile/ProfileActivity.kt index 199d3bcc..8e2d2ac8 100644 --- a/app/src/main/java/com/h/pixeldroid/profile/ProfileActivity.kt +++ b/app/src/main/java/com/h/pixeldroid/profile/ProfileActivity.kt @@ -13,7 +13,6 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope import androidx.paging.ExperimentalPagingApi -import androidx.paging.LoadState import androidx.paging.PagingDataAdapter import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.GridLayoutManager @@ -35,10 +34,7 @@ import com.h.pixeldroid.utils.api.objects.Status import com.h.pixeldroid.utils.db.entities.UserDatabaseEntity import com.h.pixeldroid.utils.openUrl import kotlinx.coroutines.Job -import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.collectLatest -import kotlinx.coroutines.flow.distinctUntilChangedBy -import kotlinx.coroutines.flow.filter import kotlinx.coroutines.launch import retrofit2.HttpException import java.io.IOException @@ -98,7 +94,6 @@ class ProfileActivity : BaseActivity() { setContent(account) profileLaunch() - profileInitSearch() } private fun profileLaunch() { @@ -111,18 +106,6 @@ class ProfileActivity : BaseActivity() { } } - private fun profileInitSearch() { - // Scroll to top when the list is refreshed from network. - lifecycleScope.launch { - profileAdapter.loadStateFlow - // Only emit when REFRESH LoadState for RemoteMediator changes. - .distinctUntilChangedBy { it.refresh } - // Only react to cases where Remote REFRESH completes i.e., NotLoading. - .filter { it.refresh is LoadState.NotLoading } - .collect { binding.profilePostsRecyclerView.scrollToPosition(0) } - } - } - /** * Shows or hides the error in the different FeedFragments */ diff --git a/app/src/main/res/layout/activity_profile.xml b/app/src/main/res/layout/activity_profile.xml index c595e0db..2ebc9cac 100644 --- a/app/src/main/res/layout/activity_profile.xml +++ b/app/src/main/res/layout/activity_profile.xml @@ -32,7 +32,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="20dp" - android:layout_marginTop="6dp" + android:layout_marginTop="10dp" android:gravity="center" android:text="@string/default_nposts" android:textStyle="bold" @@ -46,6 +46,7 @@ android:gravity="center" android:text="@string/default_nfollowers" android:textStyle="bold" + android:background="?attr/selectableItemBackgroundBorderless" app:layout_constraintBottom_toBottomOf="@+id/nbPostsTextView" app:layout_constraintEnd_toStartOf="@+id/nbFollowingTextView" app:layout_constraintStart_toEndOf="@+id/nbPostsTextView" @@ -59,6 +60,7 @@ android:gravity="center" android:text="@string/default_nfollowing" android:textStyle="bold" + android:background="?attr/selectableItemBackgroundBorderless" app:layout_constraintBottom_toBottomOf="@+id/nbFollowersTextView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="@+id/nbFollowersTextView" /> @@ -134,7 +136,7 @@ android:id="@+id/motionLayout" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_marginTop="6dp" + android:layout_marginTop="18dp" android:visibility="visible" app:layoutDescription="@xml/error_layout_xml_error_scene" app:layout_constraintEnd_toEndOf="parent" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a6c71c87..e408e90a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -127,22 +127,16 @@ For more info about Pixelfed, you can check here: https://pixelfed.org" This post is an album - "%d -Post" - "%d -Posts" + "%d\nPost" + "%d\nPosts" - "%d -Follower" - "%d -Followers" + "%d\nFollower" + "%d\nFollowers" - "%d -Following" - "%d -Following" + "%d\nFollowing" + "%d\nFollowing" Could not get follow status Could not display follow button