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 mFocusCircleView: FocusCircleView
|
||||
private lateinit var mediaSoundHelper: MediaSoundHelper
|
||||
private lateinit var binding: ActivityMainBinding
|
||||
private var mPreview: MyPreview? = null
|
||||
private var mediaSizeToggleGroup: MaterialButtonToggleGroup? = null
|
||||
private var mPreviewUri: Uri? = null
|
||||
|
@ -67,6 +66,7 @@ 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) {
|
||||
|
@ -90,7 +90,6 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
useDynamicTheme = false
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
||||
appLaunched(BuildConfig.APPLICATION_ID)
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
initVariables()
|
||||
|
|
|
@ -17,12 +17,11 @@ import java.util.*
|
|||
import kotlin.system.exitProcess
|
||||
|
||||
class SettingsActivity : SimpleActivity() {
|
||||
private lateinit var binding: ActivitySettingsBinding
|
||||
private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivitySettingsBinding.inflate(layoutInflater) }
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
isMaterialActivity = true
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivitySettingsBinding.inflate(layoutInflater)
|
||||
binding.apply {
|
||||
setContentView(root)
|
||||
setupOptionsMenu()
|
||||
|
|
Loading…
Reference in New Issue