diff --git a/app/src/main/java/eu/faircode/email/ActivityBase.java b/app/src/main/java/eu/faircode/email/ActivityBase.java index 28048f32f8..8437477b44 100644 --- a/app/src/main/java/eu/faircode/email/ActivityBase.java +++ b/app/src/main/java/eu/faircode/email/ActivityBase.java @@ -396,7 +396,10 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc super.startActivityForResult(intent, requestCode); } catch (ActivityNotFoundException ex) { Log.w(ex); - ToastEx.makeText(this, getString(R.string.title_no_viewer, intent), Toast.LENGTH_LONG).show(); + if (Helper.isTnef(intent.getType())) + Helper.viewFAQ(this, 155); + else + ToastEx.makeText(this, getString(R.string.title_no_viewer, intent), Toast.LENGTH_LONG).show(); } catch (Throwable ex) { Log.e(ex); ToastEx.makeText(this, Log.formatThrowable(ex), Toast.LENGTH_LONG).show(); diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java index b2cb135fcc..6c27fbcbb2 100644 --- a/app/src/main/java/eu/faircode/email/Helper.java +++ b/app/src/main/java/eu/faircode/email/Helper.java @@ -526,22 +526,11 @@ public class Helper { } } else context.startActivity(intent); - } else { - try { - context.startActivity(intent); - } catch (ActivityNotFoundException ex) { - if (isTnef(type)) - viewFAQ(context, 155); - else { - String message = context.getString(R.string.title_no_viewer, - type != null ? type : name != null ? name : file.getName()); - ToastEx.makeText(context, message, Toast.LENGTH_LONG).show(); - } - } - } + } else + context.startActivity(intent); } - private static boolean isTnef(String type) { + static boolean isTnef(String type) { // https://en.wikipedia.org/wiki/Transport_Neutral_Encapsulation_Format return ("application/ms-tnef".equals(type) || "application/vnd.ms-tnef".equals(type));