adding a properties menu button to photovideoactivity

This commit is contained in:
tibbi 2017-10-27 11:47:00 +02:00
parent 0b352f1bc0
commit b3427c57ab
4 changed files with 16 additions and 2 deletions

View File

@ -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'

View File

@ -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) {

View File

@ -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() {

View File

@ -6,6 +6,11 @@
android:icon="@drawable/ic_share"
android:title="@string/share"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/menu_properties"
android:icon="@drawable/ic_info"
android:title="@string/properties"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/menu_edit"
android:icon="@drawable/ic_edit"