diff --git a/app/src/main/java/com/simplemobiletools/gallery/Utils.java b/app/src/main/java/com/simplemobiletools/gallery/Utils.java index 99cd16ed0..bd3cbcbf9 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/Utils.java +++ b/app/src/main/java/com/simplemobiletools/gallery/Utils.java @@ -102,14 +102,17 @@ public class Utils { final Uri uri = Uri.fromFile(file); intent.setAction(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_STREAM, uri); - if (medium.getIsVideo()) { - intent.setType("video/*"); - } else { - intent.setType("image/*"); - } + intent.setType(getMimeType(medium)); activity.startActivity(Intent.createChooser(intent, shareTitle)); } + public static String getMimeType(Medium medium) { + if (medium.getIsVideo()) + return "video/*"; + else + return "image/*"; + } + public static void showSystemUI(ActionBar actionbar, Window window) { if (actionbar != null) actionbar.show(); diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java index 55910243a..01571c709 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java @@ -149,6 +149,9 @@ public class ViewPagerActivity extends SimpleActivity case R.id.menu_set_as_wallpaper: setAsWallpaper(); return true; + case R.id.menu_open_with: + openWith(); + return true; case R.id.menu_share: shareMedium(); return true; @@ -197,6 +200,18 @@ public class ViewPagerActivity extends SimpleActivity } } + private void openWith() { + final Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setDataAndType(Uri.fromFile(getCurrentFile()), Utils.getMimeType(getCurrentMedium())); + final Intent chooser = Intent.createChooser(intent, getString(R.string.open_with)); + + if (intent.resolveActivity(getPackageManager()) != null) { + startActivity(chooser); + } else { + Utils.showToast(getApplicationContext(), R.string.no_app_found); + } + } + @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == EDIT_IMAGE) { diff --git a/app/src/main/res/menu/viewpager_menu.xml b/app/src/main/res/menu/viewpager_menu.xml index 3ac3c6658..801f63da4 100644 --- a/app/src/main/res/menu/viewpager_menu.xml +++ b/app/src/main/res/menu/viewpager_menu.xml @@ -5,6 +5,10 @@ android:id="@+id/menu_set_as_wallpaper" android:title="@string/set_as_wallpaper" app:showAsAction="never"/> + Absteigend OK Abbrechen + Open with + No valid app found 1 Ordner gelöscht diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 6295e4fd9..0d3fc4220 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -29,6 +29,8 @@ Descendente Aceptar Cancelar + Open with + No valid app found 1 carpeta eliminada diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 837f24291..9314fecee 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -29,6 +29,8 @@ Descending OK Cancel + Open with + No valid app found 1 cartella eliminata diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 13cef7f9e..bb44813d2 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -29,6 +29,8 @@ Descending OK Cancel + Open with + No valid app found 1 フォルダーを削除しました diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index cf7d52388..f9867c1fe 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -29,6 +29,8 @@ Descendente OK Cancelar + Open with + No valid app found 1 pasta eliminada diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 1bff81531..9ea6571b2 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -29,6 +29,8 @@ Descending OK Cancel + Open with + No valid app found 1 mapp borttagen diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fc6fe1eb2..d516ddb3c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -29,6 +29,8 @@ Descending OK Cancel + Open with + No valid app found 1 folder deleted