3
3
Fork 1
mirror of https://github.com/recloudstream/cloudstream.git synced 2024-08-15 01:53:11 +00:00

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
app/src/main
java/com/lagradost/cloudstream3/ui/download
res/layout

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,98 +7,87 @@
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
<LinearLayout
android:id="@+id/download_delete_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="?attr/colorPrimary"
android:padding="8dp"
android:visibility="gone">
<LinearLayout
android:id="@+id/download_delete_appbar"
android:layout_width="match_parent"
<ImageView
android:id="@+id/btnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="?attr/colorPrimary"
android:background="?attr/selectableItemBackground"
android:src="@drawable/ic_baseline_close_24"
android:contentDescription="@string/cancel"
android:padding="8dp"
android:visibility="gone"
android:elevation="100dp">
android:layout_gravity="center_vertical"
app:tint="@android:color/white" />
<ImageView
android:id="@+id/btnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:src="@drawable/ic_baseline_close_24"
android:contentDescription="@string/cancel"
android:padding="8dp"
android:layout_gravity="center_vertical"
app:tint="@android:color/white" />
<Button
android:id="@+id/btnDelete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:text="@string/delete"
android:textColor="@android:color/white"
android:layout_gravity="center_vertical" />
<Button
android:id="@+id/btnDelete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:text="@string/delete"
android:textColor="@android:color/white"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/selectItemsText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:text="@string/downloads_delete_select"
android:textColor="@android:color/white"
android:layout_gravity="center_vertical"
android:visibility="gone" />
<TextView
android:id="@+id/selectItemsText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:text="@string/downloads_delete_select"
android:textColor="@android:color/white"
android:layout_gravity="center_vertical"
android:visibility="gone" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<Button
android:id="@+id/btnSelectAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:text="@string/select_all"
android:textColor="@android:color/white"
android:layout_marginEnd="8dp" />
<Button
android:id="@+id/btnSelectAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:text="@string/select_all"
android:textColor="@android:color/white"
android:layout_marginEnd="8dp" />
<Button
android:id="@+id/btnDeselectAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:text="@string/deselect_all"
android:textColor="@android:color/white"
android:layout_marginEnd="8dp"
android:visibility="gone" />
</LinearLayout>
<Button
android:id="@+id/btnDeselectAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:text="@string/deselect_all"
android:textColor="@android:color/white"
android:layout_marginEnd="8dp"
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"
android:layout_height="wrap_content"
android:background="?attr/primaryGrayBackground"
android:paddingTop="@dimen/navbar_height"
app:layout_scrollFlags="scroll|enterAlways"
app:navigationIconTint="?attr/iconColor"
app:titleTextColor="?attr/textColor"
tools:title="Overlord" />
</LinearLayout>
</FrameLayout>
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/download_child_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/primaryGrayBackground"
android:paddingTop="@dimen/navbar_height"
app:layout_scrollFlags="scroll|enterAlways"
app:navigationIconTint="?attr/iconColor"
app:titleTextColor="?attr/textColor"
tools:title="Overlord" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView

View file

