Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply changes from 2.0.2 release #134

Merged
merged 12 commits into from
Dec 15, 2024
Prev Previous commit
Next Next commit
EditAsset: show keyboard on screen open
  • Loading branch information
mdrlzy committed Dec 14, 2024
commit 18fb2967a9a41f517e4c26bdeff9ce758c0ea4ae
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@ import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
Expand Down Expand Up @@ -101,6 +106,13 @@ private fun Content(
var showMarketCapitalizationDialog by remember { mutableStateOf(false) }
var showValueOfCirculatingDialog by remember { mutableStateOf(false) }

val focusRequester = remember { FocusRequester() }
val keyboardController = LocalSoftwareKeyboardController.current

LaunchedEffect(Unit) {
focusRequester.requestFocus()
}

if (showMarketCapitalizationDialog) {
InfoMarketCapitalizationDialog { showMarketCapitalizationDialog = false }
}
Expand Down Expand Up @@ -137,7 +149,13 @@ private fun Content(
modifier =
Modifier
.weight(1f, fill = false)
.align(Alignment.CenterVertically),
.align(Alignment.CenterVertically)
.focusRequester(focusRequester)
.onFocusChanged {
if (it.isFocused) {
keyboardController?.show()
}
},
value = value,
onValueChange = { onValueChange(it) },
)
Expand Down