Handle Attachment Keyboard selection of a too large item.
This commit is contained in:
parent
bc5be10a0e
commit
c4dc9064e3
2 changed files with 10 additions and 2 deletions
|
@ -718,6 +718,10 @@ public class MediaSendActivity extends PassphraseRequiredActionBarActivity imple
|
||||||
case ITEM_TOO_LARGE:
|
case ITEM_TOO_LARGE:
|
||||||
Toast.makeText(this, R.string.MediaSendActivity_an_item_was_removed_because_it_exceeded_the_size_limit, Toast.LENGTH_LONG).show();
|
Toast.makeText(this, R.string.MediaSendActivity_an_item_was_removed_because_it_exceeded_the_size_limit, Toast.LENGTH_LONG).show();
|
||||||
break;
|
break;
|
||||||
|
case ONLY_ITEM_TOO_LARGE:
|
||||||
|
Toast.makeText(this, R.string.MediaSendActivity_an_item_was_removed_because_it_exceeded_the_size_limit, Toast.LENGTH_LONG).show();
|
||||||
|
onNoMediaAvailable();
|
||||||
|
break;
|
||||||
case TOO_MANY_ITEMS:
|
case TOO_MANY_ITEMS:
|
||||||
int maxSelection = viewModel.getMaxSelection();
|
int maxSelection = viewModel.getMaxSelection();
|
||||||
Toast.makeText(this, getResources().getQuantityString(R.plurals.MediaSendActivity_cant_share_more_than_n_items, maxSelection, maxSelection), Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, getResources().getQuantityString(R.plurals.MediaSendActivity_cant_share_more_than_n_items, maxSelection, maxSelection), Toast.LENGTH_SHORT).show();
|
||||||
|
|
|
@ -147,7 +147,11 @@ class MediaSendViewModel extends ViewModel {
|
||||||
List<Media> filteredMedia = getFilteredMedia(context, populatedMedia, mediaConstraints);
|
List<Media> filteredMedia = getFilteredMedia(context, populatedMedia, mediaConstraints);
|
||||||
|
|
||||||
if (filteredMedia.size() != newMedia.size()) {
|
if (filteredMedia.size() != newMedia.size()) {
|
||||||
error.setValue(Error.ITEM_TOO_LARGE);
|
if (filteredMedia.isEmpty() && newMedia.size() == 1 && page == Page.UNKNOWN) {
|
||||||
|
error.setValue(Error.ONLY_ITEM_TOO_LARGE);
|
||||||
|
} else {
|
||||||
|
error.setValue(Error.ITEM_TOO_LARGE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filteredMedia.size() > maxSelection) {
|
if (filteredMedia.size() > maxSelection) {
|
||||||
|
@ -670,7 +674,7 @@ class MediaSendViewModel extends ViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Error {
|
enum Error {
|
||||||
ITEM_TOO_LARGE, TOO_MANY_ITEMS, NO_ITEMS
|
ITEM_TOO_LARGE, TOO_MANY_ITEMS, NO_ITEMS, ONLY_ITEM_TOO_LARGE
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Event {
|
enum Event {
|
||||||
|
|
Loading…
Add table
Reference in a new issue