adding a Draw bottom action at the editor
This commit is contained in:
parent
212af3f6dc
commit
8f3ddfffa9
6 changed files with 30 additions and 4 deletions
|
@ -63,6 +63,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
||||||
private val PRIMARY_ACTION_NONE = 0
|
private val PRIMARY_ACTION_NONE = 0
|
||||||
private val PRIMARY_ACTION_FILTER = 1
|
private val PRIMARY_ACTION_FILTER = 1
|
||||||
private val PRIMARY_ACTION_CROP_ROTATE = 2
|
private val PRIMARY_ACTION_CROP_ROTATE = 2
|
||||||
|
private val PRIMARY_ACTION_DRAW = 3
|
||||||
|
|
||||||
private val CROP_ROTATE_NONE = 0
|
private val CROP_ROTATE_NONE = 0
|
||||||
private val CROP_ROTATE_ASPECT_RATIO = 1
|
private val CROP_ROTATE_ASPECT_RATIO = 1
|
||||||
|
@ -208,6 +209,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
||||||
|
|
||||||
if (isCropIntent) {
|
if (isCropIntent) {
|
||||||
bottom_primary_filter.beGone()
|
bottom_primary_filter.beGone()
|
||||||
|
bottom_primary_draw.beGone()
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
@ -287,6 +289,10 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
||||||
bottom_primary_crop_rotate.setOnClickListener {
|
bottom_primary_crop_rotate.setOnClickListener {
|
||||||
bottomCropRotateClicked()
|
bottomCropRotateClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bottom_primary_draw.setOnClickListener {
|
||||||
|
bottomDrawClicked()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bottomFilterClicked() {
|
private fun bottomFilterClicked() {
|
||||||
|
@ -307,6 +313,15 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
||||||
updatePrimaryActionButtons()
|
updatePrimaryActionButtons()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun bottomDrawClicked() {
|
||||||
|
currPrimaryAction = if (currPrimaryAction == PRIMARY_ACTION_DRAW) {
|
||||||
|
PRIMARY_ACTION_NONE
|
||||||
|
} else {
|
||||||
|
PRIMARY_ACTION_DRAW
|
||||||
|
}
|
||||||
|
updatePrimaryActionButtons()
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupCropRotateActionButtons() {
|
private fun setupCropRotateActionButtons() {
|
||||||
bottom_rotate.setOnClickListener {
|
bottom_rotate.setOnClickListener {
|
||||||
crop_image_view.rotateImage(90)
|
crop_image_view.rotateImage(90)
|
||||||
|
@ -375,13 +390,14 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
||||||
loadDefaultImageView()
|
loadDefaultImageView()
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayOf(bottom_primary_filter, bottom_primary_crop_rotate).forEach {
|
arrayOf(bottom_primary_filter, bottom_primary_crop_rotate, bottom_primary_draw).forEach {
|
||||||
it.applyColorFilter(Color.WHITE)
|
it.applyColorFilter(Color.WHITE)
|
||||||
}
|
}
|
||||||
|
|
||||||
val currentPrimaryActionButton = when (currPrimaryAction) {
|
val currentPrimaryActionButton = when (currPrimaryAction) {
|
||||||
PRIMARY_ACTION_FILTER -> bottom_primary_filter
|
PRIMARY_ACTION_FILTER -> bottom_primary_filter
|
||||||
PRIMARY_ACTION_CROP_ROTATE -> bottom_primary_crop_rotate
|
PRIMARY_ACTION_CROP_ROTATE -> bottom_primary_crop_rotate
|
||||||
|
PRIMARY_ACTION_DRAW -> bottom_primary_draw
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
app/src/main/res/drawable-hdpi/ic_draw.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_draw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 464 B |
BIN
app/src/main/res/drawable-xhdpi/ic_draw.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_draw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 601 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_draw.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_draw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 867 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_draw.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_draw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -16,7 +16,6 @@
|
||||||
android:src="@drawable/ic_photo_filter"
|
android:src="@drawable/ic_photo_filter"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/bottom_primary_crop_rotate"
|
app:layout_constraintEnd_toStartOf="@+id/bottom_primary_crop_rotate"
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"/>
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
|
@ -28,9 +27,20 @@
|
||||||
android:padding="@dimen/normal_margin"
|
android:padding="@dimen/normal_margin"
|
||||||
android:src="@drawable/ic_crop_rotate"
|
android:src="@drawable/ic_crop_rotate"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toStartOf="@+id/bottom_primary_draw"
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/bottom_primary_filter"
|
app:layout_constraintStart_toEndOf="@+id/bottom_primary_filter"
|
||||||
app:layout_constraintTop_toTopOf="parent"/>
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/bottom_primary_draw"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:padding="@dimen/normal_margin"
|
||||||
|
android:src="@drawable/ic_draw"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/bottom_primary_crop_rotate"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
Loading…
Reference in a new issue