@ -17,185 +17,179 @@
For Scroll add to LinearLayout
app:layout_scrollFlags="scroll|enterAlways"
-->
<FrameLayout
<LinearLayout
android:id="@+id/download_delete_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="?attr/colorPrimary"
android:padding="8dp"
android:visibility="gone">
<LinearLayout
android:id="@+id/download_delete_appbar"
android:layout_width="match_parent"
<ImageView
android:id="@+id/btnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="?attr/colorPrimary"
android:background="?attr/selectableItemBackground"
android:src="@drawable/ic_baseline_close_24"
android:contentDescription="@string/cancel"
android:padding="8dp"
android:visibility="gone">
android:layout_gravity="center_vertical"
app:tint="@android:color/white" />
<ImageView
android:id="@+id/btnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:src="@drawable/ic_baseline_close_24"
android:contentDescription="@string/cancel"
android:padding="8dp"
android:layout_gravity="center_vertical"
app:tint="@android:color/white" />
<Button
android:id="@+id/btnDelete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:text="@string/delete"
android:textColor="@android:color/white"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/selectItemsText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:text="@string/downloads_delete_select"
android:textColor="@android:color/white"
android:layout_gravity="center_vertical"
android:visibility="gone" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<Button
android:id="@+id/btnSelectAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:text="@string/select_all"
android:textColor="@android:color/white"
android:layout_marginEnd="8dp" />
<Button
android:id="@+id/btnDeselectAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:text="@string/deselect_all"
android:textColor="@android:color/white"
android:layout_marginEnd="8dp"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:id="@+id/download_storage_appbar"
android:layout_width="match_parent"
<Button
android:id="@+id/btnDelete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
android:background="?attr/selectableItemBackground"
android:text="@string/delete"
android:textColor="@android:color/white"
android:layout_gravity="center_vertical" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="@string/download_storage_text"
android:textColor="?attr/textColor" />
<TextView
android:id="@+id/selectItemsText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:text="@string/downloads_delete_select"
android:textColor="@android:color/white"
android:layout_gravity="center_vertical"
android:visibility="gone" />
<androidx.cardview.widget.CardView
android:layout_width="fill_parent"
android:layout_height="12dp"
android:layout_marginBottom="5dp"
android:elevation="0dp"
app:cardCornerRadius="@dimen/storage_radius"
app:cardElevation="0dp"
app:cardMaxElevation="0dp">
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/btnSelectAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:text="@string/select_all"
android:textColor="@android:color/white"
android:layout_marginEnd="8dp" />
<View
android:id="@+id/download_used"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:background="@drawable/storage_bar_left" />
<Button
android:id="@+id/btnDeselectAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:text="@string/deselect_all"
android:textColor="@android:color/white"
android:layout_marginEnd="8dp"
android:visibility="gone" />
</LinearLayout>
<View
android:id="@+id/download_app"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.10"
android:background="@drawable/storage_bar_mid" />
<LinearLayout
android:id="@+id/download_storage_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<View
android:id="@+id/download_free"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.10"
android:background="@drawable/storage_bar_right" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="@string/download_storage_text"
android:textColor="?attr/textColor" />
<androidx.cardview.widget.CardView
android:layout_width="fill_parent"
android:layout_height="12dp"
android:layout_marginBottom="5dp"
android:elevation="0dp"
app:cardCornerRadius="@dimen/storage_radius"
app:cardElevation="0dp"
app:cardMaxElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<View
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center_vertical"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:background="@drawable/storage_bar_left_box" />
<TextView
android:id="@+id/download_used_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textColor="?attr/textColor"
android:textSize="12sp"
tools:text="Used • 30.58GB" />
android:id="@+id/download_used"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:background="@drawable/storage_bar_left" />
<View
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center_vertical"
android:layout_margin="5dp"
android:background="@drawable/storage_bar_mid_box" />
<TextView
android:id="@+id/download_app_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textColor="?attr/textColor"
android:textSize="12sp"
tools:text="App • 30.58GB" />
android:id="@+id/download_app"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.10"
android:background="@drawable/storage_bar_mid" />
<View
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center_vertical"
android:layout_margin="5dp"
android:background="@drawable/storage_bar_right_box" />
<TextView
android:id="@+id/download_free_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textColor="?attr/textColor"
android:textSize="12sp"
tools:text="Free • 30.58GB" />
android:id="@+id/download_free"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.10"
android:background="@drawable/storage_bar_right" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<View
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center_vertical"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:background="@drawable/storage_bar_left_box" />
<TextView
android:id="@+id/download_used_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textColor="?attr/textColor"
android:textSize="12sp"
tools:text="Used • 30.58GB" />
<View
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center_vertical"
android:layout_margin="5dp"
android:background="@drawable/storage_bar_mid_box" />
<TextView
android:id="@+id/download_app_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textColor="?attr/textColor"
android:textSize="12sp"
tools:text="App • 30.58GB" />
<View
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center_vertical"
android:layout_margin="5dp"
android:background="@drawable/storage_bar_right_box" />
<TextView
android:id="@+id/download_free_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textColor="?attr/textColor"
android:textSize="12sp"
tools:text="Free • 30.58GB" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
@ -224,11 +218,11 @@
<!--
<ProgressBar
android:visibility="visible"
tools:visibility="gone"
android:id="@+id/download_loading"
android:layout_gravity="center"
android:layout_width="50dp" android:layout_height="50dp">
android:visibility="visible"
tools:visibility="gone"
android:id="@+id/download_loading"
android:layout_gravity="center"
android:layout_width="50dp" android:layout_height="50dp">
</ProgressBar>-->
<com.facebook.shimmer.ShimmerFrameLayout