diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/TemplateAdapter.java b/app/src/main/java/com/owncloud/android/ui/adapter/TemplateAdapter.java index faac05a212..f9ed0b2d9f 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/TemplateAdapter.java +++ b/app/src/main/java/com/owncloud/android/ui/adapter/TemplateAdapter.java @@ -1,6 +1,7 @@ /* * Nextcloud - Android Client * + * SPDX-FileCopyrightText: 2024 Alper Ozturk * SPDX-FileCopyrightText: 2019 Chris Narkiewicz * SPDX-FileCopyrightText: 2018 Tobias Kaminsky * SPDX-FileCopyrightText: 2018 Nextcloud GmbH @@ -8,6 +9,7 @@ */ package com.owncloud.android.ui.adapter; +import android.annotation.SuppressLint; import android.content.Context; import android.graphics.drawable.Drawable; import android.view.LayoutInflater; @@ -35,11 +37,11 @@ import androidx.recyclerview.widget.RecyclerView; public class TemplateAdapter extends RecyclerView.Adapter { private TemplateList templateList = new TemplateList(); - private ClickListener clickListener; - private Context context; - private CurrentAccountProvider currentAccountProvider; - private ClientFactory clientFactory; - private String mimetype; + private final ClickListener clickListener; + private final Context context; + private final CurrentAccountProvider currentAccountProvider; + private final ClientFactory clientFactory; + private final String mimetype; private Template selectedTemplate; private final ViewThemeUtils viewThemeUtils; @@ -78,6 +80,7 @@ public class TemplateAdapter extends RecyclerView.Adapter) { val fragment = chooseTemplateDialogFragmentWeakReference.get() - if (fragment == null) { + if (fragment == null || !fragment.isAdded) { Log_OC.e(TAG, "Error streaming file: no previewMediaFragment!") return } diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/ChooseTemplateDialogFragment.kt b/app/src/main/java/com/owncloud/android/ui/dialog/ChooseTemplateDialogFragment.kt index 6b7a7a1dda..34740ce960 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/ChooseTemplateDialogFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/ChooseTemplateDialogFragment.kt @@ -167,7 +167,7 @@ class ChooseTemplateDialogFragment : DialogFragment(), View.OnClickListener, Tem return builder.create() } - @Suppress("TooGenericExceptionCaught") // legacy code + @Suppress("TooGenericExceptionCaught") private fun fetchTemplate() { try { val user = currentAccount.user diff --git a/app/src/main/res/color/card_border_selector.xml b/app/src/main/res/color/card_border_selector.xml new file mode 100644 index 0000000000..05079f5776 --- /dev/null +++ b/app/src/main/res/color/card_border_selector.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/app/src/main/res/drawable/rounded_rect_8dp.xml b/app/src/main/res/drawable/rounded_rect_8dp.xml new file mode 100644 index 0000000000..6715e05f79 --- /dev/null +++ b/app/src/main/res/drawable/rounded_rect_8dp.xml @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/template_button.xml b/app/src/main/res/layout/template_button.xml index e03adff689..1df1bd27b8 100644 --- a/app/src/main/res/layout/template_button.xml +++ b/app/src/main/res/layout/template_button.xml @@ -2,26 +2,36 @@ -