mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 06:28:00 +01:00
some refactoring
This commit is contained in:
parent
50bf296f89
commit
e160894144
1 changed files with 43 additions and 40 deletions
|
@ -208,13 +208,20 @@ public class MainActivity extends AppCompatActivity
|
||||||
adapter.updateItems(dirs);
|
adapter.updateItems(dirs);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renameDirectory() {
|
private void editDirectory() {
|
||||||
final SparseBooleanArray items = gridView.getCheckedItemPositions();
|
final SparseBooleanArray items = gridView.getCheckedItemPositions();
|
||||||
final int cnt = items.size();
|
final int cnt = items.size();
|
||||||
for (int i = 0; i < cnt; i++) {
|
for (int i = 0; i < cnt; i++) {
|
||||||
if (items.valueAt(i)) {
|
if (items.valueAt(i)) {
|
||||||
final int id = items.keyAt(i);
|
final int id = items.keyAt(i);
|
||||||
final String path = dirs.get(id).getPath();
|
final String path = dirs.get(id).getPath();
|
||||||
|
renameDir(path);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renameDir(final String path) {
|
||||||
final File dir = new File(path);
|
final File dir = new File(path);
|
||||||
|
|
||||||
final View renameFileView = getLayoutInflater().inflate(R.layout.rename_directory, null);
|
final View renameFileView = getLayoutInflater().inflate(R.layout.rename_directory, null);
|
||||||
|
@ -252,10 +259,6 @@ public class MainActivity extends AppCompatActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -297,7 +300,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.cab_edit:
|
case R.id.cab_edit:
|
||||||
renameDirectory();
|
editDirectory();
|
||||||
return true;
|
return true;
|
||||||
case R.id.cab_remove:
|
case R.id.cab_remove:
|
||||||
prepareForDeleting();
|
prepareForDeleting();
|
||||||
|
|
Loading…
Reference in a new issue