@@ -6,27 +6,34 @@ import android.os.Bundle
6
6
import androidx.activity.ComponentActivity
7
7
import androidx.activity.compose.setContent
8
8
import androidx.compose.foundation.layout.fillMaxSize
9
- import androidx.compose.material3.MaterialTheme
10
9
import androidx.compose.material3.Surface
11
10
import androidx.compose.ui.Modifier
12
- import com.firebase.ui.auth.AuthUI
11
+ import androidx.compose.ui.graphics.Color
12
+ import androidx.compose.ui.graphics.toArgb
13
+ import androidx.core.view.WindowCompat
13
14
import com.firebase.ui.auth.data.model.FirebaseAuthUIAuthenticationResult
14
- import com.firebase.uidemo.R
15
15
import com.firebase.uidemo.auth.SignedInActivity
16
16
import com.firebase.uidemo.ui.theme.FirebaseUIDemoTheme
17
17
18
18
class AuthComposeActivity : ComponentActivity () {
19
19
override fun onCreate (savedInstanceState : Bundle ? ) {
20
20
super .onCreate(savedInstanceState)
21
+
22
+ // Configure system UI
23
+ window.apply {
24
+ statusBarColor = Color .White .toArgb()
25
+ navigationBarColor = Color .White .toArgb()
26
+
27
+ WindowCompat .getInsetsController(this , decorView).apply {
28
+ isAppearanceLightStatusBars = true
29
+ isAppearanceLightNavigationBars = true
30
+ }
31
+ }
32
+
21
33
setContent {
22
34
FirebaseUIDemoTheme {
23
- Surface (
24
- modifier = Modifier .fillMaxSize(),
25
- color = MaterialTheme .colorScheme.background
26
- ) {
27
- AuthScreen { result ->
28
- handleSignInResponse(result)
29
- }
35
+ Surface (modifier = Modifier .fillMaxSize(), color = Color .White ) {
36
+ AuthScreen { result -> handleSignInResponse(result) }
30
37
}
31
38
}
32
39
}
@@ -35,20 +42,16 @@ class AuthComposeActivity : ComponentActivity() {
35
42
private fun handleSignInResponse (result : FirebaseAuthUIAuthenticationResult ) {
36
43
when (result.resultCode) {
37
44
RESULT_OK -> {
38
- // Successfully signed in
39
45
val response = result.idpResponse
40
46
startActivity(SignedInActivity .createIntent(this , response))
41
47
finish()
42
48
}
43
49
else -> {
44
- // Sign in failed
45
50
val response = result.idpResponse
46
51
if (response == null ) {
47
- // User pressed back button
48
52
finish()
49
53
return
50
54
}
51
- // Handle other error cases
52
55
}
53
56
}
54
57
}
@@ -58,4 +61,4 @@ class AuthComposeActivity : ComponentActivity() {
58
61
return Intent (context, AuthComposeActivity ::class .java)
59
62
}
60
63
}
61
- }
64
+ }
0 commit comments