rename some variables

This commit is contained in:
tibbi 2016-02-20 16:42:13 +01:00
parent c157c5bb88
commit a410e4371c

View file

@ -27,9 +27,9 @@ public class MainActivity extends AppCompatActivity {
for (Map.Entry<String, Integer> dir : directories.entrySet()) { for (Map.Entry<String, Integer> dir : directories.entrySet()) {
final String path = dir.getKey(); final String path = dir.getKey();
final String name = path.substring(path.lastIndexOf("/") + 1); final String dirName = path.substring(path.lastIndexOf("/") + 1);
final String cnt = String.valueOf(dir.getValue()); final String cnt = String.valueOf(dir.getValue());
dirs.add(new Directory(path, name, cnt)); dirs.add(new Directory(path, dirName, cnt));
} }
final GridView gridView = (GridView) findViewById(R.id.photo_grid); final GridView gridView = (GridView) findViewById(R.id.photo_grid);
@ -38,7 +38,7 @@ public class MainActivity extends AppCompatActivity {
} }
private Map<String, Integer> getImages() { private Map<String, Integer> getImages() {
final Map<String, Integer> dirs = new TreeMap<>(); final Map<String, Integer> directories = new TreeMap<>();
final Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; final Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
final Cursor cursor = getContentResolver().query(uri, null, null, null, null); final Cursor cursor = getContentResolver().query(uri, null, null, null, null);
@ -47,15 +47,15 @@ public class MainActivity extends AppCompatActivity {
do { do {
final File file = new File(cursor.getString(pathIndex)); final File file = new File(cursor.getString(pathIndex));
final String path = file.getParent().toLowerCase(); final String path = file.getParent().toLowerCase();
if (dirs.containsKey(path)) { if (directories.containsKey(path)) {
dirs.put(path, dirs.get(path) + 1); directories.put(path, directories.get(path) + 1);
} else { } else {
dirs.put(path, 1); directories.put(path, 1);
} }
} while (cursor.moveToNext()); } while (cursor.moveToNext());
cursor.close(); cursor.close();
} }
return dirs; return directories;
} }
} }