display the Properties menu button at multiple items selected too
This commit is contained in:
parent
3d123098a9
commit
1b4ff76566
|
@ -73,6 +73,7 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
||||||
private Snackbar mSnackbar;
|
private Snackbar mSnackbar;
|
||||||
private AlertDialog mCopyDialog;
|
private AlertDialog mCopyDialog;
|
||||||
private TextView mDestinationView;
|
private TextView mDestinationView;
|
||||||
|
private Config mConfig;
|
||||||
|
|
||||||
private boolean mShowHidden;
|
private boolean mShowHidden;
|
||||||
private int mSelectedItemsCnt;
|
private int mSelectedItemsCnt;
|
||||||
|
@ -90,7 +91,8 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
if (mStates == null)
|
if (mStates == null)
|
||||||
mStates = new HashMap<>();
|
mStates = new HashMap<>();
|
||||||
mShowHidden = Config.newInstance(getContext()).getShowHidden();
|
mConfig = Config.newInstance(getContext());
|
||||||
|
mShowHidden = mConfig.getShowHidden();
|
||||||
mItems = new ArrayList<>();
|
mItems = new ArrayList<>();
|
||||||
mToBeDeleted = new ArrayList<>();
|
mToBeDeleted = new ArrayList<>();
|
||||||
fillItems();
|
fillItems();
|
||||||
|
@ -100,7 +102,7 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (mShowHidden != Config.newInstance(getContext()).getShowHidden()) {
|
if (mShowHidden != mConfig.getShowHidden()) {
|
||||||
mShowHidden = !mShowHidden;
|
mShowHidden = !mShowHidden;
|
||||||
mStates.remove(mPath);
|
mStates.remove(mPath);
|
||||||
fillItems();
|
fillItems();
|
||||||
|
@ -325,10 +327,6 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
||||||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
||||||
MenuItem menuItem = menu.findItem(R.id.cab_rename);
|
MenuItem menuItem = menu.findItem(R.id.cab_rename);
|
||||||
menuItem.setVisible(mSelectedItemsCnt == 1);
|
menuItem.setVisible(mSelectedItemsCnt == 1);
|
||||||
|
|
||||||
menuItem = menu.findItem(R.id.cab_properties);
|
|
||||||
menuItem.setVisible(mSelectedItemsCnt == 1);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,12 +385,27 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayPropertiesDialog() {
|
private void displayPropertiesDialog() {
|
||||||
|
final List<Integer> itemIndexes = getSelectedItemIndexes();
|
||||||
|
if (itemIndexes.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (itemIndexes.size() == 1) {
|
||||||
|
showOneItemProperties();
|
||||||
|
} else {
|
||||||
|
showMultipleItemProperties();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showOneItemProperties() {
|
||||||
final FileDirItem item = getSelectedItem();
|
final FileDirItem item = getSelectedItem();
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final Config config = Config.newInstance(getContext());
|
new PropertiesDialog(getContext(), item.getPath(), mConfig.getShowHidden());
|
||||||
new PropertiesDialog(getContext(), item.getPath(), config.getShowHidden());
|
}
|
||||||
|
|
||||||
|
private void showMultipleItemProperties() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayRenameDialog() {
|
private void displayRenameDialog() {
|
||||||
|
@ -562,8 +575,8 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
||||||
private View.OnClickListener destinationPicker = new View.OnClickListener() {
|
private View.OnClickListener destinationPicker = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final View view) {
|
public void onClick(final View view) {
|
||||||
final boolean showHiddenItems = Config.newInstance(getContext()).getShowHidden();
|
final boolean showHiddenItems = mConfig.getShowHidden();
|
||||||
final boolean showFullPath = Config.newInstance(getContext()).getShowFullPath();
|
final boolean showFullPath = mConfig.getShowFullPath();
|
||||||
PickFolderDialog dialog = PickFolderDialog.Companion.newInstance(mCopyDestinationPath, showHiddenItems, showFullPath);
|
PickFolderDialog dialog = PickFolderDialog.Companion.newInstance(mCopyDestinationPath, showHiddenItems, showFullPath);
|
||||||
dialog.setTargetFragment(ItemsFragment.this, SELECT_FOLDER_REQUEST);
|
dialog.setTargetFragment(ItemsFragment.this, SELECT_FOLDER_REQUEST);
|
||||||
dialog.show(getFragmentManager(), "selectFolder");
|
dialog.show(getFragmentManager(), "selectFolder");
|
||||||
|
|
Loading…
Reference in New Issue