From e92b708e4d04e05d5e0362f9ad08f1aaf47e84d0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 2 Dec 2018 23:36:52 +0100 Subject: [PATCH] properly remember the Other aspect ratio at cropping too --- .../gallery/pro/activities/EditActivity.kt | 6 ++++++ .../com/simplemobiletools/gallery/pro/helpers/Config.kt | 8 ++++++++ .../simplemobiletools/gallery/pro/helpers/Constants.kt | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index 034721672..285c110fb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -130,6 +130,10 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener loadDefaultImageView() setupBottomActions() + + if (config.lastEditorCropAspectRatio == ASPECT_RATIO_OTHER) { + lastOtherAspectRatio = Pair(config.lastEditorCropOtherAspectRatioX, config.lastEditorCropOtherAspectRatioY) + } updateAspectRatio(config.lastEditorCropAspectRatio) } @@ -330,6 +334,8 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener bottom_aspect_ratio_other.setOnClickListener { OtherAspectRatioDialog(this, lastOtherAspectRatio) { lastOtherAspectRatio = it + config.lastEditorCropOtherAspectRatioX = it.first + config.lastEditorCropOtherAspectRatioY = it.second updateAspectRatio(ASPECT_RATIO_OTHER) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt index 34141f32e..e25a4073d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt @@ -415,4 +415,12 @@ class Config(context: Context) : BaseConfig(context) { var lastEditorCropAspectRatio: Int get() = prefs.getInt(LAST_EDITOR_CROP_ASPECT_RATIO, ASPECT_RATIO_FREE) set(lastEditorCropAspectRatio) = prefs.edit().putInt(LAST_EDITOR_CROP_ASPECT_RATIO, lastEditorCropAspectRatio).apply() + + var lastEditorCropOtherAspectRatioX: Int + get() = prefs.getInt(LAST_EDITOR_CROP_OTHER_ASPECT_RATIO_X, 2) + set(lastEditorCropOtherAspectRatioX) = prefs.edit().putInt(LAST_EDITOR_CROP_OTHER_ASPECT_RATIO_X, lastEditorCropOtherAspectRatioX).apply() + + var lastEditorCropOtherAspectRatioY: Int + get() = prefs.getInt(LAST_EDITOR_CROP_OTHER_ASPECT_RATIO_Y, 1) + set(lastEditorCropOtherAspectRatioY) = prefs.edit().putInt(LAST_EDITOR_CROP_OTHER_ASPECT_RATIO_Y, lastEditorCropOtherAspectRatioY).apply() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index 927881807..f868a1747 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -69,7 +69,8 @@ const val LAST_BIN_CHECK = "last_bin_check" const val SHOW_HIGHEST_QUALITY = "show_highest_quality" const val ALLOW_DOWN_GESTURE = "allow_down_gesture" const val LAST_EDITOR_CROP_ASPECT_RATIO = "last_editor_crop_aspect_ratio" - +const val LAST_EDITOR_CROP_OTHER_ASPECT_RATIO_X = "last_editor_crop_other_aspect_ratio_x" +const val LAST_EDITOR_CROP_OTHER_ASPECT_RATIO_Y = "last_editor_crop_other_aspect_ratio_y" // slideshow const val SLIDESHOW_INTERVAL = "slideshow_interval"