From c37c11dcdcb5ea5cafcee0a4e9dbdb9a159b9c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Tue, 15 Aug 2023 13:31:06 +0200 Subject: [PATCH] Use delegated property viewbinding for activities --- .../com/simplemobiletools/clock/activities/MainActivity.kt | 3 +-- .../com/simplemobiletools/clock/activities/ReminderActivity.kt | 3 +-- .../com/simplemobiletools/clock/activities/SettingsActivity.kt | 3 +-- .../clock/activities/WidgetAnalogueConfigureActivity.kt | 3 +-- .../clock/activities/WidgetDigitalConfigureActivity.kt | 3 +-- .../simplemobiletools/clock/dialogs/ChangeAlarmSortDialog.kt | 2 +- 6 files changed, 6 insertions(+), 11 deletions(-) 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 efc81e3..312ff99 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/MainActivity.kt @@ -24,12 +24,11 @@ class MainActivity : SimpleActivity() { private var storedTextColor = 0 private var storedBackgroundColor = 0 private var storedPrimaryColor = 0 - private lateinit var binding: ActivityMainBinding + private val binding: ActivityMainBinding by viewBinding(ActivityMainBinding::inflate) override fun onCreate(savedInstanceState: Bundle?) { isMaterialActivity = true super.onCreate(savedInstanceState) - binding = ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root) appLaunched(BuildConfig.APPLICATION_ID) setupOptionsMenu() diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt index a314e2e..530a4a1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt @@ -35,12 +35,11 @@ class ReminderActivity : SimpleActivity() { private var vibrator: Vibrator? = null private var lastVolumeValue = 0.1f private var dragDownX = 0f - private lateinit var binding: ActivityReminderBinding + private val binding: ActivityReminderBinding by viewBinding(ActivityReminderBinding::inflate) override fun onCreate(savedInstanceState: Bundle?) { isMaterialActivity = true super.onCreate(savedInstanceState) - binding = ActivityReminderBinding.inflate(layoutInflater) setContentView(binding.root) showOverLockscreen() updateTextColors(binding.root) diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/SettingsActivity.kt index 6bc7740..93f0a0c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/SettingsActivity.kt @@ -15,12 +15,11 @@ import java.util.Locale import kotlin.system.exitProcess class SettingsActivity : SimpleActivity() { - private lateinit var binding: ActivitySettingsBinding + private val binding: ActivitySettingsBinding by viewBinding(ActivitySettingsBinding::inflate) override fun onCreate(savedInstanceState: Bundle?) { isMaterialActivity = true super.onCreate(savedInstanceState) - binding = ActivitySettingsBinding.inflate(layoutInflater) setContentView(binding.root) updateMaterialActivityViews(binding.settingsCoordinator, binding.settingsHolder, useTransparentNavigation = true, useTopSearchMenu = false) diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/WidgetAnalogueConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/WidgetAnalogueConfigureActivity.kt index 501bd3d..381aa0e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/WidgetAnalogueConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/WidgetAnalogueConfigureActivity.kt @@ -21,13 +21,12 @@ class WidgetAnalogueConfigureActivity : SimpleActivity() { private var mBgColor = 0 private var mBgColorWithoutTransparency = 0 private var mFeatureLockedDialog: FeatureLockedDialog? = null - private lateinit var binding: WidgetConfigAnalogueBinding + private val binding: WidgetConfigAnalogueBinding by viewBinding(WidgetConfigAnalogueBinding::inflate) public override fun onCreate(savedInstanceState: Bundle?) { useDynamicTheme = false super.onCreate(savedInstanceState) setResult(Activity.RESULT_CANCELED) - binding = WidgetConfigAnalogueBinding.inflate(layoutInflater) setContentView(binding.root) initVariables() diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/WidgetDigitalConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/WidgetDigitalConfigureActivity.kt index a272c0e..d8d3a7c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/WidgetDigitalConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/WidgetDigitalConfigureActivity.kt @@ -24,13 +24,12 @@ class WidgetDigitalConfigureActivity : SimpleActivity() { private var mTextColor = 0 private var mBgColorWithoutTransparency = 0 private var mFeatureLockedDialog: FeatureLockedDialog? = null - private lateinit var binding: WidgetConfigDigitalBinding + private val binding: WidgetConfigDigitalBinding by viewBinding(WidgetConfigDigitalBinding::inflate) public override fun onCreate(savedInstanceState: Bundle?) { useDynamicTheme = false super.onCreate(savedInstanceState) setResult(Activity.RESULT_CANCELED) - binding = WidgetConfigDigitalBinding.inflate(layoutInflater) setContentView(binding.root) initVariables() 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 470b01c..9b97ee5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/ChangeAlarmSortDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/ChangeAlarmSortDialog.kt @@ -11,7 +11,7 @@ import com.simplemobiletools.commons.extensions.getAlertDialogBuilder import com.simplemobiletools.commons.extensions.setupDialogStuff class ChangeAlarmSortDialog(val activity: BaseSimpleActivity, val callback: () -> Unit) { - private var binding = DialogChangeAlarmSortBinding.inflate(activity.layoutInflater).apply { + private val binding = DialogChangeAlarmSortBinding.inflate(activity.layoutInflater).apply { val activeRadioButton = when (activity.config.alarmSort) { SORT_BY_ALARM_TIME -> sortingDialogRadioAlarmTime SORT_BY_DATE_AND_TIME -> sortingDialogRadioDayAndTime