From 147046b7b4202259abec03f5b101f8d89bbb7d2a Mon Sep 17 00:00:00 2001 From: Matthieu <24-artectrex@users.noreply.shinice.net> Date: Mon, 31 Oct 2022 01:37:44 +0100 Subject: [PATCH] Make load spinner exist again --- .../app/posts/feeds/CommonFeedFragmentUtils.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/pixeldroid/app/posts/feeds/CommonFeedFragmentUtils.kt b/app/src/main/java/org/pixeldroid/app/posts/feeds/CommonFeedFragmentUtils.kt index 89c4f4ff..08b12511 100644 --- a/app/src/main/java/org/pixeldroid/app/posts/feeds/CommonFeedFragmentUtils.kt +++ b/app/src/main/java/org/pixeldroid/app/posts/feeds/CommonFeedFragmentUtils.kt @@ -31,8 +31,7 @@ import retrofit2.HttpException private fun showError( errorText: String, show: Boolean = true, motionLayout: MotionLayout, - errorLayout: ErrorLayoutBinding, - progressBar: ProgressBar){ + errorLayout: ErrorLayoutBinding){ if(show) { motionLayout.transitionToEnd() @@ -40,7 +39,6 @@ private fun showError( } else if(motionLayout.progress == 1F) { motionLayout.transitionToStart() } - progressBar.visibility = View.GONE } /** @@ -87,7 +85,7 @@ internal fun initAdapter( val error: String = (it.error as? HttpException)?.response()?.errorBody()?.string()?.ifEmpty { null }?.let { s -> Gson().fromJson(s, org.pixeldroid.app.utils.api.objects.Error::class.java)?.error?.ifBlank { null } } ?: it.error.localizedMessage.orEmpty() - showError(motionLayout = motionLayout, errorLayout = errorLayout, errorText = error, progressBar = progressBar) + showError(motionLayout = motionLayout, errorLayout = errorLayout, errorText = error) } // If the state is not an error, hide the error layout, or show message that the feed is empty @@ -100,10 +98,9 @@ internal fun initAdapter( showError( motionLayout = motionLayout, errorLayout = errorLayout, errorText = errorLayout.root.context.getString(R.string.empty_feed), - progressBar = progressBar ) } else { - showError(motionLayout = motionLayout, errorLayout = errorLayout, show = false, errorText = "", progressBar = progressBar) + showError(motionLayout = motionLayout, errorLayout = errorLayout, show = false, errorText = "") } } }