|
@@ -9,6 +9,7 @@ import android.os.Bundle;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
+import android.widget.Toast;
|
|
|
|
|
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
|
|
import com.nextcloud.client.utils.IntentUtil;
|
|
@@ -82,8 +83,14 @@ public class SendFilesDialog extends BottomSheetDialogFragment {
|
|
|
|
|
|
// populate send apps
|
|
|
Intent sendIntent = IntentUtil.createSendIntent(requireContext(), files);
|
|
|
+ List<ResolveInfo> matches = requireActivity().getPackageManager().queryIntentActivities(sendIntent, 0);
|
|
|
+ if (matches.isEmpty()) {
|
|
|
+ Toast.makeText(getContext(), R.string.no_send_app, Toast.LENGTH_SHORT).show();
|
|
|
+ dismiss();
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
- List<SendButtonData> sendButtonDataList = setupSendButtonData(sendIntent);
|
|
|
+ List<SendButtonData> sendButtonDataList = setupSendButtonData(matches);
|
|
|
|
|
|
SendButtonAdapter.ClickListener clickListener = setupSendButtonClickListener(sendIntent);
|
|
|
|
|
@@ -108,11 +115,11 @@ public class SendFilesDialog extends BottomSheetDialogFragment {
|
|
|
}
|
|
|
|
|
|
@NonNull
|
|
|
- private List<SendButtonData> setupSendButtonData(Intent sendIntent) {
|
|
|
+ private List<SendButtonData> setupSendButtonData(List<ResolveInfo> matches) {
|
|
|
Drawable icon;
|
|
|
SendButtonData sendButtonData;
|
|
|
CharSequence label;
|
|
|
- List<ResolveInfo> matches = requireActivity().getPackageManager().queryIntentActivities(sendIntent, 0);
|
|
|
+
|
|
|
List<SendButtonData> sendButtonDataList = new ArrayList<>(matches.size());
|
|
|
for (ResolveInfo match : matches) {
|
|
|
icon = match.loadIcon(requireActivity().getPackageManager());
|