From ebf0bbd656eff61f5acc149b6656c6b135fcbbfe Mon Sep 17 00:00:00 2001 From: fatih ergin Date: Fri, 25 Aug 2023 22:59:30 +0300 Subject: [PATCH] use binding extension to inflate activities --- .../com/simplemobiletools/camera/activities/MainActivity.kt | 3 ++- .../simplemobiletools/camera/activities/SettingsActivity.kt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt index bc36ff90..a60e7512 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt @@ -53,6 +53,8 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera private const val TIMER_2_SECONDS = 2001 } + private val binding by viewBinding(ActivityMainBinding::inflate) + private lateinit var defaultScene: Scene private lateinit var flashModeScene: Scene private lateinit var timerScene: Scene @@ -66,7 +68,6 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera private var mLastHandledOrientation = 0 private var countDownTimer: CountDownTimer? = null - private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivityMainBinding.inflate(layoutInflater) } private val tabSelectedListener = object : TabSelectedListener { override fun onTabSelected(tab: TabLayout.Tab) { handlePermission(PERMISSION_RECORD_AUDIO) { diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt index 5a7e05b8..cc66798a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt @@ -17,7 +17,7 @@ import java.util.* import kotlin.system.exitProcess class SettingsActivity : SimpleActivity() { - private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivitySettingsBinding.inflate(layoutInflater) } + private val binding by viewBinding(ActivitySettingsBinding::inflate) override fun onCreate(savedInstanceState: Bundle?) { isMaterialActivity = true