Fix crash on Emulator and TV

This commit is contained in:
Luna712 2024-07-11 17:26:07 -06:00 committed by GitHub
parent c9567c9694
commit 145482a32f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 221 additions and 236 deletions

View file

@ -112,6 +112,7 @@ class DownloadChildFragment : Fragment() {
if (!isMultiDeleteState) {
detachBackPressedCallback()
downloadsViewModel.clearSelectedItems()
binding?.downloadChildToolbar?.isVisible = true
}
}
observe(downloadsViewModel.selectedBytes) {
@ -161,6 +162,7 @@ class DownloadChildFragment : Fragment() {
private fun handleSelectedChange(selected: MutableList<VisualDownloadCached>) {
if (selected.isNotEmpty()) {
binding?.downloadDeleteAppbar?.isVisible = true
binding?.downloadChildToolbar?.isVisible = false
activity?.attachBackPressedCallback {
downloadsViewModel.setIsMultiDeleteState(false)
}

View file

@ -7,17 +7,13 @@
android:layout_height="match_parent"
android:background="?attr/primaryGrayBackground"
android:orientation="vertical"
tools:context=".ui.download.DownloadFragment">
tools:context=".ui.download.DownloadChildFragment">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/download_delete_appbar"
android:layout_width="match_parent"
@ -25,8 +21,7 @@
android:orientation="horizontal"
android:background="?attr/colorPrimary"
android:padding="8dp"
android:visibility="gone"
android:elevation="100dp">
android:visibility="gone">
<ImageView
android:id="@+id/btnCancel"
@ -83,10 +78,6 @@
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/download_child_toolbar"
android:layout_width="match_parent"
@ -97,8 +88,6 @@
app:navigationIconTint="?attr/iconColor"
app:titleTextColor="?attr/textColor"
tools:title="Overlord" />
</LinearLayout>
</FrameLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView

View file

@ -17,11 +17,6 @@
For Scroll add to LinearLayout
app:layout_scrollFlags="scroll|enterAlways"
-->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/download_delete_appbar"
android:layout_width="match_parent"
@ -195,7 +190,6 @@
tools:text="Free • 30.58GB" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView