├── .gitignore ├── app ├── .gitignore ├── build.gradle.kts ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── plcoding │ │ └── credentialmanagerguidecompose │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── plcoding │ │ │ └── credentialmanagerguidecompose │ │ │ ├── AccountManager.kt │ │ │ ├── MainActivity.kt │ │ │ ├── NavigationRoot.kt │ │ │ ├── SignInResult.kt │ │ │ ├── SignUpResult.kt │ │ │ ├── login │ │ │ ├── LoginAction.kt │ │ │ ├── LoginScreen.kt │ │ │ ├── LoginState.kt │ │ │ └── LoginViewModel.kt │ │ │ └── ui │ │ │ └── theme │ │ │ ├── Color.kt │ │ │ ├── Theme.kt │ │ │ └── Type.kt │ └── res │ │ ├── drawable │ │ ├── ic_launcher_background.xml │ │ └── ic_launcher_foreground.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── themes.xml │ │ └── xml │ │ ├── backup_rules.xml │ │ └── data_extraction_rules.xml │ └── test │ └── java │ └── com │ └── plcoding │ └── credentialmanagerguidecompose │ └── ExampleUnitTest.kt ├── build.gradle.kts ├── gradle.properties ├── gradle ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle.kts /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | alias(libs.plugins.android.application) 3 | alias(libs.plugins.jetbrains.kotlin.android) 4 | alias(libs.plugins.compose.compiler) 5 | alias(libs.plugins.jetbrains.kotlin.serialization) 6 | } 7 | 8 | android { 9 | namespace = "com.plcoding.credentialmanagerguidecompose" 10 | compileSdk = 35 11 | 12 | defaultConfig { 13 | applicationId = "com.plcoding.credentialmanagerguidecompose" 14 | minSdk = 26 15 | targetSdk = 35 16 | versionCode = 1 17 | versionName = "1.0" 18 | 19 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 20 | vectorDrawables { 21 | useSupportLibrary = true 22 | } 23 | } 24 | 25 | buildTypes { 26 | release { 27 | isMinifyEnabled = false 28 | proguardFiles( 29 | getDefaultProguardFile("proguard-android-optimize.txt"), 30 | "proguard-rules.pro" 31 | ) 32 | } 33 | } 34 | compileOptions { 35 | sourceCompatibility = JavaVersion.VERSION_1_8 36 | targetCompatibility = JavaVersion.VERSION_1_8 37 | } 38 | kotlinOptions { 39 | jvmTarget = "1.8" 40 | } 41 | buildFeatures { 42 | compose = true 43 | } 44 | packaging { 45 | resources { 46 | excludes += "/META-INF/{AL2.0,LGPL2.1}" 47 | } 48 | } 49 | } 50 | 51 | dependencies { 52 | implementation(libs.androidx.compose.navigation) 53 | implementation(libs.androidx.credentials.core) 54 | implementation(libs.androidx.credentials.compat) 55 | implementation(libs.androidx.lifecycle.runtime.compose) 56 | implementation(libs.kotlinx.serialization.json) 57 | 58 | implementation(libs.androidx.core.ktx) 59 | implementation(libs.androidx.lifecycle.runtime.ktx) 60 | implementation(libs.androidx.activity.compose) 61 | implementation(platform(libs.androidx.compose.bom)) 62 | implementation(libs.androidx.ui) 63 | implementation(libs.androidx.ui.graphics) 64 | implementation(libs.androidx.ui.tooling.preview) 65 | implementation(libs.androidx.material3) 66 | testImplementation(libs.junit) 67 | androidTestImplementation(libs.androidx.junit) 68 | androidTestImplementation(libs.androidx.espresso.core) 69 | androidTestImplementation(platform(libs.androidx.compose.bom)) 70 | androidTestImplementation(libs.androidx.ui.test.junit4) 71 | debugImplementation(libs.androidx.ui.tooling) 72 | debugImplementation(libs.androidx.ui.test.manifest) 73 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/androidTest/java/com/plcoding/credentialmanagerguidecompose/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.plcoding.credentialmanagerguidecompose 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.plcoding.credentialmanagerguidecompose", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 15 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/plcoding/credentialmanagerguidecompose/AccountManager.kt: -------------------------------------------------------------------------------- 1 | package com.plcoding.credentialmanagerguidecompose 2 | 3 | import android.app.Activity 4 | import androidx.credentials.CreatePasswordRequest 5 | import androidx.credentials.CredentialManager 6 | import androidx.credentials.GetCredentialRequest 7 | import androidx.credentials.GetPasswordOption 8 | import androidx.credentials.PasswordCredential 9 | import androidx.credentials.exceptions.CreateCredentialCancellationException 10 | import androidx.credentials.exceptions.CreateCredentialException 11 | import androidx.credentials.exceptions.GetCredentialCancellationException 12 | import androidx.credentials.exceptions.GetCredentialException 13 | import androidx.credentials.exceptions.NoCredentialException 14 | 15 | class AccountManager( 16 | private val activity: Activity 17 | ) { 18 | private val credentialManager = CredentialManager.create(activity) 19 | 20 | suspend fun signUp(username: String, password: String): SignUpResult { 21 | return try { 22 | credentialManager.createCredential( 23 | context = activity, 24 | request = CreatePasswordRequest( 25 | id = username, 26 | password = password 27 | ) 28 | ) 29 | SignUpResult.Success(username) 30 | } catch (e: CreateCredentialCancellationException) { 31 | e.printStackTrace() 32 | SignUpResult.Cancelled 33 | } catch(e: CreateCredentialException) { 34 | e.printStackTrace() 35 | SignUpResult.Failure 36 | } 37 | } 38 | 39 | suspend fun signIn(): SignInResult { 40 | return try { 41 | val credentialResponse = credentialManager.getCredential( 42 | context = activity, 43 | request = GetCredentialRequest( 44 | credentialOptions = listOf(GetPasswordOption()) 45 | ) 46 | ) 47 | 48 | val credential = credentialResponse.credential as? PasswordCredential 49 | ?: return SignInResult.Failure 50 | 51 | // Make login API call here with credential.id and credential.password 52 | 53 | SignInResult.Success(credential.id) 54 | } catch(e: GetCredentialCancellationException) { 55 | e.printStackTrace() 56 | SignInResult.Cancelled 57 | } catch(e: NoCredentialException) { 58 | e.printStackTrace() 59 | SignInResult.NoCredentials 60 | } catch(e: GetCredentialException) { 61 | e.printStackTrace() 62 | SignInResult.Failure 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /app/src/main/java/com/plcoding/credentialmanagerguidecompose/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.plcoding.credentialmanagerguidecompose 2 | 3 | import android.os.Bundle 4 | import androidx.activity.ComponentActivity 5 | import androidx.activity.compose.setContent 6 | import androidx.activity.enableEdgeToEdge 7 | import androidx.compose.foundation.layout.fillMaxSize 8 | import androidx.compose.foundation.layout.padding 9 | import androidx.compose.material3.Scaffold 10 | import androidx.compose.material3.Surface 11 | import androidx.compose.material3.Text 12 | import androidx.compose.runtime.Composable 13 | import androidx.compose.ui.Modifier 14 | import androidx.compose.ui.tooling.preview.Preview 15 | import com.plcoding.credentialmanagerguidecompose.ui.theme.CredentialManagerGuideComposeTheme 16 | 17 | class MainActivity : ComponentActivity() { 18 | override fun onCreate(savedInstanceState: Bundle?) { 19 | super.onCreate(savedInstanceState) 20 | enableEdgeToEdge() 21 | setContent { 22 | CredentialManagerGuideComposeTheme { 23 | Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> 24 | Surface( 25 | modifier = Modifier.padding(innerPadding) 26 | ) { 27 | NavigationRoot() 28 | } 29 | } 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /app/src/main/java/com/plcoding/credentialmanagerguidecompose/NavigationRoot.kt: -------------------------------------------------------------------------------- 1 | package com.plcoding.credentialmanagerguidecompose 2 | 3 | import androidx.compose.foundation.layout.Box 4 | import androidx.compose.foundation.layout.fillMaxSize 5 | import androidx.compose.material3.Text 6 | import androidx.compose.runtime.Composable 7 | import androidx.compose.ui.Alignment 8 | import androidx.compose.ui.Modifier 9 | import androidx.lifecycle.viewmodel.compose.viewModel 10 | import androidx.navigation.compose.NavHost 11 | import androidx.navigation.compose.composable 12 | import androidx.navigation.compose.rememberNavController 13 | import androidx.navigation.toRoute 14 | import com.plcoding.credentialmanagerguidecompose.login.LoginScreen 15 | import com.plcoding.credentialmanagerguidecompose.login.LoginViewModel 16 | import kotlinx.serialization.Serializable 17 | 18 | @Serializable 19 | data object LoginRoute 20 | 21 | @Serializable 22 | data class LoggedInRoute(val username: String) 23 | 24 | @Composable 25 | fun NavigationRoot(modifier: Modifier = Modifier) { 26 | val navController = rememberNavController() 27 | NavHost( 28 | navController = navController, 29 | startDestination = LoginRoute 30 | ) { 31 | composable { 32 | val viewModel = viewModel() 33 | LoginScreen( 34 | state = viewModel.state, 35 | onAction = viewModel::onAction, 36 | onLoggedIn = { 37 | navController.navigate(LoggedInRoute(it)) { 38 | popUpTo(LoginRoute) { 39 | inclusive = true 40 | } 41 | } 42 | } 43 | ) 44 | } 45 | composable { 46 | val username = it.toRoute().username 47 | Box( 48 | modifier = Modifier 49 | .fillMaxSize(), 50 | contentAlignment = Alignment.Center 51 | ) { 52 | Text(text = "Hello $username!") 53 | } 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /app/src/main/java/com/plcoding/credentialmanagerguidecompose/SignInResult.kt: -------------------------------------------------------------------------------- 1 | package com.plcoding.credentialmanagerguidecompose 2 | 3 | sealed interface SignInResult { 4 | data class Success(val username: String): SignInResult 5 | data object Cancelled: SignInResult 6 | data object Failure: SignInResult 7 | data object NoCredentials: SignInResult 8 | } -------------------------------------------------------------------------------- /app/src/main/java/com/plcoding/credentialmanagerguidecompose/SignUpResult.kt: -------------------------------------------------------------------------------- 1 | package com.plcoding.credentialmanagerguidecompose 2 | 3 | sealed interface SignUpResult { 4 | data class Success(val username: String): SignUpResult 5 | data object Cancelled: SignUpResult 6 | data object Failure: SignUpResult 7 | } -------------------------------------------------------------------------------- /app/src/main/java/com/plcoding/credentialmanagerguidecompose/login/LoginAction.kt: -------------------------------------------------------------------------------- 1 | package com.plcoding.credentialmanagerguidecompose.login 2 | 3 | import com.plcoding.credentialmanagerguidecompose.SignInResult 4 | import com.plcoding.credentialmanagerguidecompose.SignUpResult 5 | 6 | sealed interface LoginAction { 7 | data class OnSignIn(val result: SignInResult): LoginAction 8 | data class OnSignUp(val result: SignUpResult): LoginAction 9 | data class OnUsernameChange(val username: String): LoginAction 10 | data class OnPasswordChange(val password: String): LoginAction 11 | data object OnToggleIsRegister: LoginAction 12 | } -------------------------------------------------------------------------------- /app/src/main/java/com/plcoding/credentialmanagerguidecompose/login/LoginScreen.kt: -------------------------------------------------------------------------------- 1 | package com.plcoding.credentialmanagerguidecompose.login 2 | 3 | import androidx.activity.ComponentActivity 4 | import androidx.compose.foundation.layout.Arrangement 5 | import androidx.compose.foundation.layout.Column 6 | import androidx.compose.foundation.layout.Row 7 | import androidx.compose.foundation.layout.Spacer 8 | import androidx.compose.foundation.layout.fillMaxSize 9 | import androidx.compose.foundation.layout.fillMaxWidth 10 | import androidx.compose.foundation.layout.padding 11 | import androidx.compose.foundation.layout.width 12 | import androidx.compose.material3.Button 13 | import androidx.compose.material3.MaterialTheme 14 | import androidx.compose.material3.Switch 15 | import androidx.compose.material3.Text 16 | import androidx.compose.material3.TextField 17 | import androidx.compose.runtime.Composable 18 | import androidx.compose.runtime.LaunchedEffect 19 | import androidx.compose.runtime.remember 20 | import androidx.compose.runtime.rememberCoroutineScope 21 | import androidx.compose.ui.Alignment 22 | import androidx.compose.ui.Modifier 23 | import androidx.compose.ui.platform.LocalContext 24 | import androidx.compose.ui.unit.dp 25 | import com.plcoding.credentialmanagerguidecompose.AccountManager 26 | import kotlinx.coroutines.launch 27 | 28 | @Composable 29 | fun LoginScreen( 30 | state: LoginState, 31 | onAction: (LoginAction) -> Unit, 32 | onLoggedIn: (String) -> Unit 33 | ) { 34 | val scope = rememberCoroutineScope() 35 | val context = LocalContext.current 36 | val accountManager = remember { 37 | AccountManager(context as ComponentActivity) 38 | } 39 | 40 | LaunchedEffect(key1 = true) { 41 | val result = accountManager.signIn() 42 | onAction(LoginAction.OnSignIn(result)) 43 | } 44 | 45 | LaunchedEffect(key1 = state.loggedInUser) { 46 | if(state.loggedInUser != null) { 47 | onLoggedIn(state.loggedInUser) 48 | } 49 | } 50 | 51 | Column( 52 | modifier = Modifier 53 | .fillMaxSize() 54 | .padding(16.dp), 55 | verticalArrangement = Arrangement.spacedBy(16.dp, Alignment.CenterVertically) 56 | ) { 57 | TextField( 58 | value = state.username, 59 | onValueChange = { 60 | onAction(LoginAction.OnUsernameChange(it)) 61 | }, 62 | label = { Text(text = "Username") }, 63 | modifier = Modifier.fillMaxWidth() 64 | ) 65 | TextField( 66 | value = state.password, 67 | onValueChange = { 68 | onAction(LoginAction.OnPasswordChange(it)) 69 | }, 70 | label = { Text(text = "Password") }, 71 | modifier = Modifier.fillMaxWidth() 72 | ) 73 | Row { 74 | Text(text = "Register") 75 | Spacer(modifier = Modifier.width(8.dp)) 76 | Switch( 77 | checked = state.isRegister, 78 | onCheckedChange = { 79 | onAction(LoginAction.OnToggleIsRegister) 80 | } 81 | ) 82 | } 83 | if(state.errorMessage != null) { 84 | Text( 85 | text = state.errorMessage, 86 | color = MaterialTheme.colorScheme.error 87 | ) 88 | } 89 | Button(onClick = { 90 | scope.launch { 91 | if(state.isRegister) { 92 | val result = accountManager.signUp( 93 | username = state.username, 94 | password = state.password 95 | ) 96 | onAction(LoginAction.OnSignUp(result)) 97 | } 98 | } 99 | }) { 100 | Text(text = if(state.isRegister) "Register" else "Login") 101 | } 102 | } 103 | } -------------------------------------------------------------------------------- /app/src/main/java/com/plcoding/credentialmanagerguidecompose/login/LoginState.kt: -------------------------------------------------------------------------------- 1 | package com.plcoding.credentialmanagerguidecompose.login 2 | 3 | data class LoginState( 4 | val loggedInUser: String? = null, 5 | val username: String = "user", 6 | val password: String = "pass", 7 | val errorMessage: String? = null, 8 | val isRegister: Boolean = false 9 | ) 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/plcoding/credentialmanagerguidecompose/login/LoginViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.plcoding.credentialmanagerguidecompose.login 2 | 3 | import androidx.compose.runtime.getValue 4 | import androidx.compose.runtime.mutableStateOf 5 | import androidx.compose.runtime.setValue 6 | import androidx.lifecycle.ViewModel 7 | import com.plcoding.credentialmanagerguidecompose.SignInResult 8 | import com.plcoding.credentialmanagerguidecompose.SignUpResult 9 | 10 | class LoginViewModel: ViewModel() { 11 | 12 | var state by mutableStateOf(LoginState()) 13 | private set 14 | 15 | fun onAction(action: LoginAction) { 16 | when(action) { 17 | is LoginAction.OnPasswordChange -> { 18 | state = state.copy(password = action.password) 19 | } 20 | is LoginAction.OnSignUp -> { 21 | when(action.result) { 22 | SignUpResult.Cancelled -> { 23 | state = state.copy( 24 | errorMessage = "Sign up was cancelled." 25 | ) 26 | } 27 | SignUpResult.Failure -> { 28 | state = state.copy( 29 | errorMessage = "Sign up failed." 30 | ) 31 | } 32 | is SignUpResult.Success -> { 33 | state = state.copy( 34 | loggedInUser = action.result.username 35 | ) 36 | } 37 | } 38 | } 39 | is LoginAction.OnSignIn -> { 40 | when(action.result) { 41 | SignInResult.Cancelled -> { 42 | state = state.copy( 43 | errorMessage = "Sign in was cancelled." 44 | ) 45 | } 46 | SignInResult.Failure -> { 47 | state = state.copy( 48 | errorMessage = "Sign in failed." 49 | ) 50 | } 51 | is SignInResult.Success -> { 52 | state = state.copy( 53 | loggedInUser = action.result.username 54 | ) 55 | } 56 | is SignInResult.NoCredentials -> { 57 | state = state.copy( 58 | errorMessage = "No credentials were set up." 59 | ) 60 | } 61 | } 62 | } 63 | LoginAction.OnToggleIsRegister -> { 64 | state = state.copy(isRegister = !state.isRegister) 65 | } 66 | is LoginAction.OnUsernameChange -> { 67 | state = state.copy(username = action.username) 68 | } 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /app/src/main/java/com/plcoding/credentialmanagerguidecompose/ui/theme/Color.kt: -------------------------------------------------------------------------------- 1 | package com.plcoding.credentialmanagerguidecompose.ui.theme 2 | 3 | import androidx.compose.ui.graphics.Color 4 | 5 | val Purple80 = Color(0xFFD0BCFF) 6 | val PurpleGrey80 = Color(0xFFCCC2DC) 7 | val Pink80 = Color(0xFFEFB8C8) 8 | 9 | val Purple40 = Color(0xFF6650a4) 10 | val PurpleGrey40 = Color(0xFF625b71) 11 | val Pink40 = Color(0xFF7D5260) -------------------------------------------------------------------------------- /app/src/main/java/com/plcoding/credentialmanagerguidecompose/ui/theme/Theme.kt: -------------------------------------------------------------------------------- 1 | package com.plcoding.credentialmanagerguidecompose.ui.theme 2 | 3 | import android.app.Activity 4 | import android.os.Build 5 | import androidx.compose.foundation.isSystemInDarkTheme 6 | import androidx.compose.material3.MaterialTheme 7 | import androidx.compose.material3.darkColorScheme 8 | import androidx.compose.material3.dynamicDarkColorScheme 9 | import androidx.compose.material3.dynamicLightColorScheme 10 | import androidx.compose.material3.lightColorScheme 11 | import androidx.compose.runtime.Composable 12 | import androidx.compose.ui.platform.LocalContext 13 | 14 | private val DarkColorScheme = darkColorScheme( 15 | primary = Purple80, 16 | secondary = PurpleGrey80, 17 | tertiary = Pink80 18 | ) 19 | 20 | private val LightColorScheme = lightColorScheme( 21 | primary = Purple40, 22 | secondary = PurpleGrey40, 23 | tertiary = Pink40 24 | 25 | /* Other default colors to override 26 | background = Color(0xFFFFFBFE), 27 | surface = Color(0xFFFFFBFE), 28 | onPrimary = Color.White, 29 | onSecondary = Color.White, 30 | onTertiary = Color.White, 31 | onBackground = Color(0xFF1C1B1F), 32 | onSurface = Color(0xFF1C1B1F), 33 | */ 34 | ) 35 | 36 | @Composable 37 | fun CredentialManagerGuideComposeTheme( 38 | darkTheme: Boolean = isSystemInDarkTheme(), 39 | // Dynamic color is available on Android 12+ 40 | dynamicColor: Boolean = true, 41 | content: @Composable () -> Unit 42 | ) { 43 | val colorScheme = when { 44 | dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { 45 | val context = LocalContext.current 46 | if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) 47 | } 48 | 49 | darkTheme -> DarkColorScheme 50 | else -> LightColorScheme 51 | } 52 | 53 | MaterialTheme( 54 | colorScheme = colorScheme, 55 | typography = Typography, 56 | content = content 57 | ) 58 | } -------------------------------------------------------------------------------- /app/src/main/java/com/plcoding/credentialmanagerguidecompose/ui/theme/Type.kt: -------------------------------------------------------------------------------- 1 | package com.plcoding.credentialmanagerguidecompose.ui.theme 2 | 3 | import androidx.compose.material3.Typography 4 | import androidx.compose.ui.text.TextStyle 5 | import androidx.compose.ui.text.font.FontFamily 6 | import androidx.compose.ui.text.font.FontWeight 7 | import androidx.compose.ui.unit.sp 8 | 9 | // Set of Material typography styles to start with 10 | val Typography = Typography( 11 | bodyLarge = TextStyle( 12 | fontFamily = FontFamily.Default, 13 | fontWeight = FontWeight.Normal, 14 | fontSize = 16.sp, 15 | lineHeight = 24.sp, 16 | letterSpacing = 0.5.sp 17 | ) 18 | /* Other default text styles to override 19 | titleLarge = TextStyle( 20 | fontFamily = FontFamily.Default, 21 | fontWeight = FontWeight.Normal, 22 | fontSize = 22.sp, 23 | lineHeight = 28.sp, 24 | letterSpacing = 0.sp 25 | ), 26 | labelSmall = TextStyle( 27 | fontFamily = FontFamily.Default, 28 | fontWeight = FontWeight.Medium, 29 | fontSize = 11.sp, 30 | lineHeight = 16.sp, 31 | letterSpacing = 0.5.sp 32 | ) 33 | */ 34 | ) -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philipplackner/CredentialManagerGuideCompose/d8277524c41ca9aa6037713725ee660631ed1c1d/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philipplackner/CredentialManagerGuideCompose/d8277524c41ca9aa6037713725ee660631ed1c1d/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philipplackner/CredentialManagerGuideCompose/d8277524c41ca9aa6037713725ee660631ed1c1d/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philipplackner/CredentialManagerGuideCompose/d8277524c41ca9aa6037713725ee660631ed1c1d/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philipplackner/CredentialManagerGuideCompose/d8277524c41ca9aa6037713725ee660631ed1c1d/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philipplackner/CredentialManagerGuideCompose/d8277524c41ca9aa6037713725ee660631ed1c1d/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philipplackner/CredentialManagerGuideCompose/d8277524c41ca9aa6037713725ee660631ed1c1d/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philipplackner/CredentialManagerGuideCompose/d8277524c41ca9aa6037713725ee660631ed1c1d/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philipplackner/CredentialManagerGuideCompose/d8277524c41ca9aa6037713725ee660631ed1c1d/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philipplackner/CredentialManagerGuideCompose/d8277524c41ca9aa6037713725ee660631ed1c1d/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | CredentialManagerGuideCompose 3 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |