mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-27 20:09:11 +00:00
Show a toast when you've gone over the max media selection.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user