From 97d6f2d452bdb71cad5590bc2d202871250692a4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 3 Nov 2016 23:12:04 +0100 Subject: [PATCH] implement the Properties dialog at the albums view --- .../gallery/activities/MainActivity.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java index 069e25959..b7cf3de76 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java @@ -27,6 +27,7 @@ import android.widget.EditText; import android.widget.GridView; import android.widget.TextView; +import com.simplemobiletools.fileproperties.dialogs.PropertiesDialog; import com.simplemobiletools.gallery.Config; import com.simplemobiletools.gallery.Constants; import com.simplemobiletools.gallery.R; @@ -250,9 +251,22 @@ public class MainActivity extends SimpleActivity } }; - private void updateGridView() { - final DirectoryAdapter adapter = (DirectoryAdapter) mGridView.getAdapter(); - adapter.updateItems(mDirs); + private void showProperties() { + final SparseBooleanArray items = mGridView.getCheckedItemPositions(); + if (items.size() == 1) { + new PropertiesDialog(this, (String) getSelectedPaths().toArray()[0], false); + } else { + final List paths = new ArrayList<>(items.size()); + final int cnt = items.size(); + for (int i = 0; i < cnt; i++) { + if (items.valueAt(i)) { + final int id = items.keyAt(i); + paths.add(mDirs.get(id).getPath()); + } + } + + new PropertiesDialog(this, paths, false); + } } private void editDirectory() { @@ -382,10 +396,6 @@ public class MainActivity extends SimpleActivity return type != null && (type.startsWith("video/") || type.equals(MediaStore.Video.Media.CONTENT_TYPE)); } - private void showProperties() { - - } - @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) {