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(); return binding.getRoot();
} }
@Override @Override
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();
@ -1729,7 +1730,10 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
break; break;
} }
final Context context = getActivity(); final Context context = getActivity();
if (context != null && intent.resolveActivity(context.getPackageManager()) != null) { if (context == null) {
return;
}
if (intent.resolveActivity(context.getPackageManager()) != null) {
if (chooser) { if (chooser) {
startActivityForResult( startActivityForResult(
Intent.createChooser(intent, getString(R.string.perform_action_with)), Intent.createChooser(intent, getString(R.string.perform_action_with)),
@ -1737,6 +1741,8 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
} else { } else {
startActivityForResult(intent, attachmentChoice); startActivityForResult(intent, attachmentChoice);
} }
} else {
Toast.makeText(context, R.string.no_application_found, Toast.LENGTH_LONG).show();
} }
} }

View file

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