From 6a5832b2cec4a23f46482c4893465e73801b5b4c Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 31 Aug 2022 19:11:09 +0200 Subject: [PATCH] updating commons and target SDK to 33 --- app/build.gradle | 11 ++++++----- .../clock/activities/MainActivity.kt | 2 +- .../clock/dialogs/AddTimeZonesDialog.kt | 14 +++++++------- .../clock/dialogs/ChangeAlarmSortDialog.kt | 6 +++--- .../clock/dialogs/EditAlarmDialog.kt | 10 +++++----- .../clock/dialogs/EditTimeZoneDialog.kt | 16 ++++++++-------- .../clock/dialogs/EditTimerDialog.kt | 10 +++++----- .../clock/dialogs/MyTimePickerDialogDialog.kt | 6 +++--- 8 files changed, 38 insertions(+), 37 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 02abc936..988ed12f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,12 +10,12 @@ if (keystorePropertiesFile.exists()) { } android { - compileSdkVersion 31 + compileSdkVersion 33 defaultConfig { applicationId "com.simplemobiletools.clock" minSdkVersion 23 - targetSdkVersion 31 + targetSdkVersion 33 versionCode 29 versionName "5.8.1" setProperty("archivesBaseName", "clock") @@ -64,7 +64,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:dc5ab26794' + implementation 'com.github.SimpleMobileTools:Simple-Commons:e79ef36c10' implementation 'com.facebook.stetho:stetho:1.5.1' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'com.shawnlin:number-picker:2.4.6' @@ -72,10 +72,11 @@ dependencies { implementation "androidx.work:work-runtime-ktx:2.7.1" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0' implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1' + implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1' implementation 'org.greenrobot:eventbus:3.3.1' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'me.grantland:autofittextview:0.2.1' - implementation 'androidx.room:room-runtime:2.4.2' - kapt 'androidx.room:room-compiler:2.4.2' + implementation 'androidx.room:room-runtime:2.4.3' + kapt 'androidx.room:room-compiler:2.4.3' } diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/MainActivity.kt index d041e850..cc5017b8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/MainActivity.kt @@ -193,7 +193,7 @@ class MainActivity : SimpleActivity() { } main_tabs_holder.getTabAt(view_pager.currentItem)?.select() - val bottomBarColor = getBottomTabsBackgroundColor() + val bottomBarColor = getBottomNavigationBackgroundColor() main_tabs_holder.setBackgroundColor(bottomBarColor) updateNavigationBarColor(bottomBarColor) } diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/AddTimeZonesDialog.kt b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/AddTimeZonesDialog.kt index 95ec0a50..13bf18df 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/AddTimeZonesDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/AddTimeZonesDialog.kt @@ -1,11 +1,11 @@ package com.simplemobiletools.clock.dialogs -import androidx.appcompat.app.AlertDialog import com.simplemobiletools.clock.R import com.simplemobiletools.clock.activities.SimpleActivity import com.simplemobiletools.clock.adapters.SelectTimeZonesAdapter import com.simplemobiletools.clock.extensions.config import com.simplemobiletools.clock.helpers.getAllTimeZones +import com.simplemobiletools.commons.extensions.getAlertDialogBuilder import com.simplemobiletools.commons.extensions.setupDialogStuff import kotlinx.android.synthetic.main.dialog_select_time_zones.view.* @@ -15,12 +15,12 @@ class AddTimeZonesDialog(val activity: SimpleActivity, private val callback: () init { view.select_time_zones_list.adapter = SelectTimeZonesAdapter(activity, getAllTimeZones()) - AlertDialog.Builder(activity) - .setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() } - .setNegativeButton(R.string.cancel, null) - .create().apply { - activity.setupDialogStuff(view, this) - } + activity.getAlertDialogBuilder() + .setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() } + .setNegativeButton(R.string.cancel, null) + .apply { + activity.setupDialogStuff(view, this) + } } private fun dialogConfirmed() { diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/ChangeAlarmSortDialog.kt b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/ChangeAlarmSortDialog.kt index 6e75d096..3483f118 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/ChangeAlarmSortDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/ChangeAlarmSortDialog.kt @@ -1,13 +1,13 @@ package com.simplemobiletools.clock.dialogs import android.view.View -import androidx.appcompat.app.AlertDialog import com.simplemobiletools.clock.R import com.simplemobiletools.clock.extensions.config import com.simplemobiletools.clock.helpers.SORT_BY_ALARM_TIME import com.simplemobiletools.clock.helpers.SORT_BY_CREATION_ORDER import com.simplemobiletools.clock.helpers.SORT_BY_DATE_AND_TIME import com.simplemobiletools.commons.activities.BaseSimpleActivity +import com.simplemobiletools.commons.extensions.getAlertDialogBuilder import com.simplemobiletools.commons.extensions.setupDialogStuff import kotlinx.android.synthetic.main.dialog_change_alarm_sort.view.* @@ -22,10 +22,10 @@ class ChangeAlarmSortDialog(val activity: BaseSimpleActivity, val callback: () - } init { - AlertDialog.Builder(activity) + activity.getAlertDialogBuilder() .setPositiveButton(R.string.ok) { _, _ -> dialogConfirmed() } .setNegativeButton(R.string.cancel, null) - .create().apply { + .apply { activity.setupDialogStuff(view, this, R.string.sort_by) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt index 7347ad17..a7456ee7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt @@ -103,12 +103,12 @@ class EditAlarmDialog(val activity: SimpleActivity, val alarm: Alarm, val callba } } - AlertDialog.Builder(activity) + activity.getAlertDialogBuilder() .setPositiveButton(R.string.ok, null) .setNegativeButton(R.string.cancel, null) - .create().apply { - activity.setupDialogStuff(view, this) { - getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { + .apply { + activity.setupDialogStuff(view, this) { alertDialog -> + alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { if (!activity.config.wasAlarmWarningShown) { ConfirmationDialog(activity, messageId = R.string.alarm_warning, positive = R.string.ok, negative = 0) { activity.config.wasAlarmWarningShown = true @@ -143,7 +143,7 @@ class EditAlarmDialog(val activity: SimpleActivity, val alarm: Alarm, val callba activity.config.alarmLastConfig = alarm callback(alarmId) - dismiss() + alertDialog.dismiss() } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditTimeZoneDialog.kt b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditTimeZoneDialog.kt index f054abbd..d61dd0ad 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditTimeZoneDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditTimeZoneDialog.kt @@ -1,6 +1,5 @@ package com.simplemobiletools.clock.dialogs -import androidx.appcompat.app.AlertDialog import com.simplemobiletools.clock.R import com.simplemobiletools.clock.activities.SimpleActivity import com.simplemobiletools.clock.extensions.config @@ -9,6 +8,7 @@ import com.simplemobiletools.clock.extensions.getModifiedTimeZoneTitle import com.simplemobiletools.clock.helpers.EDITED_TIME_ZONE_SEPARATOR import com.simplemobiletools.clock.helpers.getDefaultTimeZoneTitle import com.simplemobiletools.clock.models.MyTimeZone +import com.simplemobiletools.commons.extensions.getAlertDialogBuilder import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.showKeyboard import com.simplemobiletools.commons.extensions.value @@ -22,14 +22,14 @@ class EditTimeZoneDialog(val activity: SimpleActivity, val myTimeZone: MyTimeZon edit_time_zone_value.text = getDefaultTimeZoneTitle(myTimeZone.id) } - AlertDialog.Builder(activity) - .setPositiveButton(R.string.ok, { dialog, which -> dialogConfirmed(view.edit_time_zone_title.value) }) - .setNegativeButton(R.string.cancel, null) - .create().apply { - activity.setupDialogStuff(view, this) { - showKeyboard(view.edit_time_zone_title) - } + activity.getAlertDialogBuilder() + .setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed(view.edit_time_zone_title.value) } + .setNegativeButton(R.string.cancel, null) + .apply { + activity.setupDialogStuff(view, this) { alertDialog -> + alertDialog.showKeyboard(view.edit_time_zone_title) } + } } private fun dialogConfirmed(newTitle: String) { diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditTimerDialog.kt b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditTimerDialog.kt index d655f723..e2c055e0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditTimerDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditTimerDialog.kt @@ -63,17 +63,17 @@ class EditTimerDialog(val activity: SimpleActivity, val timer: Timer, val callba } - AlertDialog.Builder(activity) + activity.getAlertDialogBuilder() .setPositiveButton(R.string.ok, null) .setNegativeButton(R.string.cancel, null) - .create().apply { - activity.setupDialogStuff(view, this) { - getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { + .apply { + activity.setupDialogStuff(view, this) { alertDialog -> + alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { timer.label = view.edit_timer_label.value activity.timerHelper.insertOrUpdateTimer(timer) { activity.config.timerLastConfig = timer callback() - dismiss() + alertDialog.dismiss() } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/MyTimePickerDialogDialog.kt b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/MyTimePickerDialogDialog.kt index 06156793..f4968167 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/MyTimePickerDialogDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/MyTimePickerDialogDialog.kt @@ -1,8 +1,8 @@ package com.simplemobiletools.clock.dialogs -import androidx.appcompat.app.AlertDialog import com.simplemobiletools.clock.R import com.simplemobiletools.clock.activities.SimpleActivity +import com.simplemobiletools.commons.extensions.getAlertDialogBuilder import com.simplemobiletools.commons.extensions.getProperTextColor import com.simplemobiletools.commons.extensions.setupDialogStuff import kotlinx.android.synthetic.main.dialog_my_time_picker.view.* @@ -24,10 +24,10 @@ class MyTimePickerDialogDialog(val activity: SimpleActivity, val initialSeconds: my_time_picker_seconds.value = initialSeconds % 60 } - AlertDialog.Builder(activity) + activity.getAlertDialogBuilder() .setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() } .setNegativeButton(R.string.cancel, null) - .create().apply { + .apply { activity.setupDialogStuff(view, this) } }