reuse the same crop image view at Edit and Set Wallpaper activities

This commit is contained in:
tibbi 2017-03-22 22:50:25 +01:00
parent 7ebfeeb66a
commit e58ab7111c
4 changed files with 4 additions and 19 deletions

View file

@ -19,7 +19,7 @@ import com.simplemobiletools.gallery.extensions.config
import com.simplemobiletools.gallery.extensions.getCompressionFormat import com.simplemobiletools.gallery.extensions.getCompressionFormat
import com.simplemobiletools.gallery.extensions.getRealPathFromURI import com.simplemobiletools.gallery.extensions.getRealPathFromURI
import com.theartofdev.edmodo.cropper.CropImageView import com.theartofdev.edmodo.cropper.CropImageView
import kotlinx.android.synthetic.main.activity_edit.* import kotlinx.android.synthetic.main.view_crop_image.*
import java.io.File import java.io.File
import java.io.FileOutputStream import java.io.FileOutputStream
import java.io.OutputStream import java.io.OutputStream
@ -33,7 +33,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_edit) setContentView(R.layout.view_crop_image)
if (intent.data == null) { if (intent.data == null) {
toast(R.string.invalid_image_path) toast(R.string.invalid_image_path)

View file

@ -12,7 +12,7 @@ import android.view.MenuItem
import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import com.theartofdev.edmodo.cropper.CropImageView import com.theartofdev.edmodo.cropper.CropImageView
import kotlinx.android.synthetic.main.activity_edit.* import kotlinx.android.synthetic.main.view_crop_image.*
class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener { class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener {
private val PICK_IMAGE = 1 private val PICK_IMAGE = 1
@ -22,7 +22,7 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_set_wallpaper) setContentView(R.layout.view_crop_image)
if (intent.data == null) { if (intent.data == null) {
val pickIntent = Intent(applicationContext, MainActivity::class.java) val pickIntent = Intent(applicationContext, MainActivity::class.java)

View file

@ -1,15 +0,0 @@
<?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/coordinator_layout"
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:cropInitialCropWindowPaddingRatio="0"/>
</RelativeLayout>