move some Editor actions at the bottom of the screen
This commit is contained in:
parent
3358dfa201
commit
868b654107
|
@ -20,7 +20,8 @@ import com.simplemobiletools.gallery.dialogs.ResizeDialog
|
|||
import com.simplemobiletools.gallery.dialogs.SaveAsDialog
|
||||
import com.simplemobiletools.gallery.extensions.openEditor
|
||||
import com.theartofdev.edmodo.cropper.CropImageView
|
||||
import kotlinx.android.synthetic.main.view_crop_image.*
|
||||
import kotlinx.android.synthetic.main.activity_edit.*
|
||||
import kotlinx.android.synthetic.main.bottom_editor_actions.*
|
||||
import java.io.*
|
||||
|
||||
class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener {
|
||||
|
@ -37,7 +38,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.view_crop_image)
|
||||
setContentView(R.layout.activity_edit)
|
||||
|
||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||
if (it) {
|
||||
|
@ -90,6 +91,8 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
if (isCropIntent && shouldCropSquare())
|
||||
setFixedAspectRatio(true)
|
||||
}
|
||||
|
||||
setupBottomActions()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
@ -106,15 +109,12 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
menuInflater.inflate(R.menu.menu_editor, menu)
|
||||
menu.findItem(R.id.resize).isVisible = !isCropIntent
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.save_as -> crop_image_view.getCroppedImageAsync()
|
||||
R.id.rotate -> crop_image_view.rotateImage(90)
|
||||
R.id.resize -> resizeImage()
|
||||
R.id.flip_horizontally -> flipImage(true)
|
||||
R.id.flip_vertically -> flipImage(false)
|
||||
R.id.edit -> editWith()
|
||||
|
@ -123,6 +123,17 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
return true
|
||||
}
|
||||
|
||||
private fun setupBottomActions() {
|
||||
bottom_rotate.setOnClickListener {
|
||||
crop_image_view.rotateImage(90)
|
||||
}
|
||||
|
||||
bottom_resize.beGoneIf(isCropIntent)
|
||||
bottom_resize.setOnClickListener {
|
||||
resizeImage()
|
||||
}
|
||||
}
|
||||
|
||||
private fun resizeImage() {
|
||||
val point = getAreaSize()
|
||||
if (point == null) {
|
||||
|
|
|
@ -16,7 +16,7 @@ import com.simplemobiletools.commons.helpers.isNougatPlus
|
|||
import com.simplemobiletools.commons.models.RadioItem
|
||||
import com.simplemobiletools.gallery.R
|
||||
import com.theartofdev.edmodo.cropper.CropImageView
|
||||
import kotlinx.android.synthetic.main.view_crop_image.*
|
||||
import kotlinx.android.synthetic.main.activity_edit.*
|
||||
|
||||
class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener {
|
||||
private val PICK_IMAGE = 1
|
||||
|
@ -28,7 +28,7 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.view_crop_image)
|
||||
setContentView(R.layout.activity_set_wallpaper)
|
||||
|
||||
if (intent.data == null) {
|
||||
val pickIntent = Intent(applicationContext, MainActivity::class.java)
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/fragment_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.theartofdev.edmodo.cropper.CropImageView
|
||||
android:id="@+id/crop_image_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:cropBackgroundColor="@color/crop_image_view_background"
|
||||
app:cropInitialCropWindowPaddingRatio="0"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/bottom_editor_actions"
|
||||
layout="@layout/bottom_editor_actions"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/bottom_editor_actions_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_actions_height"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/gradient_background_lighter"
|
||||
android:paddingTop="@dimen/medium_margin">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_rotate"
|
||||
style="@style/MyBorderlessBackgroundStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_rotate_right"
|
||||
app:layout_constraintEnd_toStartOf="@+id/bottom_resize"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_resize"
|
||||
style="@style/MyBorderlessBackgroundStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_minimize"
|
||||
app:layout_constraintEnd_toStartOf="@+id/bottom_flip"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/bottom_rotate"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_flip"
|
||||
style="@style/MyBorderlessBackgroundStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_flip"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/bottom_resize"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -6,16 +6,6 @@
|
|||
android:icon="@drawable/ic_check"
|
||||
android:title="@string/save_as"
|
||||
app:showAsAction="always"/>
|
||||
<item
|
||||
android:id="@+id/rotate"
|
||||
android:icon="@drawable/ic_rotate_right"
|
||||
android:title="@string/rotate"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/resize"
|
||||
android:icon="@drawable/ic_minimize"
|
||||
android:title="@string/resize"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/flip"
|
||||
android:icon="@drawable/ic_flip"
|
||||
|
|
Loading…
Reference in New Issue