Skip to content

Commit

Permalink
Minor code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Javernaut committed Apr 3, 2024
1 parent afbdea4 commit 8bd12e3
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,18 @@ class RootActivity : AppCompatActivity() {
WhatTheCodecTheme {
val screenState by mediaFileViewModel.screenState.observeAsState()
if (screenState == null) {
EmptyScreen(::onPickVideoClicked, ::onPickAudioClicked) {
SettingsActivity.start(this@RootActivity)
}
EmptyScreen(
::onPickVideoClicked,
::onPickAudioClicked,
::onSettingsClicked
)
} else {
MainScreen(screenState!!, ::onPickVideoClicked, ::onPickAudioClicked) {
SettingsActivity.start(this@RootActivity)
}
MainScreen(
screenState!!,
::onPickVideoClicked,
::onPickAudioClicked,
::onSettingsClicked
)
}
}
}
Expand Down Expand Up @@ -139,6 +144,10 @@ class RootActivity : AppCompatActivity() {
}
}

private fun onSettingsClicked() {
SettingsActivity.start(this@RootActivity)
}

private inline fun checkPermissionAndTryOpenMedia(requestCode: Int, actualAction: () -> Unit) {
if (TinyActivityCompat.needRequestReadStoragePermission(this)) {
TinyActivityCompat.requestReadStoragePermission(this, requestCode)
Expand Down

0 comments on commit 8bd12e3

Please sign in to comment.