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 6a7e30885..d51b515fe 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 @@ -333,7 +333,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } bottom_aspect_ratio_other.setOnClickListener { - OtherAspectRatioDialog(this) { + OtherAspectRatioDialog(this, lastOtherAspectRatio) { lastOtherAspectRatio = it updateAspectRatio(ASPECT_RATIO_OTHER) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/OtherAspectRatioDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/OtherAspectRatioDialog.kt index f536162d8..60cd259b6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/OtherAspectRatioDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/OtherAspectRatioDialog.kt @@ -6,7 +6,7 @@ import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.gallery.pro.R import kotlinx.android.synthetic.main.dialog_other_aspect_ratio.view.* -class OtherAspectRatioDialog(val activity: BaseSimpleActivity, val callback: (aspectRatio: Pair) -> Unit) { +class OtherAspectRatioDialog(val activity: BaseSimpleActivity, val lastOtherAspectRatio: Pair?, val callback: (aspectRatio: Pair) -> Unit) { private val dialog: AlertDialog init { @@ -24,6 +24,28 @@ class OtherAspectRatioDialog(val activity: BaseSimpleActivity, val callback: (as other_aspect_ratio_3_5.setOnClickListener { ratioPicked(Pair(3, 5)) } other_aspect_ratio_9_16.setOnClickListener { ratioPicked(Pair(9, 16)) } other_aspect_ratio_9_19.setOnClickListener { ratioPicked(Pair(9, 19)) } + + val radio1SelectedItemId = when (lastOtherAspectRatio) { + Pair(2, 1) -> other_aspect_ratio_2_1.id + Pair(3, 2) -> other_aspect_ratio_3_2.id + Pair(4, 3) -> other_aspect_ratio_4_3.id + Pair(5, 3) -> other_aspect_ratio_5_3.id + Pair(16, 9) -> other_aspect_ratio_16_9.id + Pair(19, 9) -> other_aspect_ratio_19_9.id + else -> 0 + } + other_aspect_ratio_dialog_radio_1.check(radio1SelectedItemId) + + val radio2SelectedItemId = when (lastOtherAspectRatio) { + Pair(1, 2) -> other_aspect_ratio_1_2.id + Pair(2, 3) -> other_aspect_ratio_2_3.id + Pair(3, 4) -> other_aspect_ratio_3_4.id + Pair(3, 5) -> other_aspect_ratio_3_5.id + Pair(9, 16) -> other_aspect_ratio_9_16.id + Pair(9, 19) -> other_aspect_ratio_9_19.id + else -> 0 + } + other_aspect_ratio_dialog_radio_2.check(radio2SelectedItemId) } dialog = AlertDialog.Builder(activity)