implement the flipping functionality at the edit activity

This commit is contained in:
tibbi 2017-04-17 19:14:13 +02:00
parent 0cecfb4a6f
commit e41ae2554c
4 changed files with 5 additions and 22 deletions

View File

@ -147,7 +147,10 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
} }
private fun flipImage(horizontally: Boolean) { private fun flipImage(horizontally: Boolean) {
if (horizontally)
crop_image_view.flipImageHorizontally()
else
crop_image_view.flipImageVertically()
} }
private fun scanFinalPath(path: String) { private fun scanFinalPath(path: String) {

View File

@ -163,7 +163,6 @@ 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 {
@ -187,8 +186,6 @@ 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())
@ -354,10 +351,6 @@ 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

@ -191,6 +191,7 @@ fun SimpleActivity.removeNoMedia(path: String, callback: () -> Unit) {
} }
fun Activity.getFileSignature(path: String) = StringSignature(File(path).lastModified().toString()) fun Activity.getFileSignature(path: String) = StringSignature(File(path).lastModified().toString())
fun Activity.loadImage(path: String, target: MySquareImageView) { fun Activity.loadImage(path: String, target: MySquareImageView) {
if (path.isImageFast() || path.isVideoFast()) { if (path.isImageFast() || path.isVideoFast()) {
if (path.isPng()) { if (path.isPng()) {

View File

@ -34,20 +34,6 @@
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"