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

View file

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

View file

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