diff --git a/jami-android/app/src/main/java/cx/ring/utils/AndroidFileUtils.kt b/jami-android/app/src/main/java/cx/ring/utils/AndroidFileUtils.kt index 2d8376caf343ba6ed1cd2e446a689c58685bf1e8..7379897576674211b1dfee9bee3a8742b983eab2 100644 --- a/jami-android/app/src/main/java/cx/ring/utils/AndroidFileUtils.kt +++ b/jami-android/app/src/main/java/cx/ring/utils/AndroidFileUtils.kt @@ -35,6 +35,8 @@ import android.system.Os import android.text.TextUtils import android.util.Log import android.webkit.MimeTypeMap +import android.widget.Toast +import cx.ring.R import io.reactivex.rxjava3.core.Completable import io.reactivex.rxjava3.core.Single import io.reactivex.rxjava3.schedulers.Schedulers @@ -544,14 +546,14 @@ object AndroidFileUtils { fun openFile(c: Context, uri: Uri, displayName: String) { try { - //startActivity(Intent.createChooser(sendIntent, null)); c.startActivity(Intent(Intent.ACTION_VIEW).apply { addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) setDataAndType(uri, c.contentResolver.getType(uri.buildUpon().appendPath(displayName).build())) putExtra(Intent.EXTRA_STREAM, uri) }) } catch (e: Exception) { - Log.e(TAG, "File of unknown type, could not open: $displayName") + Toast.makeText(c, + c.getString(R.string.error_open_no_app_found, displayName), Toast.LENGTH_SHORT).show() } } diff --git a/jami-android/app/src/main/res/values/strings.xml b/jami-android/app/src/main/res/values/strings.xml index e7f8b658040983e30494d70f1b2250ccddd91a93..bb52e3abb77afb715e774273cd83c36c03813587 100644 --- a/jami-android/app/src/main/res/values/strings.xml +++ b/jami-android/app/src/main/res/values/strings.xml @@ -450,6 +450,6 @@ along with this program; if not, write to the Free Software <string name="picker_btn">Select contacts</string> <string name="bottomsheet_contact">Contact Jami\n%1$s</string> <string name="bottomsheet_remove">Remove from the swarm</string> - + <string name="error_open_no_app_found">No application found to handle this file: %1$s</string> </resources>