diff --git a/res/values/strings.xml b/res/values/strings.xml index 346616d71b..2f548bdc8b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -440,6 +440,10 @@ Tap to select + + You can\'t share more than %d item. + You can\'t share more than %d items. + Add a caption... diff --git a/src/org/thoughtcrime/securesms/mediasend/MediaPickerItemAdapter.java b/src/org/thoughtcrime/securesms/mediasend/MediaPickerItemAdapter.java index 03a3d47407..651c8c4874 100644 --- a/src/org/thoughtcrime/securesms/mediasend/MediaPickerItemAdapter.java +++ b/src/org/thoughtcrime/securesms/mediasend/MediaPickerItemAdapter.java @@ -134,6 +134,8 @@ public class MediaPickerItemAdapter extends RecyclerView.Adapter(selected)); + } else { + eventListener.onMediaSelectionOverflow(maxSelection); } }); } @@ -147,5 +149,6 @@ public class MediaPickerItemAdapter extends RecyclerView.Adapter media); + void onMediaSelectionOverflow(int maxSelection); } } diff --git a/src/org/thoughtcrime/securesms/mediasend/MediaPickerItemFragment.java b/src/org/thoughtcrime/securesms/mediasend/MediaPickerItemFragment.java index 3018b93352..5af64e20e2 100644 --- a/src/org/thoughtcrime/securesms/mediasend/MediaPickerItemFragment.java +++ b/src/org/thoughtcrime/securesms/mediasend/MediaPickerItemFragment.java @@ -22,6 +22,7 @@ import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; +import android.widget.Toast; import org.thoughtcrime.securesms.R; import org.thoughtcrime.securesms.mms.GlideApp; @@ -167,6 +168,11 @@ public class MediaPickerItemFragment extends Fragment implements MediaPickerItem viewModel.onSelectedMediaChanged(selected); } + @Override + public void onMediaSelectionOverflow(int maxSelection) { + Toast.makeText(requireContext(), getResources().getQuantityString(R.plurals.MediaPickerItemFragment_cant_share_more_than_n_items, maxSelection, maxSelection), Toast.LENGTH_SHORT).show(); + } + private void initToolbar(Toolbar toolbar) { ((AppCompatActivity) requireActivity()).setSupportActionBar(toolbar); ((AppCompatActivity) requireActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);