Ensure toasts don't get queued up

This commit is contained in:
Huxley Oosthuizen 2015-08-03 12:34:11 +02:00
parent 7090da920c
commit e414ce5b54
1 changed files with 6 additions and 3 deletions

View File

@ -79,6 +79,7 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
protected FileItemAdapter<T> mAdapter = null;
protected TextView mCurrentDirView;
protected SortedList<T> mFiles = null;
protected Toast mToast = null;
protected FileItemAdapter<T> getAdapter() {
return mAdapter;
@ -162,9 +163,11 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
// Some invalid cases first
if ((allowMultiple || mode == MODE_FILE) && mCheckedItems.isEmpty()) {
Toast.makeText(getActivity(),
R.string.nnf_select_something_first,
Toast.LENGTH_SHORT).show();
if (mToast == null) {
mToast = Toast.makeText(getActivity(), R.string.nnf_select_something_first,
Toast.LENGTH_SHORT);
}
mToast.show();
return;
}