From b327548c852e858fc879a40f0940f94a2fde8730 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 13 Nov 2020 12:50:05 +0100 Subject: [PATCH] show toast if no application found to attach --- .../siacs/conversations/ui/ConversationFragment.java | 10 ++++++++-- src/main/res/values/strings.xml | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 6ca868ba8..f0c3bc181 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -1048,10 +1048,11 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke return binding.getRoot(); } + @Override public void onDestroyView() { super.onDestroyView(); - Log.d(Config.LOGTAG,"ConversationFragment.onDestroyView()"); + Log.d(Config.LOGTAG, "ConversationFragment.onDestroyView()"); messageListAdapter.setOnContactPictureClicked(null); messageListAdapter.setOnContactPictureLongClicked(null); messageListAdapter.setOnQuoteListener(null); @@ -1729,7 +1730,10 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke break; } final Context context = getActivity(); - if (context != null && intent.resolveActivity(context.getPackageManager()) != null) { + if (context == null) { + return; + } + if (intent.resolveActivity(context.getPackageManager()) != null) { if (chooser) { startActivityForResult( Intent.createChooser(intent, getString(R.string.perform_action_with)), @@ -1737,6 +1741,8 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } else { startActivityForResult(intent, attachmentChoice); } + } else { + Toast.makeText(context, R.string.no_application_found, Toast.LENGTH_LONG).show(); } } diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 8362cc28c..f40317ea8 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -949,4 +949,5 @@ Failed deliveries More options + No application found