Fix re-enabling tab switching in MediaOverview.

We were being inconsistent in how we were handling exiting multiselect,
and it wasn't behaving properly when you left by clicking the 'x'. Now
it's all handled centrally.

Fixes #8234
This commit is contained in:
Greyson Parrelli 2018-10-01 23:38:07 -07:00
parent bc6941589c
commit 2c5fa155ae

View File

@ -286,7 +286,7 @@ public class MediaOverviewActivity extends PassphraseRequiredActionBarActivity {
adapter.toggleSelection(mediaRecord); adapter.toggleSelection(mediaRecord);
if (adapter.getSelectedMediaCount() == 0) { if (adapter.getSelectedMediaCount() == 0) {
exitMultiSelect(); actionMode.finish();
} else { } else {
actionMode.setTitle(String.valueOf(adapter.getSelectedMediaCount())); actionMode.setTitle(String.valueOf(adapter.getSelectedMediaCount()));
} }
@ -360,7 +360,7 @@ public class MediaOverviewActivity extends PassphraseRequiredActionBarActivity {
attachments.size()); attachments.size());
saveTask.executeOnExecutor(THREAD_POOL_EXECUTOR, saveTask.executeOnExecutor(THREAD_POOL_EXECUTOR,
attachments.toArray(new SaveAttachmentTask.Attachment[attachments.size()])); attachments.toArray(new SaveAttachmentTask.Attachment[attachments.size()]));
exitMultiSelect(); actionMode.finish();
} }
}.execute(); }.execute();
}) })
@ -422,12 +422,6 @@ public class MediaOverviewActivity extends PassphraseRequiredActionBarActivity {
((MediaOverviewActivity) getActivity()).onEnterMultiSelect(); ((MediaOverviewActivity) getActivity()).onEnterMultiSelect();
} }
private void exitMultiSelect() {
actionMode.finish();
actionMode = null;
((MediaOverviewActivity) getActivity()).onExitMultiSelect();
}
private class ActionModeCallback implements ActionMode.Callback { private class ActionModeCallback implements ActionMode.Callback {
private int originalStatusBarColor; private int originalStatusBarColor;
@ -458,7 +452,7 @@ public class MediaOverviewActivity extends PassphraseRequiredActionBarActivity {
return true; return true;
case R.id.delete: case R.id.delete:
handleDeleteMedia(getListAdapter().getSelectedMedia()); handleDeleteMedia(getListAdapter().getSelectedMedia());
exitMultiSelect(); actionMode.finish();
return true; return true;
case R.id.select_all: case R.id.select_all:
handleSelectAllMedia(); handleSelectAllMedia();
@ -471,6 +465,7 @@ public class MediaOverviewActivity extends PassphraseRequiredActionBarActivity {
public void onDestroyActionMode(ActionMode mode) { public void onDestroyActionMode(ActionMode mode) {
actionMode = null; actionMode = null;
getListAdapter().clearSelection(); getListAdapter().clearSelection();
((MediaOverviewActivity) getActivity()).onExitMultiSelect();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getActivity().getWindow().setStatusBarColor(originalStatusBarColor); getActivity().getWindow().setStatusBarColor(originalStatusBarColor);