Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
Rename files in ui/screens
Browse files Browse the repository at this point in the history
  • Loading branch information
M3DZIK committed Oct 15, 2023
1 parent ea4b676 commit a8e3831
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 36 deletions.
16 changes: 8 additions & 8 deletions app/src/main/java/dev/medzik/librepass/android/ui/Navigation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ import dev.medzik.android.components.rememberMutableBoolean
import dev.medzik.librepass.android.MainActivity
import dev.medzik.librepass.android.R
import dev.medzik.librepass.android.data.getRepository
import dev.medzik.librepass.android.ui.screens.PasswordGeneratorScreen
import dev.medzik.librepass.android.ui.screens.WelcomeScreen
import dev.medzik.librepass.android.ui.screens.auth.AddCustomServer
import dev.medzik.librepass.android.ui.screens.auth.AddCustomServerScreen
import dev.medzik.librepass.android.ui.screens.auth.LoginScreen
import dev.medzik.librepass.android.ui.screens.auth.RegisterScreen
import dev.medzik.librepass.android.ui.screens.auth.UnlockScreen
import dev.medzik.librepass.android.ui.screens.dashboard.CipherAddScreen
import dev.medzik.librepass.android.ui.screens.dashboard.CipherEditScreen
import dev.medzik.librepass.android.ui.screens.dashboard.CipherViewScreen
import dev.medzik.librepass.android.ui.screens.dashboard.SearchScreen
import dev.medzik.librepass.android.ui.screens.dashboard.VaultScreen
import dev.medzik.librepass.android.ui.screens.settings.SettingsAccountScreen
import dev.medzik.librepass.android.ui.screens.settings.SettingsAppearanceScreen
import dev.medzik.librepass.android.ui.screens.settings.SettingsScreen
import dev.medzik.librepass.android.ui.screens.settings.SettingsSecurityScreen
import dev.medzik.librepass.android.ui.screens.vault.CipherAddScreen
import dev.medzik.librepass.android.ui.screens.vault.CipherEditScreen
import dev.medzik.librepass.android.ui.screens.vault.CipherViewScreen
import dev.medzik.librepass.android.ui.screens.vault.PasswordGeneratorScreen
import dev.medzik.librepass.android.ui.screens.vault.SearchScreen
import dev.medzik.librepass.android.ui.screens.vault.VaultScreen
import dev.medzik.librepass.android.utils.SecretStore
import dev.medzik.librepass.android.utils.SecretStore.getUserSecrets
import dev.medzik.librepass.android.utils.TopBar
Expand Down Expand Up @@ -99,7 +99,7 @@ enum class Screen(
navigationIcon = { TopBarBackIcon(it) }
)
},
composable = { AddCustomServer(it) }
composable = { AddCustomServerScreen(it) }
),

// Vault
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import dev.medzik.librepass.android.utils.StoreKey
import dev.medzik.librepass.android.utils.TextInputField

@Composable
fun AddCustomServer(navController: NavController) {
fun AddCustomServerScreen(navController: NavController) {
val context = LocalContext.current

var loading by rememberMutableBoolean()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.medzik.librepass.android.ui.screens.dashboard
package dev.medzik.librepass.android.ui.screens.vault

import androidx.compose.runtime.Composable
import androidx.navigation.NavController
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.medzik.librepass.android.ui.screens.dashboard
package dev.medzik.librepass.android.ui.screens.vault

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.medzik.librepass.android.ui.screens.dashboard
package dev.medzik.librepass.android.ui.screens.vault

import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.medzik.librepass.android.ui.screens.dashboard
package dev.medzik.librepass.android.ui.screens.vault

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand All @@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.OpenInNew
import androidx.compose.material.icons.filled.ContentCopy
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material.icons.filled.History
Expand All @@ -27,6 +28,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.unit.dp
Expand All @@ -36,6 +38,7 @@ import dev.medzik.android.components.SecondaryText
import dev.medzik.android.components.getString
import dev.medzik.android.components.navigate
import dev.medzik.android.components.rememberDialogState
import dev.medzik.android.utils.showToast
import dev.medzik.librepass.android.R
import dev.medzik.librepass.android.data.getRepository
import dev.medzik.librepass.android.ui.Argument
Expand Down Expand Up @@ -192,6 +195,8 @@ fun CipherViewScreen(navController: NavController) {
CipherField(
title = stringResource(R.string.CipherField_URL) + " ${index + 1}",
value = it,
openUri = true,
uri = it,
copy = true
)
}
Expand Down Expand Up @@ -221,11 +226,15 @@ fun CipherField(
title: String,
value: String?,
hidden: Boolean = false,
openUri: Boolean = false,
uri: String? = null,
copy: Boolean = false,
customIcon: (@Composable () -> Unit)? = null
) {
if (value.isNullOrEmpty()) return

val context = LocalContext.current
val uriHandler = LocalUriHandler.current
val clipboardManager = LocalClipboardManager.current

var hiddenState by remember { mutableStateOf(hidden) }
Expand Down Expand Up @@ -268,6 +277,25 @@ fun CipherField(
}
}

if (openUri) {
IconButton(onClick = {
try {
var address = uri!!
if (!address.contains("http(s)?://".toRegex()))
address = "https://$uri"

uriHandler.openUri(address)
} catch (e: Exception) {
context.showToast("No application found for URI: $uri")
}
}) {
Icon(
imageVector = Icons.AutoMirrored.Filled.OpenInNew,
contentDescription = null
)
}
}

if (copy) {
IconButton(onClick = { clipboardManager.setText(AnnotatedString(value)) }) {
Icon(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.medzik.librepass.android.ui.screens
package dev.medzik.librepass.android.ui.screens.vault

import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.medzik.librepass.android.ui.screens.dashboard
package dev.medzik.librepass.android.ui.screens.vault

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.medzik.librepass.android.ui.screens.dashboard
package dev.medzik.librepass.android.ui.screens.vault

import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,21 @@ fun TextInputField(
maxLines = 1,
singleLine = true,
visualTransformation = (
if (hidden && hiddenState.value)
PasswordVisualTransformation()
else
VisualTransformation.None
),
if (hidden && hiddenState.value)
PasswordVisualTransformation()
else
VisualTransformation.None
),
trailingIcon = {
if (hidden) {
IconButton(onClick = { hiddenState.value = !hiddenState.value }) {
Icon(
imageVector = (
if (hiddenState.value)
Icons.Filled.Visibility
else
Icons.Filled.VisibilityOff
),
if (hiddenState.value)
Icons.Filled.Visibility
else
Icons.Filled.VisibilityOff
),
contentDescription = null
)
}
Expand Down Expand Up @@ -103,22 +103,22 @@ fun TextInputFieldBase(
label = { Text(label) },
singleLine = singleLine,
visualTransformation = (
if (hidden && hiddenState.value)
PasswordVisualTransformation()
else
VisualTransformation.None
),
if (hidden && hiddenState.value)
PasswordVisualTransformation()
else
VisualTransformation.None
),
trailingIcon = {
Row {
if (hidden) {
IconButton(onClick = { hiddenState.value = !hiddenState.value }) {
Icon(
imageVector = (
if (hiddenState.value)
Icons.Filled.Visibility
else
Icons.Filled.VisibilityOff
),
if (hiddenState.value)
Icons.Filled.Visibility
else
Icons.Filled.VisibilityOff
),
contentDescription = null
)
}
Expand Down

0 comments on commit a8e3831

Please sign in to comment.