From c23f15749d59646ec4fa60881e1043762a1f6d80 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 17 Apr 2017 18:41:11 +0200 Subject: [PATCH] add flip menu items to the viewpager and editor activities --- .../gallery/activities/EditActivity.kt | 6 ++++++ .../gallery/activities/ViewPagerActivity.kt | 7 +++++++ app/src/main/res/menu/menu_editor.xml | 14 ++++++++++++++ app/src/main/res/menu/menu_viewpager.xml | 14 ++++++++++++++ 4 files changed, 41 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt index ecc00aaa9..6fd49ec86 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -62,6 +62,8 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener R.id.save_as -> crop_image_view.getCroppedImageAsync() R.id.rotate -> crop_image_view.rotateImage(90) R.id.resize -> resizeImage() + R.id.flip_horizontally -> flipImage(true) + R.id.flip_vertically -> flipImage(false) else -> return super.onOptionsItemSelected(item) } return true @@ -144,6 +146,10 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener out.close() } + private fun flipImage(horizontally: Boolean) { + + } + private fun scanFinalPath(path: String) { scanPath(path) { setResult(Activity.RESULT_OK, intent) 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 cbbdc4897..bfa06e801 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -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_edit).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_rotate).subMenu.apply { @@ -186,6 +187,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View R.id.menu_move_to -> moveTo() R.id.menu_open_with -> openWith(getCurrentFile()) 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_rename -> renameFile() R.id.menu_edit -> openEditor(getCurrentFile()) @@ -351,6 +354,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View super.onActivityResult(requestCode, resultCode, resultData) } + private fun flipImage(horizontally: Boolean) { + + } + private fun askConfirmDelete() { ConfirmationDialog(this) { deleteFileBg(File(mMedia[mPos].path)) { diff --git a/app/src/main/res/menu/menu_editor.xml b/app/src/main/res/menu/menu_editor.xml index c8b286e8b..eeeb84d73 100644 --- a/app/src/main/res/menu/menu_editor.xml +++ b/app/src/main/res/menu/menu_editor.xml @@ -16,4 +16,18 @@ android:icon="@drawable/ic_minimize" android:title="@string/resize" app:showAsAction="ifRoom"/> + + + + + + diff --git a/app/src/main/res/menu/menu_viewpager.xml b/app/src/main/res/menu/menu_viewpager.xml index 807553576..3a7924597 100644 --- a/app/src/main/res/menu/menu_viewpager.xml +++ b/app/src/main/res/menu/menu_viewpager.xml @@ -34,6 +34,20 @@ android:icon="@drawable/ic_share" android:title="@string/share" app:showAsAction="ifRoom"/> + + + + + +