add the properties dialog th the media activity

This commit is contained in:
tibbi 2016-11-03 23:16:47 +01:00
parent 97d6f2d452
commit b3fa4bf880
2 changed files with 22 additions and 0 deletions

View file

@ -28,6 +28,7 @@ import android.widget.GridView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.simplemobiletools.fileproperties.dialogs.PropertiesDialog;
import com.simplemobiletools.gallery.Constants;
import com.simplemobiletools.gallery.R;
import com.simplemobiletools.gallery.Utils;
@ -368,6 +369,19 @@ public class MediaActivity extends SimpleActivity
}
}
private void showProperties() {
final List<Medium> selectedMedia = getSelectedMedia();
if (selectedMedia.size() == 1) {
new PropertiesDialog(this, selectedMedia.get(0).getPath(), false);
} else {
final List<String> paths = new ArrayList<>(selectedMedia.size());
for (Medium medium : selectedMedia) {
paths.add(medium.getPath());
}
new PropertiesDialog(this, paths, false);
}
}
private boolean isSetWallpaperIntent() {
return getIntent().getBooleanExtra(Constants.SET_WALLPAPER_INTENT, false);
}
@ -439,6 +453,9 @@ public class MediaActivity extends SimpleActivity
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
switch (item.getItemId()) {
case R.id.cab_properties:
showProperties();
return true;
case R.id.cab_share:
shareMedia();
return true;

View file

@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/cab_properties"
android:icon="@mipmap/info"
android:title="@string/properties"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/cab_share"
android:icon="@mipmap/share"