add flip menu items to the viewpager and editor activities

This commit is contained in:
tibbi 2017-04-17 18:41:11 +02:00
parent e120154741
commit c23f15749d
4 changed files with 41 additions and 0 deletions

View file

@ -62,6 +62,8 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
R.id.save_as -> crop_image_view.getCroppedImageAsync() R.id.save_as -> crop_image_view.getCroppedImageAsync()
R.id.rotate -> crop_image_view.rotateImage(90) R.id.rotate -> crop_image_view.rotateImage(90)
R.id.resize -> resizeImage() R.id.resize -> resizeImage()
R.id.flip_horizontally -> flipImage(true)
R.id.flip_vertically -> flipImage(false)
else -> return super.onOptionsItemSelected(item) else -> return super.onOptionsItemSelected(item)
} }
return true return true
@ -144,6 +146,10 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
out.close() out.close()
} }
private fun flipImage(horizontally: Boolean) {
}
private fun scanFinalPath(path: String) { private fun scanFinalPath(path: String) {
scanPath(path) { scanPath(path) {
setResult(Activity.RESULT_OK, intent) setResult(Activity.RESULT_OK, intent)

View file

@ -163,6 +163,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
findItem(R.id.menu_set_as_wallpaper).isVisible = getCurrentMedium()!!.isImage() == true findItem(R.id.menu_set_as_wallpaper).isVisible = getCurrentMedium()!!.isImage() == true
findItem(R.id.menu_edit).isVisible = getCurrentMedium()!!.isImage() == true findItem(R.id.menu_edit).isVisible = getCurrentMedium()!!.isImage() == true
findItem(R.id.menu_rotate).isVisible = getCurrentMedium()!!.isImage() == true findItem(R.id.menu_rotate).isVisible = getCurrentMedium()!!.isImage() == true
findItem(R.id.menu_flip).isVisible = getCurrentMedium()!!.isImage() == true
findItem(R.id.menu_save_as).isVisible = mRotationDegrees != 0f findItem(R.id.menu_save_as).isVisible = mRotationDegrees != 0f
findItem(R.id.menu_rotate).subMenu.apply { findItem(R.id.menu_rotate).subMenu.apply {
@ -186,6 +187,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
R.id.menu_move_to -> moveTo() R.id.menu_move_to -> moveTo()
R.id.menu_open_with -> openWith(getCurrentFile()) R.id.menu_open_with -> openWith(getCurrentFile())
R.id.menu_share -> shareMedium(getCurrentMedium()!!) R.id.menu_share -> shareMedium(getCurrentMedium()!!)
R.id.menu_flip_horizontally -> flipImage(true)
R.id.menu_flip_vertically -> flipImage(false)
R.id.menu_delete -> askConfirmDelete() R.id.menu_delete -> askConfirmDelete()
R.id.menu_rename -> renameFile() R.id.menu_rename -> renameFile()
R.id.menu_edit -> openEditor(getCurrentFile()) R.id.menu_edit -> openEditor(getCurrentFile())
@ -351,6 +354,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
super.onActivityResult(requestCode, resultCode, resultData) super.onActivityResult(requestCode, resultCode, resultData)
} }
private fun flipImage(horizontally: Boolean) {
}
private fun askConfirmDelete() { private fun askConfirmDelete() {
ConfirmationDialog(this) { ConfirmationDialog(this) {
deleteFileBg(File(mMedia[mPos].path)) { deleteFileBg(File(mMedia[mPos].path)) {

View file

@ -16,4 +16,18 @@
android:icon="@drawable/ic_minimize" android:icon="@drawable/ic_minimize"
android:title="@string/resize" android:title="@string/resize"
app:showAsAction="ifRoom"/> app:showAsAction="ifRoom"/>
<item
android:id="@+id/flip"
android:icon="@drawable/ic_flip"
android:title="@string/flip"
app:showAsAction="ifRoom">
<menu>
<item
android:id="@+id/flip_horizontally"
android:title="@string/flip_horizontally"/>
<item
android:id="@+id/flip_vertically"
android:title="@string/flip_vertically"/>
</menu>
</item>
</menu> </menu>

View file

@ -34,6 +34,20 @@
android:icon="@drawable/ic_share" android:icon="@drawable/ic_share"
android:title="@string/share" android:title="@string/share"
app:showAsAction="ifRoom"/> app:showAsAction="ifRoom"/>
<item
android:id="@+id/menu_flip"
android:icon="@drawable/ic_flip"
android:title="@string/flip"
app:showAsAction="ifRoom">
<menu>
<item
android:id="@+id/menu_flip_horizontally"
android:title="@string/flip_horizontally"/>
<item
android:id="@+id/menu_flip_vertically"
android:title="@string/flip_vertically"/>
</menu>
</item>
<item <item
android:id="@+id/menu_copy_to" android:id="@+id/menu_copy_to"
android:title="@string/copy_to" android:title="@string/copy_to"