Use delegated property viewbinding for activities

This commit is contained in:
Ensar Sarajčić 2023-08-15 13:31:06 +02:00
parent e816a02fde
commit c37c11dcdc
6 changed files with 6 additions and 11 deletions

View file

@ -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()

View file

@ -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)

View file

@ -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)

View file

@ -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()

View file

@ -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()

View file

@ -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