Loading packages/CredentialManager/wear/Android.bp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -35,6 +35,7 @@ android_app { "androidx.compose.ui_ui", "androidx.compose.ui_ui", "androidx.compose.ui_ui-tooling", "androidx.compose.ui_ui-tooling", "androidx.core_core-ktx", "androidx.core_core-ktx", "androidx.hilt_hilt-navigation-compose", "androidx.lifecycle_lifecycle-extensions", "androidx.lifecycle_lifecycle-extensions", "androidx.lifecycle_lifecycle-livedata", "androidx.lifecycle_lifecycle-livedata", "androidx.lifecycle_lifecycle-runtime-ktx", "androidx.lifecycle_lifecycle-runtime-ktx", Loading packages/CredentialManager/wear/src/com/android/credentialmanager/CredentialSelectorActivity.kt +6 −48 Original line number Original line Diff line number Diff line Loading @@ -21,16 +21,10 @@ import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.compose.setContent import androidx.activity.viewModels import androidx.activity.viewModels import androidx.lifecycle.Lifecycle import androidx.lifecycle.lifecycleScope import androidx.lifecycle.repeatOnLifecycle import androidx.wear.compose.material.MaterialTheme import androidx.wear.compose.material.MaterialTheme import com.android.credentialmanager.ui.WearApp import com.android.credentialmanager.ui.WearApp import com.android.credentialmanager.ui.screens.single.password.SinglePasswordScreen import com.google.android.horologist.annotations.ExperimentalHorologistApi import com.google.android.horologist.annotations.ExperimentalHorologistApi import com.google.android.horologist.compose.layout.belowTimeTextPreview import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.launch @AndroidEntryPoint(ComponentActivity::class) @AndroidEntryPoint(ComponentActivity::class) class CredentialSelectorActivity : Hilt_CredentialSelectorActivity() { class CredentialSelectorActivity : Hilt_CredentialSelectorActivity() { Loading @@ -42,11 +36,6 @@ class CredentialSelectorActivity : Hilt_CredentialSelectorActivity() { super.onCreate(savedInstanceState) super.onCreate(savedInstanceState) setTheme(android.R.style.Theme_DeviceDefault) setTheme(android.R.style.Theme_DeviceDefault) // TODO: b/301027810 due to this issue with compose in Main platform, we are implementing a // workaround. Once the issue is fixed, remove the "else" bracket and leave only the // contents of the "if" bracket. if (false) { setContent { setContent { MaterialTheme { MaterialTheme { WearApp( WearApp( Loading @@ -55,37 +44,6 @@ class CredentialSelectorActivity : Hilt_CredentialSelectorActivity() { ) ) } } } } } else { // TODO: b/301027810 Remove the content of this "else" bracket fully once issue is fixed lifecycleScope.launch { repeatOnLifecycle(Lifecycle.State.STARTED) { viewModel.uiState.collect { uiState -> when (uiState) { CredentialSelectorUiState.Idle -> { // Don't display anything, assuming that there should be minimal latency // to parse the Credential Manager intent and define the state of the // app. If latency is big, then a "loading" screen should be displayed // to the user. } is CredentialSelectorUiState.Get -> { setContent { MaterialTheme { SinglePasswordScreen( columnState = belowTimeTextPreview(), onCloseApp = ::finish, ) } } } else -> finish() } } } } } viewModel.onNewIntent(intent) viewModel.onNewIntent(intent) } } Loading packages/CredentialManager/wear/src/com/android/credentialmanager/ui/screens/single/password/SinglePasswordScreen.kt +2 −2 Original line number Original line Diff line number Diff line Loading @@ -27,8 +27,8 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.viewmodel.compose.viewModel import com.android.credentialmanager.R import com.android.credentialmanager.R import com.android.credentialmanager.TAG import com.android.credentialmanager.TAG import com.android.credentialmanager.activity.StartBalIntentSenderForResultContract import com.android.credentialmanager.activity.StartBalIntentSenderForResultContract Loading @@ -47,7 +47,7 @@ fun SinglePasswordScreen( columnState: ScalingLazyColumnState, columnState: ScalingLazyColumnState, onCloseApp: () -> Unit, onCloseApp: () -> Unit, modifier: Modifier = Modifier, modifier: Modifier = Modifier, viewModel: SinglePasswordScreenViewModel = viewModel(), viewModel: SinglePasswordScreenViewModel = hiltViewModel(), ) { ) { viewModel.initialize() viewModel.initialize() Loading Loading
packages/CredentialManager/wear/Android.bp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -35,6 +35,7 @@ android_app { "androidx.compose.ui_ui", "androidx.compose.ui_ui", "androidx.compose.ui_ui-tooling", "androidx.compose.ui_ui-tooling", "androidx.core_core-ktx", "androidx.core_core-ktx", "androidx.hilt_hilt-navigation-compose", "androidx.lifecycle_lifecycle-extensions", "androidx.lifecycle_lifecycle-extensions", "androidx.lifecycle_lifecycle-livedata", "androidx.lifecycle_lifecycle-livedata", "androidx.lifecycle_lifecycle-runtime-ktx", "androidx.lifecycle_lifecycle-runtime-ktx", Loading
packages/CredentialManager/wear/src/com/android/credentialmanager/CredentialSelectorActivity.kt +6 −48 Original line number Original line Diff line number Diff line Loading @@ -21,16 +21,10 @@ import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.compose.setContent import androidx.activity.viewModels import androidx.activity.viewModels import androidx.lifecycle.Lifecycle import androidx.lifecycle.lifecycleScope import androidx.lifecycle.repeatOnLifecycle import androidx.wear.compose.material.MaterialTheme import androidx.wear.compose.material.MaterialTheme import com.android.credentialmanager.ui.WearApp import com.android.credentialmanager.ui.WearApp import com.android.credentialmanager.ui.screens.single.password.SinglePasswordScreen import com.google.android.horologist.annotations.ExperimentalHorologistApi import com.google.android.horologist.annotations.ExperimentalHorologistApi import com.google.android.horologist.compose.layout.belowTimeTextPreview import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.launch @AndroidEntryPoint(ComponentActivity::class) @AndroidEntryPoint(ComponentActivity::class) class CredentialSelectorActivity : Hilt_CredentialSelectorActivity() { class CredentialSelectorActivity : Hilt_CredentialSelectorActivity() { Loading @@ -42,11 +36,6 @@ class CredentialSelectorActivity : Hilt_CredentialSelectorActivity() { super.onCreate(savedInstanceState) super.onCreate(savedInstanceState) setTheme(android.R.style.Theme_DeviceDefault) setTheme(android.R.style.Theme_DeviceDefault) // TODO: b/301027810 due to this issue with compose in Main platform, we are implementing a // workaround. Once the issue is fixed, remove the "else" bracket and leave only the // contents of the "if" bracket. if (false) { setContent { setContent { MaterialTheme { MaterialTheme { WearApp( WearApp( Loading @@ -55,37 +44,6 @@ class CredentialSelectorActivity : Hilt_CredentialSelectorActivity() { ) ) } } } } } else { // TODO: b/301027810 Remove the content of this "else" bracket fully once issue is fixed lifecycleScope.launch { repeatOnLifecycle(Lifecycle.State.STARTED) { viewModel.uiState.collect { uiState -> when (uiState) { CredentialSelectorUiState.Idle -> { // Don't display anything, assuming that there should be minimal latency // to parse the Credential Manager intent and define the state of the // app. If latency is big, then a "loading" screen should be displayed // to the user. } is CredentialSelectorUiState.Get -> { setContent { MaterialTheme { SinglePasswordScreen( columnState = belowTimeTextPreview(), onCloseApp = ::finish, ) } } } else -> finish() } } } } } viewModel.onNewIntent(intent) viewModel.onNewIntent(intent) } } Loading
packages/CredentialManager/wear/src/com/android/credentialmanager/ui/screens/single/password/SinglePasswordScreen.kt +2 −2 Original line number Original line Diff line number Diff line Loading @@ -27,8 +27,8 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.viewmodel.compose.viewModel import com.android.credentialmanager.R import com.android.credentialmanager.R import com.android.credentialmanager.TAG import com.android.credentialmanager.TAG import com.android.credentialmanager.activity.StartBalIntentSenderForResultContract import com.android.credentialmanager.activity.StartBalIntentSenderForResultContract Loading @@ -47,7 +47,7 @@ fun SinglePasswordScreen( columnState: ScalingLazyColumnState, columnState: ScalingLazyColumnState, onCloseApp: () -> Unit, onCloseApp: () -> Unit, modifier: Modifier = Modifier, modifier: Modifier = Modifier, viewModel: SinglePasswordScreenViewModel = viewModel(), viewModel: SinglePasswordScreenViewModel = hiltViewModel(), ) { ) { viewModel.initialize() viewModel.initialize() Loading