bind activities lazily
This commit is contained in:
parent
3d09de6939
commit
4087769c7e
|
@ -59,7 +59,6 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
|
||||||
private lateinit var mOrientationEventListener: OrientationEventListener
|
private lateinit var mOrientationEventListener: OrientationEventListener
|
||||||
private lateinit var mFocusCircleView: FocusCircleView
|
private lateinit var mFocusCircleView: FocusCircleView
|
||||||
private lateinit var mediaSoundHelper: MediaSoundHelper
|
private lateinit var mediaSoundHelper: MediaSoundHelper
|
||||||
private lateinit var binding: ActivityMainBinding
|
|
||||||
private var mPreview: MyPreview? = null
|
private var mPreview: MyPreview? = null
|
||||||
private var mediaSizeToggleGroup: MaterialButtonToggleGroup? = null
|
private var mediaSizeToggleGroup: MaterialButtonToggleGroup? = null
|
||||||
private var mPreviewUri: Uri? = null
|
private var mPreviewUri: Uri? = null
|
||||||
|
@ -67,6 +66,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
|
||||||
private var mLastHandledOrientation = 0
|
private var mLastHandledOrientation = 0
|
||||||
private var countDownTimer: CountDownTimer? = null
|
private var countDownTimer: CountDownTimer? = null
|
||||||
|
|
||||||
|
private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivityMainBinding.inflate(layoutInflater) }
|
||||||
private val tabSelectedListener = object : TabSelectedListener {
|
private val tabSelectedListener = object : TabSelectedListener {
|
||||||
override fun onTabSelected(tab: TabLayout.Tab) {
|
override fun onTabSelected(tab: TabLayout.Tab) {
|
||||||
handlePermission(PERMISSION_RECORD_AUDIO) {
|
handlePermission(PERMISSION_RECORD_AUDIO) {
|
||||||
|
@ -90,7 +90,6 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
useDynamicTheme = false
|
useDynamicTheme = false
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
|
||||||
appLaunched(BuildConfig.APPLICATION_ID)
|
appLaunched(BuildConfig.APPLICATION_ID)
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||||
initVariables()
|
initVariables()
|
||||||
|
|
|
@ -17,12 +17,11 @@ import java.util.*
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
class SettingsActivity : SimpleActivity() {
|
class SettingsActivity : SimpleActivity() {
|
||||||
private lateinit var binding: ActivitySettingsBinding
|
private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivitySettingsBinding.inflate(layoutInflater) }
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
isMaterialActivity = true
|
isMaterialActivity = true
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivitySettingsBinding.inflate(layoutInflater)
|
|
||||||
binding.apply {
|
binding.apply {
|
||||||
setContentView(root)
|
setContentView(root)
|
||||||
setupOptionsMenu()
|
setupOptionsMenu()
|
||||||
|
|
Loading…
Reference in New Issue