mirror of
https://github.com/owenlejeune/TVTime.git
synced 2025-11-22 11:40:54 -05:00
move some remember to rememberSaveable
This commit is contained in:
@@ -5,6 +5,7 @@ import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
@@ -29,7 +30,7 @@ class MainActivity : ComponentActivity() {
|
||||
|
||||
setContent {
|
||||
AppKeyboardFocusManager()
|
||||
val displayUnderStatusBar = remember { mutableStateOf(false) }
|
||||
val displayUnderStatusBar = rememberSaveable { mutableStateOf(false) }
|
||||
// WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
// WindowCompat.setDecorFitsSystemWindows(window, !displayUnderStatusBar.value)
|
||||
// val statusBarColor = if (displayUnderStatusBar.value) {
|
||||
|
||||
@@ -45,7 +45,7 @@ fun MainAppView(appNavController: NavHostController, preferences: AppPreferences
|
||||
}
|
||||
|
||||
val focusRequester = remember { FocusRequester() }
|
||||
val focusSearchBar = remember { mutableStateOf(false) }
|
||||
val focusSearchBar = rememberSaveable { mutableStateOf(false) }
|
||||
val searchableScreens = listOf(BottomNavItem.Movies.route, BottomNavItem.TV.route, BottomNavItem.People.route)
|
||||
|
||||
val appBarActions = remember { mutableStateOf<@Composable RowScope.() -> Unit>( {} ) }
|
||||
@@ -123,7 +123,7 @@ private fun SearchTopBar(
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
val hasSearchFocus = remember { mutableStateOf(requestSearchFocus.value) }
|
||||
val hasSearchFocus = rememberSaveable { mutableStateOf(requestSearchFocus.value) }
|
||||
if (!requestSearchFocus.value && !hasSearchFocus.value && !(preferences.persistentSearch && preferences.hideTitle)) {
|
||||
Text(text = title.value)
|
||||
}
|
||||
|
||||
@@ -54,19 +54,27 @@ fun AccountTab(
|
||||
appBarTitle: MutableState<String>,
|
||||
appBarActions: MutableState<@Composable (RowScope.() -> Unit)> = mutableStateOf({})
|
||||
) {
|
||||
if (appBarTitle.value.equals(stringResource(id = R.string.nav_account_title))) {
|
||||
when (SessionManager.currentSession?.isAuthorized) {
|
||||
false -> {
|
||||
appBarTitle.value =
|
||||
stringResource(id = R.string.account_header_title_formatted, stringResource(id = R.string.account_name_guest))
|
||||
stringResource(
|
||||
id = R.string.account_header_title_formatted,
|
||||
stringResource(id = R.string.account_name_guest)
|
||||
)
|
||||
}
|
||||
true -> {
|
||||
appBarTitle.value =
|
||||
stringResource(id = R.string.account_header_title_formatted, getAccountName(SessionManager.currentSession?.accountDetails))
|
||||
stringResource(
|
||||
id = R.string.account_header_title_formatted,
|
||||
getAccountName(SessionManager.currentSession?.accountDetails)
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
appBarTitle.value = stringResource(id = R.string.account_not_logged_in)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val lastSelectedOption = remember { mutableStateOf("") }
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ fun PeopleTab(
|
||||
appBarTitle: MutableState<String>,
|
||||
appNavController: NavHostController
|
||||
) {
|
||||
// appBarTitle.value = stringResource(id = R.string.nav_popular_people_title)
|
||||
// appBarTitle.value = stringResource(id = R.string.nav_people_title)
|
||||
|
||||
val service = PeopleService()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user