Improve updates page UI + fix empty updates on refresh

This commit is contained in:
Rahul Patel
2024-07-20 23:55:51 +05:30
parent 8c7bf1b9bc
commit c406e56d6a
5 changed files with 26 additions and 19 deletions

View File

@@ -84,14 +84,14 @@ class AppUpdateView @JvmOverloads constructor(
context.getString(R.string.details_changelog_unavailable)
binding.headerIndicator.setOnClickListener {
if (binding.txtChangelog.isVisible) {
if (binding.cardChangelog.isVisible) {
binding.headerIndicator.icon =
ContextCompat.getDrawable(context, R.drawable.ic_arrow_down)
binding.txtChangelog.visibility = View.GONE
binding.cardChangelog.visibility = View.GONE
} else {
binding.headerIndicator.icon =
ContextCompat.getDrawable(context, R.drawable.ic_arrow_up)
binding.txtChangelog.visibility = View.VISIBLE
binding.cardChangelog.visibility = View.VISIBLE
}
}
}

View File

@@ -109,8 +109,6 @@ class UpdatesFragment : BaseFragment<FragmentUpdatesBinding>() {
viewModel.fetchingUpdates.collect {
binding.swipeRefreshLayout.isRefreshing = it
if (it && viewModel.updates.value.isNullOrEmpty()) {
updateController(null)
} else {
updateController(emptyMap())
}
}

View File

@@ -28,8 +28,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="@dimen/padding_small"
android:paddingEnd="@dimen/padding_xsmall">
android:paddingStart="@dimen/padding_medium"
android:paddingTop="@dimen/padding_xsmall"
android:paddingEnd="@dimen/padding_small"
android:paddingBottom="@dimen/padding_xsmall">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/img_icon"

View File

@@ -116,16 +116,23 @@
android:layout_alignParentEnd="true"
android:gravity="center" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/txt_changelog"
<androidx.cardview.widget.CardView
android:id="@+id/card_changelog"
style="@style/Widget.Material3.CardView.Outlined"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txt_line4"
android:background="@drawable/bg_changelog"
android:ellipsize="end"
android:minHeight="?actionBarSize"
android:singleLine="false"
android:textAppearance="@style/TextAppearance.Aurora.Line2"
android:textIsSelectable="true"
android:visibility="gone" />
android:visibility="gone">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/txt_changelog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_changelog"
android:ellipsize="end"
android:minHeight="?actionBarSize"
android:singleLine="false"
android:textAppearance="@style/TextAppearance.Aurora.Line2"
android:textIsSelectable="true" />
</androidx.cardview.widget.CardView>
</RelativeLayout>

View File

@@ -36,7 +36,7 @@
<com.google.android.material.button.MaterialButton
android:id="@+id/btnPositive"
style="@style/Widget.Material3.Button.OutlinedButton"
style="@style/Widget.Material3.Button.TonalButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/action_update"
@@ -49,7 +49,7 @@
<com.google.android.material.button.MaterialButton
android:id="@+id/btnQueued"
style="@style/Widget.Material3.Button.OutlinedButton"
style="@style/Widget.Material3.Button.TonalButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
@@ -63,7 +63,7 @@
<com.google.android.material.button.MaterialButton
android:id="@+id/btnNegative"
style="@style/Widget.Material3.Button.OutlinedButton"
style="@style/Widget.Material3.Button.TonalButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/action_cancel"