diff --git a/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/AssuranceActivity.kt b/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/AssuranceActivity.kt index b3a563d..3314480 100644 --- a/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/AssuranceActivity.kt +++ b/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/AssuranceActivity.kt @@ -15,9 +15,14 @@ import android.content.pm.ActivityInfo import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.safeDrawingPadding import androidx.compose.material.MaterialTheme +import androidx.compose.material.Surface import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.SideEffect +import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.toArgb import androidx.navigation.compose.rememberNavController import com.adobe.marketing.mobile.assurance.internal.AssuranceComponentRegistry @@ -26,7 +31,7 @@ import com.adobe.marketing.mobile.assurance.internal.ui.theme.AssuranceTheme.bac /** * Activity that hosts all of the Assurance UI. */ -internal class AssuranceActivity : ComponentActivity() { +class AssuranceActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -36,29 +41,46 @@ internal class AssuranceActivity : ComponentActivity() { setContent { MaterialTheme( content = { - // Locks the Assurance screen to always be in portrait mode. - val orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT - DisposableEffect(orientation) { - val originalOrientation = requestedOrientation - requestedOrientation = orientation - onDispose { - // restore original orientation when view disappears - requestedOrientation = originalOrientation - } - } + Surface( + modifier = Modifier + .fillMaxSize(), + color = backgroundColor + ) { + Box( + modifier = Modifier + .safeDrawingPadding() + .fillMaxSize() + ) { + + // Locks the Assurance screen to always be in portrait mode. + val orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT + DisposableEffect(orientation) { + val originalOrientation = requestedOrientation + requestedOrientation = orientation + onDispose { + // restore original orientation when view disappears + requestedOrientation = originalOrientation + } + } - // Set the status bar and navigation bar colors to be the same as the - // background color of Assurance screens. This isto simulate an edge to edge - // experience while the Assurance UI is active. - SideEffect { - with(this@AssuranceActivity) { - window.statusBarColor = backgroundColor.toArgb() - window.navigationBarColor = backgroundColor.toArgb() + // Set the status bar and navigation bar colors to be the same as the + // background color of Assurance screens. This is to simulate an edge to edge + // experience while the Assurance UI is active. + // TODO: + // When Assurance SDK's target SDK is updated to 35 (where the + // window.statusBarColor, window.navigationBarColor APIs are deprecated), + // update activity-compose dependency and use enableEdgeToEdge API. + SideEffect { + with(this@AssuranceActivity) { + window.statusBarColor = backgroundColor.toArgb() + window.navigationBarColor = backgroundColor.toArgb() + } + } + + // The AssuranceNavHost composable which is the entry point for the Assurance UI. + AssuranceNavHost(rememberNavController(), connectionPhase) } } - - // The AssuranceNavHost composable which is the entry point for the Assurance UI. - AssuranceNavHost(rememberNavController(), connectionPhase) } ) } diff --git a/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/pin/dialpad/DialPadView.kt b/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/pin/dialpad/DialPadView.kt index 5470dc1..0a088a3 100644 --- a/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/pin/dialpad/DialPadView.kt +++ b/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/pin/dialpad/DialPadView.kt @@ -15,9 +15,13 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.ui.Alignment @@ -44,9 +48,12 @@ internal fun DialPadView( pinScreenState: State, onAction: (action: PinScreenAction) -> Unit ) { + + val scrollState = rememberScrollState() Box( modifier = Modifier .fillMaxSize() + .verticalScroll(scrollState) .background(backgroundColor) .padding(horizontal = AssuranceTheme.dimensions.padding.xxLarge) .testTag(AssuranceUiTestTags.PinScreen.DIAL_PAD_VIEW) @@ -62,6 +69,7 @@ internal fun DialPadView( NumberRow(listOf("4", "5", "6"), onClick = { action -> onAction(action) }) NumberRow(listOf("7", "8", "9"), onClick = { action -> onAction(action) }) SymbolRow(onClick = { action -> onAction(action) }) + Spacer(modifier = Modifier.height(AssuranceTheme.dimensions.spacing.xLarge)) } ActionButtonRow( diff --git a/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/pin/error/PinAuthErrorMessageContent.kt b/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/pin/error/PinAuthErrorMessageContent.kt index b2d1fbc..4bdcd60 100644 --- a/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/pin/error/PinAuthErrorMessageContent.kt +++ b/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/pin/error/PinAuthErrorMessageContent.kt @@ -47,7 +47,7 @@ internal fun PinAuthErrorMessageContent(text: String) { fontFamily = FontFamily.SansSerif, fontSize = 18.sp, fontWeight = FontWeight.Normal, - textAlign = TextAlign.Justify + textAlign = TextAlign.Start ), modifier = Modifier .fillMaxWidth() diff --git a/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/pin/loading/PinConnectingView.kt b/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/pin/loading/PinConnectingView.kt index 7a1d120..dea356c 100644 --- a/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/pin/loading/PinConnectingView.kt +++ b/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/pin/loading/PinConnectingView.kt @@ -34,11 +34,10 @@ import com.adobe.marketing.mobile.assurance.internal.ui.theme.AssuranceTheme.bac @Composable internal fun PinConnectingView() { Box( - modifier = Modifier.run { - fillMaxSize() - .background(backgroundColor) - .padding(horizontal = AssuranceTheme.dimensions.padding.xLarge) - } + modifier = Modifier + .fillMaxSize() + .background(backgroundColor) + .padding(horizontal = AssuranceTheme.dimensions.padding.xLarge) ) { Column( modifier = Modifier.fillMaxSize(), diff --git a/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/quickconnect/QuickConnectErrorPanel.kt b/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/quickconnect/QuickConnectErrorPanel.kt index 4d07955..fb03b3b 100644 --- a/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/quickconnect/QuickConnectErrorPanel.kt +++ b/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/quickconnect/QuickConnectErrorPanel.kt @@ -74,7 +74,7 @@ internal fun QuickConnectErrorPanel(error: AssuranceConstants.AssuranceConnectio text = error.description, color = Color.White, fontFamily = FontFamily.SansSerif, - textAlign = TextAlign.Center, + textAlign = TextAlign.Start, style = TextStyle( color = Color.White, fontSize = AssuranceTheme.typography.font.size.large.sp diff --git a/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/theme/AssuranceTheme.kt b/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/theme/AssuranceTheme.kt index 6cb03a7..a9729b5 100644 --- a/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/theme/AssuranceTheme.kt +++ b/code/assurance/src/main/java/com/adobe/marketing/mobile/assurance/internal/ui/theme/AssuranceTheme.kt @@ -39,7 +39,8 @@ internal object Dimensions { internal class Spacing( val small: Dp, val medium: Dp, - val large: Dp + val large: Dp, + val xLarge: Dp ) internal class Size( @@ -68,6 +69,7 @@ internal object Dimensions { small = 20.dp, medium = 24.dp, large = 32.dp, + xLarge = 64.dp ) internal val button = Button(