show toast if no application found to attach

This commit is contained in:
Daniel Gultsch 2020-11-13 12:50:05 +01:00
parent aaebb3a536
commit b327548c85
2 changed files with 9 additions and 2 deletions

View file

@ -1048,6 +1048,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
return binding.getRoot();
}
@Override
public void onDestroyView() {
super.onDestroyView();
@ -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();
}
}

View file

@ -949,4 +949,5 @@
</plurals>
<string name="failed_deliveries">Failed deliveries</string>
<string name="more_options">More options</string>
<string name="no_application_found">No application found</string>
</resources>