Эх сурвалжийг харах

Merge pull request #13534 from nextcloud/always-download-preference

Always download if image is unsupported
Alper Öztürk 6 сар өмнө
parent
commit
6f08389417

+ 1 - 1
app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java

@@ -474,7 +474,7 @@ public final class ThumbnailsCacheManager {
                             }
                         } else {
                             if (fileFragment instanceof PreviewImageFragment) {
-                                ((PreviewImageFragment) fileFragment).setErrorPreviewMessage();
+                                ((PreviewImageFragment) fileFragment).handleUnsupportedImage();
                             }
                         }
                     }).start();

+ 4 - 18
app/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.kt

@@ -721,28 +721,14 @@ class PreviewImageFragment : FileFragment(), Injectable {
         binding.emptyListProgress.visibility = View.GONE
     }
 
-    fun setErrorPreviewMessage() {
+    fun handleUnsupportedImage() {
         try {
-            if (activity != null) {
+            (activity as? PreviewImageActivity)?.requestForDownload(file) ?: context?.let {
                 Snackbar.make(
                     binding.emptyListView,
-                    R.string.resized_image_not_possible_download,
+                    resources.getString(R.string.could_not_download_image),
                     Snackbar.LENGTH_INDEFINITE
-                )
-                    .setAction(
-                        R.string.common_yes
-                    ) { v: View? ->
-                        val activity = activity as PreviewImageActivity?
-                        if (activity != null) {
-                            activity.requestForDownload(file)
-                        } else if (context != null) {
-                            Snackbar.make(
-                                binding.emptyListView,
-                                resources.getString(R.string.could_not_download_image),
-                                Snackbar.LENGTH_INDEFINITE
-                            ).show()
-                        }
-                    }.show()
+                ).show()
             }
         } catch (e: IllegalArgumentException) {
             Log_OC.d(TAG, e.message)

+ 0 - 2
app/src/main/res/values/strings.xml

@@ -727,8 +727,6 @@
 
     <string name="sync_in_progress">Fetching most recent version of the file.</string>
 
-    <string name="resized_image_not_possible_download">No resized image available. Download full image?</string>
-
     <string name="store_short_desc">The self-hosted productivity platform that keeps you in control</string>
     <string name="store_full_desc">The self-hosted productivity platform that keeps you in control.\n\nFeatures:\n* Easy, modern interface, suited to the theme of your server\n* Upload files to your Nextcloud server\n* Share them with others\n* Keep your favorite files and folders synced\n* Search across all folders on your server\n* Auto Upload for photos and videos taken by your device\n* Keep up to date with notifications\n* Multi-account support\n* Secure access to your data with fingerprint or PIN\n* Integration with DAVx5 (formerly known as DAVdroid) for easy setup of calendar and contacts synchronization\n\nPlease report all issues at https://github.com/nextcloud/android/issues and discuss this app at https://help.nextcloud.com/c/clients/android\n\nNew to Nextcloud? Nextcloud is a private file sync and share and communication server. It is libre software, and you can host it yourself or pay a company to do it for you. That way, you are in control of your photos, your calendar and contact data, your documents and everything else.\n\nCheck out Nextcloud at https://nextcloud.com</string>