From b3427c57abd1ff38333d91eee0c8728449cc9dd5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 27 Oct 2017 11:47:00 +0200 Subject: [PATCH] adding a properties menu button to photovideoactivity --- app/build.gradle | 2 +- .../gallery/activities/PhotoVideoActivity.kt | 8 ++++++++ .../gallery/activities/ViewPagerActivity.kt | 3 ++- app/src/main/res/menu/photo_video_menu.xml | 5 +++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 784e54418..4b5446f43 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.32.4' + compile 'com.simplemobiletools:commons:2.32.5' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt index e50d61f99..cd2bf4902 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -8,6 +8,7 @@ import android.os.Bundle import android.view.Menu import android.view.MenuItem import android.view.View +import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.extensions.getFilenameFromUri import com.simplemobiletools.commons.extensions.getRealPathFromURI import com.simplemobiletools.commons.extensions.scanPath @@ -26,6 +27,7 @@ import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.fragment_holder.* import java.io.File + open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentListener { private var mMedium: Medium? = null private var mIsFullScreen = false @@ -117,6 +119,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList menu.findItem(R.id.menu_set_as).isVisible = mMedium?.isImage() == true menu.findItem(R.id.menu_edit).isVisible = mMedium?.isImage() == true + menu.findItem(R.id.menu_edit).isVisible = mUri.scheme == "file" return true } @@ -130,11 +133,16 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList R.id.menu_open_with -> openFile(mUri) R.id.menu_share -> shareUri(mUri) R.id.menu_edit -> openEditor(mUri) + R.id.menu_properties -> showProperties() else -> return super.onOptionsItemSelected(item) } return true } + private fun showProperties() { + PropertiesDialog(this, mUri.path) + } + override fun fragmentClicked() { mIsFullScreen = !mIsFullScreen if (mIsFullScreen) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 5db29688f..7214b6a00 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -515,8 +515,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun getCurrentFragment() = (view_pager.adapter as MyPagerAdapter).getCurrentFragment(view_pager.currentItem) private fun showProperties() { - if (getCurrentMedium() != null) + if (getCurrentMedium() != null) { PropertiesDialog(this, getCurrentPath(), false) + } } private fun showOnMap() { diff --git a/app/src/main/res/menu/photo_video_menu.xml b/app/src/main/res/menu/photo_video_menu.xml index 5911eebf5..584e40c29 100644 --- a/app/src/main/res/menu/photo_video_menu.xml +++ b/app/src/main/res/menu/photo_video_menu.xml @@ -6,6 +6,11 @@ android:icon="@drawable/ic_share" android:title="@string/share" app:showAsAction="ifRoom"/> +