hide the bottom primary actions at editor crop intent

This commit is contained in:
tibbi 2018-07-23 12:49:05 +02:00
parent 91bb5b70de
commit 9cfab3abc3

View file

@ -11,6 +11,7 @@ import android.os.Bundle
import android.provider.MediaStore
import android.view.Menu
import android.view.MenuItem
import android.widget.RelativeLayout
import com.bumptech.glide.Glide
import com.bumptech.glide.load.DataSource
import com.bumptech.glide.load.engine.DiskCacheStrategy
@ -124,6 +125,11 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
}
isCropIntent = intent.extras?.get(CROP) == "true"
if (isCropIntent) {
bottom_editor_primary_actions.beGone()
(bottom_editor_crop_rotate_actions.layoutParams as RelativeLayout.LayoutParams).addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 1)
}
loadDefaultImageView()
setupBottomActions()
}
@ -182,7 +188,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
if (isCropIntent) {
loadCropImageView()
bottom_primary_filter.beGone()
bottom_primary_crop_rotate.performClick()
bottomCropRotateClicked()
}
return false
@ -240,6 +246,15 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
private fun setupPrimaryActionButtons() {
bottom_primary_filter.setOnClickListener {
bottomFilterClicked()
}
bottom_primary_crop_rotate.setOnClickListener {
bottomCropRotateClicked()
}
}
private fun bottomFilterClicked() {
currPrimaryAction = if (currPrimaryAction == PRIMARY_ACTION_FILTER) {
PRIMARY_ACTION_NONE
} else {
@ -248,7 +263,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
updatePrimaryActionButtons()
}
bottom_primary_crop_rotate.setOnClickListener {
private fun bottomCropRotateClicked() {
currPrimaryAction = if (currPrimaryAction == PRIMARY_ACTION_CROP_ROTATE) {
PRIMARY_ACTION_NONE
} else {
@ -256,7 +271,6 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
}
updatePrimaryActionButtons()
}
}
private fun setupCropRotateActionButtons() {
bottom_rotate.setOnClickListener {