update commons to 5.2.8

This commit is contained in:
tibbi 2018-10-25 13:38:27 +02:00
parent f773ab9c1c
commit 1321ccae66
3 changed files with 30 additions and 49 deletions

View File

@ -48,7 +48,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.2.6'
implementation 'com.simplemobiletools:commons:5.2.8'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'it.sephiroth.android.exif:library:1.0.1'

View File

@ -1,15 +1,10 @@
package com.simplemobiletools.gallery.dialogs
import android.graphics.Point
import androidx.appcompat.app.AlertDialog
import android.text.Editable
import android.text.TextWatcher
import android.widget.EditText
import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.extensions.showKeyboard
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.extensions.value
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.gallery.R
import kotlinx.android.synthetic.main.resize_image.view.*
@ -24,49 +19,33 @@ class ResizeDialog(val activity: BaseSimpleActivity, val size: Point, val callba
val ratio = size.x / size.y.toFloat()
widthView.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(s: Editable?) {
if (widthView.hasFocus()) {
var width = getViewValue(widthView)
if (width > size.x) {
widthView.setText(size.x.toString())
width = size.x
}
widthView.onTextChangeListener {
if (widthView.hasFocus()) {
var width = getViewValue(widthView)
if (width > size.x) {
widthView.setText(size.x.toString())
width = size.x
}
if (view.keep_aspect_ratio.isChecked) {
heightView.setText((width / ratio).toInt().toString())
}
if (view.keep_aspect_ratio.isChecked) {
heightView.setText((width / ratio).toInt().toString())
}
}
}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
heightView.onTextChangeListener {
if (heightView.hasFocus()) {
var height = getViewValue(heightView)
if (height > size.y) {
heightView.setText(size.y.toString())
height = size.y
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
}
})
heightView.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(s: Editable?) {
if (heightView.hasFocus()) {
var height = getViewValue(heightView)
if (height > size.y) {
heightView.setText(size.y.toString())
height = size.y
}
if (view.keep_aspect_ratio.isChecked) {
widthView.setText((height * ratio).toInt().toString())
}
if (view.keep_aspect_ratio.isChecked) {
widthView.setText((height * ratio).toInt().toString())
}
}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
}
})
}
AlertDialog.Builder(activity)
.setPositiveButton(R.string.ok, null)

View File

@ -5,7 +5,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/activity_margin">
android:paddingLeft="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/image_width_label"
@ -29,8 +31,8 @@
android:id="@+id/image_height_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginStart="50dp"
android:layout_marginLeft="50dp"
android:layout_toRightOf="@+id/image_width_label"
android:text="@string/height"/>
@ -38,9 +40,9 @@
android:id="@+id/image_height"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/image_height_label"
android:layout_alignStart="@+id/image_height_label"
android:layout_below="@+id/image_width_label"
android:layout_alignStart="@+id/image_height_label"
android:layout_alignLeft="@+id/image_height_label"
android:inputType="number"
android:maxLength="6"
android:maxLines="1"
@ -54,8 +56,8 @@
android:layout_below="@+id/image_height"
android:layout_marginTop="@dimen/activity_margin"
android:checked="true"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin"
android:text="@string/keep_aspect_ratio"/>
</RelativeLayout>