Profile fixes
This commit is contained in:
parent
c2dd66c54f
commit
4096af2872
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -127,22 +127,16 @@ For more info about Pixelfed, you can check here: https://pixelfed.org"</string>
|
|||
<string name="post_is_album">This post is an album</string>
|
||||
<!-- Profile page -->
|
||||
<plurals name="nb_posts">
|
||||
<item quantity="one">"%d
|
||||
Post"</item>
|
||||
<item quantity="other">"%d
|
||||
Posts"</item>
|
||||
<item quantity="one">"%d\nPost"</item>
|
||||
<item quantity="other">"%d\nPosts"</item>
|
||||
</plurals>
|
||||
<plurals name="nb_followers">
|
||||
<item quantity="one">"%d
|
||||
Follower"</item>
|
||||
<item quantity="other">"%d
|
||||
Followers"</item>
|
||||
<item quantity="one">"%d\nFollower"</item>
|
||||
<item quantity="other">"%d\nFollowers"</item>
|
||||
</plurals>
|
||||
<plurals name="nb_following">
|
||||
<item quantity="one">"%d
|
||||
Following"</item>
|
||||
<item quantity="other">"%d
|
||||
Following"</item>
|
||||
<item quantity="one">"%d\nFollowing"</item>
|
||||
<item quantity="other">"%d\nFollowing"</item>
|
||||
</plurals>
|
||||
<string name="follow_status_failed">Could not get follow status</string>
|
||||
<string name="follow_button_failed">Could not display follow button</string>
|
||||
|
|
Loading…
Reference in New Issue