summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2024-05-28 00:35:22 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2024-05-28 00:35:22 +0530
commit3266a1b0333e43ff567e9d2c7fed85cd428e69d3 (patch)
tree73fec12dbbcbe33e5f8f040fa5bff1ef5e0de1d7 /app/src/main
parent0f9540a645ef66f3cf67294f75ba2c5d9d80078e (diff)
refactor(compose): make theme decisions within `APSTheme`
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/app/passwordstore/ui/crypto/EditPasswordScreen.kt5
-rw-r--r--app/src/main/java/app/passwordstore/ui/crypto/ViewPasswordScreen.kt4
-rw-r--r--app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt6
-rw-r--r--app/src/main/java/app/passwordstore/ui/pgp/PGPKeyListActivity.kt5
4 files changed, 8 insertions, 12 deletions
diff --git a/app/src/main/java/app/passwordstore/ui/crypto/EditPasswordScreen.kt b/app/src/main/java/app/passwordstore/ui/crypto/EditPasswordScreen.kt
index 9c3707f7..4a7b1aa2 100644
--- a/app/src/main/java/app/passwordstore/ui/crypto/EditPasswordScreen.kt
+++ b/app/src/main/java/app/passwordstore/ui/crypto/EditPasswordScreen.kt
@@ -10,7 +10,6 @@ import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
@@ -20,7 +19,7 @@ import app.passwordstore.R
import app.passwordstore.data.passfile.PasswordEntry
import app.passwordstore.ui.APSAppBar
import app.passwordstore.ui.compose.PasswordField
-import app.passwordstore.ui.compose.theme.APSThemePreview
+import app.passwordstore.ui.compose.theme.APSTheme
import app.passwordstore.util.time.UserClock
import app.passwordstore.util.totp.UriTotpFinder
@@ -75,7 +74,7 @@ private fun ExtraContent(
@Preview
@Composable
private fun EditPasswordScreenPreview() {
- APSThemePreview {
+ APSTheme {
EditPasswordScreen(
entryName = "Test Entry",
entry = createTestEntry(),
diff --git a/app/src/main/java/app/passwordstore/ui/crypto/ViewPasswordScreen.kt b/app/src/main/java/app/passwordstore/ui/crypto/ViewPasswordScreen.kt
index 2ebdc3a9..70933ab4 100644
--- a/app/src/main/java/app/passwordstore/ui/crypto/ViewPasswordScreen.kt
+++ b/app/src/main/java/app/passwordstore/ui/crypto/ViewPasswordScreen.kt
@@ -24,7 +24,7 @@ import app.passwordstore.data.passfile.PasswordEntry
import app.passwordstore.ui.APSAppBar
import app.passwordstore.ui.compose.CopyButton
import app.passwordstore.ui.compose.PasswordField
-import app.passwordstore.ui.compose.theme.APSThemePreview
+import app.passwordstore.ui.compose.theme.APSTheme
import app.passwordstore.util.time.UserClock
import app.passwordstore.util.totp.UriTotpFinder
import kotlinx.coroutines.flow.first
@@ -106,7 +106,7 @@ private fun ExtraContent(
@Preview
@Composable
private fun ViewPasswordScreenPreview() {
- APSThemePreview {
+ APSTheme {
ViewPasswordScreen(
entryName = "Test Entry",
entry = createTestEntry(),
diff --git a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt
index 0ee5748c..5b12fd88 100644
--- a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt
+++ b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyList.kt
@@ -33,7 +33,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import app.passwordstore.R
import app.passwordstore.crypto.PGPIdentifier
-import app.passwordstore.ui.compose.theme.APSThemePreview
+import app.passwordstore.ui.compose.theme.APSTheme
import app.passwordstore.util.extensions.conditional
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
@@ -139,7 +139,7 @@ private inline fun DeleteConfirmationDialog(
@Preview
@Composable
private fun KeyListPreview() {
- APSThemePreview {
+ APSTheme {
Box(modifier = Modifier.background(MaterialTheme.colorScheme.background)) {
KeyList(
identifiers =
@@ -157,7 +157,7 @@ private fun KeyListPreview() {
@Preview
@Composable
private fun EmptyKeyListPreview() {
- APSThemePreview {
+ APSTheme {
Box(modifier = Modifier.background(MaterialTheme.colorScheme.background)) {
KeyList(identifiers = persistentListOf(), onItemClick = {})
}
diff --git a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyListActivity.kt b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyListActivity.kt
index 5c932545..9ae9f879 100644
--- a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyListActivity.kt
+++ b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyListActivity.kt
@@ -13,13 +13,11 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.ui.Modifier
-import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import app.passwordstore.R
import app.passwordstore.ui.APSAppBar
import app.passwordstore.ui.compose.theme.APSTheme
-import app.passwordstore.ui.compose.theme.decideColorScheme
import app.passwordstore.util.viewmodel.PGPKeyListViewModel
import dagger.hilt.android.AndroidEntryPoint
@@ -38,8 +36,7 @@ class PGPKeyListActivity : ComponentActivity() {
super.onCreate(savedInstanceState)
val isSelecting = intent.extras?.getBoolean(EXTRA_KEY_SELECTION) ?: false
setContent {
- val context = LocalContext.current
- APSTheme(colors = decideColorScheme(context)) {
+ APSTheme {
Scaffold(
topBar = {
APSAppBar(