take new color picker values into consideration only if OK was pressed

This commit is contained in:
tibbi 2018-09-18 21:36:44 +02:00
parent 7b8b19cdce
commit 07894ef11b

View File

@ -7,7 +7,6 @@ import android.graphics.Color
import android.os.Bundle import android.os.Bundle
import android.widget.SeekBar import android.widget.SeekBar
import com.simplemobiletools.clock.R import com.simplemobiletools.clock.R
import com.simplemobiletools.clock.R.id.*
import com.simplemobiletools.clock.extensions.config import com.simplemobiletools.clock.extensions.config
import com.simplemobiletools.clock.extensions.getFormattedDate import com.simplemobiletools.clock.extensions.getFormattedDate
import com.simplemobiletools.clock.extensions.getFormattedTime import com.simplemobiletools.clock.extensions.getFormattedTime
@ -105,17 +104,21 @@ class WidgetDateTimeConfigureActivity : SimpleActivity() {
private fun pickBackgroundColor() { private fun pickBackgroundColor() {
ColorPickerDialog(this, mBgColorWithoutTransparency) { wasPositivePressed, color -> ColorPickerDialog(this, mBgColorWithoutTransparency) { wasPositivePressed, color ->
if (wasPositivePressed) {
mBgColorWithoutTransparency = color mBgColorWithoutTransparency = color
updateBgColor() updateBgColor()
} }
} }
}
private fun pickTextColor() { private fun pickTextColor() {
ColorPickerDialog(this, mTextColor) { wasPositivePressed, color -> ColorPickerDialog(this, mTextColor) { wasPositivePressed, color ->
if (wasPositivePressed) {
mTextColorWithoutTransparency = color mTextColorWithoutTransparency = color
updateColors() updateColors()
} }
} }
}
private fun requestWidgetUpdate() { private fun requestWidgetUpdate() {
Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE, null, this, MyWidgetDateTimeProvider::class.java).apply { Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE, null, this, MyWidgetDateTimeProvider::class.java).apply {