mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-30 13:35:18 +00:00
Show a toast when you've gone over the max media selection.
This commit is contained in:
parent
4643dea2ad
commit
a6f31c60bd
@ -440,6 +440,10 @@
|
||||
|
||||
<!-- MediaPickerItemFragment -->
|
||||
<string name="MediaPickerItemFragment_tap_to_select">Tap to select</string>
|
||||
<plurals name="MediaPickerItemFragment_cant_share_more_than_n_items">
|
||||
<item quantity="one">You can\'t share more than %d item.</item>
|
||||
<item quantity="other">You can\'t share more than %d items.</item>
|
||||
</plurals>
|
||||
|
||||
<!-- MediaSendActivity -->
|
||||
<string name="MediaSendActivity_add_a_caption">Add a caption...</string>
|
||||
|
@ -134,6 +134,8 @@ public class MediaPickerItemAdapter extends RecyclerView.Adapter<MediaPickerItem
|
||||
if (selected.size() < maxSelection) {
|
||||
selected.add(media);
|
||||
eventListener.onMediaSelectionChanged(new ArrayList<>(selected));
|
||||
} else {
|
||||
eventListener.onMediaSelectionOverflow(maxSelection);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -147,5 +149,6 @@ public class MediaPickerItemAdapter extends RecyclerView.Adapter<MediaPickerItem
|
||||
interface EventListener {
|
||||
void onMediaChosen(@NonNull Media media);
|
||||
void onMediaSelectionChanged(@NonNull List<Media> media);
|
||||
void onMediaSelectionOverflow(int maxSelection);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user