Skip to content

Commit

Permalink
Update libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
hegocre committed Sep 6, 2024
1 parent ae768d3 commit 8080ae5
Show file tree
Hide file tree
Showing 15 changed files with 135 additions and 340 deletions.
24 changes: 12 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
applicationId "com.hegocre.nextcloudpasswords"
minSdk 24
targetSdk 34
versionCode 30
versionName "1.0.9"
versionCode 32
versionName "1.0.10"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down Expand Up @@ -66,7 +66,7 @@ android {
buildConfig true
}
composeOptions {
kotlinCompilerExtensionVersion '1.5.11'
kotlinCompilerExtensionVersion '1.5.15'
}
packagingOptions {
resources {
Expand All @@ -79,9 +79,9 @@ android {
}

dependencies {
implementation 'androidx.core:core-ktx:1.13.0'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.security:security-crypto:1.0.0'
implementation "androidx.datastore:datastore-preferences:1.1.0"
implementation "androidx.datastore:datastore-preferences:1.1.1"

implementation 'com.squareup.okhttp3:okhttp:4.12.0'

Expand All @@ -92,15 +92,15 @@ dependencies {
implementation 'io.coil-kt:coil-compose:2.6.0'

//Compose dependencies
implementation platform('androidx.compose:compose-bom:2024.04.01')
implementation platform('androidx.compose:compose-bom:2024.09.00')
implementation 'androidx.compose.ui:ui'
implementation 'androidx.compose.material3:material3'
implementation 'androidx.compose.ui:ui-tooling-preview'
implementation 'androidx.compose.material:material-icons-extended'
implementation 'androidx.compose.runtime:runtime-livedata'
implementation 'androidx.compose.foundation:foundation'
implementation 'androidx.navigation:navigation-compose:2.7.7'
implementation 'androidx.activity:activity-compose:1.9.0'
implementation 'androidx.navigation:navigation-compose:2.8.0'
implementation 'androidx.activity:activity-compose:1.9.2'
implementation 'androidx.biometric:biometric:1.1.0'
implementation "androidx.autofill:autofill:1.1.0"

Expand All @@ -110,14 +110,14 @@ dependencies {

implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3'

implementation 'com.materialkolor:material-kolor:1.4.4'
implementation 'com.materialkolor:material-kolor:1.7.0'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.arch.core:core-testing:2.2.0'

androidTestImplementation platform('androidx.compose:compose-bom:2024.04.01')
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation platform('androidx.compose:compose-bom:2024.09.00')
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
debugImplementation 'androidx.compose.ui:ui-tooling'
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
android:supportsRtl="true"
android:fullBackupContent="@xml/full_backup_content"
android:theme="@style/Theme.NextcloudPasswords"
android:enableOnBackInvokedCallback="true"
tools:ignore="UnusedAttribute">

<activity
Expand Down
15 changes: 13 additions & 2 deletions app/src/main/java/com/hegocre/nextcloudpasswords/api/ServiceApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import java.net.SocketTimeoutException
import java.net.URLEncoder
import java.util.Locale
import javax.net.ssl.SSLHandshakeException

/**
Expand Down Expand Up @@ -84,10 +85,20 @@ class ServiceApi private constructor(private val server: Server) {
}

fun getFaviconUrl(url: String): String =
server.url + String.format(FAVICON_URL, URLEncoder.encode(url, "utf-8"), 256)
server.url + String.format(
Locale.getDefault(),
FAVICON_URL,
URLEncoder.encode(url, "utf-8"),
256
)

fun getAvatarUrl(): String =
server.url + String.format(AVATAR_URL, URLEncoder.encode(server.username, "utf-8"), 256)
server.url + String.format(
Locale.getDefault(),
AVATAR_URL,
URLEncoder.encode(server.username, "utf-8"),
256
)

companion object {
private const val FAVICON_URL = "/index.php/apps/passwords/api/1.0/service/favicon/%s/%d"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
package com.hegocre.nextcloudpasswords.ui.components

import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.OutlinedTextFieldDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.InterceptPlatformTextInput
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.hegocre.nextcloudpasswords.ui.theme.NextcloudPasswordsTheme
import kotlinx.coroutines.awaitCancellation

@Composable
fun OutlinedTextFieldWithCaption(
Expand Down Expand Up @@ -77,6 +85,44 @@ fun OutlinedTextFieldWithCaption(
}
}

@OptIn(ExperimentalComposeUiApi::class)
@Composable
fun OutlinedClickableTextField(
value: String,
label: String,
onClick: () -> Unit,
modifier: Modifier = Modifier
) {
val interactionSource = remember { MutableInteractionSource() }

Box {
InterceptPlatformTextInput(interceptor = { _, _ ->
awaitCancellation()
}) {
OutlinedTextField(
value = value,
onValueChange = { },
label = { Text(text = label) },
singleLine = true,
maxLines = 1,
modifier = modifier,
readOnly = true,
colors = OutlinedTextFieldDefaults.colors(cursorColor = Color.Transparent)
)
}
Box(
modifier = Modifier
.matchParentSize()
.clickable(
onClick = onClick,
interactionSource = interactionSource,
indication = null
),

)
}
}

@Preview
@Composable
fun OutlinedTextFieldPreview() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import androidx.compose.material3.ListItem
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MenuAnchorType
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.RadioButton
import androidx.compose.material3.Surface
Expand Down Expand Up @@ -272,8 +273,7 @@ fun AddCustomFieldDialog(
onExpandedChange = { typeMenuExpanded = !typeMenuExpanded }
) {
OutlinedTextField(
modifier = Modifier
.menuAnchor(),
modifier = Modifier.menuAnchor(MenuAnchorType.PrimaryNotEditable),
value = types[type] ?: "",
onValueChange = {},
readOnly = true,
Expand Down Expand Up @@ -697,8 +697,7 @@ fun PasswordGenerationDialog(
.padding(bottom = 8.dp)
) {
OutlinedTextField(
modifier = Modifier
.menuAnchor(),
modifier = Modifier.menuAnchor(MenuAnchorType.PrimaryNotEditable),
value = strengthValues[strength] ?: "",
onValueChange = {},
readOnly = true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.hegocre.nextcloudpasswords.ui.components

import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.PressInteraction
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.add
Expand All @@ -13,8 +11,6 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.windowInsetsBottomHeight
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.text.selection.LocalTextSelectionColors
import androidx.compose.foundation.text.selection.TextSelectionColors
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Star
import androidx.compose.material3.Button
Expand All @@ -23,22 +19,16 @@ import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.OutlinedTextFieldDefaults
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.Saver
import androidx.compose.runtime.saveable.listSaver
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalTextInputService
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -151,41 +141,20 @@ fun EditableFolderView(
}

item(key = "folder_parent") {
CompositionLocalProvider(
LocalTextSelectionColors provides TextSelectionColors(
Color.Transparent,
Color.Transparent
),
LocalTextInputService provides null
) {
OutlinedTextField(
value = if (editableFolderState.parent == FoldersApi.DEFAULT_FOLDER_UUID) {
stringResource(id = R.string.top_level_folder_name)
} else {
folders.firstOrNull { it.id == editableFolderState.parent }?.label
?: stringResource(id = R.string.top_level_folder_name)
},
onValueChange = { },
label = { Text(text = stringResource(id = R.string.folder_attr_parent_folder)) },
singleLine = true,
maxLines = 1,
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 16.dp)
.padding(horizontal = 16.dp),
interactionSource = remember { MutableInteractionSource() }
.also { mutableInteractionSource ->
LaunchedEffect(key1 = mutableInteractionSource) {
mutableInteractionSource.interactions.collect {
if (it is PressInteraction.Release) {
showFolderDialog = true
}
}
}
},
colors = OutlinedTextFieldDefaults.colors(cursorColor = Color.Unspecified)
)
}
OutlinedClickableTextField(
value = if (editableFolderState.parent == FoldersApi.DEFAULT_FOLDER_UUID) {
stringResource(id = R.string.top_level_folder_name)
} else {
folders.firstOrNull { it.id == editableFolderState.parent }?.label
?: stringResource(id = R.string.top_level_folder_name)
},
label = stringResource(id = R.string.folder_attr_parent_folder),
onClick = { showFolderDialog = true },
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 16.dp)
.padding(horizontal = 16.dp)
)
}

item(key = "folder_save") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ fun NextcloudPasswordsApp(
modalSheetState.hide()
}
},
windowInsets = WindowInsets.navigationBars
contentWindowInsets = { WindowInsets.navigationBars }
) {
PasswordItem(
password = passwordsViewModel.visiblePassword.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.hegocre.nextcloudpasswords.ui.components
import android.content.res.Configuration
import androidx.biometric.BiometricManager
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.PressInteraction
Expand Down Expand Up @@ -184,7 +183,6 @@ fun NextcloudPasswordsAppLock(
}
}

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun PasscodeIndicator(
inputPassword: String,
Expand All @@ -208,7 +206,7 @@ fun PasscodeIndicator(
items(count = inputPassword.length, key = { it }) {
KeyboardDigitIndicator(
color = MaterialTheme.colorScheme.primary,
modifier = Modifier.animateItemPlacement()
modifier = Modifier.animateItem()
)
}
}
Expand Down
Loading

0 comments on commit 8080ae5

Please sign in to comment.