Skip to content

Commit

Permalink
Merge pull request #8 from Noisyfox/master
Browse files Browse the repository at this point in the history
对文件操作菜单的一些小改进
  • Loading branch information
haonan committed Apr 16, 2012
2 parents 5c2124d + b9f00b3 commit c10bf0a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/net/micode/fileexplorer/FileListItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ public void onClick(View v) {
} else {
tag.Selected = !tag.Selected;
}

Util.updateActionModeTitle(actionMode, mContext,
mFileViewInteractionHub.getSelectedFileList().size());
}
Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 4 additions & 0 deletions src/net/micode/fileexplorer/FileViewInteractionHub.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions src/net/micode/fileexplorer/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}

Expand Down

0 comments on commit c10bf0a

Please sign in to comment.