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 3eb5c1fdb..fafa777a2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -29,12 +29,18 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private val ASPECT_Y = "aspectY" private val CROP = "crop" + private val ASPECT_RATIO_ANY = 0 + private val ASPECT_RATIO_ONE_ONE = 1 + private val ASPECT_RATIO_FOUR_THREE = 2 + private val ASPECT_RATIO_SIXTEEN_NINE = 3 + private lateinit var uri: Uri private lateinit var saveUri: Uri private var resizeWidth = 0 private var resizeHeight = 0 private var isCropIntent = false private var isEditingWithThirdParty = false + private var currentAspectRatio = ASPECT_RATIO_ANY override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -88,8 +94,11 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener setOnCropImageCompleteListener(this@EditActivity) setImageUriAsync(uri) - if (isCropIntent && shouldCropSquare()) + if (isCropIntent && shouldCropSquare()) { + currentAspectRatio = ASPECT_RATIO_ONE_ONE setFixedAspectRatio(true) + bottom_aspect_ratio.beGone() + } } setupBottomActions() diff --git a/app/src/main/res/drawable-hdpi/ic_aspect_ratio.png b/app/src/main/res/drawable-hdpi/ic_aspect_ratio.png new file mode 100644 index 000000000..81c7958d6 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_aspect_ratio.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_aspect_ratio.png b/app/src/main/res/drawable-xhdpi/ic_aspect_ratio.png new file mode 100644 index 000000000..8a69e996e Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_aspect_ratio.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_aspect_ratio.png b/app/src/main/res/drawable-xxhdpi/ic_aspect_ratio.png new file mode 100644 index 000000000..cc07c4c25 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_aspect_ratio.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_aspect_ratio.png b/app/src/main/res/drawable-xxxhdpi/ic_aspect_ratio.png new file mode 100644 index 000000000..3c52ec564 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_aspect_ratio.png differ diff --git a/app/src/main/res/layout/bottom_editor_actions.xml b/app/src/main/res/layout/bottom_editor_actions.xml index 7ffe42837..7dcbb0a9d 100644 --- a/app/src/main/res/layout/bottom_editor_actions.xml +++ b/app/src/main/res/layout/bottom_editor_actions.xml @@ -27,10 +27,21 @@ android:layout_height="wrap_content" android:padding="@dimen/medium_margin" android:src="@drawable/ic_minimize" - app:layout_constraintEnd_toStartOf="@+id/bottom_flip_horizontally" + app:layout_constraintEnd_toStartOf="@+id/bottom_aspect_ratio" app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toEndOf="@+id/bottom_rotate"/> + + + app:layout_constraintStart_toEndOf="@+id/bottom_aspect_ratio"/>