some refactoring

This commit is contained in:
tibbi 2016-03-07 22:02:10 +01:00
parent 50bf296f89
commit e160894144

View file

@ -208,13 +208,20 @@ public class MainActivity extends AppCompatActivity
adapter.updateItems(dirs);
}
private void renameDirectory() {
private void editDirectory() {
final SparseBooleanArray items = gridView.getCheckedItemPositions();
final int cnt = items.size();
for (int i = 0; i < cnt; i++) {
if (items.valueAt(i)) {
final int id = items.keyAt(i);
final String path = dirs.get(id).getPath();
renameDir(path);
break;
}
}
}
private void renameDir(final String path) {
final File dir = new File(path);
final View renameFileView = getLayoutInflater().inflate(R.layout.rename_directory, null);
@ -252,10 +259,6 @@ public class MainActivity extends AppCompatActivity
}
}
});
break;
}
}
}
@Override
@ -297,7 +300,7 @@ public class MainActivity extends AppCompatActivity
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
switch (item.getItemId()) {
case R.id.cab_edit:
renameDirectory();
editDirectory();
return true;
case R.id.cab_remove:
prepareForDeleting();