diff --git a/src/net/micode/fileexplorer/FileListItem.java b/src/net/micode/fileexplorer/FileListItem.java index 9ee85ca..2542925 100644 --- a/src/net/micode/fileexplorer/FileListItem.java +++ b/src/net/micode/fileexplorer/FileListItem.java @@ -101,7 +101,6 @@ public void onClick(View v) { } else { tag.Selected = !tag.Selected; } - Util.updateActionModeTitle(actionMode, mContext, mFileViewInteractionHub.getSelectedFileList().size()); } @@ -144,6 +143,10 @@ public boolean onCreateActionMode(ActionMode mode, Menu menu) { public boolean onPrepareActionMode(ActionMode mode, Menu menu) { mMenu.findItem(R.id.action_copy_path).setVisible( mFileViewInteractionHub.getSelectedFileList().size() == 1); + mMenu.findItem(R.id.action_cancel).setVisible( + mFileViewInteractionHub.isSelected()); + mMenu.findItem(R.id.action_select_all).setVisible( + !mFileViewInteractionHub.isSelectedAll()); return true; } diff --git a/src/net/micode/fileexplorer/FileViewInteractionHub.java b/src/net/micode/fileexplorer/FileViewInteractionHub.java index f5cbffa..8073715 100644 --- a/src/net/micode/fileexplorer/FileViewInteractionHub.java +++ b/src/net/micode/fileexplorer/FileViewInteractionHub.java @@ -1029,6 +1029,10 @@ private boolean isSelectingFiles() { public boolean isSelectedAll() { return mFileViewListener.getItemCount() != 0 && mCheckedFileNameList.size() == mFileViewListener.getItemCount(); } + + public boolean isSelected() { + return mCheckedFileNameList.size() != 0; + } public void clearSelection() { if (mCheckedFileNameList.size() > 0) { diff --git a/src/net/micode/fileexplorer/Util.java b/src/net/micode/fileexplorer/Util.java index 7c3575c..41f764f 100644 --- a/src/net/micode/fileexplorer/Util.java +++ b/src/net/micode/fileexplorer/Util.java @@ -400,6 +400,9 @@ public static String formatDateString(Context context, long time) { public static void updateActionModeTitle(ActionMode mode, Context context, int selectedNum) { if (mode != null) { mode.setTitle(context.getString(R.string.multi_select_title,selectedNum)); + if(selectedNum == 0){ + mode.finish(); + } } }