diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index 6d0ee1c..c224ad5 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 0ebf3bc..ba16dbb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,20 +10,20 @@ GEM artifactory (3.0.17) atomos (0.1.3) aws-eventstream (1.3.0) - aws-partitions (1.968.0) - aws-sdk-core (3.201.5) + aws-partitions (1.995.0) + aws-sdk-core (3.211.0) aws-eventstream (~> 1, >= 1.3.0) - aws-partitions (~> 1, >= 1.651.0) + aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.88.0) - aws-sdk-core (~> 3, >= 3.201.0) + aws-sdk-kms (1.95.0) + aws-sdk-core (~> 3, >= 3.210.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.159.0) - aws-sdk-core (~> 3, >= 3.201.0) + aws-sdk-s3 (1.169.0) + aws-sdk-core (~> 3, >= 3.210.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sigv4 (1.9.1) + aws-sigv4 (1.10.1) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) base64 (0.2.0) @@ -38,8 +38,8 @@ GEM domain_name (0.6.20240107) dotenv (2.8.1) emoji_regex (3.2.3) - excon (0.111.0) - faraday (1.10.3) + excon (0.112.0) + faraday (1.10.4) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -65,10 +65,10 @@ GEM faraday-patron (1.0.0) faraday-rack (1.0.0) faraday-retry (1.0.3) - faraday_middleware (1.2.0) + faraday_middleware (1.2.1) faraday (~> 1.0) fastimage (2.3.1) - fastlane (2.222.0) + fastlane (2.225.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) @@ -84,6 +84,7 @@ GEM faraday-cookie_jar (~> 0.0.6) faraday_middleware (~> 1.0) fastimage (>= 2.1.0, < 3.0.0) + fastlane-sirp (>= 1.0.0) gh_inspector (>= 1.1.2, < 2.0.0) google-apis-androidpublisher_v3 (~> 0.3) google-apis-playcustomapp_v1 (~> 0.1) @@ -109,6 +110,8 @@ GEM xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) + fastlane-sirp (1.0.0) + sysrandom (~> 1.0) gh_inspector (1.1.3) google-apis-androidpublisher_v3 (0.54.0) google-apis-core (>= 0.11.0, < 2.a) @@ -151,8 +154,8 @@ GEM domain_name (~> 0.5) httpclient (2.8.3) jmespath (1.6.2) - json (2.7.2) - jwt (2.8.2) + json (2.7.4) + jwt (2.9.3) base64 mini_magick (4.13.2) mini_mime (1.1.5) @@ -171,8 +174,7 @@ GEM trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.3.6) - strscan + rexml (3.3.9) rouge (2.0.7) ruby2_keywords (0.0.5) rubyzip (2.3.2) @@ -185,7 +187,7 @@ GEM simctl (1.6.10) CFPropertyList naturally - strscan (3.1.0) + sysrandom (1.0.5) terminal-notifier (2.0.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) @@ -195,15 +197,15 @@ GEM tty-spinner (0.9.3) tty-cursor (~> 0.7) uber (0.1.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) word_wrap (1.0.0) - xcodeproj (1.25.0) + xcodeproj (1.25.1) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.3.0) - rexml (>= 3.3.2, < 4.0) + rexml (>= 3.3.6, < 4.0) xcpretty (0.3.0) rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.1) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index eb84422..d84fe4b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -25,8 +25,8 @@ android { minSdk = 26 //noinspection OldTargetApi targetSdk = 34 - versionCode = 24 - versionName = "1.3.3" + versionCode = 25 + versionName = "1.4.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } @@ -72,9 +72,18 @@ android { generateLocaleConfig = true } buildFeatures { + buildConfig = true compose = true } packaging { + // This is set to false starting with minSdk >= 28, but I want uncompressed DEX files with minSdk 26 + // According to https://developer.android.com/build/releases/past-releases/agp-4-2-0-release-notes#dex-files-uncompressed-in-apks-when-minsdk-=-28-or-higher: + // + // > This causes an increase in APK size, but it results in a smaller installation size on the device, and the download size is roughly the same. + // + // Currently this makes the APK ~1MB heavier + // + dex.useLegacyPackaging = false resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 402af51..c9cc148 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,38 +1,41 @@ - + android:theme="@style/Theme.App"> + android:windowSoftInputMode="adjustResize"> - + + + + + + android:exported="true" + android:windowSoftInputMode="adjustResize"> - - @@ -40,15 +43,13 @@ + android:targetActivity=".DetailsActivity"> - - diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/DetailsActivity.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/DetailsActivity.kt index 6b9b2e6..ab80d3d 100644 --- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/DetailsActivity.kt +++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/DetailsActivity.kt @@ -27,10 +27,10 @@ import android.util.Log import android.widget.Toast import androidx.activity.ComponentActivity import androidx.activity.compose.setContent +import androidx.activity.enableEdgeToEdge import androidx.activity.result.ActivityResultLauncher import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass -import androidx.core.view.WindowCompat import androidx.lifecycle.lifecycleScope import androidx.preference.PreferenceManager import com.mateusrodcosta.apps.share2storage.model.UriData @@ -57,9 +57,7 @@ class DetailsActivity : ComponentActivity() { @OptIn(ExperimentalMaterial3WindowSizeClassApi::class) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - WindowCompat.setDecorFitsSystemWindows(window, false) - val windowInsetsController = WindowCompat.getInsetsController(window, window.decorView) - windowInsetsController.isAppearanceLightNavigationBars = true + enableEdgeToEdge() getPreferences() handleIntent(intent) @@ -69,6 +67,7 @@ class DetailsActivity : ComponentActivity() { setContent { val windowSizeClass = calculateWindowSizeClass(this) + DetailsScreen( uriData = uriData, windowSizeClass = windowSizeClass, diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/MainActivity.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/MainActivity.kt index 27bee42..8e2ceac 100644 --- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/MainActivity.kt +++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/MainActivity.kt @@ -17,15 +17,18 @@ package com.mateusrodcosta.apps.share2storage +import android.content.Intent import android.os.Bundle import android.util.Log import androidx.activity.ComponentActivity import androidx.activity.compose.setContent +import androidx.activity.enableEdgeToEdge import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass +import androidx.compose.runtime.LaunchedEffect import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen -import androidx.core.view.WindowCompat +import androidx.navigation.compose.rememberNavController import com.mateusrodcosta.apps.share2storage.screens.AppNavigation import com.mateusrodcosta.apps.share2storage.screens.SettingsViewModel @@ -45,11 +48,11 @@ class MainActivity : ComponentActivity() { @OptIn(ExperimentalMaterial3WindowSizeClassApi::class) override fun onCreate(savedInstanceState: Bundle?) { + val isAppPreference = intent.action == Intent.ACTION_APPLICATION_PREFERENCES + installSplashScreen() super.onCreate(savedInstanceState) - WindowCompat.setDecorFitsSystemWindows(window, false) - val windowInsetsController = WindowCompat.getInsetsController(window, window.decorView) - windowInsetsController.isAppearanceLightNavigationBars = true + enableEdgeToEdge() settingsViewModel.initializeWithContext(applicationContext) settingsViewModel.assignSaveLocationDirIntent(getSaveLocationDirIntent) @@ -57,8 +60,13 @@ class MainActivity : ComponentActivity() { setContent { val windowSizeClass = calculateWindowSizeClass(this) - AppNavigation(settingsViewModel, windowSizeClass) + val navController = rememberNavController() + + LaunchedEffect(key1 = Unit) { + if (isAppPreference) navController.navigate("settings") + } + + AppNavigation(navController, settingsViewModel, windowSizeClass) } } } - diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/AboutDialog.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/AboutDialog.kt new file mode 100644 index 0000000..080be8f --- /dev/null +++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/AboutDialog.kt @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 mateusrc + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +package com.mateusrodcosta.apps.share2storage.screens + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Column +import androidx.compose.material3.Card +import androidx.compose.material3.ListItem +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.scale +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.window.Dialog +import com.mateusrodcosta.apps.share2storage.BuildConfig +import com.mateusrodcosta.apps.share2storage.R +import com.mateusrodcosta.apps.share2storage.screens.shared.ListItemWithURL +import com.mateusrodcosta.apps.share2storage.ui.theme.AppTheme + +@Preview(apiLevel = 34) +@Composable +fun AboutDialogContentPreview() { + AboutDialogContent() +} + +@Preview(apiLevel = 34, locale = "pt-rBR") +@Composable +fun AboutDialogContentPreviewPtBr() { + AboutDialogContent() +} + +@Composable +fun AboutDialog(onDismissRequest: () -> Unit) { + Dialog(onDismissRequest = onDismissRequest) { + AboutDialogContent() + } +} + +@Composable +fun AboutDialogContent() { + AppTheme { + Card { + Column { + AppInfo() + ListItemWithURL( + stringResource(R.string.about_developer), + linkPlacement = "Mateus Rodrigues Costa", + url = stringResource(R.string.github_profile_url), + ) + ListItemWithURL( + stringResource(R.string.about_icon_credits), + linkPlacement = "@swyzera", + url = stringResource(R.string.swy_website_url) + ) + ListItemWithURL( + stringResource(R.string.about_github), + linkPlacement = "%s", + url = stringResource(R.string.source_code_url), + replaceWithUrl = true + ) + } + } + } +} + +@Composable +fun AppInfo() { + val version = BuildConfig.VERSION_NAME + + ListItem(leadingContent = { + Image( + painterResource(R.drawable.ic_launcher_foreground), + stringResource(R.string.app_name), + modifier = Modifier.scale(1.5f), + ) + }, headlineContent = { + Text( + stringResource(R.string.app_name), + style = MaterialTheme.typography.headlineMedium.copy(color = MaterialTheme.colorScheme.primary) + ) + }, supportingContent = { + Text(version, style = MaterialTheme.typography.bodyLarge.copy(fontWeight = FontWeight.Bold)) + }) +} \ No newline at end of file diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/AppNavigation.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/AppNavigation.kt index fe91955..30c0a00 100644 --- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/AppNavigation.kt +++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/AppNavigation.kt @@ -19,14 +19,16 @@ package com.mateusrodcosta.apps.share2storage.screens import androidx.compose.material3.windowsizeclass.WindowSizeClass import androidx.compose.runtime.Composable +import androidx.navigation.NavHostController import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable -import androidx.navigation.compose.rememberNavController @Composable -fun AppNavigation(settingsViewModel: SettingsViewModel, windowSizeClass: WindowSizeClass) { - val navController = rememberNavController() - +fun AppNavigation( + navController: NavHostController, + settingsViewModel: SettingsViewModel, + windowSizeClass: WindowSizeClass +) { NavHost(navController = navController, startDestination = "main") { composable("main") { MainScreen(navController, windowSizeClass) } composable("settings") { SettingsScreen(navController, settingsViewModel) } diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/DetailsScreen.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/DetailsScreen.kt index 5bb9b16..38e9064 100644 --- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/DetailsScreen.kt +++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/DetailsScreen.kt @@ -23,15 +23,15 @@ import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.systemBars +import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons @@ -43,6 +43,7 @@ import androidx.compose.material.icons.rounded.Download import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.FloatingActionButton import androidx.compose.material3.Icon +import androidx.compose.material3.ListItem import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.Text @@ -63,11 +64,10 @@ import androidx.compose.ui.unit.dp import com.mateusrodcosta.apps.share2storage.R import com.mateusrodcosta.apps.share2storage.model.SampleUriDataProvider import com.mateusrodcosta.apps.share2storage.model.UriData -import com.mateusrodcosta.apps.share2storage.screens.shared.appTopAppBarColors import com.mateusrodcosta.apps.share2storage.screens.shared.shouldShowLandscape import com.mateusrodcosta.apps.share2storage.ui.theme.AppTheme -@Preview(apiLevel = 34, showBackground = true) +@Preview(apiLevel = 34, showSystemUi = true, showBackground = true) @Composable fun DetailsScreenPreview(@PreviewParameter(SampleUriDataProvider::class) uriData: UriData?) { DetailsScreenContent( @@ -77,6 +77,16 @@ fun DetailsScreenPreview(@PreviewParameter(SampleUriDataProvider::class) uriData ) } +@Preview(apiLevel = 34, showSystemUi = true, showBackground = true, locale = "pt-rBR") +@Composable +fun DetailsScreenPreviewPtBr(@PreviewParameter(SampleUriDataProvider::class) uriData: UriData?) { + DetailsScreenContent( + uriData = uriData, + widthSizeClass = WindowWidthSizeClass.Compact, + heightSizeClass = WindowHeightSizeClass.Medium, + ) +} + @Composable fun DetailsScreen( uriData: UriData?, @@ -103,11 +113,15 @@ fun DetailsScreenContent( Scaffold(topBar = { TopAppBar( title = { Text(stringResource(R.string.file_details)) }, - colors = appTopAppBarColors(), ) }, floatingActionButton = { if (uriData != null) { FloatingActionButton( + modifier = Modifier.windowInsetsPadding( + WindowInsets.systemBars.only( + WindowInsetsSides.Horizontal + ) + ), onClick = { launchFilePicker() }, content = { Icon( @@ -115,8 +129,8 @@ fun DetailsScreenContent( contentDescription = stringResource(R.string.save_button) ) }, - containerColor = MaterialTheme.colorScheme.secondary, - contentColor = MaterialTheme.colorScheme.onSecondary, + containerColor = MaterialTheme.colorScheme.primary, + contentColor = MaterialTheme.colorScheme.onPrimary, ) } }) { paddingValues -> @@ -132,7 +146,7 @@ fun DetailsScreenContent( else FileDetailsPortrait(uriData) } else Text( stringResource(R.string.no_file_found), - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.headlineMedium ) } } @@ -146,9 +160,11 @@ fun FileDetailsPortrait(uriData: UriData) { horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.SpaceEvenly ) { - Box(modifier = Modifier - .fillMaxSize() - .weight(1.0f)) { + Box( + modifier = Modifier + .fillMaxSize() + .weight(1.0f) + ) { FilePreview(uriData) } Box { @@ -189,7 +205,6 @@ fun FileInfo(uriData: UriData) { ) FileInfoLine( label = stringResource(R.string.file_size), - // TODO: Find code to calculate file size for previews content = if (uriData.size != null) Formatter.formatFileSize( LocalContext.current, uriData.size ) else stringResource(R.string.unknown) @@ -199,22 +214,11 @@ fun FileInfo(uriData: UriData) { @Composable fun FileInfoLine(label: String, content: String) { - Box(modifier = Modifier - .fillMaxWidth() - .clickable { }) { - Column( - modifier = Modifier - .padding(PaddingValues(horizontal = 16.dp, vertical = 8.dp)) - .heightIn(min = 48.dp), horizontalAlignment = Alignment.Start - ) { - Text( - label, - style = MaterialTheme.typography.titleLarge.copy(color = MaterialTheme.colorScheme.tertiary) - ) - Spacer(modifier = Modifier.height(8.dp)) - Text(content, softWrap = true, style = MaterialTheme.typography.bodyLarge) - } - } + ListItem(modifier = Modifier.clickable { }, headlineContent = { + Text(label) + }, supportingContent = { + Text(content, softWrap = true) + }) } @Composable diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/MainScreen.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/MainScreen.kt index 333096c..031764a 100644 --- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/MainScreen.kt +++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/MainScreen.kt @@ -22,22 +22,21 @@ import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.width import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.rounded.Info import androidx.compose.material.icons.rounded.Settings import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton +import androidx.compose.material3.ListItem +import androidx.compose.material3.LocalTextStyle import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.Text @@ -46,30 +45,25 @@ import androidx.compose.material3.windowsizeclass.WindowHeightSizeClass import androidx.compose.material3.windowsizeclass.WindowSizeClass import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass import androidx.compose.runtime.Composable +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.scale -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.SpanStyle -import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.text.style.TextDecoration -import androidx.compose.ui.text.withStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.navigation.NavController import com.mateusrodcosta.apps.share2storage.R -import com.mateusrodcosta.apps.share2storage.screens.shared.AppBasicDivider import com.mateusrodcosta.apps.share2storage.screens.shared.AppListHeader -import com.mateusrodcosta.apps.share2storage.screens.shared.appTopAppBarColors +import com.mateusrodcosta.apps.share2storage.screens.shared.ListItemWithURL import com.mateusrodcosta.apps.share2storage.screens.shared.shouldShowLandscape import com.mateusrodcosta.apps.share2storage.ui.theme.AppTheme -@Preview(apiLevel = 34, showBackground = true) +@Preview(apiLevel = 34, showSystemUi = true, showBackground = true) @Composable fun MainScreenPreview() { MainScreenContent( @@ -78,6 +72,15 @@ fun MainScreenPreview() { ) } +@Preview(apiLevel = 34, showSystemUi = true, showBackground = true, locale = "pt-rBR") +@Composable +fun MainScreenPreviewPtBr() { + MainScreenContent( + widthSizeClass = WindowWidthSizeClass.Compact, + heightSizeClass = WindowHeightSizeClass.Medium, + ) +} + @Composable fun MainScreen(navController: NavController, windowSizeClass: WindowSizeClass) { MainScreenContent( @@ -94,16 +97,26 @@ fun MainScreenContent( widthSizeClass: WindowWidthSizeClass, heightSizeClass: WindowHeightSizeClass, ) { + val openAboutDialog = remember { mutableStateOf(false) } + + if (openAboutDialog.value) { + AboutDialog(onDismissRequest = { + openAboutDialog.value = false + }) + } + AppTheme { Scaffold(topBar = { TopAppBar( title = { Text(stringResource(R.string.app_name)) }, actions = { + IconButton(onClick = { openAboutDialog.value = true }) { + Icon(Icons.Rounded.Info, stringResource(R.string.about_title)) + } IconButton(onClick = { navController?.navigate("settings") }) { - Icon(Icons.Rounded.Settings, stringResource(R.string.settings)) + Icon(Icons.Rounded.Settings, stringResource(R.string.settings_title)) } }, - colors = appTopAppBarColors(), ) }) { paddingValues -> Box(modifier = Modifier.padding(paddingValues)) { @@ -133,7 +146,7 @@ fun HowToUsePortrait() { modifier = Modifier .fillMaxSize() .verticalScroll(rememberScrollState()), - horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center, ) { HowToUseHeader() HowToUseContent() @@ -152,11 +165,11 @@ fun HowToUseHeader() { Image( painterResource(R.drawable.ic_launcher_foreground), stringResource(R.string.app_name), - modifier = Modifier.scale(1.8f), + modifier = Modifier.scale(1.5f), ) Text( stringResource(R.string.how_to_use), - style = MaterialTheme.typography.titleLarge.copy(color = MaterialTheme.colorScheme.tertiary), + style = MaterialTheme.typography.headlineLarge.copy(color = MaterialTheme.colorScheme.secondary), textAlign = TextAlign.Center ) } @@ -177,94 +190,25 @@ fun HowToUseContent(isLandscape: Boolean = false) { ) HowToUseRow(3, stringResource(R.string.how_to_use_step_3)) HowToUseRow(4, stringResource(R.string.how_to_use_step_4)) - AppBasicDivider() - AppListHeader(title = stringResource(R.string.how_to_use_about_title)) - AboutRowWithURL( - stringResource(R.string.how_to_use_app_donation), + Spacer(modifier = Modifier.height(16.dp)) + AppListHeader(title = stringResource(R.string.donation_title)) + ListItemWithURL( + stringResource(R.string.donation_content), + linkPlacement = "%s", url = stringResource(R.string.donation_url), - "%s" - ) - AboutRowWithURL( - stringResource(R.string.how_to_use_about), - url = stringResource(R.string.github_profile_url), - "Mateus Rodrigues Costa", - false - ) - AboutRow( - stringResource(R.string.how_to_use_app_icon_credits) - ) - AboutRowWithURL( - stringResource(R.string.how_to_use_github), - url = stringResource(R.string.source_code_url), - "%s" + replaceWithUrl = true ) } } @Composable fun HowToUseRow(num: Int?, string: String) { - GenericRow { + ListItem(modifier = Modifier.clickable { }, leadingContent = { Text( if (num == null) " " else "$num.", - style = MaterialTheme.typography.titleSmall.copy(fontWeight = FontWeight.Bold), - ) - Spacer(modifier = Modifier.width(8.dp)) - Text( - string, - style = MaterialTheme.typography.bodyLarge, - softWrap = true, - ) - } -} - -@Composable -fun AboutRow(string: String) { - GenericRow { - Text( - string, - style = MaterialTheme.typography.bodyLarge, - softWrap = true, - ) - } -} - - -@Composable -fun AboutRowWithURL( - string: String, url: String, linkPlacement: String, replaceWithUrl: Boolean = true -) { - val localUriHandler = LocalUriHandler.current - val stringPieces = string.split(linkPlacement) - GenericRow(onClick = { localUriHandler.openUri(url) }) { - Text( - buildAnnotatedString { - append(stringPieces[0]) - withStyle( - style = SpanStyle( - color = Color.Blue, textDecoration = TextDecoration.Underline - ) - ) { - if (replaceWithUrl) append(url) else append(linkPlacement) - } - if (stringPieces.size >= 2) append(stringPieces[1]) - }, - style = MaterialTheme.typography.bodyLarge, - softWrap = true, + style = LocalTextStyle.current.copy(fontWeight = FontWeight.Bold), ) - } + }, headlineContent = { + Text(string, softWrap = true) + }) } - -@Composable -fun GenericRow(onClick: () -> Unit = {}, content: @Composable (RowScope.() -> Unit)) { - Box(modifier = Modifier - .fillMaxWidth() - .clickable { onClick() }) { - Row( - modifier = Modifier - .padding(PaddingValues(horizontal = 16.dp, vertical = 8.dp)) - .heightIn(min = 32.dp), - verticalAlignment = Alignment.CenterVertically, - content = content, - ) - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/SettingsScreen.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/SettingsScreen.kt index 99fe849..8fcbf84 100644 --- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/SettingsScreen.kt +++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/SettingsScreen.kt @@ -21,13 +21,8 @@ import android.net.Uri import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.width import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons @@ -36,7 +31,7 @@ import androidx.compose.material.icons.rounded.Clear import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton -import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.ListItem import androidx.compose.material3.Scaffold import androidx.compose.material3.Switch import androidx.compose.material3.Text @@ -48,17 +43,15 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp import androidx.navigation.NavController import com.mateusrodcosta.apps.share2storage.R import com.mateusrodcosta.apps.share2storage.screens.shared.AppBasicDivider import com.mateusrodcosta.apps.share2storage.screens.shared.AppListHeader -import com.mateusrodcosta.apps.share2storage.screens.shared.appTopAppBarColors import com.mateusrodcosta.apps.share2storage.ui.theme.AppTheme import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow -@Preview(apiLevel = 34, showBackground = true) +@Preview(apiLevel = 34, showSystemUi = true, showBackground = true) @Composable fun SettingsScreenPreview() { val mockDefaultSaveLocation = MutableStateFlow(null) @@ -74,6 +67,23 @@ fun SettingsScreenPreview() { ) } + +@Preview(apiLevel = 34, showSystemUi = true, showBackground = true, locale = "pt-rBR") +@Composable +fun SettingsScreenPreviewPtBr() { + val mockDefaultSaveLocation = MutableStateFlow(null) + val mockSkipFileDetails = MutableStateFlow(false) + val mockInterceptActionViewIntents = MutableStateFlow(false) + val mockShowFilePreview = MutableStateFlow(true) + + SettingsScreenContent( + spDefaultSaveLocation = mockDefaultSaveLocation, + spSkipFileDetails = mockSkipFileDetails, + spInterceptActionViewIntents = mockInterceptActionViewIntents, + spShowFilePreview = mockShowFilePreview, + ) +} + @Composable fun SettingsScreen(navController: NavController, settingsViewModel: SettingsViewModel) { SettingsScreenContent( @@ -110,19 +120,16 @@ fun SettingsScreenContent( updateInterceptActionViewIntents: (Boolean) -> Unit = {}, updateShowFilePreview: (Boolean) -> Unit = {}, ) { - val settingsPadding = PaddingValues(horizontal = 16.dp, vertical = 8.dp) - AppTheme { Scaffold(topBar = { - TopAppBar(title = { Text(stringResource(R.string.settings)) }, - colors = appTopAppBarColors(), - navigationIcon = { - IconButton(onClick = { navController?.navigateUp() }) { - Icon( - Icons.AutoMirrored.Filled.ArrowBack, stringResource(R.string.back_arrow) - ) - } - }) + TopAppBar(title = { Text(stringResource(R.string.settings_title)) }, navigationIcon = { + IconButton(onClick = { navController?.navigateUp() }) { + Icon( + Icons.AutoMirrored.Filled.ArrowBack, + stringResource(R.string.back_arrow), + ) + } + }) }) { paddingValues -> Box(modifier = Modifier.padding(paddingValues)) { Column( @@ -137,26 +144,22 @@ fun SettingsScreenContent( launchFilePicker = launchFilePicker, clearSaveDirectory = clearSaveDirectory, spDefaultSaveLocation = spDefaultSaveLocation, - paddingValues = settingsPadding, ) AppBasicDivider() AppListHeader(stringResource(R.string.settings_category_file_details)) SkipFileDetailsSetting( updateSkipFileDetails = updateSkipFileDetails, spSkipFileDetails = spSkipFileDetails, - paddingValues = settingsPadding, ) ShowFilePreviewSetting( updateShowFilePreview = updateShowFilePreview, spShowFilePreview = spShowFilePreview, - paddingValues = settingsPadding, ) AppBasicDivider() AppListHeader(title = stringResource(R.string.settings_category_intents)) InterceptActionViewIntentsSetting( updateInterceptActionViewIntents = updateInterceptActionViewIntents, spInterceptActionViewIntents = spInterceptActionViewIntents, - paddingValues = settingsPadding, ) } } @@ -170,59 +173,42 @@ fun DefaultSaveLocationSetting( launchFilePicker: () -> Unit, clearSaveDirectory: () -> Unit, spDefaultSaveLocation: StateFlow, - paddingValues: PaddingValues, ) { val defaultSaveLocation by spDefaultSaveLocation.collectAsState() - Row(modifier = Modifier - .clickable { launchFilePicker() } - .padding(paddingValues) - .heightIn(min = 48.dp), verticalAlignment = Alignment.CenterVertically) { - Column(modifier = Modifier.weight(1.0f)) { - Text( - stringResource(R.string.settings_default_save_location), - style = MaterialTheme.typography.titleLarge, - ) - Text( - defaultSaveLocation?.path - ?: stringResource(R.string.settings_default_save_location_last_used), - style = MaterialTheme.typography.bodyLarge - ) - } + ListItem(modifier = Modifier.clickable { launchFilePicker() }, headlineContent = { + Text(stringResource(R.string.settings_default_save_location)) + }, supportingContent = { + Text( + defaultSaveLocation?.path + ?: stringResource(R.string.settings_default_save_location_last_used) + ) + }, trailingContent = { IconButton(onClick = { clearSaveDirectory() }) { Icon(Icons.Rounded.Clear, stringResource(R.string.clear_button)) } - } + }) } @Composable fun SkipFileDetailsSetting( updateSkipFileDetails: (Boolean) -> Unit, spSkipFileDetails: StateFlow, - paddingValues: PaddingValues, ) { val skipFileDetails by spSkipFileDetails.collectAsState() - Row(modifier = Modifier - .clickable { updateSkipFileDetails(!skipFileDetails) } - .padding(paddingValues) - .heightIn(min = 48.dp), - verticalAlignment = Alignment.CenterVertically) { - Column(modifier = Modifier.weight(1.0f)) { - Text( - stringResource(R.string.settings_skip_file_details_page), - style = MaterialTheme.typography.titleLarge, - ) - Text( - stringResource(R.string.settings_skip_file_details_page_info), - style = MaterialTheme.typography.bodyLarge - ) - } - Spacer(modifier = Modifier.width(8.dp)) - Switch(checked = skipFileDetails, onCheckedChange = { value -> - updateSkipFileDetails(value) + ListItem(modifier = Modifier.clickable { updateSkipFileDetails(!skipFileDetails) }, + headlineContent = { + Text(stringResource(R.string.settings_skip_file_details_page)) + }, + supportingContent = { + Text(stringResource(R.string.settings_skip_file_details_page_info)) + }, + trailingContent = { + Switch(checked = skipFileDetails, onCheckedChange = { value -> + updateSkipFileDetails(value) + }) }) - } } @@ -230,58 +216,40 @@ fun SkipFileDetailsSetting( fun ShowFilePreviewSetting( updateShowFilePreview: (Boolean) -> Unit, spShowFilePreview: StateFlow, - paddingValues: PaddingValues, ) { val showFilePreview by spShowFilePreview.collectAsState() - Row(modifier = Modifier - .clickable { updateShowFilePreview(!showFilePreview) } - .padding(paddingValues) - .heightIn(min = 48.dp), - verticalAlignment = Alignment.CenterVertically) { - Column(modifier = Modifier.weight(1.0f)) { - Text( - stringResource(R.string.settings_show_file_preview), - style = MaterialTheme.typography.titleLarge, - ) - Text( - stringResource(R.string.settings_show_file_preview_info), - style = MaterialTheme.typography.bodyLarge - ) - } - Spacer(modifier = Modifier.width(8.dp)) - Switch(checked = showFilePreview, onCheckedChange = { value -> - updateShowFilePreview(value) + ListItem(modifier = Modifier.clickable { updateShowFilePreview(!showFilePreview) }, + headlineContent = { + Text(stringResource(R.string.settings_show_file_preview)) + }, + supportingContent = { + Text(stringResource(R.string.settings_show_file_preview_info)) + }, + trailingContent = { + Switch(checked = showFilePreview, onCheckedChange = { value -> + updateShowFilePreview(value) + }) }) - } } @Composable fun InterceptActionViewIntentsSetting( updateInterceptActionViewIntents: (Boolean) -> Unit, spInterceptActionViewIntents: StateFlow, - paddingValues: PaddingValues, ) { val interceptActionViewIntents by spInterceptActionViewIntents.collectAsState() - Row(modifier = Modifier - .clickable { updateInterceptActionViewIntents(!interceptActionViewIntents) } - .padding(paddingValues) - .heightIn(min = 48.dp), - verticalAlignment = Alignment.CenterVertically) { - Column(modifier = Modifier.weight(1.0f)) { - Text( - stringResource(R.string.settings_intercept_action_view_intents), - style = MaterialTheme.typography.titleLarge, - ) - Text( - stringResource(R.string.settings_intercept_action_view_intents_info), - style = MaterialTheme.typography.bodyLarge, - ) - } - Spacer(modifier = Modifier.width(8.dp)) - Switch(checked = interceptActionViewIntents, onCheckedChange = { value -> - updateInterceptActionViewIntents(value) + ListItem(modifier = Modifier.clickable { updateInterceptActionViewIntents(!interceptActionViewIntents) }, + headlineContent = { + Text(stringResource(R.string.settings_intercept_action_view_intents)) + }, + supportingContent = { + Text(stringResource(R.string.settings_intercept_action_view_intents_info)) + }, + trailingContent = { + Switch(checked = interceptActionViewIntents, onCheckedChange = { value -> + updateInterceptActionViewIntents(value) + }) }) - } } \ No newline at end of file diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/shared/SharedComposables.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/shared/SharedComposables.kt index 9a8dbe0..f09356e 100644 --- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/shared/SharedComposables.kt +++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/shared/SharedComposables.kt @@ -17,16 +17,21 @@ package com.mateusrodcosta.apps.share2storage.screens.shared +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.ListItem import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text -import androidx.compose.material3.TopAppBarColors -import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalUriHandler +import androidx.compose.ui.text.SpanStyle +import androidx.compose.ui.text.buildAnnotatedString +import androidx.compose.ui.text.style.TextDecoration +import androidx.compose.ui.text.withStyle import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp @@ -40,19 +45,33 @@ fun AppListHeader(title: String) { Text( text = title, modifier = Modifier - .padding(horizontal = 16.dp, vertical = 8.dp) + .padding(horizontal = 16.dp, vertical = 4.dp) .fillMaxWidth(), - style = MaterialTheme.typography.headlineSmall.copy(color = MaterialTheme.colorScheme.tertiary), + style = MaterialTheme.typography.headlineMedium.copy(color = MaterialTheme.colorScheme.secondary), ) } -@OptIn(ExperimentalMaterial3Api::class) @Composable -fun appTopAppBarColors(): TopAppBarColors { - return TopAppBarDefaults.topAppBarColors( - containerColor = MaterialTheme.colorScheme.primary, - titleContentColor = MaterialTheme.colorScheme.onPrimary, - navigationIconContentColor = MaterialTheme.colorScheme.onPrimary, - actionIconContentColor = MaterialTheme.colorScheme.onPrimary, - ) +fun ListItemWithURL( + string: String, linkPlacement: String, url: String, replaceWithUrl: Boolean = false +) { + val localUriHandler = LocalUriHandler.current + val stringPieces = string.split(linkPlacement) + + ListItem(modifier = Modifier.clickable { localUriHandler.openUri(url) }, headlineContent = { + Text( + buildAnnotatedString { + append(stringPieces[0]) + withStyle( + style = SpanStyle( + color = MaterialTheme.colorScheme.tertiary, textDecoration = TextDecoration.Underline + ) + ) { + if (replaceWithUrl) append(url) else append(linkPlacement) + } + if (stringPieces.size >= 2) append(stringPieces[1]) + }, + softWrap = true, + ) + }) } \ No newline at end of file diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Color.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Color.kt index e41306d..02c0e37 100644 --- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Color.kt +++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Color.kt @@ -19,67 +19,218 @@ package com.mateusrodcosta.apps.share2storage.ui.theme import androidx.compose.ui.graphics.Color -val md_theme_light_primary = Color(0xFF006B5F) -val md_theme_light_onPrimary = Color(0xFFFFFFFF) -val md_theme_light_primaryContainer = Color(0xFF74F8E4) -val md_theme_light_onPrimaryContainer = Color(0xFF00201C) -val md_theme_light_secondary = Color(0xFF4A635E) -val md_theme_light_onSecondary = Color(0xFFFFFFFF) -val md_theme_light_secondaryContainer = Color(0xFFCCE8E2) -val md_theme_light_onSecondaryContainer = Color(0xFF06201C) -val md_theme_light_tertiary = Color(0xFF456179) -val md_theme_light_onTertiary = Color(0xFFFFFFFF) -val md_theme_light_tertiaryContainer = Color(0xFFCBE6FF) -val md_theme_light_onTertiaryContainer = Color(0xFF001E31) -val md_theme_light_error = Color(0xFFBA1A1A) -val md_theme_light_errorContainer = Color(0xFFFFDAD6) -val md_theme_light_onError = Color(0xFFFFFFFF) -val md_theme_light_onErrorContainer = Color(0xFF410002) -val md_theme_light_background = Color(0xFFFAFDFB) -val md_theme_light_onBackground = Color(0xFF191C1B) -val md_theme_light_surface = Color(0xFFFAFDFB) -val md_theme_light_onSurface = Color(0xFF191C1B) -val md_theme_light_surfaceVariant = Color(0xFFDAE5E1) -val md_theme_light_onSurfaceVariant = Color(0xFF3F4946) -val md_theme_light_outline = Color(0xFF6F7976) -val md_theme_light_inverseOnSurface = Color(0xFFEFF1EF) -val md_theme_light_inverseSurface = Color(0xFF2D3130) -val md_theme_light_inversePrimary = Color(0xFF54DBC8) -val md_theme_light_shadow = Color(0xFF000000) -val md_theme_light_surfaceTint = Color(0xFF006B5F) -val md_theme_light_outlineVariant = Color(0xFFBEC9C5) -val md_theme_light_scrim = Color(0xFF000000) +val primaryLight = Color(0xFF256A4A) +val onPrimaryLight = Color(0xFFFFFFFF) +val primaryContainerLight = Color(0xFFABF2C9) +val onPrimaryContainerLight = Color(0xFF002112) +val secondaryLight = Color(0xFF4D6356) +val onSecondaryLight = Color(0xFFFFFFFF) +val secondaryContainerLight = Color(0xFFD0E8D7) +val onSecondaryContainerLight = Color(0xFF0B1F15) +val tertiaryLight = Color(0xFF3C6472) +val onTertiaryLight = Color(0xFFFFFFFF) +val tertiaryContainerLight = Color(0xFFC0E9FA) +val onTertiaryContainerLight = Color(0xFF001F28) +val errorLight = Color(0xFFBA1A1A) +val onErrorLight = Color(0xFFFFFFFF) +val errorContainerLight = Color(0xFFFFDAD6) +val onErrorContainerLight = Color(0xFF410002) +val backgroundLight = Color(0xFFF5FBF4) +val onBackgroundLight = Color(0xFF171D19) +val surfaceLight = Color(0xFFF5FBF4) +val onSurfaceLight = Color(0xFF171D19) +val surfaceVariantLight = Color(0xFFDCE5DC) +val onSurfaceVariantLight = Color(0xFF404943) +val outlineLight = Color(0xFF707972) +val outlineVariantLight = Color(0xFFC0C9C1) +val scrimLight = Color(0xFF000000) +val inverseSurfaceLight = Color(0xFF2C322E) +val inverseOnSurfaceLight = Color(0xFFEDF2EC) +val inversePrimaryLight = Color(0xFF90D5AE) +val surfaceDimLight = Color(0xFFD6DBD5) +val surfaceBrightLight = Color(0xFFF5FBF4) +val surfaceContainerLowestLight = Color(0xFFFFFFFF) +val surfaceContainerLowLight = Color(0xFFF0F5EF) +val surfaceContainerLight = Color(0xFFEAEFE9) +val surfaceContainerHighLight = Color(0xFFE4EAE3) +val surfaceContainerHighestLight = Color(0xFFDEE4DE) -val md_theme_dark_primary = Color(0xFF54DBC8) -val md_theme_dark_onPrimary = Color(0xFF003731) -val md_theme_dark_primaryContainer = Color(0xFF005048) -val md_theme_dark_onPrimaryContainer = Color(0xFF74F8E4) -val md_theme_dark_secondary = Color(0xFFB1CCC6) -val md_theme_dark_onSecondary = Color(0xFF1C3531) -val md_theme_dark_secondaryContainer = Color(0xFF334B47) -val md_theme_dark_onSecondaryContainer = Color(0xFFCCE8E2) -val md_theme_dark_tertiary = Color(0xFFADCAE5) -val md_theme_dark_onTertiary = Color(0xFF143349) -val md_theme_dark_tertiaryContainer = Color(0xFF2D4A60) -val md_theme_dark_onTertiaryContainer = Color(0xFFCBE6FF) -val md_theme_dark_error = Color(0xFFFFB4AB) -val md_theme_dark_errorContainer = Color(0xFF93000A) -val md_theme_dark_onError = Color(0xFF690005) -val md_theme_dark_onErrorContainer = Color(0xFFFFDAD6) -val md_theme_dark_background = Color(0xFF191C1B) -val md_theme_dark_onBackground = Color(0xFFE0E3E1) -val md_theme_dark_surface = Color(0xFF191C1B) -val md_theme_dark_onSurface = Color(0xFFE0E3E1) -val md_theme_dark_surfaceVariant = Color(0xFF3F4946) -val md_theme_dark_onSurfaceVariant = Color(0xFFBEC9C5) -val md_theme_dark_outline = Color(0xFF899390) -val md_theme_dark_inverseOnSurface = Color(0xFF191C1B) -val md_theme_dark_inverseSurface = Color(0xFFE0E3E1) -val md_theme_dark_inversePrimary = Color(0xFF006B5F) -val md_theme_dark_shadow = Color(0xFF000000) -val md_theme_dark_surfaceTint = Color(0xFF54DBC8) -val md_theme_dark_outlineVariant = Color(0xFF3F4946) -val md_theme_dark_scrim = Color(0xFF000000) +val primaryLightMediumContrast = Color(0xFF004D31) +val onPrimaryLightMediumContrast = Color(0xFFFFFFFF) +val primaryContainerLightMediumContrast = Color(0xFF3E8160) +val onPrimaryContainerLightMediumContrast = Color(0xFFFFFFFF) +val secondaryLightMediumContrast = Color(0xFF32473B) +val onSecondaryLightMediumContrast = Color(0xFFFFFFFF) +val secondaryContainerLightMediumContrast = Color(0xFF637A6B) +val onSecondaryContainerLightMediumContrast = Color(0xFFFFFFFF) +val tertiaryLightMediumContrast = Color(0xFF1E4855) +val onTertiaryLightMediumContrast = Color(0xFFFFFFFF) +val tertiaryContainerLightMediumContrast = Color(0xFF537A89) +val onTertiaryContainerLightMediumContrast = Color(0xFFFFFFFF) +val errorLightMediumContrast = Color(0xFF8C0009) +val onErrorLightMediumContrast = Color(0xFFFFFFFF) +val errorContainerLightMediumContrast = Color(0xFFDA342E) +val onErrorContainerLightMediumContrast = Color(0xFFFFFFFF) +val backgroundLightMediumContrast = Color(0xFFF5FBF4) +val onBackgroundLightMediumContrast = Color(0xFF171D19) +val surfaceLightMediumContrast = Color(0xFFF5FBF4) +val onSurfaceLightMediumContrast = Color(0xFF171D19) +val surfaceVariantLightMediumContrast = Color(0xFFDCE5DC) +val onSurfaceVariantLightMediumContrast = Color(0xFF3C453F) +val outlineLightMediumContrast = Color(0xFF58615B) +val outlineVariantLightMediumContrast = Color(0xFF747D76) +val scrimLightMediumContrast = Color(0xFF000000) +val inverseSurfaceLightMediumContrast = Color(0xFF2C322E) +val inverseOnSurfaceLightMediumContrast = Color(0xFFEDF2EC) +val inversePrimaryLightMediumContrast = Color(0xFF90D5AE) +val surfaceDimLightMediumContrast = Color(0xFFD6DBD5) +val surfaceBrightLightMediumContrast = Color(0xFFF5FBF4) +val surfaceContainerLowestLightMediumContrast = Color(0xFFFFFFFF) +val surfaceContainerLowLightMediumContrast = Color(0xFFF0F5EF) +val surfaceContainerLightMediumContrast = Color(0xFFEAEFE9) +val surfaceContainerHighLightMediumContrast = Color(0xFFE4EAE3) +val surfaceContainerHighestLightMediumContrast = Color(0xFFDEE4DE) +val primaryLightHighContrast = Color(0xFF002818) +val onPrimaryLightHighContrast = Color(0xFFFFFFFF) +val primaryContainerLightHighContrast = Color(0xFF004D31) +val onPrimaryContainerLightHighContrast = Color(0xFFFFFFFF) +val secondaryLightHighContrast = Color(0xFF12261B) +val onSecondaryLightHighContrast = Color(0xFFFFFFFF) +val secondaryContainerLightHighContrast = Color(0xFF32473B) +val onSecondaryContainerLightHighContrast = Color(0xFFFFFFFF) +val tertiaryLightHighContrast = Color(0xFF002631) +val onTertiaryLightHighContrast = Color(0xFFFFFFFF) +val tertiaryContainerLightHighContrast = Color(0xFF1E4855) +val onTertiaryContainerLightHighContrast = Color(0xFFFFFFFF) +val errorLightHighContrast = Color(0xFF4E0002) +val onErrorLightHighContrast = Color(0xFFFFFFFF) +val errorContainerLightHighContrast = Color(0xFF8C0009) +val onErrorContainerLightHighContrast = Color(0xFFFFFFFF) +val backgroundLightHighContrast = Color(0xFFF5FBF4) +val onBackgroundLightHighContrast = Color(0xFF171D19) +val surfaceLightHighContrast = Color(0xFFF5FBF4) +val onSurfaceLightHighContrast = Color(0xFF000000) +val surfaceVariantLightHighContrast = Color(0xFFDCE5DC) +val onSurfaceVariantLightHighContrast = Color(0xFF1E2621) +val outlineLightHighContrast = Color(0xFF3C453F) +val outlineVariantLightHighContrast = Color(0xFF3C453F) +val scrimLightHighContrast = Color(0xFF000000) +val inverseSurfaceLightHighContrast = Color(0xFF2C322E) +val inverseOnSurfaceLightHighContrast = Color(0xFFFFFFFF) +val inversePrimaryLightHighContrast = Color(0xFFB5FCD2) +val surfaceDimLightHighContrast = Color(0xFFD6DBD5) +val surfaceBrightLightHighContrast = Color(0xFFF5FBF4) +val surfaceContainerLowestLightHighContrast = Color(0xFFFFFFFF) +val surfaceContainerLowLightHighContrast = Color(0xFFF0F5EF) +val surfaceContainerLightHighContrast = Color(0xFFEAEFE9) +val surfaceContainerHighLightHighContrast = Color(0xFFE4EAE3) +val surfaceContainerHighestLightHighContrast = Color(0xFFDEE4DE) -val seed = Color(0xFF00897B) +val primaryDark = Color(0xFF90D5AE) +val onPrimaryDark = Color(0xFF003823) +val primaryContainerDark = Color(0xFF005234) +val onPrimaryContainerDark = Color(0xFFABF2C9) +val secondaryDark = Color(0xFFB4CCBC) +val onSecondaryDark = Color(0xFF203529) +val secondaryContainerDark = Color(0xFF364B3F) +val onSecondaryContainerDark = Color(0xFFD0E8D7) +val tertiaryDark = Color(0xFFA4CDDD) +val onTertiaryDark = Color(0xFF053542) +val tertiaryContainerDark = Color(0xFF234C59) +val onTertiaryContainerDark = Color(0xFFC0E9FA) +val errorDark = Color(0xFFFFB4AB) +val onErrorDark = Color(0xFF690005) +val errorContainerDark = Color(0xFF93000A) +val onErrorContainerDark = Color(0xFFFFDAD6) +val backgroundDark = Color(0xFF0F1511) +val onBackgroundDark = Color(0xFFDEE4DE) +val surfaceDark = Color(0xFF0F1511) +val onSurfaceDark = Color(0xFFDEE4DE) +val surfaceVariantDark = Color(0xFF404943) +val onSurfaceVariantDark = Color(0xFFC0C9C1) +val outlineDark = Color(0xFF8A938C) +val outlineVariantDark = Color(0xFF404943) +val scrimDark = Color(0xFF000000) +val inverseSurfaceDark = Color(0xFFDEE4DE) +val inverseOnSurfaceDark = Color(0xFF2C322E) +val inversePrimaryDark = Color(0xFF256A4A) +val surfaceDimDark = Color(0xFF0F1511) +val surfaceBrightDark = Color(0xFF353B36) +val surfaceContainerLowestDark = Color(0xFF0A0F0C) +val surfaceContainerLowDark = Color(0xFF171D19) +val surfaceContainerDark = Color(0xFF1B211D) +val surfaceContainerHighDark = Color(0xFF262B27) +val surfaceContainerHighestDark = Color(0xFF303632) + +val primaryDarkMediumContrast = Color(0xFF94DAB2) +val onPrimaryDarkMediumContrast = Color(0xFF001B0E) +val primaryContainerDarkMediumContrast = Color(0xFF5B9E7B) +val onPrimaryContainerDarkMediumContrast = Color(0xFF000000) +val secondaryDarkMediumContrast = Color(0xFFB8D1C0) +val onSecondaryDarkMediumContrast = Color(0xFF061A10) +val secondaryContainerDarkMediumContrast = Color(0xFF7F9687) +val onSecondaryContainerDarkMediumContrast = Color(0xFF000000) +val tertiaryDarkMediumContrast = Color(0xFFA8D1E1) +val onTertiaryDarkMediumContrast = Color(0xFF001921) +val tertiaryContainerDarkMediumContrast = Color(0xFF6F97A6) +val onTertiaryContainerDarkMediumContrast = Color(0xFF000000) +val errorDarkMediumContrast = Color(0xFFFFBAB1) +val onErrorDarkMediumContrast = Color(0xFF370001) +val errorContainerDarkMediumContrast = Color(0xFFFF5449) +val onErrorContainerDarkMediumContrast = Color(0xFF000000) +val backgroundDarkMediumContrast = Color(0xFF0F1511) +val onBackgroundDarkMediumContrast = Color(0xFFDEE4DE) +val surfaceDarkMediumContrast = Color(0xFF0F1511) +val onSurfaceDarkMediumContrast = Color(0xFFF7FCF6) +val surfaceVariantDarkMediumContrast = Color(0xFF404943) +val onSurfaceVariantDarkMediumContrast = Color(0xFFC4CDC5) +val outlineDarkMediumContrast = Color(0xFF9CA59E) +val outlineVariantDarkMediumContrast = Color(0xFF7C857E) +val scrimDarkMediumContrast = Color(0xFF000000) +val inverseSurfaceDarkMediumContrast = Color(0xFFDEE4DE) +val inverseOnSurfaceDarkMediumContrast = Color(0xFF262B27) +val inversePrimaryDarkMediumContrast = Color(0xFF025335) +val surfaceDimDarkMediumContrast = Color(0xFF0F1511) +val surfaceBrightDarkMediumContrast = Color(0xFF353B36) +val surfaceContainerLowestDarkMediumContrast = Color(0xFF0A0F0C) +val surfaceContainerLowDarkMediumContrast = Color(0xFF171D19) +val surfaceContainerDarkMediumContrast = Color(0xFF1B211D) +val surfaceContainerHighDarkMediumContrast = Color(0xFF262B27) +val surfaceContainerHighestDarkMediumContrast = Color(0xFF303632) + +val primaryDarkHighContrast = Color(0xFFEEFFF2) +val onPrimaryDarkHighContrast = Color(0xFF000000) +val primaryContainerDarkHighContrast = Color(0xFF94DAB2) +val onPrimaryContainerDarkHighContrast = Color(0xFF000000) +val secondaryDarkHighContrast = Color(0xFFEEFFF2) +val onSecondaryDarkHighContrast = Color(0xFF000000) +val secondaryContainerDarkHighContrast = Color(0xFFB8D1C0) +val onSecondaryContainerDarkHighContrast = Color(0xFF000000) +val tertiaryDarkHighContrast = Color(0xFFF6FCFF) +val onTertiaryDarkHighContrast = Color(0xFF000000) +val tertiaryContainerDarkHighContrast = Color(0xFFA8D1E1) +val onTertiaryContainerDarkHighContrast = Color(0xFF000000) +val errorDarkHighContrast = Color(0xFFFFF9F9) +val onErrorDarkHighContrast = Color(0xFF000000) +val errorContainerDarkHighContrast = Color(0xFFFFBAB1) +val onErrorContainerDarkHighContrast = Color(0xFF000000) +val backgroundDarkHighContrast = Color(0xFF0F1511) +val onBackgroundDarkHighContrast = Color(0xFFDEE4DE) +val surfaceDarkHighContrast = Color(0xFF0F1511) +val onSurfaceDarkHighContrast = Color(0xFFFFFFFF) +val surfaceVariantDarkHighContrast = Color(0xFF404943) +val onSurfaceVariantDarkHighContrast = Color(0xFFF4FDF4) +val outlineDarkHighContrast = Color(0xFFC4CDC5) +val outlineVariantDarkHighContrast = Color(0xFFC4CDC5) +val scrimDarkHighContrast = Color(0xFF000000) +val inverseSurfaceDarkHighContrast = Color(0xFFDEE4DE) +val inverseOnSurfaceDarkHighContrast = Color(0xFF000000) +val inversePrimaryDarkHighContrast = Color(0xFF00311E) +val surfaceDimDarkHighContrast = Color(0xFF0F1511) +val surfaceBrightDarkHighContrast = Color(0xFF353B36) +val surfaceContainerLowestDarkHighContrast = Color(0xFF0A0F0C) +val surfaceContainerLowDarkHighContrast = Color(0xFF171D19) +val surfaceContainerDarkHighContrast = Color(0xFF1B211D) +val surfaceContainerHighDarkHighContrast = Color(0xFF262B27) +val surfaceContainerHighestDarkHighContrast = Color(0xFF303632) diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Theme.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Theme.kt index 78c04a7..92b9dd0 100644 --- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Theme.kt +++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Theme.kt @@ -17,89 +17,272 @@ package com.mateusrodcosta.apps.share2storage.ui.theme +import android.os.Build import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.MaterialTheme import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable +import androidx.compose.runtime.Immutable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext +private val lightScheme = lightColorScheme( + primary = primaryLight, + onPrimary = onPrimaryLight, + primaryContainer = primaryContainerLight, + onPrimaryContainer = onPrimaryContainerLight, + secondary = secondaryLight, + onSecondary = onSecondaryLight, + secondaryContainer = secondaryContainerLight, + onSecondaryContainer = onSecondaryContainerLight, + tertiary = tertiaryLight, + onTertiary = onTertiaryLight, + tertiaryContainer = tertiaryContainerLight, + onTertiaryContainer = onTertiaryContainerLight, + error = errorLight, + onError = onErrorLight, + errorContainer = errorContainerLight, + onErrorContainer = onErrorContainerLight, + background = backgroundLight, + onBackground = onBackgroundLight, + surface = surfaceLight, + onSurface = onSurfaceLight, + surfaceVariant = surfaceVariantLight, + onSurfaceVariant = onSurfaceVariantLight, + outline = outlineLight, + outlineVariant = outlineVariantLight, + scrim = scrimLight, + inverseSurface = inverseSurfaceLight, + inverseOnSurface = inverseOnSurfaceLight, + inversePrimary = inversePrimaryLight, + surfaceDim = surfaceDimLight, + surfaceBright = surfaceBrightLight, + surfaceContainerLowest = surfaceContainerLowestLight, + surfaceContainerLow = surfaceContainerLowLight, + surfaceContainer = surfaceContainerLight, + surfaceContainerHigh = surfaceContainerHighLight, + surfaceContainerHighest = surfaceContainerHighestLight, +) + +private val darkScheme = darkColorScheme( + primary = primaryDark, + onPrimary = onPrimaryDark, + primaryContainer = primaryContainerDark, + onPrimaryContainer = onPrimaryContainerDark, + secondary = secondaryDark, + onSecondary = onSecondaryDark, + secondaryContainer = secondaryContainerDark, + onSecondaryContainer = onSecondaryContainerDark, + tertiary = tertiaryDark, + onTertiary = onTertiaryDark, + tertiaryContainer = tertiaryContainerDark, + onTertiaryContainer = onTertiaryContainerDark, + error = errorDark, + onError = onErrorDark, + errorContainer = errorContainerDark, + onErrorContainer = onErrorContainerDark, + background = backgroundDark, + onBackground = onBackgroundDark, + surface = surfaceDark, + onSurface = onSurfaceDark, + surfaceVariant = surfaceVariantDark, + onSurfaceVariant = onSurfaceVariantDark, + outline = outlineDark, + outlineVariant = outlineVariantDark, + scrim = scrimDark, + inverseSurface = inverseSurfaceDark, + inverseOnSurface = inverseOnSurfaceDark, + inversePrimary = inversePrimaryDark, + surfaceDim = surfaceDimDark, + surfaceBright = surfaceBrightDark, + surfaceContainerLowest = surfaceContainerLowestDark, + surfaceContainerLow = surfaceContainerLowDark, + surfaceContainer = surfaceContainerDark, + surfaceContainerHigh = surfaceContainerHighDark, + surfaceContainerHighest = surfaceContainerHighestDark, +) -private val LightColors = lightColorScheme( - primary = md_theme_light_primary, - onPrimary = md_theme_light_onPrimary, - primaryContainer = md_theme_light_primaryContainer, - onPrimaryContainer = md_theme_light_onPrimaryContainer, - secondary = md_theme_light_secondary, - onSecondary = md_theme_light_onSecondary, - secondaryContainer = md_theme_light_secondaryContainer, - onSecondaryContainer = md_theme_light_onSecondaryContainer, - tertiary = md_theme_light_tertiary, - onTertiary = md_theme_light_onTertiary, - tertiaryContainer = md_theme_light_tertiaryContainer, - onTertiaryContainer = md_theme_light_onTertiaryContainer, - error = md_theme_light_error, - errorContainer = md_theme_light_errorContainer, - onError = md_theme_light_onError, - onErrorContainer = md_theme_light_onErrorContainer, - background = md_theme_light_background, - onBackground = md_theme_light_onBackground, - surface = md_theme_light_surface, - onSurface = md_theme_light_onSurface, - surfaceVariant = md_theme_light_surfaceVariant, - onSurfaceVariant = md_theme_light_onSurfaceVariant, - outline = md_theme_light_outline, - inverseOnSurface = md_theme_light_inverseOnSurface, - inverseSurface = md_theme_light_inverseSurface, - inversePrimary = md_theme_light_inversePrimary, - surfaceTint = md_theme_light_surfaceTint, - outlineVariant = md_theme_light_outlineVariant, - scrim = md_theme_light_scrim, +private val mediumContrastLightColorScheme = lightColorScheme( + primary = primaryLightMediumContrast, + onPrimary = onPrimaryLightMediumContrast, + primaryContainer = primaryContainerLightMediumContrast, + onPrimaryContainer = onPrimaryContainerLightMediumContrast, + secondary = secondaryLightMediumContrast, + onSecondary = onSecondaryLightMediumContrast, + secondaryContainer = secondaryContainerLightMediumContrast, + onSecondaryContainer = onSecondaryContainerLightMediumContrast, + tertiary = tertiaryLightMediumContrast, + onTertiary = onTertiaryLightMediumContrast, + tertiaryContainer = tertiaryContainerLightMediumContrast, + onTertiaryContainer = onTertiaryContainerLightMediumContrast, + error = errorLightMediumContrast, + onError = onErrorLightMediumContrast, + errorContainer = errorContainerLightMediumContrast, + onErrorContainer = onErrorContainerLightMediumContrast, + background = backgroundLightMediumContrast, + onBackground = onBackgroundLightMediumContrast, + surface = surfaceLightMediumContrast, + onSurface = onSurfaceLightMediumContrast, + surfaceVariant = surfaceVariantLightMediumContrast, + onSurfaceVariant = onSurfaceVariantLightMediumContrast, + outline = outlineLightMediumContrast, + outlineVariant = outlineVariantLightMediumContrast, + scrim = scrimLightMediumContrast, + inverseSurface = inverseSurfaceLightMediumContrast, + inverseOnSurface = inverseOnSurfaceLightMediumContrast, + inversePrimary = inversePrimaryLightMediumContrast, + surfaceDim = surfaceDimLightMediumContrast, + surfaceBright = surfaceBrightLightMediumContrast, + surfaceContainerLowest = surfaceContainerLowestLightMediumContrast, + surfaceContainerLow = surfaceContainerLowLightMediumContrast, + surfaceContainer = surfaceContainerLightMediumContrast, + surfaceContainerHigh = surfaceContainerHighLightMediumContrast, + surfaceContainerHighest = surfaceContainerHighestLightMediumContrast, ) +private val highContrastLightColorScheme = lightColorScheme( + primary = primaryLightHighContrast, + onPrimary = onPrimaryLightHighContrast, + primaryContainer = primaryContainerLightHighContrast, + onPrimaryContainer = onPrimaryContainerLightHighContrast, + secondary = secondaryLightHighContrast, + onSecondary = onSecondaryLightHighContrast, + secondaryContainer = secondaryContainerLightHighContrast, + onSecondaryContainer = onSecondaryContainerLightHighContrast, + tertiary = tertiaryLightHighContrast, + onTertiary = onTertiaryLightHighContrast, + tertiaryContainer = tertiaryContainerLightHighContrast, + onTertiaryContainer = onTertiaryContainerLightHighContrast, + error = errorLightHighContrast, + onError = onErrorLightHighContrast, + errorContainer = errorContainerLightHighContrast, + onErrorContainer = onErrorContainerLightHighContrast, + background = backgroundLightHighContrast, + onBackground = onBackgroundLightHighContrast, + surface = surfaceLightHighContrast, + onSurface = onSurfaceLightHighContrast, + surfaceVariant = surfaceVariantLightHighContrast, + onSurfaceVariant = onSurfaceVariantLightHighContrast, + outline = outlineLightHighContrast, + outlineVariant = outlineVariantLightHighContrast, + scrim = scrimLightHighContrast, + inverseSurface = inverseSurfaceLightHighContrast, + inverseOnSurface = inverseOnSurfaceLightHighContrast, + inversePrimary = inversePrimaryLightHighContrast, + surfaceDim = surfaceDimLightHighContrast, + surfaceBright = surfaceBrightLightHighContrast, + surfaceContainerLowest = surfaceContainerLowestLightHighContrast, + surfaceContainerLow = surfaceContainerLowLightHighContrast, + surfaceContainer = surfaceContainerLightHighContrast, + surfaceContainerHigh = surfaceContainerHighLightHighContrast, + surfaceContainerHighest = surfaceContainerHighestLightHighContrast, +) + +private val mediumContrastDarkColorScheme = darkColorScheme( + primary = primaryDarkMediumContrast, + onPrimary = onPrimaryDarkMediumContrast, + primaryContainer = primaryContainerDarkMediumContrast, + onPrimaryContainer = onPrimaryContainerDarkMediumContrast, + secondary = secondaryDarkMediumContrast, + onSecondary = onSecondaryDarkMediumContrast, + secondaryContainer = secondaryContainerDarkMediumContrast, + onSecondaryContainer = onSecondaryContainerDarkMediumContrast, + tertiary = tertiaryDarkMediumContrast, + onTertiary = onTertiaryDarkMediumContrast, + tertiaryContainer = tertiaryContainerDarkMediumContrast, + onTertiaryContainer = onTertiaryContainerDarkMediumContrast, + error = errorDarkMediumContrast, + onError = onErrorDarkMediumContrast, + errorContainer = errorContainerDarkMediumContrast, + onErrorContainer = onErrorContainerDarkMediumContrast, + background = backgroundDarkMediumContrast, + onBackground = onBackgroundDarkMediumContrast, + surface = surfaceDarkMediumContrast, + onSurface = onSurfaceDarkMediumContrast, + surfaceVariant = surfaceVariantDarkMediumContrast, + onSurfaceVariant = onSurfaceVariantDarkMediumContrast, + outline = outlineDarkMediumContrast, + outlineVariant = outlineVariantDarkMediumContrast, + scrim = scrimDarkMediumContrast, + inverseSurface = inverseSurfaceDarkMediumContrast, + inverseOnSurface = inverseOnSurfaceDarkMediumContrast, + inversePrimary = inversePrimaryDarkMediumContrast, + surfaceDim = surfaceDimDarkMediumContrast, + surfaceBright = surfaceBrightDarkMediumContrast, + surfaceContainerLowest = surfaceContainerLowestDarkMediumContrast, + surfaceContainerLow = surfaceContainerLowDarkMediumContrast, + surfaceContainer = surfaceContainerDarkMediumContrast, + surfaceContainerHigh = surfaceContainerHighDarkMediumContrast, + surfaceContainerHighest = surfaceContainerHighestDarkMediumContrast, +) -private val DarkColors = darkColorScheme( - primary = md_theme_dark_primary, - onPrimary = md_theme_dark_onPrimary, - primaryContainer = md_theme_dark_primaryContainer, - onPrimaryContainer = md_theme_dark_onPrimaryContainer, - secondary = md_theme_dark_secondary, - onSecondary = md_theme_dark_onSecondary, - secondaryContainer = md_theme_dark_secondaryContainer, - onSecondaryContainer = md_theme_dark_onSecondaryContainer, - tertiary = md_theme_dark_tertiary, - onTertiary = md_theme_dark_onTertiary, - tertiaryContainer = md_theme_dark_tertiaryContainer, - onTertiaryContainer = md_theme_dark_onTertiaryContainer, - error = md_theme_dark_error, - errorContainer = md_theme_dark_errorContainer, - onError = md_theme_dark_onError, - onErrorContainer = md_theme_dark_onErrorContainer, - background = md_theme_dark_background, - onBackground = md_theme_dark_onBackground, - surface = md_theme_dark_surface, - onSurface = md_theme_dark_onSurface, - surfaceVariant = md_theme_dark_surfaceVariant, - onSurfaceVariant = md_theme_dark_onSurfaceVariant, - outline = md_theme_dark_outline, - inverseOnSurface = md_theme_dark_inverseOnSurface, - inverseSurface = md_theme_dark_inverseSurface, - inversePrimary = md_theme_dark_inversePrimary, - surfaceTint = md_theme_dark_surfaceTint, - outlineVariant = md_theme_dark_outlineVariant, - scrim = md_theme_dark_scrim, +private val highContrastDarkColorScheme = darkColorScheme( + primary = primaryDarkHighContrast, + onPrimary = onPrimaryDarkHighContrast, + primaryContainer = primaryContainerDarkHighContrast, + onPrimaryContainer = onPrimaryContainerDarkHighContrast, + secondary = secondaryDarkHighContrast, + onSecondary = onSecondaryDarkHighContrast, + secondaryContainer = secondaryContainerDarkHighContrast, + onSecondaryContainer = onSecondaryContainerDarkHighContrast, + tertiary = tertiaryDarkHighContrast, + onTertiary = onTertiaryDarkHighContrast, + tertiaryContainer = tertiaryContainerDarkHighContrast, + onTertiaryContainer = onTertiaryContainerDarkHighContrast, + error = errorDarkHighContrast, + onError = onErrorDarkHighContrast, + errorContainer = errorContainerDarkHighContrast, + onErrorContainer = onErrorContainerDarkHighContrast, + background = backgroundDarkHighContrast, + onBackground = onBackgroundDarkHighContrast, + surface = surfaceDarkHighContrast, + onSurface = onSurfaceDarkHighContrast, + surfaceVariant = surfaceVariantDarkHighContrast, + onSurfaceVariant = onSurfaceVariantDarkHighContrast, + outline = outlineDarkHighContrast, + outlineVariant = outlineVariantDarkHighContrast, + scrim = scrimDarkHighContrast, + inverseSurface = inverseSurfaceDarkHighContrast, + inverseOnSurface = inverseOnSurfaceDarkHighContrast, + inversePrimary = inversePrimaryDarkHighContrast, + surfaceDim = surfaceDimDarkHighContrast, + surfaceBright = surfaceBrightDarkHighContrast, + surfaceContainerLowest = surfaceContainerLowestDarkHighContrast, + surfaceContainerLow = surfaceContainerLowDarkHighContrast, + surfaceContainer = surfaceContainerDarkHighContrast, + surfaceContainerHigh = surfaceContainerHighDarkHighContrast, + surfaceContainerHighest = surfaceContainerHighestDarkHighContrast, +) + +@Immutable +data class ColorFamily( + val color: Color, val onColor: Color, val colorContainer: Color, val onColorContainer: Color +) + +val unspecified_scheme = ColorFamily( + Color.Unspecified, Color.Unspecified, Color.Unspecified, Color.Unspecified ) @Composable fun AppTheme( - useDarkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit + darkTheme: Boolean = isSystemInDarkTheme(), + // Dynamic color is available on Android 12+ + dynamicColor: Boolean = true, content: @Composable() () -> Unit ) { - val colors = if (!useDarkTheme) { - LightColors - } else { - DarkColors + val colorScheme = when { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) + } + + darkTheme -> darkScheme + else -> lightScheme } MaterialTheme( - colorScheme = colors, content = content + colorScheme = colorScheme, typography = AppTypography, content = content ) } \ No newline at end of file diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Type.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Type.kt new file mode 100644 index 0000000..1e7fca7 --- /dev/null +++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Type.kt @@ -0,0 +1,5 @@ +package com.mateusrodcosta.apps.share2storage.ui.theme + +import androidx.compose.material3.Typography + +val AppTypography = Typography() diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 64aa0a3..0fa5076 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -8,13 +8,16 @@ Selecione \"%s\" nas opções de compartilhamento Uma tela com detalhes do arquivo será mostrada, toque em "Salvar" O seletor de arquivos será exibido, selecione onde e com qual nome salvar - Sobre - Gostou do app? Considere doar! Para mais detalhes, acesse %s - Desenvolvido por Mateus Rodrigues Costa - Design do ícone do app por @swyzera - Código-fonte disponível no Github em %s, licenciado sob AGPLv3+ - Configurações + Doação + Gostou do app? Considere doar! Para mais detalhes, acesse %s + + Sobre + Desenvolvido por Mateus Rodrigues Costa + Design do ícone do app por @swyzera + Código-fonte disponível no Github em %s, licenciado sob AGPLv3+ + + Configurações Seletor de Arquivos Local de salvamento padrão diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1ab768f..8d56bb5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -8,13 +8,16 @@ Select \"%s\" on the share options A screen with details about the file will open, press Save The file picker will open, select where to save and the filename - About - Like the app? Consider donating! For more information, visit %s - Developed by Mateus Rodrigues Costa - App icon designed by @swyzera - Source code available on Github at %s, licensed under AGPLv3+ - Settings + Donate + Like the app? Consider donating! For more information, visit %s + + About + Developed by Mateus Rodrigues Costa + App icon designed by @swyzera + Source code available on Github at %s, licensed under AGPLv3+ + + Settings File Picker Default save location diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/themes.xml similarity index 72% rename from app/src/main/res/values/styles.xml rename to app/src/main/res/values/themes.xml index 390fb2a..d7aee51 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/themes.xml @@ -1,10 +1,8 @@ +