feat(mobile): refonte UI phases 0-4 + nav sans transitions
CI / lint-backend (push) Successful in 1m37s
CI / lint-mobile (push) Successful in 11m18s
CI / test-backend (push) Successful in 1m34s
CI / test-mobile (push) Successful in 13m11s
CI / build-backend (push) Successful in 1m6s
CI / docker (push) Successful in 9s
CI / lint-backend (push) Successful in 1m37s
CI / lint-mobile (push) Successful in 11m18s
CI / test-backend (push) Successful in 1m34s
CI / test-mobile (push) Successful in 13m11s
CI / build-backend (push) Successful in 1m6s
CI / docker (push) Successful in 9s
- Phase 0: design system (Color/Theme/Type complets light/dark, Shapes/Dimens, KazierCard, formatFileSize centralise) - Phase 1: composants partages sur colorScheme (badges, dialogs, nav flottante factorisee, contentDescriptions) - Phase 2: ecrans principaux (cartes unifiees, boutons M3, LoginForm partage, recherche avec compteur/clear) - Phase 3: flows secondaires (dashboard sync, review animee, scan 360dp + sortie cul-de-sac camera, PdfBuilder checkbox/ recherche/fin auto-nav, share ExposedDropdownMenu + confirmation, watched rescan + erreur import) - Phase 4: a11y (selection semantics), dialogs saveable, cibles 48dp - NavHost: transitions d'ecran desactivees (Enter/Exit None)
This commit is contained in:
@@ -0,0 +1,133 @@
|
|||||||
|
package com.kazier.mobile.ui.auth
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.text.KeyboardActions
|
||||||
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Visibility
|
||||||
|
import androidx.compose.material.icons.filled.VisibilityOff
|
||||||
|
import androidx.compose.material3.Button
|
||||||
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.IconButton
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.OutlinedTextField
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.input.ImeAction
|
||||||
|
import androidx.compose.ui.text.input.KeyboardType
|
||||||
|
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||||
|
import androidx.compose.ui.text.input.VisualTransformation
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.kazier.mobile.R
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formulaire d'authentification partagé (Login + Réglages) : validation
|
||||||
|
* inline (champs non vides), touche Done = submit, œil voir/masquer le mot
|
||||||
|
* de passe, erreur centrée sous le bouton.
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
fun LoginForm(
|
||||||
|
username: String,
|
||||||
|
onUsernameChange: (String) -> Unit,
|
||||||
|
password: String,
|
||||||
|
onPasswordChange: (String) -> Unit,
|
||||||
|
submitting: Boolean,
|
||||||
|
errorRes: Int?,
|
||||||
|
submitLabel: String,
|
||||||
|
onSubmit: () -> Unit,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
) {
|
||||||
|
var passwordVisible by rememberSaveable { mutableStateOf(false) }
|
||||||
|
// Pas d'appel réseau pour des champs vides — validation pure UI.
|
||||||
|
val canSubmit = !submitting && username.isNotBlank() && password.isNotBlank()
|
||||||
|
val submitIfValid = { if (canSubmit) onSubmit() }
|
||||||
|
|
||||||
|
Column(
|
||||||
|
modifier = modifier,
|
||||||
|
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
|
) {
|
||||||
|
OutlinedTextField(
|
||||||
|
value = username,
|
||||||
|
onValueChange = onUsernameChange,
|
||||||
|
label = { Text(stringResource(R.string.login_username)) },
|
||||||
|
singleLine = true,
|
||||||
|
keyboardOptions = KeyboardOptions(
|
||||||
|
keyboardType = KeyboardType.Text,
|
||||||
|
imeAction = ImeAction.Next,
|
||||||
|
),
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
)
|
||||||
|
OutlinedTextField(
|
||||||
|
value = password,
|
||||||
|
onValueChange = onPasswordChange,
|
||||||
|
label = { Text(stringResource(R.string.login_password)) },
|
||||||
|
singleLine = true,
|
||||||
|
visualTransformation = if (passwordVisible) {
|
||||||
|
VisualTransformation.None
|
||||||
|
} else {
|
||||||
|
PasswordVisualTransformation()
|
||||||
|
},
|
||||||
|
trailingIcon = {
|
||||||
|
IconButton(onClick = { passwordVisible = !passwordVisible }) {
|
||||||
|
Icon(
|
||||||
|
imageVector = if (passwordVisible) {
|
||||||
|
Icons.Filled.VisibilityOff
|
||||||
|
} else {
|
||||||
|
Icons.Filled.Visibility
|
||||||
|
},
|
||||||
|
contentDescription = stringResource(
|
||||||
|
if (passwordVisible) {
|
||||||
|
R.string.login_hide_password
|
||||||
|
} else {
|
||||||
|
R.string.login_show_password
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
keyboardOptions = KeyboardOptions(
|
||||||
|
keyboardType = KeyboardType.Password,
|
||||||
|
imeAction = ImeAction.Done,
|
||||||
|
),
|
||||||
|
keyboardActions = KeyboardActions(onDone = { submitIfValid() }),
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
)
|
||||||
|
Spacer(Modifier.height(4.dp))
|
||||||
|
Button(
|
||||||
|
onClick = submitIfValid,
|
||||||
|
enabled = canSubmit,
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
) {
|
||||||
|
if (submitting) {
|
||||||
|
CircularProgressIndicator(
|
||||||
|
modifier = Modifier.size(20.dp),
|
||||||
|
strokeWidth = 2.dp,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Text(submitLabel)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (errorRes != null) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(errorRes),
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
color = MaterialTheme.colorScheme.error,
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,28 +8,19 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.imePadding
|
import androidx.compose.foundation.layout.imePadding
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material3.Button
|
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.OutlinedTextField
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.input.ImeAction
|
|
||||||
import androidx.compose.ui.text.input.KeyboardType
|
|
||||||
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
@@ -67,53 +58,17 @@ fun LoginScreen(
|
|||||||
)
|
)
|
||||||
Spacer(Modifier.height(32.dp))
|
Spacer(Modifier.height(32.dp))
|
||||||
|
|
||||||
OutlinedTextField(
|
LoginForm(
|
||||||
value = username,
|
username = username,
|
||||||
onValueChange = { username = it },
|
onUsernameChange = { username = it },
|
||||||
label = { Text(stringResource(R.string.login_username)) },
|
password = password,
|
||||||
singleLine = true,
|
onPasswordChange = { password = it },
|
||||||
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next),
|
submitting = loginUi.isSubmitting,
|
||||||
|
errorRes = loginUi.error?.let(::authErrorResFor),
|
||||||
|
submitLabel = stringResource(R.string.login_submit),
|
||||||
|
onSubmit = { viewModel.signIn(username, password) },
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
)
|
)
|
||||||
Spacer(Modifier.height(12.dp))
|
|
||||||
OutlinedTextField(
|
|
||||||
value = password,
|
|
||||||
onValueChange = { password = it },
|
|
||||||
label = { Text(stringResource(R.string.login_password)) },
|
|
||||||
singleLine = true,
|
|
||||||
visualTransformation = PasswordVisualTransformation(),
|
|
||||||
keyboardOptions = KeyboardOptions(
|
|
||||||
keyboardType = KeyboardType.Password,
|
|
||||||
imeAction = ImeAction.Done,
|
|
||||||
),
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
)
|
|
||||||
Spacer(Modifier.height(24.dp))
|
|
||||||
|
|
||||||
Button(
|
|
||||||
onClick = { viewModel.signIn(username, password) },
|
|
||||||
enabled = !loginUi.isSubmitting,
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
) {
|
|
||||||
if (loginUi.isSubmitting) {
|
|
||||||
CircularProgressIndicator(
|
|
||||||
modifier = Modifier.size(20.dp),
|
|
||||||
strokeWidth = 2.dp,
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
Text(stringResource(R.string.login_submit))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
loginUi.error?.let { error ->
|
|
||||||
Spacer(Modifier.height(12.dp))
|
|
||||||
Text(
|
|
||||||
text = stringResource(authErrorResFor(error)),
|
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
|
||||||
color = MaterialTheme.colorScheme.error,
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer(Modifier.height(16.dp))
|
Spacer(Modifier.height(16.dp))
|
||||||
TextButton(onClick = viewModel::continueWithoutAccount) {
|
TextButton(onClick = viewModel::continueWithoutAccount) {
|
||||||
|
|||||||
+13
-9
@@ -17,25 +17,27 @@ import androidx.compose.material3.TextButton
|
|||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import com.kazier.mobile.R
|
import com.kazier.mobile.R
|
||||||
import com.kazier.mobile.data.local.entity.FileEntity
|
import com.kazier.mobile.data.local.entity.FileEntity
|
||||||
import com.kazier.mobile.data.local.entity.FileStatus
|
import com.kazier.mobile.data.local.entity.FileStatus
|
||||||
import com.kazier.mobile.features.saf.FileDeleter
|
import com.kazier.mobile.features.saf.FileDeleter
|
||||||
|
import com.kazier.mobile.ui.theme.NavItemShape
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
/** Résultat de l\'analyse de compatibilité entre les fichiers et le mode choisi. */
|
/** Résultat de l'analyse de compatibilité entre les fichiers et le mode choisi. */
|
||||||
data class DeleteReview(
|
data class DeleteReview(
|
||||||
val mode: FileDeleter.DeleteMode,
|
val mode: FileDeleter.DeleteMode,
|
||||||
val total: Int,
|
val total: Int,
|
||||||
val incompatibleCount: Int,
|
val incompatibleCount: Int,
|
||||||
) {
|
) : Serializable {
|
||||||
val hasWarning: Boolean get() = incompatibleCount > 0
|
val hasWarning: Boolean get() = incompatibleCount > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,15 +63,16 @@ fun DeleteDropdownButton(
|
|||||||
onModeSelected: (FileDeleter.DeleteMode) -> Unit,
|
onModeSelected: (FileDeleter.DeleteMode) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
var expanded by remember { mutableStateOf(false) }
|
var expanded by rememberSaveable { mutableStateOf(false) }
|
||||||
val tint = if (enabled) MaterialTheme.colorScheme.error
|
val tint = if (enabled) MaterialTheme.colorScheme.error
|
||||||
else MaterialTheme.colorScheme.onSurfaceVariant
|
else MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
val deleteLabel = stringResource(R.string.delete)
|
||||||
|
|
||||||
Box(modifier = modifier) {
|
Box(modifier = modifier) {
|
||||||
Surface(
|
Surface(
|
||||||
onClick = { if (enabled) expanded = true },
|
onClick = { if (enabled) expanded = true },
|
||||||
enabled = enabled,
|
enabled = enabled,
|
||||||
shape = androidx.compose.foundation.shape.RoundedCornerShape(20.dp),
|
shape = NavItemShape,
|
||||||
color = if (enabled) MaterialTheme.colorScheme.errorContainer
|
color = if (enabled) MaterialTheme.colorScheme.errorContainer
|
||||||
else MaterialTheme.colorScheme.surfaceVariant,
|
else MaterialTheme.colorScheme.surfaceVariant,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
@@ -84,15 +87,16 @@ fun DeleteDropdownButton(
|
|||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.Delete,
|
imageVector = Icons.Filled.Delete,
|
||||||
contentDescription = null,
|
contentDescription = deleteLabel,
|
||||||
tint = tint,
|
tint = tint,
|
||||||
modifier = Modifier.size(20.dp),
|
modifier = Modifier.size(20.dp),
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.delete),
|
text = deleteLabel,
|
||||||
color = tint,
|
color = tint,
|
||||||
fontSize = 11.sp,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
)
|
)
|
||||||
Icon(
|
Icon(
|
||||||
|
|||||||
+31
-13
@@ -9,12 +9,15 @@ import androidx.compose.material.icons.filled.Movie
|
|||||||
import androidx.compose.material.icons.filled.MusicNote
|
import androidx.compose.material.icons.filled.MusicNote
|
||||||
import androidx.compose.material.icons.filled.PictureAsPdf
|
import androidx.compose.material.icons.filled.PictureAsPdf
|
||||||
import androidx.compose.material.icons.filled.TextSnippet
|
import androidx.compose.material.icons.filled.TextSnippet
|
||||||
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
|
import com.kazier.mobile.R
|
||||||
import com.kazier.mobile.data.local.entity.FileEntity
|
import com.kazier.mobile.data.local.entity.FileEntity
|
||||||
import com.kazier.mobile.domain.FileCategory
|
import com.kazier.mobile.domain.FileCategory
|
||||||
import com.kazier.mobile.domain.computeCategory
|
import com.kazier.mobile.domain.computeCategory
|
||||||
@@ -31,16 +34,31 @@ val FileCategory.icon: ImageVector
|
|||||||
FileCategory.OTHER -> Icons.Filled.InsertDriveFile
|
FileCategory.OTHER -> Icons.Filled.InsertDriveFile
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Teinte dédiée à chaque catégorie de document. */
|
/** Teinte dédiée à chaque catégorie — déclinaison light/dark lisible sur les deux thèmes. */
|
||||||
val FileCategory.color: Color
|
@Composable
|
||||||
get() = when (this) {
|
fun FileCategory.color(): androidx.compose.ui.graphics.Color {
|
||||||
FileCategory.PDF -> Color(0xFFD32F2F)
|
val dark = isSystemInDarkTheme()
|
||||||
FileCategory.OFFICE -> Color(0xFF1565C0)
|
return when (this) {
|
||||||
FileCategory.IMAGE -> Color(0xFF2E7D32)
|
FileCategory.PDF -> if (dark) androidx.compose.ui.graphics.Color(0xFFE57373) else androidx.compose.ui.graphics.Color(0xFFD32F2F)
|
||||||
FileCategory.TEXT -> Color(0xFF546E7A)
|
FileCategory.OFFICE -> if (dark) androidx.compose.ui.graphics.Color(0xFF90CAF9) else androidx.compose.ui.graphics.Color(0xFF1565C0)
|
||||||
FileCategory.VIDEO -> Color(0xFF6A1B9A)
|
FileCategory.IMAGE -> if (dark) androidx.compose.ui.graphics.Color(0xFF81C784) else androidx.compose.ui.graphics.Color(0xFF2E7D32)
|
||||||
FileCategory.AUDIO -> Color(0xFFAD1457)
|
FileCategory.TEXT -> if (dark) androidx.compose.ui.graphics.Color(0xFFB0BEC5) else androidx.compose.ui.graphics.Color(0xFF546E7A)
|
||||||
FileCategory.OTHER -> Color(0xFF757575)
|
FileCategory.VIDEO -> if (dark) androidx.compose.ui.graphics.Color(0xFFCE93D8) else androidx.compose.ui.graphics.Color(0xFF6A1B9A)
|
||||||
|
FileCategory.AUDIO -> if (dark) androidx.compose.ui.graphics.Color(0xFFF48FB1) else androidx.compose.ui.graphics.Color(0xFFAD1457)
|
||||||
|
FileCategory.OTHER -> if (dark) androidx.compose.ui.graphics.Color(0xFFBDBDBD) else androidx.compose.ui.graphics.Color(0xFF757575)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Libellé i18n de la catégorie — utilisé comme contentDescription. */
|
||||||
|
@Composable
|
||||||
|
fun FileCategory.label(): String = when (this) {
|
||||||
|
FileCategory.PDF -> stringResource(R.string.category_pdf)
|
||||||
|
FileCategory.OFFICE -> stringResource(R.string.category_office)
|
||||||
|
FileCategory.IMAGE -> stringResource(R.string.category_image)
|
||||||
|
FileCategory.TEXT -> stringResource(R.string.category_text)
|
||||||
|
FileCategory.VIDEO -> stringResource(R.string.category_video)
|
||||||
|
FileCategory.AUDIO -> stringResource(R.string.category_audio)
|
||||||
|
FileCategory.OTHER -> stringResource(R.string.category_other)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,8 +81,8 @@ fun FileCategoryIcon(
|
|||||||
val category = file.categoryValue()
|
val category = file.categoryValue()
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = category.icon,
|
imageVector = category.icon,
|
||||||
contentDescription = null,
|
contentDescription = category.label(),
|
||||||
tint = category.color,
|
tint = category.color(),
|
||||||
modifier = modifier.size(size),
|
modifier = modifier.size(size),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
+2
-2
@@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.Row
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
@@ -19,6 +18,7 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.kazier.mobile.R
|
import com.kazier.mobile.R
|
||||||
import com.kazier.mobile.data.local.entity.FileEntity
|
import com.kazier.mobile.data.local.entity.FileEntity
|
||||||
|
import com.kazier.mobile.ui.theme.ThumbShape
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Un fichier est « à traiter » s'il est présent physiquement et jamais encore
|
* Un fichier est « à traiter » s'il est présent physiquement et jamais encore
|
||||||
@@ -41,7 +41,7 @@ fun FilePendingReviewBadge(
|
|||||||
) {
|
) {
|
||||||
if (!file.isPendingReview()) return
|
if (!file.isPendingReview()) return
|
||||||
Surface(
|
Surface(
|
||||||
shape = RoundedCornerShape(8.dp),
|
shape = ThumbShape,
|
||||||
color = MaterialTheme.colorScheme.tertiaryContainer,
|
color = MaterialTheme.colorScheme.tertiaryContainer,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
) {
|
) {
|
||||||
|
|||||||
+21
-9
@@ -5,12 +5,14 @@ import androidx.compose.material.icons.Icons
|
|||||||
import androidx.compose.material.icons.filled.Cloud
|
import androidx.compose.material.icons.filled.Cloud
|
||||||
import androidx.compose.material.icons.filled.CloudDone
|
import androidx.compose.material.icons.filled.CloudDone
|
||||||
import androidx.compose.material.icons.filled.CloudOff
|
import androidx.compose.material.icons.filled.CloudOff
|
||||||
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
|
import com.kazier.mobile.R
|
||||||
import com.kazier.mobile.data.local.entity.FileEntity
|
import com.kazier.mobile.data.local.entity.FileEntity
|
||||||
import com.kazier.mobile.data.local.entity.FileStatus
|
import com.kazier.mobile.data.local.entity.FileStatus
|
||||||
|
|
||||||
@@ -35,12 +37,22 @@ private val FileSyncPlacement.icon: ImageVector
|
|||||||
FileSyncPlacement.LOCAL_CLOUD -> Icons.Filled.CloudDone
|
FileSyncPlacement.LOCAL_CLOUD -> Icons.Filled.CloudDone
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Teinte dédiée à chaque placement. */
|
/** Teinte dédiée à chaque placement — déclinaison light/dark. */
|
||||||
private val FileSyncPlacement.color: Color
|
@Composable
|
||||||
get() = when (this) {
|
private fun FileSyncPlacement.color(): androidx.compose.ui.graphics.Color {
|
||||||
FileSyncPlacement.LOCAL -> Color(0xFFF57F17)
|
val dark = isSystemInDarkTheme()
|
||||||
FileSyncPlacement.CLOUD -> Color(0xFF1565C0)
|
return when (this) {
|
||||||
FileSyncPlacement.LOCAL_CLOUD -> Color(0xFF2E7D32)
|
FileSyncPlacement.LOCAL -> if (dark) androidx.compose.ui.graphics.Color(0xFFFFB74D) else androidx.compose.ui.graphics.Color(0xFFB26A00)
|
||||||
|
FileSyncPlacement.CLOUD -> if (dark) androidx.compose.ui.graphics.Color(0xFF90CAF9) else androidx.compose.ui.graphics.Color(0xFF1565C0)
|
||||||
|
FileSyncPlacement.LOCAL_CLOUD -> if (dark) androidx.compose.ui.graphics.Color(0xFF81C784) else androidx.compose.ui.graphics.Color(0xFF2E7D32)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun FileSyncPlacement.label(): String = when (this) {
|
||||||
|
FileSyncPlacement.LOCAL -> stringResource(R.string.sync_placement_local)
|
||||||
|
FileSyncPlacement.CLOUD -> stringResource(R.string.sync_placement_cloud)
|
||||||
|
FileSyncPlacement.LOCAL_CLOUD -> stringResource(R.string.sync_placement_local_cloud)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Statut de sync d'un fichier — présence device / serveur distant. */
|
/** Statut de sync d'un fichier — présence device / serveur distant. */
|
||||||
@@ -53,8 +65,8 @@ fun FileSyncStatusIcon(
|
|||||||
val placement = file.syncPlacement()
|
val placement = file.syncPlacement()
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = placement.icon,
|
imageVector = placement.icon,
|
||||||
contentDescription = null,
|
contentDescription = placement.label(),
|
||||||
tint = placement.color,
|
tint = placement.color(),
|
||||||
modifier = modifier.size(size),
|
modifier = modifier.size(size),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@ package com.kazier.mobile.ui.components
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.produceState
|
import androidx.compose.runtime.produceState
|
||||||
@@ -13,12 +12,12 @@ import androidx.compose.ui.graphics.Shape
|
|||||||
import androidx.compose.ui.layout.ContentScale
|
import androidx.compose.ui.layout.ContentScale
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import coil.compose.AsyncImage
|
import coil.compose.AsyncImage
|
||||||
import coil.request.ImageRequest
|
import coil.request.ImageRequest
|
||||||
import com.kazier.mobile.data.local.entity.FileEntity
|
import com.kazier.mobile.data.local.entity.FileEntity
|
||||||
import com.kazier.mobile.domain.FileCategory
|
import com.kazier.mobile.domain.FileCategory
|
||||||
import com.kazier.mobile.features.thumbnails.ThumbnailStore
|
import com.kazier.mobile.features.thumbnails.ThumbnailStore
|
||||||
|
import com.kazier.mobile.ui.theme.ThumbShape
|
||||||
import dagger.hilt.EntryPoint
|
import dagger.hilt.EntryPoint
|
||||||
import dagger.hilt.InstallIn
|
import dagger.hilt.InstallIn
|
||||||
import dagger.hilt.android.EntryPointAccessors
|
import dagger.hilt.android.EntryPointAccessors
|
||||||
@@ -41,7 +40,7 @@ fun FileThumbnail(
|
|||||||
file: FileEntity,
|
file: FileEntity,
|
||||||
size: Dp,
|
size: Dp,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
shape: Shape = RoundedCornerShape(8.dp),
|
shape: Shape = ThumbShape,
|
||||||
) {
|
) {
|
||||||
val category = file.categoryValue()
|
val category = file.categoryValue()
|
||||||
if (category != FileCategory.IMAGE && category != FileCategory.PDF) {
|
if (category != FileCategory.IMAGE && category != FileCategory.PDF) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import androidx.compose.material3.TextButton
|
|||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
@@ -20,7 +20,7 @@ fun FolderNameDialog(
|
|||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
onConfirm: (String) -> Unit,
|
onConfirm: (String) -> Unit,
|
||||||
) {
|
) {
|
||||||
var name by remember { mutableStateOf("") }
|
var name by rememberSaveable { mutableStateOf("") }
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
onDismissRequest = onDismiss,
|
onDismissRequest = onDismiss,
|
||||||
title = { Text(stringResource(R.string.new_folder_name_title)) },
|
title = { Text(stringResource(R.string.new_folder_name_title)) },
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.kazier.mobile.ui.components
|
||||||
|
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import com.kazier.mobile.R
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formattage de taille centralisé (Phase 0) : remplace les 5 copies
|
||||||
|
* (`FolderList`, `FolderDetail`, `Search`, `Document`, `SwipeCardDeck`,
|
||||||
|
* `PdfBuilder`) dont 2 en français en dur (`o/ko/Mo`).
|
||||||
|
* Utilise les strings i18n `unit_bytes / unit_kilobytes / unit_megabytes`.
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
fun formatFileSize(bytes: Long): String {
|
||||||
|
val safe = bytes.coerceAtLeast(0)
|
||||||
|
if (safe < 1_024) {
|
||||||
|
return "$safe ${stringResource(R.string.unit_bytes)}"
|
||||||
|
}
|
||||||
|
if (safe < 1_024 * 1_024) {
|
||||||
|
val kb = safe / 1_024f
|
||||||
|
return String.format(
|
||||||
|
Locale.getDefault(),
|
||||||
|
"%.1f %s",
|
||||||
|
kb,
|
||||||
|
stringResource(R.string.unit_kilobytes),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val mb = safe / (1_024f * 1_024f)
|
||||||
|
return String.format(
|
||||||
|
Locale.getDefault(),
|
||||||
|
"%.1f %s",
|
||||||
|
mb,
|
||||||
|
stringResource(R.string.unit_megabytes),
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.kazier.mobile.ui.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.BorderStroke
|
||||||
|
import androidx.compose.material3.Card
|
||||||
|
import androidx.compose.material3.CardDefaults
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import com.kazier.mobile.ui.theme.KazierDimens
|
||||||
|
import com.kazier.mobile.ui.theme.ListCardShape
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Carte de liste unifiée (Phase 0) : remplace les 3 recettes dispersées
|
||||||
|
* (`surfaceVariant+elev 1dp`, `surface+elev 1dp`, `#F7F8FA + border #EAEAEA`).
|
||||||
|
* Couleurs 100% thème → lisible en dark mode.
|
||||||
|
*
|
||||||
|
* Le clic (simple ou combiné long) se gère via `modifier` pour préserver
|
||||||
|
* les `combinedClickable` de sélection — pas de `onClick` M3 ici.
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
fun KazierCard(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
content: @Composable () -> Unit,
|
||||||
|
) {
|
||||||
|
Card(
|
||||||
|
modifier = modifier,
|
||||||
|
shape = ListCardShape,
|
||||||
|
colors = CardDefaults.cardColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.surfaceVariant,
|
||||||
|
contentColor = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
border = BorderStroke(
|
||||||
|
KazierDimens.CardBorderWidth,
|
||||||
|
MaterialTheme.colorScheme.outlineVariant,
|
||||||
|
),
|
||||||
|
elevation = CardDefaults.cardElevation(defaultElevation = KazierDimens.CardElevation),
|
||||||
|
content = { content() },
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -13,7 +13,11 @@ import androidx.compose.runtime.mutableStateOf
|
|||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.semantics.selected
|
||||||
|
import androidx.compose.ui.semantics.semantics
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.kazier.mobile.R
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* État du mode multi-sélection (long-press pour entrer, tap pour cocher).
|
* État du mode multi-sélection (long-press pour entrer, tap pour cocher).
|
||||||
@@ -50,12 +54,16 @@ fun rememberSelectionState(): SelectionState = remember { SelectionState() }
|
|||||||
fun SelectionStatusIcon(selected: Boolean, modifier: Modifier = Modifier) {
|
fun SelectionStatusIcon(selected: Boolean, modifier: Modifier = Modifier) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = if (selected) Icons.Filled.CheckCircle else Icons.Filled.RadioButtonUnchecked,
|
imageVector = if (selected) Icons.Filled.CheckCircle else Icons.Filled.RadioButtonUnchecked,
|
||||||
contentDescription = null,
|
contentDescription = stringResource(
|
||||||
|
if (selected) R.string.selection_selected else R.string.selection_unselected,
|
||||||
|
),
|
||||||
tint = if (selected) {
|
tint = if (selected) {
|
||||||
MaterialTheme.colorScheme.primary
|
MaterialTheme.colorScheme.primary
|
||||||
} else {
|
} else {
|
||||||
MaterialTheme.colorScheme.onSurfaceVariant
|
MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
},
|
},
|
||||||
modifier = modifier.size(24.dp),
|
modifier = modifier
|
||||||
|
.size(24.dp)
|
||||||
|
.semantics { this.selected = selected },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
+13
-10
@@ -2,30 +2,30 @@ package com.kazier.mobile.ui.components
|
|||||||
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.semantics.Role
|
import androidx.compose.ui.semantics.Role
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.kazier.mobile.R
|
import com.kazier.mobile.R
|
||||||
import com.kazier.mobile.features.connection.ServerConnectionStatus
|
import com.kazier.mobile.features.connection.ServerConnectionStatus
|
||||||
import com.kazier.mobile.ui.theme.InactiveGray
|
import com.kazier.mobile.ui.theme.PendingDark
|
||||||
|
import com.kazier.mobile.ui.theme.PendingLight
|
||||||
private val OnlineGreen = Color(0xFF2E7D32)
|
import com.kazier.mobile.ui.theme.PillShape
|
||||||
private val CheckingAmber = Color(0xFFF9A825)
|
import com.kazier.mobile.ui.theme.SuccessDark
|
||||||
|
import com.kazier.mobile.ui.theme.SuccessLight
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pilule de statut serveur affichée dans le header : cercle coloré + libellé.
|
* Pilule de statut serveur affichée dans le header : cercle coloré + libellé.
|
||||||
@@ -37,15 +37,18 @@ fun ServerStatusBadge(
|
|||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
val dark = isSystemInDarkTheme()
|
||||||
|
val onlineGreen = if (dark) SuccessDark else SuccessLight
|
||||||
|
val checkingAmber = if (dark) PendingDark else PendingLight
|
||||||
val (dotColor, labelRes) = when (status) {
|
val (dotColor, labelRes) = when (status) {
|
||||||
ServerConnectionStatus.Checking -> CheckingAmber to R.string.status_checking
|
ServerConnectionStatus.Checking -> checkingAmber to R.string.status_checking
|
||||||
ServerConnectionStatus.Online -> OnlineGreen to R.string.status_online
|
ServerConnectionStatus.Online -> onlineGreen to R.string.status_online
|
||||||
ServerConnectionStatus.Offline -> MaterialTheme.colorScheme.error to R.string.status_offline
|
ServerConnectionStatus.Offline -> MaterialTheme.colorScheme.error to R.string.status_offline
|
||||||
ServerConnectionStatus.Local -> InactiveGray to R.string.status_local
|
ServerConnectionStatus.Local -> MaterialTheme.colorScheme.onSurfaceVariant to R.string.status_local
|
||||||
}
|
}
|
||||||
val label = stringResource(labelRes)
|
val label = stringResource(labelRes)
|
||||||
val tapLabel = stringResource(R.string.status_tap_to_recheck)
|
val tapLabel = stringResource(R.string.status_tap_to_recheck)
|
||||||
val shape = RoundedCornerShape(percent = 50)
|
val shape = PillShape
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
|
|||||||
+13
-9
@@ -2,6 +2,7 @@ package com.kazier.mobile.ui.components
|
|||||||
|
|
||||||
import android.text.format.DateUtils
|
import android.text.format.DateUtils
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@@ -20,7 +21,6 @@ import androidx.compose.material3.TextButton
|
|||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -28,10 +28,13 @@ import com.kazier.mobile.R
|
|||||||
import com.kazier.mobile.data.local.entity.PendingOpStatus
|
import com.kazier.mobile.data.local.entity.PendingOpStatus
|
||||||
import com.kazier.mobile.data.local.entity.PendingOperationEntity
|
import com.kazier.mobile.data.local.entity.PendingOperationEntity
|
||||||
import com.kazier.mobile.features.sync.SyncViewModel
|
import com.kazier.mobile.features.sync.SyncViewModel
|
||||||
|
import com.kazier.mobile.ui.theme.ErrorDark
|
||||||
private val StatusPending = Color(0xFF1E88E5)
|
import com.kazier.mobile.ui.theme.ErrorLight
|
||||||
private val StatusSynced = Color(0xFF2E7D32)
|
import com.kazier.mobile.ui.theme.KazierDimens
|
||||||
private val StatusFailed = Color(0xFFC62828)
|
import com.kazier.mobile.ui.theme.SuccessDark
|
||||||
|
import com.kazier.mobile.ui.theme.SuccessLight
|
||||||
|
import com.kazier.mobile.ui.theme.SyncingDark
|
||||||
|
import com.kazier.mobile.ui.theme.SyncingLight
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dialogue « liste des sync » : dernières opérations de l'outbox (tous statuts),
|
* Dialogue « liste des sync » : dernières opérations de l'outbox (tous statuts),
|
||||||
@@ -58,7 +61,7 @@ internal fun SyncOperationsDialog(
|
|||||||
LazyColumn(
|
LazyColumn(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.heightIn(max = 360.dp),
|
.heightIn(max = KazierDimens.DialogListMaxHeight),
|
||||||
verticalArrangement = Arrangement.spacedBy(2.dp),
|
verticalArrangement = Arrangement.spacedBy(2.dp),
|
||||||
) {
|
) {
|
||||||
items(status.operations, key = { it.id }) { op ->
|
items(status.operations, key = { it.id }) { op ->
|
||||||
@@ -99,10 +102,11 @@ private fun SyncListSummary(status: SyncViewModel.SyncStatus) {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SyncOperationRow(op: PendingOperationEntity) {
|
private fun SyncOperationRow(op: PendingOperationEntity) {
|
||||||
|
val dark = isSystemInDarkTheme()
|
||||||
val (dotColor, statusLabel) = when (op.status) {
|
val (dotColor, statusLabel) = when (op.status) {
|
||||||
PendingOpStatus.PENDING -> StatusPending to stringResource(R.string.sync_status_pending)
|
PendingOpStatus.PENDING -> (if (dark) SyncingDark else SyncingLight) to stringResource(R.string.sync_status_pending)
|
||||||
PendingOpStatus.SYNCED -> StatusSynced to stringResource(R.string.sync_status_synced)
|
PendingOpStatus.SYNCED -> (if (dark) SuccessDark else SuccessLight) to stringResource(R.string.sync_status_synced)
|
||||||
else -> StatusFailed to stringResource(R.string.sync_status_failed)
|
else -> (if (dark) ErrorDark else ErrorLight) to stringResource(R.string.sync_status_failed)
|
||||||
}
|
}
|
||||||
val opLabel = operationLabel(op.operation)
|
val opLabel = operationLabel(op.operation)
|
||||||
val time = DateUtils.getRelativeTimeSpanString(op.createdAt).toString()
|
val time = DateUtils.getRelativeTimeSpanString(op.createdAt).toString()
|
||||||
|
|||||||
+14
-10
@@ -15,6 +15,7 @@ import androidx.compose.material3.CircularProgressIndicator
|
|||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
@@ -23,7 +24,6 @@ import androidx.compose.runtime.setValue
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.semantics.Role
|
import androidx.compose.ui.semantics.Role
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
@@ -31,9 +31,11 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.kazier.mobile.R
|
import com.kazier.mobile.R
|
||||||
import com.kazier.mobile.features.sync.SyncViewModel
|
import com.kazier.mobile.features.sync.SyncViewModel
|
||||||
|
import com.kazier.mobile.ui.theme.PendingDark
|
||||||
private val SyncingAccent = Color(0xFF1E88E5)
|
import com.kazier.mobile.ui.theme.PendingLight
|
||||||
private val PendingAmber = Color(0xFFF9A825)
|
import com.kazier.mobile.ui.theme.PillShape
|
||||||
|
import com.kazier.mobile.ui.theme.SyncingDark
|
||||||
|
import com.kazier.mobile.ui.theme.SyncingLight
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pilule de statut de synchro affichée dans le header : spinner quand une marche
|
* Pilule de statut de synchro affichée dans le header : spinner quand une marche
|
||||||
@@ -46,9 +48,12 @@ fun SyncStatusBadge(
|
|||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
val dark = isSystemInDarkTheme()
|
||||||
|
val syncingAccent = if (dark) SyncingDark else SyncingLight
|
||||||
|
val pendingAmber = if (dark) PendingDark else PendingLight
|
||||||
val (accent, label, showSpinner) = when {
|
val (accent, label, showSpinner) = when {
|
||||||
status.syncing -> {
|
status.syncing -> {
|
||||||
Triple(SyncingAccent, stringResource(R.string.sync_syncing), true)
|
Triple(syncingAccent, stringResource(R.string.sync_syncing), true)
|
||||||
}
|
}
|
||||||
status.pending > 0 -> {
|
status.pending > 0 -> {
|
||||||
val label = if (status.pending == 1) {
|
val label = if (status.pending == 1) {
|
||||||
@@ -56,7 +61,7 @@ fun SyncStatusBadge(
|
|||||||
} else {
|
} else {
|
||||||
stringResource(R.string.sync_pending_count, status.pending)
|
stringResource(R.string.sync_pending_count, status.pending)
|
||||||
}
|
}
|
||||||
Triple(PendingAmber, label, false)
|
Triple(pendingAmber, label, false)
|
||||||
}
|
}
|
||||||
else -> Triple(
|
else -> Triple(
|
||||||
MaterialTheme.colorScheme.primary,
|
MaterialTheme.colorScheme.primary,
|
||||||
@@ -64,7 +69,7 @@ fun SyncStatusBadge(
|
|||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val shape = RoundedCornerShape(percent = 50)
|
val shape = PillShape
|
||||||
val tapLabel = stringResource(R.string.sync_tap_to_view)
|
val tapLabel = stringResource(R.string.sync_tap_to_view)
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
@@ -95,15 +100,14 @@ fun SyncStatusBadge(
|
|||||||
Text(
|
Text(
|
||||||
text = status.pending.coerceAtMost(99).toString(),
|
text = status.pending.coerceAtMost(99).toString(),
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
color = Color.White,
|
color = MaterialTheme.colorScheme.surface,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.Check,
|
imageVector = Icons.Filled.Check,
|
||||||
contentDescription = null,
|
contentDescription = null, modifier = Modifier.size(12.dp),
|
||||||
modifier = Modifier.size(12.dp),
|
|
||||||
tint = accent,
|
tint = accent,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+63
@@ -0,0 +1,63 @@
|
|||||||
|
package com.kazier.mobile.ui.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.heightIn
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.material3.Button
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.OutlinedButton
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.kazier.mobile.ui.theme.KazierDimens
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bouton d'action vertical (icône + libellé `labelSmall` ellipsé) : tient
|
||||||
|
* sur 360dp là où des boutons horizontaux icône+texte seraient tronqués
|
||||||
|
* (exports du scan, ajouts du PdfBuilder).
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
fun VerticalActionButton(
|
||||||
|
icon: ImageVector,
|
||||||
|
label: String,
|
||||||
|
onClick: () -> Unit,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
enabled: Boolean = true,
|
||||||
|
outlined: Boolean = true,
|
||||||
|
) {
|
||||||
|
val content: @Composable () -> Unit = {
|
||||||
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
|
Icon(
|
||||||
|
imageVector = icon,
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(20.dp),
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = label,
|
||||||
|
style = MaterialTheme.typography.labelSmall,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (outlined) {
|
||||||
|
OutlinedButton(
|
||||||
|
onClick = onClick,
|
||||||
|
enabled = enabled,
|
||||||
|
modifier = modifier.heightIn(min = KazierDimens.MinTouchTarget),
|
||||||
|
content = { content() },
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Button(
|
||||||
|
onClick = onClick,
|
||||||
|
enabled = enabled,
|
||||||
|
modifier = modifier.heightIn(min = KazierDimens.MinTouchTarget),
|
||||||
|
content = { content() },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-2
@@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.Arrangement
|
|||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Visibility
|
import androidx.compose.material.icons.filled.Visibility
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
@@ -23,6 +22,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.kazier.mobile.R
|
import com.kazier.mobile.R
|
||||||
|
import com.kazier.mobile.ui.theme.PillShape
|
||||||
import com.kazier.mobile.ui.watchedfolders.WatchedFoldersViewModel
|
import com.kazier.mobile.ui.watchedfolders.WatchedFoldersViewModel
|
||||||
|
|
||||||
/** Seuil au-delà duquel le badge affiche « 99+ » au lieu du compte exact. */
|
/** Seuil au-delà duquel le badge affiche « 99+ » au lieu du compte exact. */
|
||||||
@@ -47,7 +47,7 @@ fun WatchedFoldersBadge(
|
|||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.clip(RoundedCornerShape(percent = 50))
|
.clip(PillShape)
|
||||||
.clickable(
|
.clickable(
|
||||||
role = Role.Button,
|
role = Role.Button,
|
||||||
onClickLabel = contentDescription,
|
onClickLabel = contentDescription,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.kazier.mobile.ui.dashboard
|
package com.kazier.mobile.ui.dashboard
|
||||||
|
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@@ -12,9 +13,9 @@ import androidx.compose.material.icons.Icons
|
|||||||
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight
|
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight
|
||||||
import androidx.compose.material.icons.filled.CheckCircle
|
import androidx.compose.material.icons.filled.CheckCircle
|
||||||
import androidx.compose.material.icons.filled.DocumentScanner
|
import androidx.compose.material.icons.filled.DocumentScanner
|
||||||
import androidx.compose.material3.Card
|
import androidx.compose.material.icons.filled.Sync
|
||||||
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.FloatingActionButton
|
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
@@ -26,6 +27,7 @@ import androidx.compose.runtime.getValue
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.semantics.Role
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
@@ -33,6 +35,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|||||||
import com.kazier.mobile.R
|
import com.kazier.mobile.R
|
||||||
import com.kazier.mobile.features.connection.ConnectionStatusViewModel
|
import com.kazier.mobile.features.connection.ConnectionStatusViewModel
|
||||||
import com.kazier.mobile.features.sync.SyncViewModel
|
import com.kazier.mobile.features.sync.SyncViewModel
|
||||||
|
import com.kazier.mobile.ui.components.KazierCard
|
||||||
import com.kazier.mobile.ui.components.ServerStatusBadge
|
import com.kazier.mobile.ui.components.ServerStatusBadge
|
||||||
import com.kazier.mobile.ui.components.SyncStatusAction
|
import com.kazier.mobile.ui.components.SyncStatusAction
|
||||||
import com.kazier.mobile.ui.navigation.FloatingNavBar
|
import com.kazier.mobile.ui.navigation.FloatingNavBar
|
||||||
@@ -51,6 +54,8 @@ fun DashboardScreen(
|
|||||||
) {
|
) {
|
||||||
val connectionStatus by connectionStatusViewModel.status.collectAsStateWithLifecycle()
|
val connectionStatus by connectionStatusViewModel.status.collectAsStateWithLifecycle()
|
||||||
val unprocessed by viewModel.unprocessedCount.collectAsStateWithLifecycle()
|
val unprocessed by viewModel.unprocessedCount.collectAsStateWithLifecycle()
|
||||||
|
val syncStatus by syncViewModel.syncStatus.collectAsStateWithLifecycle()
|
||||||
|
val showSyncCard = syncStatus.syncing || syncStatus.pending > 0 || syncStatus.failed > 0
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
@@ -94,7 +99,14 @@ fun DashboardScreen(
|
|||||||
onClick = onOpenReview,
|
onClick = onOpenReview,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
)
|
)
|
||||||
} else {
|
}
|
||||||
|
if (showSyncCard) {
|
||||||
|
SyncSummaryCard(
|
||||||
|
status = syncStatus,
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (unprocessed == 0 && !showSyncCard) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
@@ -128,7 +140,14 @@ private fun ReviewCard(
|
|||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Card(onClick = onClick, modifier = modifier) {
|
val label = stringResource(R.string.dashboard_review_title, count)
|
||||||
|
KazierCard(
|
||||||
|
modifier = modifier.clickable(
|
||||||
|
role = Role.Button,
|
||||||
|
onClickLabel = label,
|
||||||
|
onClick = onClick,
|
||||||
|
),
|
||||||
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.padding(20.dp),
|
modifier = Modifier.padding(20.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
@@ -136,7 +155,7 @@ private fun ReviewCard(
|
|||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.weight(1f)) {
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.dashboard_review_title, count),
|
text = label,
|
||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
@@ -154,3 +173,62 @@ private fun ReviewCard(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Résumé de la file de synchro (état déjà exposé par [SyncViewModel]) :
|
||||||
|
* marche en cours, opérations en attente, échecs — sans nouveau ViewModel.
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
private fun SyncSummaryCard(
|
||||||
|
status: SyncViewModel.SyncStatus,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
) {
|
||||||
|
KazierCard(modifier = modifier) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.padding(20.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
||||||
|
) {
|
||||||
|
if (status.syncing) {
|
||||||
|
CircularProgressIndicator(modifier = Modifier.size(28.dp))
|
||||||
|
} else {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Filled.Sync,
|
||||||
|
contentDescription = null,
|
||||||
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
|
modifier = Modifier.size(28.dp),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.dashboard_sync_title),
|
||||||
|
style = MaterialTheme.typography.titleMedium,
|
||||||
|
)
|
||||||
|
if (status.syncing) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.sync_syncing),
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
modifier = Modifier.padding(top = 4.dp),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (status.pending > 0) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.sync_pending_count, status.pending),
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
modifier = Modifier.padding(top = 4.dp),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (status.failed > 0) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.sync_summary_failed, status.failed),
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
color = MaterialTheme.colorScheme.error,
|
||||||
|
modifier = Modifier.padding(top = 4.dp),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+67
-71
@@ -18,7 +18,6 @@ import androidx.compose.foundation.pager.HorizontalPager
|
|||||||
import androidx.compose.foundation.pager.rememberPagerState
|
import androidx.compose.foundation.pager.rememberPagerState
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.foundation.text.selection.SelectionContainer
|
import androidx.compose.foundation.text.selection.SelectionContainer
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
@@ -29,12 +28,12 @@ import androidx.compose.material.icons.filled.Close
|
|||||||
import androidx.compose.material.icons.filled.Delete
|
import androidx.compose.material.icons.filled.Delete
|
||||||
import androidx.compose.material.icons.filled.DocumentScanner
|
import androidx.compose.material.icons.filled.DocumentScanner
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.Card
|
import androidx.compose.material3.ButtonDefaults
|
||||||
import androidx.compose.material3.CardDefaults
|
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
import androidx.compose.material3.DropdownMenu
|
import androidx.compose.material3.DropdownMenu
|
||||||
import androidx.compose.material3.DropdownMenuItem
|
import androidx.compose.material3.DropdownMenuItem
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.FilledTonalButton
|
||||||
import androidx.compose.material3.FloatingActionButton
|
import androidx.compose.material3.FloatingActionButton
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
@@ -70,7 +69,6 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.core.view.WindowInsetsControllerCompat
|
import androidx.core.view.WindowInsetsControllerCompat
|
||||||
@@ -86,14 +84,18 @@ import com.kazier.mobile.features.ocr.OcrViewModel
|
|||||||
import com.kazier.mobile.features.saf.FileDeleter
|
import com.kazier.mobile.features.saf.FileDeleter
|
||||||
import com.kazier.mobile.features.sync.SyncViewModel
|
import com.kazier.mobile.features.sync.SyncViewModel
|
||||||
import com.kazier.mobile.ui.components.DeleteConfirmDialog
|
import com.kazier.mobile.ui.components.DeleteConfirmDialog
|
||||||
|
import com.kazier.mobile.ui.components.KazierCard
|
||||||
import com.kazier.mobile.ui.components.ServerStatusBadge
|
import com.kazier.mobile.ui.components.ServerStatusBadge
|
||||||
import com.kazier.mobile.ui.components.SyncStatusAction
|
import com.kazier.mobile.ui.components.SyncStatusAction
|
||||||
import com.kazier.mobile.ui.components.categoryValue
|
import com.kazier.mobile.ui.components.categoryValue
|
||||||
|
import com.kazier.mobile.ui.components.formatFileSize
|
||||||
import com.kazier.mobile.ui.document.content.DocumentContentViewer
|
import com.kazier.mobile.ui.document.content.DocumentContentViewer
|
||||||
import com.kazier.mobile.ui.document.content.ImageViewer
|
import com.kazier.mobile.ui.document.content.ImageViewer
|
||||||
import com.kazier.mobile.ui.document.content.PdfFocusViewer
|
import com.kazier.mobile.ui.document.content.PdfFocusViewer
|
||||||
import com.kazier.mobile.ui.document.content.TextFocusViewer
|
import com.kazier.mobile.ui.document.content.TextFocusViewer
|
||||||
import com.kazier.mobile.ui.document.content.ZoomableContent
|
import com.kazier.mobile.ui.document.content.ZoomableContent
|
||||||
|
import com.kazier.mobile.ui.theme.PillShape
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
@@ -197,7 +199,7 @@ fun DocumentViewerScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation avant suppression d'un document déjà traité.
|
// Confirmation avant suppression d'un document déjà traité.
|
||||||
var pendingDeleteMode by remember { mutableStateOf<FileDeleter.DeleteMode?>(null) }
|
var pendingDeleteMode by rememberSaveable { mutableStateOf<FileDeleter.DeleteMode?>(null) }
|
||||||
var showDeleteConfirm by rememberSaveable { mutableStateOf(false) }
|
var showDeleteConfirm by rememberSaveable { mutableStateOf(false) }
|
||||||
|
|
||||||
var fullscreen by rememberSaveable { mutableStateOf(false) }
|
var fullscreen by rememberSaveable { mutableStateOf(false) }
|
||||||
@@ -276,6 +278,17 @@ fun DocumentViewerScreen(
|
|||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(padding),
|
.padding(padding),
|
||||||
) {
|
) {
|
||||||
|
if (documents.isEmpty()) {
|
||||||
|
// Chargement initial : le pager serait vide sans repère.
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.weight(1f),
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
|
) {
|
||||||
|
CircularProgressIndicator()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
HorizontalPager(
|
HorizontalPager(
|
||||||
state = pagerState,
|
state = pagerState,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -293,6 +306,7 @@ fun DocumentViewerScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Barre d'action fixe pilotée par le document affiché : garder
|
// Barre d'action fixe pilotée par le document affiché : garder
|
||||||
// ou supprimer un document en attente de review, ou supprimer
|
// ou supprimer un document en attente de review, ou supprimer
|
||||||
// (local / cloud / les deux) un document déjà traité.
|
// (local / cloud / les deux) un document déjà traité.
|
||||||
@@ -388,7 +402,8 @@ private fun FocusDocumentReader(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Cadre commun du mode focus : fond noir plein écran, un tap (l'indicatrice de
|
* Cadre commun du mode focus : fond noir plein écran, un tap (l'indicatrice de
|
||||||
* position est optionnelle) quitte le mode.
|
* position est optionnelle) quitte le mode. Un hint discret « toucher pour
|
||||||
|
* quitter » s'affiche 3 s à l'entrée pour lever l'ambiguïté tap / pinch.
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
private fun FocusScaffold(
|
private fun FocusScaffold(
|
||||||
@@ -398,6 +413,11 @@ private fun FocusScaffold(
|
|||||||
position: String? = null,
|
position: String? = null,
|
||||||
content: @Composable () -> Unit,
|
content: @Composable () -> Unit,
|
||||||
) {
|
) {
|
||||||
|
var showHint by remember(file.resourceId) { mutableStateOf(true) }
|
||||||
|
LaunchedEffect(file.resourceId) {
|
||||||
|
delay(3_000)
|
||||||
|
showHint = false
|
||||||
|
}
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
@@ -407,12 +427,28 @@ private fun FocusScaffold(
|
|||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
content()
|
content()
|
||||||
|
if (showHint) {
|
||||||
|
Surface(
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.TopCenter)
|
||||||
|
.padding(top = 16.dp),
|
||||||
|
shape = PillShape,
|
||||||
|
color = MaterialTheme.colorScheme.inverseSurface.copy(alpha = 0.85f),
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.focus_tap_to_exit),
|
||||||
|
modifier = Modifier.padding(horizontal = 12.dp, vertical = 6.dp),
|
||||||
|
style = MaterialTheme.typography.labelMedium,
|
||||||
|
color = MaterialTheme.colorScheme.inverseOnSurface,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
if (position != null) {
|
if (position != null) {
|
||||||
Surface(
|
Surface(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.BottomCenter)
|
.align(Alignment.BottomCenter)
|
||||||
.padding(bottom = 16.dp),
|
.padding(bottom = 16.dp),
|
||||||
shape = RoundedCornerShape(percent = 50),
|
shape = PillShape,
|
||||||
color = MaterialTheme.colorScheme.inverseSurface.copy(alpha = 0.85f),
|
color = MaterialTheme.colorScheme.inverseSurface.copy(alpha = 0.85f),
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
@@ -549,14 +585,11 @@ private fun DocumentViewerPage(
|
|||||||
|
|
||||||
Spacer(Modifier.height(16.dp))
|
Spacer(Modifier.height(16.dp))
|
||||||
|
|
||||||
Card(
|
KazierCard(modifier = Modifier.fillMaxWidth()) {
|
||||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant),
|
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp),
|
|
||||||
) {
|
|
||||||
Column(modifier = Modifier
|
Column(modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(16.dp)) {
|
.padding(16.dp)) {
|
||||||
MetadataRow(stringResource(R.string.document_size), formatSize(file.size))
|
MetadataRow(stringResource(R.string.document_size), formatFileSize(file.size))
|
||||||
MetadataRow(stringResource(R.string.document_type), fileTypeLabel(file))
|
MetadataRow(stringResource(R.string.document_type), fileTypeLabel(file))
|
||||||
MetadataRow(stringResource(R.string.document_added_at), formatDateTime(file.addedAt))
|
MetadataRow(stringResource(R.string.document_added_at), formatDateTime(file.addedAt))
|
||||||
file.lastModified?.let { lastModified ->
|
file.lastModified?.let { lastModified ->
|
||||||
@@ -599,7 +632,7 @@ private fun DocumentActionBar(
|
|||||||
) {
|
) {
|
||||||
if (pendingReview) {
|
if (pendingReview) {
|
||||||
Surface(
|
Surface(
|
||||||
shape = RoundedCornerShape(percent = 50),
|
shape = PillShape,
|
||||||
color = MaterialTheme.colorScheme.secondaryContainer,
|
color = MaterialTheme.colorScheme.secondaryContainer,
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
@@ -610,7 +643,10 @@ private fun DocumentActionBar(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Spacer(Modifier.height(12.dp))
|
Spacer(Modifier.height(12.dp))
|
||||||
Row(horizontalArrangement = Arrangement.spacedBy(48.dp)) {
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(16.dp, Alignment.CenterHorizontally),
|
||||||
|
) {
|
||||||
DocumentActionButton(
|
DocumentActionButton(
|
||||||
icon = Icons.Filled.Close,
|
icon = Icons.Filled.Close,
|
||||||
contentDescription = stringResource(R.string.review_delete),
|
contentDescription = stringResource(R.string.review_delete),
|
||||||
@@ -653,7 +689,7 @@ private fun DocumentActionBar(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Bouton « OCR » — même gabarit que le menu Supprimer (Surface 88×48). */
|
/** Bouton « OCR » M3 — gabarit adaptatif (plus de Surface 88×48 fixe). */
|
||||||
@Composable
|
@Composable
|
||||||
private fun DocumentOcrButton(
|
private fun DocumentOcrButton(
|
||||||
label: Int,
|
label: Int,
|
||||||
@@ -661,39 +697,24 @@ private fun DocumentOcrButton(
|
|||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val tint = if (enabled) MaterialTheme.colorScheme.primary
|
val labelText = stringResource(label)
|
||||||
else MaterialTheme.colorScheme.onSurfaceVariant
|
FilledTonalButton(
|
||||||
|
onClick = onClick,
|
||||||
Surface(
|
|
||||||
onClick = { if (enabled) onClick() },
|
|
||||||
enabled = enabled,
|
enabled = enabled,
|
||||||
shape = RoundedCornerShape(20.dp),
|
|
||||||
color = if (enabled) MaterialTheme.colorScheme.primaryContainer
|
|
||||||
else MaterialTheme.colorScheme.surfaceVariant,
|
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
) {
|
) {
|
||||||
Box(
|
|
||||||
modifier = Modifier.size(width = 88.dp, height = 48.dp),
|
|
||||||
contentAlignment = Alignment.Center,
|
|
||||||
) {
|
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.DocumentScanner,
|
imageVector = Icons.Filled.DocumentScanner,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = tint,
|
|
||||||
modifier = Modifier.size(20.dp),
|
modifier = Modifier.size(20.dp),
|
||||||
)
|
)
|
||||||
|
Spacer(Modifier.size(ButtonDefaults.IconSpacing))
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(label),
|
text = labelText,
|
||||||
color = tint,
|
|
||||||
fontSize = 11.sp,
|
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
fontWeight = FontWeight.Bold,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fenêtre OCR : progression (upload → queued → processing), texte extrait
|
* Fenêtre OCR : progression (upload → queued → processing), texte extrait
|
||||||
@@ -815,45 +836,34 @@ private fun DocumentDeleteMenu(
|
|||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val modes = deleteModesFor(file)
|
val modes = deleteModesFor(file)
|
||||||
var expanded by remember { mutableStateOf(false) }
|
var expanded by rememberSaveable { mutableStateOf(false) }
|
||||||
val tint = if (enabled) MaterialTheme.colorScheme.error
|
val deleteLabel = stringResource(R.string.delete)
|
||||||
else MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
|
|
||||||
Box(modifier = modifier) {
|
Box(modifier = modifier) {
|
||||||
Surface(
|
FilledTonalButton(
|
||||||
onClick = { if (enabled) expanded = true },
|
onClick = { expanded = true },
|
||||||
enabled = enabled,
|
enabled = enabled,
|
||||||
shape = RoundedCornerShape(20.dp),
|
colors = ButtonDefaults.filledTonalButtonColors(
|
||||||
color = if (enabled) MaterialTheme.colorScheme.errorContainer
|
containerColor = MaterialTheme.colorScheme.errorContainer,
|
||||||
else MaterialTheme.colorScheme.surfaceVariant,
|
contentColor = MaterialTheme.colorScheme.onErrorContainer,
|
||||||
|
),
|
||||||
) {
|
) {
|
||||||
Box(
|
|
||||||
modifier = Modifier.size(width = 88.dp, height = 48.dp),
|
|
||||||
contentAlignment = Alignment.Center,
|
|
||||||
) {
|
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.Delete,
|
imageVector = Icons.Filled.Delete,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = tint,
|
|
||||||
modifier = Modifier.size(20.dp),
|
modifier = Modifier.size(20.dp),
|
||||||
)
|
)
|
||||||
|
Spacer(Modifier.size(ButtonDefaults.IconSpacing))
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.delete),
|
text = deleteLabel,
|
||||||
color = tint,
|
|
||||||
fontSize = 11.sp,
|
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
fontWeight = FontWeight.Bold,
|
|
||||||
)
|
)
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.ArrowDropDown,
|
imageVector = Icons.Filled.ArrowDropDown,
|
||||||
contentDescription = null,
|
contentDescription = deleteLabel,
|
||||||
tint = tint,
|
|
||||||
modifier = Modifier.size(16.dp),
|
modifier = Modifier.size(16.dp),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DropdownMenu(
|
DropdownMenu(
|
||||||
expanded = expanded,
|
expanded = expanded,
|
||||||
@@ -964,17 +974,3 @@ private fun formatDateTime(millis: Long): String {
|
|||||||
val time = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT).withLocale(locale).format(dateTime)
|
val time = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT).withLocale(locale).format(dateTime)
|
||||||
return "$day $time"
|
return "$day $time"
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Miroir de `formatSize` (app/index.tsx). */
|
|
||||||
@Composable
|
|
||||||
private fun formatSize(bytes: Long): String {
|
|
||||||
if (bytes < 1_024) {
|
|
||||||
return "$bytes ${stringResource(R.string.unit_bytes)}"
|
|
||||||
}
|
|
||||||
if (bytes < 1_024 * 1_024) {
|
|
||||||
val kb = bytes / 1_024f
|
|
||||||
return String.format(Locale.getDefault(), "%.1f %s", kb, stringResource(R.string.unit_kilobytes))
|
|
||||||
}
|
|
||||||
val mb = bytes / (1_024f * 1_024f)
|
|
||||||
return String.format(Locale.getDefault(), "%.1f %s", mb, stringResource(R.string.unit_megabytes))
|
|
||||||
}
|
|
||||||
+36
-42
@@ -2,6 +2,7 @@ package com.kazier.mobile.ui.folderdetail
|
|||||||
|
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
@@ -20,14 +21,12 @@ import androidx.compose.material.icons.filled.Close
|
|||||||
import androidx.compose.material.icons.filled.CreateNewFolder
|
import androidx.compose.material.icons.filled.CreateNewFolder
|
||||||
import androidx.compose.material.icons.filled.Folder
|
import androidx.compose.material.icons.filled.Folder
|
||||||
import androidx.compose.material.icons.filled.MoreVert
|
import androidx.compose.material.icons.filled.MoreVert
|
||||||
import androidx.compose.material.icons.filled.Refresh
|
|
||||||
import androidx.compose.material3.Card
|
|
||||||
import androidx.compose.material3.CardDefaults
|
|
||||||
import androidx.compose.material3.DropdownMenu
|
import androidx.compose.material3.DropdownMenu
|
||||||
import androidx.compose.material3.DropdownMenuItem
|
import androidx.compose.material3.DropdownMenuItem
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
|
import androidx.compose.material3.LinearProgressIndicator
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.SnackbarHost
|
import androidx.compose.material3.SnackbarHost
|
||||||
@@ -44,6 +43,7 @@ import androidx.compose.runtime.setValue
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.semantics.Role
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -58,11 +58,13 @@ import com.kazier.mobile.ui.components.FilePendingReviewBadge
|
|||||||
import com.kazier.mobile.ui.components.FileSyncStatusIcon
|
import com.kazier.mobile.ui.components.FileSyncStatusIcon
|
||||||
import com.kazier.mobile.ui.components.FileThumbnail
|
import com.kazier.mobile.ui.components.FileThumbnail
|
||||||
import com.kazier.mobile.ui.components.FolderNameDialog
|
import com.kazier.mobile.ui.components.FolderNameDialog
|
||||||
|
import com.kazier.mobile.ui.components.KazierCard
|
||||||
import com.kazier.mobile.ui.components.MoveFolderPickerDialog
|
import com.kazier.mobile.ui.components.MoveFolderPickerDialog
|
||||||
import com.kazier.mobile.ui.components.SelectionState
|
import com.kazier.mobile.ui.components.SelectionState
|
||||||
import com.kazier.mobile.ui.components.SelectionStatusIcon
|
import com.kazier.mobile.ui.components.SelectionStatusIcon
|
||||||
import com.kazier.mobile.ui.components.ServerStatusBadge
|
import com.kazier.mobile.ui.components.ServerStatusBadge
|
||||||
import com.kazier.mobile.ui.components.SyncStatusAction
|
import com.kazier.mobile.ui.components.SyncStatusAction
|
||||||
|
import com.kazier.mobile.ui.components.formatFileSize
|
||||||
import com.kazier.mobile.ui.components.rememberSelectionState
|
import com.kazier.mobile.ui.components.rememberSelectionState
|
||||||
import com.kazier.mobile.features.saf.FileDeleter
|
import com.kazier.mobile.features.saf.FileDeleter
|
||||||
import com.kazier.mobile.ui.components.DeleteConfirmDialog
|
import com.kazier.mobile.ui.components.DeleteConfirmDialog
|
||||||
@@ -74,7 +76,6 @@ import com.kazier.mobile.ui.auth.AuthState
|
|||||||
import com.kazier.mobile.ui.auth.AuthViewModel
|
import com.kazier.mobile.ui.auth.AuthViewModel
|
||||||
import com.kazier.mobile.ui.share.ShareBottomSheet
|
import com.kazier.mobile.ui.share.ShareBottomSheet
|
||||||
import com.kazier.mobile.ui.share.ShareViewModel
|
import com.kazier.mobile.ui.share.ShareViewModel
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -101,10 +102,10 @@ fun FolderDetailScreen(
|
|||||||
var showDeleteConfirm by rememberSaveable { mutableStateOf(false) }
|
var showDeleteConfirm by rememberSaveable { mutableStateOf(false) }
|
||||||
var showShareSheet by rememberSaveable { mutableStateOf(false) }
|
var showShareSheet by rememberSaveable { mutableStateOf(false) }
|
||||||
var showMoreMenu by rememberSaveable { mutableStateOf(false) }
|
var showMoreMenu by rememberSaveable { mutableStateOf(false) }
|
||||||
var pendingDeleteMode by remember { mutableStateOf<FileDeleter.DeleteMode?>(null) }
|
var pendingDeleteMode by rememberSaveable { mutableStateOf<FileDeleter.DeleteMode?>(null) }
|
||||||
var pendingDeleteReview by remember { mutableStateOf<DeleteReview?>(null) }
|
var pendingDeleteReview by rememberSaveable { mutableStateOf<DeleteReview?>(null) }
|
||||||
val snackbarHostState = remember { SnackbarHostState() }
|
val snackbarHostState = remember { SnackbarHostState() }
|
||||||
val deletedLabel = stringResource(R.string.delete)
|
val deletedLabel = stringResource(R.string.delete_success)
|
||||||
|
|
||||||
// M33 : le gate `canShare` dépend du token — recalculé au login/logout.
|
// M33 : le gate `canShare` dépend du token — recalculé au login/logout.
|
||||||
LaunchedEffect(authState) {
|
LaunchedEffect(authState) {
|
||||||
@@ -364,6 +365,24 @@ private fun FolderDetailContent(
|
|||||||
contentPadding = PaddingValues(16.dp),
|
contentPadding = PaddingValues(16.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
) {
|
) {
|
||||||
|
if (isRefreshing) {
|
||||||
|
item(key = "refreshing") {
|
||||||
|
LinearProgressIndicator(modifier = Modifier.fillMaxWidth())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (error != null) {
|
||||||
|
item(key = "error") {
|
||||||
|
Text(
|
||||||
|
text = error,
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
color = MaterialTheme.colorScheme.error,
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 8.dp),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
items(subFolders, key = { it.resourceId }) { folder ->
|
items(subFolders, key = { it.resourceId }) { folder ->
|
||||||
FolderRow(folder, onClick = { onOpenFolder(folder.resourceId) })
|
FolderRow(folder, onClick = { onOpenFolder(folder.resourceId) })
|
||||||
}
|
}
|
||||||
@@ -389,28 +408,19 @@ private fun FolderDetailContent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (error != null) {
|
|
||||||
item(key = "error") {
|
|
||||||
Text(
|
|
||||||
text = error,
|
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
|
||||||
color = MaterialTheme.colorScheme.error,
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(vertical = 8.dp),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun FolderRow(folder: FolderEntity, onClick: () -> Unit) {
|
private fun FolderRow(folder: FolderEntity, onClick: () -> Unit) {
|
||||||
Card(
|
KazierCard(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.clickable(
|
||||||
|
role = Role.Button,
|
||||||
|
onClickLabel = folder.name,
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant),
|
),
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 1.dp),
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -421,7 +431,7 @@ private fun FolderRow(folder: FolderEntity, onClick: () -> Unit) {
|
|||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.Folder,
|
imageVector = Icons.Filled.Folder,
|
||||||
contentDescription = null,
|
contentDescription = folder.name,
|
||||||
tint = MaterialTheme.colorScheme.primary,
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
modifier = Modifier.size(28.dp),
|
modifier = Modifier.size(28.dp),
|
||||||
)
|
)
|
||||||
@@ -450,9 +460,7 @@ private fun FileRow(
|
|||||||
onOpenDocument: () -> Unit,
|
onOpenDocument: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val selected = file.resourceId in selection.ids
|
val selected = file.resourceId in selection.ids
|
||||||
Card(
|
KazierCard(
|
||||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surface),
|
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 1.dp),
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.combinedClickable(
|
.combinedClickable(
|
||||||
@@ -479,7 +487,7 @@ private fun FileRow(
|
|||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = formatSize(file.size),
|
text = formatFileSize(file.size),
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
)
|
)
|
||||||
@@ -498,17 +506,3 @@ private fun FileRow(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Miroir de `formatSize` (app/folder/[id].tsx). */
|
|
||||||
@Composable
|
|
||||||
private fun formatSize(bytes: Long): String {
|
|
||||||
if (bytes < 1_024) {
|
|
||||||
return "$bytes ${stringResource(R.string.unit_bytes)}"
|
|
||||||
}
|
|
||||||
if (bytes < 1_024 * 1_024) {
|
|
||||||
val kb = bytes / 1_024f
|
|
||||||
return String.format(Locale.getDefault(), "%.1f %s", kb, stringResource(R.string.unit_kilobytes))
|
|
||||||
}
|
|
||||||
val mb = bytes / (1_024f * 1_024f)
|
|
||||||
return String.format(Locale.getDefault(), "%.1f %s", mb, stringResource(R.string.unit_megabytes))
|
|
||||||
}
|
|
||||||
+23
-49
@@ -5,7 +5,6 @@ import android.net.Uri
|
|||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.compose.foundation.BorderStroke
|
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
@@ -23,7 +22,6 @@ import androidx.compose.foundation.layout.width
|
|||||||
import androidx.compose.foundation.layout.widthIn
|
import androidx.compose.foundation.layout.widthIn
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Add
|
import androidx.compose.material.icons.filled.Add
|
||||||
import androidx.compose.material.icons.filled.ArrowUpward
|
import androidx.compose.material.icons.filled.ArrowUpward
|
||||||
@@ -38,8 +36,6 @@ import androidx.compose.material.icons.filled.Refresh
|
|||||||
import androidx.compose.material.icons.filled.Share
|
import androidx.compose.material.icons.filled.Share
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.Card
|
|
||||||
import androidx.compose.material3.CardDefaults
|
|
||||||
import androidx.compose.material3.DropdownMenu
|
import androidx.compose.material3.DropdownMenu
|
||||||
import androidx.compose.material3.DropdownMenuItem
|
import androidx.compose.material3.DropdownMenuItem
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
@@ -66,7 +62,6 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
@@ -74,7 +69,6 @@ import androidx.compose.ui.text.font.FontWeight
|
|||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.kazier.mobile.R
|
import com.kazier.mobile.R
|
||||||
@@ -94,11 +88,12 @@ import com.kazier.mobile.ui.components.FilePendingReviewBadge
|
|||||||
import com.kazier.mobile.ui.components.FileSyncStatusIcon
|
import com.kazier.mobile.ui.components.FileSyncStatusIcon
|
||||||
import com.kazier.mobile.ui.components.FileThumbnail
|
import com.kazier.mobile.ui.components.FileThumbnail
|
||||||
import com.kazier.mobile.ui.components.FolderNameDialog
|
import com.kazier.mobile.ui.components.FolderNameDialog
|
||||||
|
import com.kazier.mobile.ui.components.KazierCard
|
||||||
import com.kazier.mobile.ui.components.SelectionState
|
import com.kazier.mobile.ui.components.SelectionState
|
||||||
import com.kazier.mobile.ui.components.SelectionStatusIcon
|
import com.kazier.mobile.ui.components.SelectionStatusIcon
|
||||||
import com.kazier.mobile.ui.components.ServerStatusBadge
|
import com.kazier.mobile.ui.components.ServerStatusBadge
|
||||||
import com.kazier.mobile.ui.components.SyncStatusAction
|
import com.kazier.mobile.ui.components.SyncStatusAction
|
||||||
|
import com.kazier.mobile.ui.components.formatFileSize
|
||||||
import com.kazier.mobile.ui.components.rememberSelectionState
|
import com.kazier.mobile.ui.components.rememberSelectionState
|
||||||
import com.kazier.mobile.ui.components.reviewDelete
|
import com.kazier.mobile.ui.components.reviewDelete
|
||||||
import com.kazier.mobile.ui.navigation.FloatingNavBar
|
import com.kazier.mobile.ui.navigation.FloatingNavBar
|
||||||
@@ -110,15 +105,16 @@ import com.kazier.mobile.ui.auth.AuthState
|
|||||||
import com.kazier.mobile.ui.auth.AuthViewModel
|
import com.kazier.mobile.ui.auth.AuthViewModel
|
||||||
import com.kazier.mobile.ui.share.ShareBottomSheet
|
import com.kazier.mobile.ui.share.ShareBottomSheet
|
||||||
import com.kazier.mobile.ui.share.ShareViewModel
|
import com.kazier.mobile.ui.share.ShareViewModel
|
||||||
|
import com.kazier.mobile.ui.theme.NavItemShape
|
||||||
|
import com.kazier.mobile.ui.theme.NavPillShape
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
/** Dossier cible du partage : id + nom affiché dans le sheet. */
|
/** Dossier cible du partage : id + nom affiché dans le sheet. */
|
||||||
private data class ShareTarget(
|
private data class ShareTarget(
|
||||||
val resourceId: String,
|
val resourceId: String,
|
||||||
val name: String,
|
val name: String,
|
||||||
)
|
) : java.io.Serializable
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -145,13 +141,13 @@ fun FolderListScreen(
|
|||||||
var showCreateDialog by rememberSaveable { mutableStateOf(false) }
|
var showCreateDialog by rememberSaveable { mutableStateOf(false) }
|
||||||
var showDeleteWarning by rememberSaveable { mutableStateOf(false) }
|
var showDeleteWarning by rememberSaveable { mutableStateOf(false) }
|
||||||
var showDeleteConfirm by rememberSaveable { mutableStateOf(false) }
|
var showDeleteConfirm by rememberSaveable { mutableStateOf(false) }
|
||||||
var pendingDeleteMode by remember { mutableStateOf<FileDeleter.DeleteMode?>(null) }
|
var pendingDeleteMode by rememberSaveable { mutableStateOf<FileDeleter.DeleteMode?>(null) }
|
||||||
var pendingDeleteReview by remember { mutableStateOf<DeleteReview?>(null) }
|
var pendingDeleteReview by rememberSaveable { mutableStateOf<DeleteReview?>(null) }
|
||||||
var pendingFolderIds by remember { mutableStateOf<List<String>>(emptyList()) }
|
var pendingFolderIds by rememberSaveable { mutableStateOf<List<String>>(emptyList()) }
|
||||||
var pendingFileIds by remember { mutableStateOf<List<String>>(emptyList()) }
|
var pendingFileIds by rememberSaveable { mutableStateOf<List<String>>(emptyList()) }
|
||||||
var shareTarget by remember { mutableStateOf<ShareTarget?>(null) }
|
var shareTarget by rememberSaveable { mutableStateOf<ShareTarget?>(null) }
|
||||||
var showShareMenu by rememberSaveable { mutableStateOf(false) }
|
var showShareMenu by rememberSaveable { mutableStateOf(false) }
|
||||||
var shareEnabled by remember { mutableStateOf(false) }
|
var shareEnabled by rememberSaveable { mutableStateOf(false) }
|
||||||
var showCreateMenu by rememberSaveable { mutableStateOf(false) }
|
var showCreateMenu by rememberSaveable { mutableStateOf(false) }
|
||||||
var showNoteDialog by rememberSaveable { mutableStateOf(false) }
|
var showNoteDialog by rememberSaveable { mutableStateOf(false) }
|
||||||
val snackbarHostState = remember { SnackbarHostState() }
|
val snackbarHostState = remember { SnackbarHostState() }
|
||||||
@@ -203,7 +199,7 @@ fun FolderListScreen(
|
|||||||
|
|
||||||
LaunchedEffect(uiState.deleteSuccess) {
|
LaunchedEffect(uiState.deleteSuccess) {
|
||||||
if (uiState.deleteSuccess) {
|
if (uiState.deleteSuccess) {
|
||||||
snackbarHostState.showSnackbar(context.getString(R.string.delete))
|
snackbarHostState.showSnackbar(context.getString(R.string.delete_success))
|
||||||
viewModel.clearDeleteSuccess()
|
viewModel.clearDeleteSuccess()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -595,7 +591,7 @@ private fun HomeViewSelector(
|
|||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
Surface(
|
Surface(
|
||||||
shape = RoundedCornerShape(30.dp),
|
shape = NavPillShape,
|
||||||
color = MaterialTheme.colorScheme.surface,
|
color = MaterialTheme.colorScheme.surface,
|
||||||
shadowElevation = 8.dp,
|
shadowElevation = 8.dp,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -642,7 +638,7 @@ private fun ViewSegment(
|
|||||||
Surface(
|
Surface(
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
enabled = enabled,
|
enabled = enabled,
|
||||||
shape = RoundedCornerShape(20.dp),
|
shape = NavItemShape,
|
||||||
color = if (selected) MaterialTheme.colorScheme.primaryContainer
|
color = if (selected) MaterialTheme.colorScheme.primaryContainer
|
||||||
else MaterialTheme.colorScheme.surface,
|
else MaterialTheme.colorScheme.surface,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
@@ -656,14 +652,14 @@ private fun ViewSegment(
|
|||||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = icon,
|
imageVector = icon,
|
||||||
contentDescription = null,
|
contentDescription = label,
|
||||||
tint = tint,
|
tint = tint,
|
||||||
modifier = Modifier.size(22.dp),
|
modifier = Modifier.size(22.dp),
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = label,
|
text = label,
|
||||||
color = tint,
|
color = tint,
|
||||||
fontSize = 11.sp,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
fontWeight = if (selected) FontWeight.Bold else FontWeight.Medium,
|
fontWeight = if (selected) FontWeight.Bold else FontWeight.Medium,
|
||||||
@@ -866,7 +862,7 @@ private fun FolderBrowserContent(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(top = 8.dp, bottom = 4.dp),
|
.padding(top = 8.dp, bottom = 4.dp),
|
||||||
) {
|
) {
|
||||||
Icon(Icons.Filled.CreateNewFolder, contentDescription = null)
|
Icon(Icons.Filled.CreateNewFolder, contentDescription = stringResource(R.string.create_folder))
|
||||||
Spacer(Modifier.width(8.dp))
|
Spacer(Modifier.width(8.dp))
|
||||||
Text(stringResource(R.string.create_folder))
|
Text(stringResource(R.string.create_folder))
|
||||||
}
|
}
|
||||||
@@ -1006,9 +1002,7 @@ private fun FolderRow(
|
|||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val selected = folder.resourceId in selection.ids
|
val selected = folder.resourceId in selection.ids
|
||||||
Card(
|
KazierCard(
|
||||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant),
|
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 1.dp),
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(bottom = 8.dp)
|
.padding(bottom = 8.dp)
|
||||||
@@ -1030,7 +1024,7 @@ private fun FolderRow(
|
|||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.Folder,
|
imageVector = Icons.Filled.Folder,
|
||||||
contentDescription = null,
|
contentDescription = folder.name,
|
||||||
tint = MaterialTheme.colorScheme.primary,
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
modifier = Modifier.size(28.dp),
|
modifier = Modifier.size(28.dp),
|
||||||
)
|
)
|
||||||
@@ -1064,11 +1058,7 @@ private fun FileCard(
|
|||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val selected = file.resourceId in selection.ids
|
val selected = file.resourceId in selection.ids
|
||||||
Card(
|
KazierCard(
|
||||||
colors = CardDefaults.cardColors(containerColor = Color(0xFFF7F8FA)),
|
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp),
|
|
||||||
border = BorderStroke(1.dp, Color(0xFFEAEAEA)),
|
|
||||||
shape = RoundedCornerShape(10.dp),
|
|
||||||
modifier = modifier.combinedClickable(
|
modifier = modifier.combinedClickable(
|
||||||
onClick = {
|
onClick = {
|
||||||
if (selection.active) selection.toggle(file.resourceId) else onClick()
|
if (selection.active) selection.toggle(file.resourceId) else onClick()
|
||||||
@@ -1104,7 +1094,7 @@ private fun FileCard(
|
|||||||
)
|
)
|
||||||
Spacer(Modifier.height(4.dp))
|
Spacer(Modifier.height(4.dp))
|
||||||
Text(
|
Text(
|
||||||
text = formatSize(file.size),
|
text = formatFileSize(file.size),
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
)
|
)
|
||||||
@@ -1121,9 +1111,7 @@ private fun BrowseFileRow(
|
|||||||
onOpenDocument: () -> Unit,
|
onOpenDocument: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val selected = file.resourceId in selection.ids
|
val selected = file.resourceId in selection.ids
|
||||||
Card(
|
KazierCard(
|
||||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surface),
|
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 1.dp),
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(bottom = 6.dp)
|
.padding(bottom = 6.dp)
|
||||||
@@ -1153,7 +1141,7 @@ private fun BrowseFileRow(
|
|||||||
fontWeight = FontWeight.Medium,
|
fontWeight = FontWeight.Medium,
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = formatSize(file.size),
|
text = formatFileSize(file.size),
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
)
|
)
|
||||||
@@ -1173,20 +1161,6 @@ private fun BrowseFileRow(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Miroir de `formatSize` (app/index.tsx). */
|
|
||||||
@Composable
|
|
||||||
private fun formatSize(bytes: Long): String {
|
|
||||||
if (bytes < 1_024) {
|
|
||||||
return "$bytes ${stringResource(R.string.unit_bytes)}"
|
|
||||||
}
|
|
||||||
if (bytes < 1_024 * 1_024) {
|
|
||||||
val kb = bytes / 1_024f
|
|
||||||
return String.format(Locale.getDefault(), "%.1f %s", kb, stringResource(R.string.unit_kilobytes))
|
|
||||||
}
|
|
||||||
val mb = bytes / (1_024f * 1_024f)
|
|
||||||
return String.format(Locale.getDefault(), "%.1f %s", mb, stringResource(R.string.unit_megabytes))
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Création d'une note : titre requis, corps de texte libre. */
|
/** Création d'une note : titre requis, corps de texte libre. */
|
||||||
@Composable
|
@Composable
|
||||||
private fun NoteDialog(
|
private fun NoteDialog(
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ import androidx.compose.foundation.layout.Arrangement
|
|||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.RowScope
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.heightIn
|
import androidx.compose.foundation.layout.heightIn
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.widthIn
|
import androidx.compose.foundation.layout.widthIn
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Dashboard
|
import androidx.compose.material.icons.filled.Dashboard
|
||||||
import androidx.compose.material.icons.filled.DriveFileMove
|
import androidx.compose.material.icons.filled.DriveFileMove
|
||||||
@@ -38,10 +38,12 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import com.kazier.mobile.R
|
import com.kazier.mobile.R
|
||||||
import com.kazier.mobile.ui.components.DeleteDropdownButton
|
|
||||||
import com.kazier.mobile.features.saf.FileDeleter
|
import com.kazier.mobile.features.saf.FileDeleter
|
||||||
|
import com.kazier.mobile.ui.components.DeleteDropdownButton
|
||||||
|
import com.kazier.mobile.ui.theme.KazierDimens
|
||||||
|
import com.kazier.mobile.ui.theme.NavItemShape
|
||||||
|
import com.kazier.mobile.ui.theme.NavPillShape
|
||||||
|
|
||||||
enum class NavTab(val route: String) {
|
enum class NavTab(val route: String) {
|
||||||
FILES(Routes.FILES),
|
FILES(Routes.FILES),
|
||||||
@@ -64,11 +66,11 @@ private val TAB_ITEMS = listOf(
|
|||||||
TabItem(NavTab.SETTINGS, Icons.Filled.Settings, Icons.Outlined.Settings, R.string.nav_settings),
|
TabItem(NavTab.SETTINGS, Icons.Filled.Settings, Icons.Outlined.Settings, R.string.nav_settings),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/** Conteneur pill commun aux 4 barres flottantes (nav + sélection + déplacement). */
|
||||||
@Composable
|
@Composable
|
||||||
fun FloatingNavBar(
|
private fun FloatingPillContainer(
|
||||||
selected: NavTab,
|
|
||||||
onSelect: (NavTab) -> Unit,
|
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
|
content: @Composable RowScope.() -> Unit,
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
@@ -77,25 +79,38 @@ fun FloatingNavBar(
|
|||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
Surface(
|
Surface(
|
||||||
shape = RoundedCornerShape(30.dp),
|
shape = NavPillShape,
|
||||||
color = MaterialTheme.colorScheme.surface,
|
color = MaterialTheme.colorScheme.surface,
|
||||||
shadowElevation = 8.dp,
|
shadowElevation = KazierDimens.NavElevation,
|
||||||
modifier = Modifier.widthIn(max = 400.dp).fillMaxWidth(),
|
modifier = Modifier.widthIn(max = KazierDimens.ListMaxWidth).fillMaxWidth(),
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.padding(vertical = 8.dp, horizontal = 8.dp),
|
modifier = Modifier.padding(vertical = 8.dp, horizontal = 8.dp),
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
content = content,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun FloatingNavBar(
|
||||||
|
selected: NavTab,
|
||||||
|
onSelect: (NavTab) -> Unit,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
FloatingPillContainer(modifier = modifier) {
|
||||||
TAB_ITEMS.forEach { item ->
|
TAB_ITEMS.forEach { item ->
|
||||||
val isActive = item.tab == selected
|
val isActive = item.tab == selected
|
||||||
val icon = if (isActive) item.filled else item.outlined
|
val icon = if (isActive) item.filled else item.outlined
|
||||||
val tint = if (isActive) MaterialTheme.colorScheme.primary
|
val tint = if (isActive) MaterialTheme.colorScheme.primary
|
||||||
else MaterialTheme.colorScheme.onSurfaceVariant
|
else MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
val label = stringResource(item.labelRes)
|
||||||
|
|
||||||
Surface(
|
Surface(
|
||||||
onClick = { onSelect(item.tab) },
|
onClick = { onSelect(item.tab) },
|
||||||
shape = RoundedCornerShape(20.dp),
|
shape = NavItemShape,
|
||||||
color = if (isActive) MaterialTheme.colorScheme.primaryContainer
|
color = if (isActive) MaterialTheme.colorScheme.primaryContainer
|
||||||
else MaterialTheme.colorScheme.surface,
|
else MaterialTheme.colorScheme.surface,
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
@@ -109,14 +124,14 @@ fun FloatingNavBar(
|
|||||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = icon,
|
imageVector = icon,
|
||||||
contentDescription = null,
|
contentDescription = label,
|
||||||
tint = tint,
|
tint = tint,
|
||||||
modifier = Modifier.size(22.dp),
|
modifier = Modifier.size(22.dp),
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(item.labelRes),
|
text = label,
|
||||||
color = tint,
|
color = tint,
|
||||||
fontSize = 11.sp,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
fontWeight = if (isActive) FontWeight.Bold else FontWeight.Medium,
|
fontWeight = if (isActive) FontWeight.Bold else FontWeight.Medium,
|
||||||
@@ -128,8 +143,6 @@ fun FloatingNavBar(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Barre d'actions affichée à la place de la nav quand le mode multi-sélection est actif. */
|
/** Barre d'actions affichée à la place de la nav quand le mode multi-sélection est actif. */
|
||||||
@Composable
|
@Composable
|
||||||
@@ -140,23 +153,7 @@ fun SelectionNavBar(
|
|||||||
enabled: Boolean,
|
enabled: Boolean,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Box(
|
FloatingPillContainer(modifier = modifier) {
|
||||||
modifier = modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(start = 20.dp, end = 20.dp, bottom = 16.dp),
|
|
||||||
contentAlignment = Alignment.Center,
|
|
||||||
) {
|
|
||||||
Surface(
|
|
||||||
shape = RoundedCornerShape(30.dp),
|
|
||||||
color = MaterialTheme.colorScheme.surface,
|
|
||||||
shadowElevation = 8.dp,
|
|
||||||
modifier = Modifier.widthIn(max = 400.dp).fillMaxWidth(),
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = Modifier.padding(vertical = 8.dp, horizontal = 8.dp),
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
) {
|
|
||||||
SelectionAction(
|
SelectionAction(
|
||||||
label = stringResource(R.string.move_files),
|
label = stringResource(R.string.move_files),
|
||||||
icon = Icons.Filled.DriveFileMove,
|
icon = Icons.Filled.DriveFileMove,
|
||||||
@@ -178,8 +175,6 @@ fun SelectionNavBar(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Barre d'actions multi-sélection propre aux dossiers : partage + suppression. */
|
/** Barre d'actions multi-sélection propre aux dossiers : partage + suppression. */
|
||||||
@Composable
|
@Composable
|
||||||
@@ -190,23 +185,7 @@ fun FolderSelectionNavBar(
|
|||||||
deleteEnabled: Boolean,
|
deleteEnabled: Boolean,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Box(
|
FloatingPillContainer(modifier = modifier) {
|
||||||
modifier = modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(start = 20.dp, end = 20.dp, bottom = 16.dp),
|
|
||||||
contentAlignment = Alignment.Center,
|
|
||||||
) {
|
|
||||||
Surface(
|
|
||||||
shape = RoundedCornerShape(30.dp),
|
|
||||||
color = MaterialTheme.colorScheme.surface,
|
|
||||||
shadowElevation = 8.dp,
|
|
||||||
modifier = Modifier.widthIn(max = 400.dp).fillMaxWidth(),
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = Modifier.padding(vertical = 8.dp, horizontal = 8.dp),
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
) {
|
|
||||||
SelectionAction(
|
SelectionAction(
|
||||||
label = stringResource(R.string.share_action),
|
label = stringResource(R.string.share_action),
|
||||||
icon = Icons.Filled.Share,
|
icon = Icons.Filled.Share,
|
||||||
@@ -221,8 +200,6 @@ fun FolderSelectionNavBar(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Barre du mode déplacement : bouton « Déplacer ici (N) » vers le dossier courant. */
|
/** Barre du mode déplacement : bouton « Déplacer ici (N) » vers le dossier courant. */
|
||||||
@Composable
|
@Composable
|
||||||
@@ -231,23 +208,8 @@ fun MoveTargetBar(
|
|||||||
onMoveHere: () -> Unit,
|
onMoveHere: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Box(
|
FloatingPillContainer(modifier = modifier) {
|
||||||
modifier = modifier
|
val label = stringResource(R.string.move_here_count, fileCount)
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(start = 20.dp, end = 20.dp, bottom = 16.dp),
|
|
||||||
contentAlignment = Alignment.Center,
|
|
||||||
) {
|
|
||||||
Surface(
|
|
||||||
shape = RoundedCornerShape(30.dp),
|
|
||||||
color = MaterialTheme.colorScheme.surface,
|
|
||||||
shadowElevation = 8.dp,
|
|
||||||
modifier = Modifier.widthIn(max = 400.dp).fillMaxWidth(),
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = Modifier.padding(horizontal = 12.dp, vertical = 10.dp),
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
) {
|
|
||||||
Button(
|
Button(
|
||||||
onClick = onMoveHere,
|
onClick = onMoveHere,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -256,17 +218,15 @@ fun MoveTargetBar(
|
|||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.DriveFileMove,
|
imageVector = Icons.Filled.DriveFileMove,
|
||||||
contentDescription = null,
|
contentDescription = label,
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.move_here_count, fileCount),
|
text = label,
|
||||||
modifier = Modifier.padding(start = 8.dp),
|
modifier = Modifier.padding(start = 8.dp),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SelectionAction(
|
private fun SelectionAction(
|
||||||
@@ -281,7 +241,7 @@ private fun SelectionAction(
|
|||||||
Surface(
|
Surface(
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
enabled = enabled,
|
enabled = enabled,
|
||||||
shape = RoundedCornerShape(20.dp),
|
shape = NavItemShape,
|
||||||
color = if (enabled) MaterialTheme.colorScheme.primaryContainer
|
color = if (enabled) MaterialTheme.colorScheme.primaryContainer
|
||||||
else MaterialTheme.colorScheme.surfaceVariant,
|
else MaterialTheme.colorScheme.surfaceVariant,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
@@ -295,14 +255,14 @@ private fun SelectionAction(
|
|||||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = icon,
|
imageVector = icon,
|
||||||
contentDescription = null,
|
contentDescription = label,
|
||||||
tint = tint,
|
tint = tint,
|
||||||
modifier = Modifier.size(22.dp),
|
modifier = Modifier.size(22.dp),
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = label,
|
text = label,
|
||||||
color = tint,
|
color = tint,
|
||||||
fontSize = 11.sp,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.kazier.mobile.ui.navigation
|
package com.kazier.mobile.ui.navigation
|
||||||
|
|
||||||
|
import androidx.compose.animation.EnterTransition
|
||||||
|
import androidx.compose.animation.ExitTransition
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@@ -104,6 +106,11 @@ fun NavGraph(
|
|||||||
NavHost(
|
NavHost(
|
||||||
navController = navController,
|
navController = navController,
|
||||||
startDestination = Routes.FILES,
|
startDestination = Routes.FILES,
|
||||||
|
// Pas de transition animée entre les vues : changement instantané.
|
||||||
|
enterTransition = { EnterTransition.None },
|
||||||
|
exitTransition = { ExitTransition.None },
|
||||||
|
popEnterTransition = { EnterTransition.None },
|
||||||
|
popExitTransition = { ExitTransition.None },
|
||||||
) {
|
) {
|
||||||
composable(Routes.FILES) {
|
composable(Routes.FILES) {
|
||||||
FolderListScreen(
|
FolderListScreen(
|
||||||
|
|||||||
+71
-49
@@ -18,29 +18,29 @@ import androidx.compose.foundation.lazy.items
|
|||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||||
import androidx.compose.material.icons.filled.Add
|
import androidx.compose.material.icons.filled.Add
|
||||||
import androidx.compose.material.icons.filled.Check
|
|
||||||
import androidx.compose.material.icons.filled.Close
|
import androidx.compose.material.icons.filled.Close
|
||||||
import androidx.compose.material.icons.filled.KeyboardArrowDown
|
import androidx.compose.material.icons.filled.KeyboardArrowDown
|
||||||
import androidx.compose.material.icons.filled.KeyboardArrowUp
|
import androidx.compose.material.icons.filled.KeyboardArrowUp
|
||||||
import androidx.compose.material.icons.filled.Image
|
import androidx.compose.material.icons.filled.Image
|
||||||
import androidx.compose.material.icons.filled.MergeType
|
import androidx.compose.material.icons.filled.MergeType
|
||||||
|
import androidx.compose.material.icons.filled.Search
|
||||||
import androidx.compose.material.icons.filled.TextSnippet
|
import androidx.compose.material.icons.filled.TextSnippet
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.Card
|
import androidx.compose.material3.Checkbox
|
||||||
import androidx.compose.material3.CardDefaults
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.LinearProgressIndicator
|
import androidx.compose.material3.LinearProgressIndicator
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.ModalBottomSheet
|
import androidx.compose.material3.ModalBottomSheet
|
||||||
import androidx.compose.material3.OutlinedButton
|
|
||||||
import androidx.compose.material3.OutlinedTextField
|
import androidx.compose.material3.OutlinedTextField
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.SnackbarDuration
|
||||||
import androidx.compose.material3.SnackbarHost
|
import androidx.compose.material3.SnackbarHost
|
||||||
import androidx.compose.material3.SnackbarHostState
|
import androidx.compose.material3.SnackbarHostState
|
||||||
|
import androidx.compose.material3.SnackbarResult
|
||||||
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
@@ -57,6 +57,7 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.semantics.Role
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
@@ -68,11 +69,13 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|||||||
import com.kazier.mobile.R
|
import com.kazier.mobile.R
|
||||||
import com.kazier.mobile.data.local.entity.FileEntity
|
import com.kazier.mobile.data.local.entity.FileEntity
|
||||||
import com.kazier.mobile.ui.components.FileCategoryIcon
|
import com.kazier.mobile.ui.components.FileCategoryIcon
|
||||||
|
import com.kazier.mobile.ui.components.KazierCard
|
||||||
|
import com.kazier.mobile.ui.components.VerticalActionButton
|
||||||
|
import com.kazier.mobile.ui.components.formatFileSize
|
||||||
import com.kazier.mobile.ui.document.content.DocumentContentViewer
|
import com.kazier.mobile.ui.document.content.DocumentContentViewer
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -111,8 +114,22 @@ fun PdfBuilderScreen(
|
|||||||
LaunchedEffect(isReady) {
|
LaunchedEffect(isReady) {
|
||||||
if (isReady) showNameDialog = true
|
if (isReady) showNameDialog = true
|
||||||
}
|
}
|
||||||
|
// Plus d'auto-navigation à la sauvegarde : un Snackbar « PDF créé / Voir »
|
||||||
|
// laisse l'utilisateur dans le panier ; l'ouverture est explicite.
|
||||||
|
// `savedAnnouncedFor` (UI seule) évite le re-snackbar à la rotation.
|
||||||
|
val savedLabel = stringResource(R.string.pdf_builder_saved)
|
||||||
|
val viewLabel = stringResource(R.string.pdf_builder_view)
|
||||||
|
var savedAnnouncedFor by rememberSaveable { mutableStateOf<String?>(null) }
|
||||||
LaunchedEffect(savedResourceId) {
|
LaunchedEffect(savedResourceId) {
|
||||||
if (savedResourceId != null) onOpenDocument(savedResourceId)
|
if (savedResourceId != null && savedAnnouncedFor != savedResourceId) {
|
||||||
|
savedAnnouncedFor = savedResourceId
|
||||||
|
val result = snackbarHostState.showSnackbar(
|
||||||
|
message = savedLabel,
|
||||||
|
actionLabel = viewLabel,
|
||||||
|
duration = SnackbarDuration.Long,
|
||||||
|
)
|
||||||
|
if (result == SnackbarResult.ActionPerformed) onOpenDocument(savedResourceId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LaunchedEffect(failureMessage) {
|
LaunchedEffect(failureMessage) {
|
||||||
if (failureMessage != null) {
|
if (failureMessage != null) {
|
||||||
@@ -257,7 +274,12 @@ private fun SelectFilesSheet(
|
|||||||
// `remember(files)`, chaque update Room recréait la sélection et effaçait
|
// `remember(files)`, chaque update Room recréait la sélection et effaçait
|
||||||
// les cases cochées en cours.
|
// les cases cochées en cours.
|
||||||
var selected by remember(existingIds) { mutableStateOf(existingIds.toMutableSet()) }
|
var selected by remember(existingIds) { mutableStateOf(existingIds.toMutableSet()) }
|
||||||
|
var searchQuery by rememberSaveable { mutableStateOf("") }
|
||||||
val sheetState = rememberModalBottomSheetState()
|
val sheetState = rememberModalBottomSheetState()
|
||||||
|
val visibleFiles = remember(files, searchQuery) {
|
||||||
|
if (searchQuery.isBlank()) files
|
||||||
|
else files.filter { it.name.contains(searchQuery, ignoreCase = true) }
|
||||||
|
}
|
||||||
|
|
||||||
ModalBottomSheet(
|
ModalBottomSheet(
|
||||||
onDismissRequest = onDismiss,
|
onDismissRequest = onDismiss,
|
||||||
@@ -269,18 +291,33 @@ private fun SelectFilesSheet(
|
|||||||
fontWeight = FontWeight.SemiBold,
|
fontWeight = FontWeight.SemiBold,
|
||||||
modifier = Modifier.padding(horizontal = 16.dp),
|
modifier = Modifier.padding(horizontal = 16.dp),
|
||||||
)
|
)
|
||||||
|
OutlinedTextField(
|
||||||
|
value = searchQuery,
|
||||||
|
onValueChange = { searchQuery = it },
|
||||||
|
leadingIcon = { Icon(Icons.Filled.Search, contentDescription = null) },
|
||||||
|
placeholder = { Text(stringResource(R.string.pdf_builder_search_files)) },
|
||||||
|
singleLine = true,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||||
|
)
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = PaddingValues(16.dp),
|
contentPadding = PaddingValues(16.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(4.dp),
|
verticalArrangement = Arrangement.spacedBy(4.dp),
|
||||||
) {
|
) {
|
||||||
items(files, key = { it.resourceId }) { file ->
|
items(visibleFiles, key = { it.resourceId }) { file ->
|
||||||
|
val checked = file.resourceId in selected
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable {
|
.clickable(
|
||||||
if (file.resourceId in selected) selected.remove(file.resourceId)
|
role = Role.Checkbox,
|
||||||
|
onClickLabel = file.name,
|
||||||
|
onClick = {
|
||||||
|
if (checked) selected.remove(file.resourceId)
|
||||||
else selected.add(file.resourceId)
|
else selected.add(file.resourceId)
|
||||||
}
|
},
|
||||||
|
)
|
||||||
.padding(vertical = 8.dp),
|
.padding(vertical = 8.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
@@ -294,19 +331,17 @@ private fun SelectFilesSheet(
|
|||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = formatSize(file.size),
|
text = formatFileSize(file.size),
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Spacer(Modifier.width(8.dp))
|
Spacer(Modifier.width(8.dp))
|
||||||
Icon(
|
Checkbox(
|
||||||
imageVector = Icons.Filled.Check,
|
checked = checked,
|
||||||
contentDescription = null,
|
onCheckedChange = {
|
||||||
tint = if (file.resourceId in selected) {
|
if (checked) selected.remove(file.resourceId)
|
||||||
MaterialTheme.colorScheme.primary
|
else selected.add(file.resourceId)
|
||||||
} else {
|
|
||||||
MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.6f)
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -332,7 +367,7 @@ private fun NamePdfDialog(
|
|||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
onConfirm: (String) -> Unit,
|
onConfirm: (String) -> Unit,
|
||||||
) {
|
) {
|
||||||
var name by remember { mutableStateOf(defaultName) }
|
var name by rememberSaveable { mutableStateOf(defaultName) }
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
onDismissRequest = onDismiss,
|
onDismissRequest = onDismiss,
|
||||||
title = { Text(stringResource(R.string.pdf_builder_name_title)) },
|
title = { Text(stringResource(R.string.pdf_builder_name_title)) },
|
||||||
@@ -366,7 +401,7 @@ private fun AddNoteDialog(
|
|||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
onConfirm: (String) -> Unit,
|
onConfirm: (String) -> Unit,
|
||||||
) {
|
) {
|
||||||
var body by remember { mutableStateOf("") }
|
var body by rememberSaveable { mutableStateOf("") }
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
onDismissRequest = onDismiss,
|
onDismissRequest = onDismiss,
|
||||||
title = { Text(stringResource(R.string.pdf_builder_add_note)) },
|
title = { Text(stringResource(R.string.pdf_builder_add_note)) },
|
||||||
@@ -404,10 +439,7 @@ private fun BuilderItemRow(
|
|||||||
onPreview: (() -> Unit)?,
|
onPreview: (() -> Unit)?,
|
||||||
) {
|
) {
|
||||||
val previewModifier = if (onPreview != null) Modifier.clickable(onClick = onPreview) else Modifier
|
val previewModifier = if (onPreview != null) Modifier.clickable(onClick = onPreview) else Modifier
|
||||||
Card(
|
KazierCard(modifier = Modifier.fillMaxWidth()) {
|
||||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant),
|
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp),
|
|
||||||
) {
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
@@ -419,13 +451,13 @@ private fun BuilderItemRow(
|
|||||||
is PdfBuilderItem.FileItem -> FileCategoryIcon(file = item.file, size = 24.dp)
|
is PdfBuilderItem.FileItem -> FileCategoryIcon(file = item.file, size = 24.dp)
|
||||||
is PdfBuilderItem.NoteItem -> Icon(
|
is PdfBuilderItem.NoteItem -> Icon(
|
||||||
imageVector = Icons.Filled.TextSnippet,
|
imageVector = Icons.Filled.TextSnippet,
|
||||||
contentDescription = null,
|
contentDescription = stringResource(R.string.pdf_builder_note),
|
||||||
tint = MaterialTheme.colorScheme.primary,
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
modifier = Modifier.size(24.dp),
|
modifier = Modifier.size(24.dp),
|
||||||
)
|
)
|
||||||
is PdfBuilderItem.FilePathItem -> Icon(
|
is PdfBuilderItem.FilePathItem -> Icon(
|
||||||
imageVector = Icons.Filled.Image,
|
imageVector = Icons.Filled.Image,
|
||||||
contentDescription = null,
|
contentDescription = item.file.name,
|
||||||
tint = MaterialTheme.colorScheme.primary,
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
modifier = Modifier.size(24.dp),
|
modifier = Modifier.size(24.dp),
|
||||||
)
|
)
|
||||||
@@ -450,14 +482,14 @@ private fun BuilderItemRow(
|
|||||||
is PdfBuilderItem.FileItem -> if (isFailed) {
|
is PdfBuilderItem.FileItem -> if (isFailed) {
|
||||||
stringResource(R.string.pdf_builder_unreadable)
|
stringResource(R.string.pdf_builder_unreadable)
|
||||||
} else {
|
} else {
|
||||||
formatSize(item.file.size)
|
formatFileSize(item.file.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
is PdfBuilderItem.NoteItem -> item.body
|
is PdfBuilderItem.NoteItem -> item.body
|
||||||
.replace('\n', ' ')
|
.replace('\n', ' ')
|
||||||
.take(80)
|
.take(80)
|
||||||
|
|
||||||
is PdfBuilderItem.FilePathItem -> formatSize(item.file.length())
|
is PdfBuilderItem.FilePathItem -> formatFileSize(item.file.length())
|
||||||
},
|
},
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
color = if (isFailed) MaterialTheme.colorScheme.error
|
color = if (isFailed) MaterialTheme.colorScheme.error
|
||||||
@@ -547,24 +579,22 @@ private fun BuilderActions(
|
|||||||
) {
|
) {
|
||||||
Column(modifier = modifier, verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
Column(modifier = modifier, verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
OutlinedButton(
|
VerticalActionButton(
|
||||||
|
icon = Icons.Filled.Add,
|
||||||
|
label = stringResource(R.string.pdf_builder_add_files),
|
||||||
onClick = onAddFile,
|
onClick = onAddFile,
|
||||||
enabled = !building,
|
enabled = !building,
|
||||||
|
outlined = true,
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
) {
|
)
|
||||||
Icon(Icons.Filled.Add, contentDescription = null)
|
VerticalActionButton(
|
||||||
Spacer(Modifier.width(6.dp))
|
icon = Icons.Filled.TextSnippet,
|
||||||
Text(stringResource(R.string.pdf_builder_add_files))
|
label = stringResource(R.string.pdf_builder_add_note),
|
||||||
}
|
|
||||||
OutlinedButton(
|
|
||||||
onClick = onAddNote,
|
onClick = onAddNote,
|
||||||
enabled = !building,
|
enabled = !building,
|
||||||
|
outlined = true,
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
) {
|
)
|
||||||
Icon(Icons.Filled.TextSnippet, contentDescription = null)
|
|
||||||
Spacer(Modifier.width(6.dp))
|
|
||||||
Text(stringResource(R.string.pdf_builder_add_note))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Button(
|
Button(
|
||||||
onClick = onAssemble,
|
onClick = onAssemble,
|
||||||
@@ -580,11 +610,3 @@ private fun BuilderActions(
|
|||||||
|
|
||||||
private val DEFAULT_DATE_FORMAT: DateTimeFormatter =
|
private val DEFAULT_DATE_FORMAT: DateTimeFormatter =
|
||||||
DateTimeFormatter.ofPattern("dd-MM-yyyy")
|
DateTimeFormatter.ofPattern("dd-MM-yyyy")
|
||||||
|
|
||||||
private fun formatSize(bytes: Long): String {
|
|
||||||
if (bytes < 1_024) return "$bytes o"
|
|
||||||
if (bytes < 1_024 * 1_024) {
|
|
||||||
return String.format(Locale.getDefault(), "%.1f ko", bytes / 1_024f)
|
|
||||||
}
|
|
||||||
return String.format(Locale.getDefault(), "%.1f Mo", bytes / (1_024f * 1_024f))
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
package com.kazier.mobile.ui.review
|
package com.kazier.mobile.ui.review
|
||||||
|
|
||||||
|
import androidx.compose.animation.AnimatedContent
|
||||||
|
import androidx.compose.animation.fadeIn
|
||||||
|
import androidx.compose.animation.fadeOut
|
||||||
|
import androidx.compose.animation.scaleIn
|
||||||
|
import androidx.compose.animation.scaleOut
|
||||||
|
import androidx.compose.animation.togetherWith
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
@@ -27,7 +33,9 @@ import androidx.compose.ui.text.style.TextOverflow
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.kazier.mobile.data.local.entity.FileEntity
|
import com.kazier.mobile.data.local.entity.FileEntity
|
||||||
import com.kazier.mobile.ui.components.FileCategoryIcon
|
import com.kazier.mobile.ui.components.FileCategoryIcon
|
||||||
|
import com.kazier.mobile.ui.components.formatFileSize
|
||||||
import com.kazier.mobile.ui.document.content.DocumentContentViewer
|
import com.kazier.mobile.ui.document.content.DocumentContentViewer
|
||||||
|
import com.kazier.mobile.ui.theme.SheetShape
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
@@ -49,17 +57,13 @@ fun SwipeCardDeck(
|
|||||||
) {
|
) {
|
||||||
Box(modifier = modifier) {
|
Box(modifier = modifier) {
|
||||||
val visible = cards.take(MAX_STACK)
|
val visible = cards.take(MAX_STACK)
|
||||||
|
val top = visible.firstOrNull()
|
||||||
|
|
||||||
visible.asReversed().forEach { file ->
|
// Cartes d'arrière-plan : profondeur = distance au dessus (0 = dessus).
|
||||||
val depth = visible.indexOf(file)
|
visible.asReversed().forEachIndexed { reversedIndex, file ->
|
||||||
|
val depth = visible.size - 1 - reversedIndex
|
||||||
|
if (depth == 0) return@forEachIndexed
|
||||||
key(file.resourceId) {
|
key(file.resourceId) {
|
||||||
if (depth == 0) {
|
|
||||||
TopCard(
|
|
||||||
file = file,
|
|
||||||
onOpenExternalFailed = onOpenExternalFailed,
|
|
||||||
modifier = Modifier.fillMaxSize(),
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
StackedCard(
|
StackedCard(
|
||||||
file = file,
|
file = file,
|
||||||
depth = depth,
|
depth = depth,
|
||||||
@@ -67,6 +71,28 @@ fun SwipeCardDeck(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Carte du dessus : transition fondu + échelle à chaque document —
|
||||||
|
// fini la disparition brutale au garder/supprimer.
|
||||||
|
AnimatedContent(
|
||||||
|
targetState = top?.resourceId,
|
||||||
|
transitionSpec = {
|
||||||
|
(fadeIn() + scaleIn(initialScale = 0.96f)) togetherWith
|
||||||
|
(fadeOut() + scaleOut(targetScale = 0.96f))
|
||||||
|
},
|
||||||
|
label = "review-top-card",
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
) { topId ->
|
||||||
|
val file = visible.firstOrNull { it.resourceId == topId }
|
||||||
|
if (file != null) {
|
||||||
|
key(file.resourceId) {
|
||||||
|
TopCard(
|
||||||
|
file = file,
|
||||||
|
onOpenExternalFailed = onOpenExternalFailed,
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,7 +181,7 @@ private fun ReviewCardMetaBar(file: FileEntity, modifier: Modifier = Modifier) {
|
|||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = "${formatSize(file.size)} • ${formatDate(file)}",
|
text = "${formatFileSize(file.size)} • ${formatDate(file)}",
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
)
|
)
|
||||||
@@ -163,16 +189,6 @@ private fun ReviewCardMetaBar(file: FileEntity, modifier: Modifier = Modifier) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun formatSize(bytes: Long): String {
|
|
||||||
val kb = 1024.0
|
|
||||||
val mb = kb * 1024
|
|
||||||
return when {
|
|
||||||
bytes >= mb -> String.format(Locale.getDefault(), "%.1f Mo", bytes / mb)
|
|
||||||
bytes >= kb -> String.format(Locale.getDefault(), "%.1f ko", bytes / kb)
|
|
||||||
else -> "$bytes o"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun formatDate(file: FileEntity): String {
|
private fun formatDate(file: FileEntity): String {
|
||||||
val millis = file.lastModified ?: file.addedAt
|
val millis = file.lastModified ?: file.addedAt
|
||||||
return DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM)
|
return DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM)
|
||||||
@@ -180,7 +196,7 @@ private fun formatDate(file: FileEntity): String {
|
|||||||
.format(Instant.ofEpochMilli(millis).atZone(ZoneId.systemDefault()).toLocalDate())
|
.format(Instant.ofEpochMilli(millis).atZone(ZoneId.systemDefault()).toLocalDate())
|
||||||
}
|
}
|
||||||
|
|
||||||
private val CardShape = RoundedCornerShape(20.dp)
|
private val CardShape = SheetShape
|
||||||
private const val MAX_STACK = 3
|
private const val MAX_STACK = 3
|
||||||
private const val STACK_SHRINK = 0.045f
|
private const val STACK_SHRINK = 0.045f
|
||||||
private const val STACK_OFFSET_DP = 18f
|
private const val STACK_OFFSET_DP = 18f
|
||||||
@@ -13,6 +13,7 @@ import androidx.compose.material.icons.Icons
|
|||||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||||
import androidx.compose.material.icons.filled.Check
|
import androidx.compose.material.icons.filled.Check
|
||||||
import androidx.compose.material.icons.filled.Close
|
import androidx.compose.material.icons.filled.Close
|
||||||
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.FloatingActionButton
|
import androidx.compose.material3.FloatingActionButton
|
||||||
@@ -28,8 +29,10 @@ import androidx.compose.material3.TopAppBar
|
|||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@@ -38,7 +41,6 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.window.Dialog
|
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.kazier.mobile.R
|
import com.kazier.mobile.R
|
||||||
@@ -61,7 +63,7 @@ fun SwipeReviewScreen(
|
|||||||
val snackbarHostState = remember { SnackbarHostState() }
|
val snackbarHostState = remember { SnackbarHostState() }
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
val openExternalErrorMsg = stringResource(R.string.document_open_error)
|
val openExternalErrorMsg = stringResource(R.string.document_open_error)
|
||||||
var confirmMarkAll by remember { androidx.compose.runtime.mutableStateOf(false) }
|
var confirmMarkAll by rememberSaveable { mutableStateOf(false) }
|
||||||
|
|
||||||
LaunchedEffect(state.error) {
|
LaunchedEffect(state.error) {
|
||||||
state.error?.let {
|
state.error?.let {
|
||||||
@@ -156,31 +158,11 @@ fun SwipeReviewScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (confirmMarkAll) {
|
if (confirmMarkAll) {
|
||||||
Dialog(onDismissRequest = { confirmMarkAll = false }) {
|
AlertDialog(
|
||||||
androidx.compose.material3.Surface(
|
onDismissRequest = { confirmMarkAll = false },
|
||||||
shape = MaterialTheme.shapes.medium,
|
title = { Text(stringResource(R.string.review_mark_all_title)) },
|
||||||
tonalElevation = 3.dp,
|
text = { Text(stringResource(R.string.review_mark_all_message)) },
|
||||||
) {
|
confirmButton = {
|
||||||
Column(modifier = Modifier.padding(24.dp)) {
|
|
||||||
Text(
|
|
||||||
text = stringResource(R.string.review_mark_all_title),
|
|
||||||
style = MaterialTheme.typography.titleMedium,
|
|
||||||
)
|
|
||||||
Text(
|
|
||||||
text = stringResource(R.string.review_mark_all_message),
|
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
modifier = Modifier.padding(top = 8.dp),
|
|
||||||
)
|
|
||||||
Row(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(top = 16.dp),
|
|
||||||
horizontalArrangement = Arrangement.End,
|
|
||||||
) {
|
|
||||||
TextButton(onClick = { confirmMarkAll = false }) {
|
|
||||||
Text(stringResource(R.string.pdf_builder_cancel))
|
|
||||||
}
|
|
||||||
TextButton(
|
TextButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
confirmMarkAll = false
|
confirmMarkAll = false
|
||||||
@@ -189,10 +171,13 @@ fun SwipeReviewScreen(
|
|||||||
) {
|
) {
|
||||||
Text(stringResource(R.string.review_mark_all))
|
Text(stringResource(R.string.review_mark_all))
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
dismissButton = {
|
||||||
|
TextButton(onClick = { confirmMarkAll = false }) {
|
||||||
|
Text(stringResource(R.string.pdf_builder_cancel))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +190,7 @@ private fun ReviewActions(
|
|||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
horizontalArrangement = Arrangement.spacedBy(48.dp),
|
horizontalArrangement = Arrangement.spacedBy(24.dp, Alignment.CenterHorizontally),
|
||||||
verticalAlignment = Alignment.Top,
|
verticalAlignment = Alignment.Top,
|
||||||
) {
|
) {
|
||||||
ReviewAction(
|
ReviewAction(
|
||||||
|
|||||||
@@ -1,14 +1,22 @@
|
|||||||
package com.kazier.mobile.ui.scan
|
package com.kazier.mobile.ui.scan
|
||||||
|
|
||||||
import android.Manifest.permission.CAMERA
|
import android.Manifest.permission.CAMERA
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
|
import android.net.Uri
|
||||||
|
import android.provider.Settings
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||||
import androidx.activity.result.contract.ActivityResultContracts.RequestPermission
|
import androidx.activity.result.contract.ActivityResultContracts.RequestPermission
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
@@ -26,6 +34,7 @@ import androidx.compose.runtime.LaunchedEffect
|
|||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@@ -34,6 +43,7 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.core.app.ActivityCompat
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
@@ -59,11 +69,18 @@ fun ScanFlowScreen(
|
|||||||
val pages by viewModel.pages.collectAsStateWithLifecycle()
|
val pages by viewModel.pages.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
val activity = context as? Activity
|
||||||
var hasCameraPermission by remember {
|
var hasCameraPermission by remember {
|
||||||
mutableStateOf(ContextCompat.checkSelfPermission(context, CAMERA) == PackageManager.PERMISSION_GRANTED)
|
mutableStateOf(ContextCompat.checkSelfPermission(context, CAMERA) == PackageManager.PERMISSION_GRANTED)
|
||||||
}
|
}
|
||||||
|
// Refus définitif (« ne plus demander ») : la demande système ne
|
||||||
|
// réapparaîtra plus — on propose les Réglages au lieu d'un cul-de-sac.
|
||||||
|
var permanentlyDenied by rememberSaveable { mutableStateOf(false) }
|
||||||
val launcher = rememberLauncherForActivityResult(RequestPermission()) { granted ->
|
val launcher = rememberLauncherForActivityResult(RequestPermission()) { granted ->
|
||||||
hasCameraPermission = granted
|
hasCameraPermission = granted
|
||||||
|
permanentlyDenied = !granted && activity?.let {
|
||||||
|
!ActivityCompat.shouldShowRequestPermissionRationale(it, CAMERA)
|
||||||
|
} ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retour écran précédent à l'export (observé une seule fois).
|
// Retour écran précédent à l'export (observé une seule fois).
|
||||||
@@ -85,7 +102,7 @@ fun ScanFlowScreen(
|
|||||||
// Confirmation avant de quitter le scanner quand des pages sont en cours :
|
// Confirmation avant de quitter le scanner quand des pages sont en cours :
|
||||||
// la flèche CAMERA et le back système feront tous deux valider par un
|
// la flèche CAMERA et le back système feront tous deux valider par un
|
||||||
// dialogue (sinon abandon = suppression des pages capturées).
|
// dialogue (sinon abandon = suppression des pages capturées).
|
||||||
var showExitConfirm by remember { mutableStateOf(false) }
|
var showExitConfirm by rememberSaveable { mutableStateOf(false) }
|
||||||
|
|
||||||
val requestExit: () -> Unit = {
|
val requestExit: () -> Unit = {
|
||||||
if (pages.isNotEmpty()) {
|
if (pages.isNotEmpty()) {
|
||||||
@@ -156,7 +173,15 @@ fun ScanFlowScreen(
|
|||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
CameraRationale(
|
CameraRationale(
|
||||||
|
permanentlyDenied = permanentlyDenied,
|
||||||
onGrant = { launcher.launch(CAMERA) },
|
onGrant = { launcher.launch(CAMERA) },
|
||||||
|
onOpenSettings = {
|
||||||
|
val intent = Intent(
|
||||||
|
Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
|
||||||
|
Uri.fromParts("package", context.packageName, null),
|
||||||
|
)
|
||||||
|
context.startActivity(intent)
|
||||||
|
},
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -172,9 +197,15 @@ fun ScanFlowScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (busy) {
|
if (busy) {
|
||||||
CircularProgressIndicator(
|
// Voile + spinner : bloque les interactions derrière le loader.
|
||||||
modifier = Modifier.align(Alignment.Center),
|
Box(
|
||||||
)
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(MaterialTheme.colorScheme.scrim.copy(alpha = 0.32f)),
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
|
) {
|
||||||
|
CircularProgressIndicator()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (showExitConfirm) {
|
if (showExitConfirm) {
|
||||||
@@ -199,20 +230,34 @@ fun ScanFlowScreen(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun CameraRationale(
|
private fun CameraRationale(
|
||||||
|
permanentlyDenied: Boolean,
|
||||||
onGrant: () -> Unit,
|
onGrant: () -> Unit,
|
||||||
|
onOpenSettings: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Box(modifier = modifier, contentAlignment = Alignment.Center) {
|
Box(modifier = modifier, contentAlignment = Alignment.Center) {
|
||||||
androidx.compose.foundation.layout.Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
Column(
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.spacedBy(16.dp),
|
||||||
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.scan_permission_rationale),
|
text = stringResource(R.string.scan_permission_rationale),
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
modifier = Modifier.padding(horizontal = 32.dp),
|
modifier = Modifier.padding(horizontal = 32.dp),
|
||||||
)
|
)
|
||||||
TextButton(onClick = onGrant, modifier = Modifier.padding(top = 16.dp)) {
|
if (permanentlyDenied) {
|
||||||
|
Button(onClick = onOpenSettings) {
|
||||||
|
Text(stringResource(R.string.scan_permission_open_settings))
|
||||||
|
}
|
||||||
|
TextButton(onClick = onGrant) {
|
||||||
|
Text(stringResource(R.string.scan_permission_grant))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Button(onClick = onGrant) {
|
||||||
Text(stringResource(R.string.scan_permission_grant))
|
Text(stringResource(R.string.scan_permission_grant))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.padding
|
|||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.itemsIndexed
|
import androidx.compose.foundation.lazy.itemsIndexed
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Add
|
import androidx.compose.material.icons.filled.Add
|
||||||
import androidx.compose.material.icons.filled.Delete
|
import androidx.compose.material.icons.filled.Delete
|
||||||
@@ -18,18 +17,14 @@ import androidx.compose.material.icons.filled.KeyboardArrowDown
|
|||||||
import androidx.compose.material.icons.filled.KeyboardArrowUp
|
import androidx.compose.material.icons.filled.KeyboardArrowUp
|
||||||
import androidx.compose.material.icons.filled.PictureAsPdf
|
import androidx.compose.material.icons.filled.PictureAsPdf
|
||||||
import androidx.compose.material.icons.filled.Save
|
import androidx.compose.material.icons.filled.Save
|
||||||
import androidx.compose.material3.Button
|
|
||||||
import androidx.compose.material3.Card
|
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.OutlinedButton
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.layout.ContentScale
|
import androidx.compose.ui.layout.ContentScale
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
@@ -38,6 +33,9 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|||||||
import coil.compose.AsyncImage
|
import coil.compose.AsyncImage
|
||||||
import com.kazier.mobile.R
|
import com.kazier.mobile.R
|
||||||
import com.kazier.mobile.data.local.entity.ScanPageEntity
|
import com.kazier.mobile.data.local.entity.ScanPageEntity
|
||||||
|
import com.kazier.mobile.ui.components.KazierCard
|
||||||
|
import com.kazier.mobile.ui.components.VerticalActionButton
|
||||||
|
import com.kazier.mobile.ui.theme.ThumbShape
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,32 +89,33 @@ fun SessionStage(
|
|||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(16.dp),
|
.padding(12.dp),
|
||||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
) {
|
) {
|
||||||
OutlinedButton(
|
VerticalActionButton(
|
||||||
|
icon = Icons.Filled.Add,
|
||||||
|
label = stringResource(R.string.scan_add_page),
|
||||||
onClick = viewModel::openCamera,
|
onClick = viewModel::openCamera,
|
||||||
|
enabled = true,
|
||||||
|
outlined = true,
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
) {
|
)
|
||||||
Icon(imageVector = Icons.Filled.Add, contentDescription = null)
|
VerticalActionButton(
|
||||||
Text(stringResource(R.string.scan_add_page), modifier = Modifier.padding(start = 4.dp))
|
icon = Icons.Filled.PictureAsPdf,
|
||||||
}
|
label = stringResource(R.string.scan_export_pdf),
|
||||||
OutlinedButton(
|
|
||||||
onClick = viewModel::exportPdf,
|
onClick = viewModel::exportPdf,
|
||||||
modifier = Modifier.weight(1f),
|
|
||||||
enabled = pages.isNotEmpty(),
|
enabled = pages.isNotEmpty(),
|
||||||
) {
|
outlined = true,
|
||||||
Icon(imageVector = Icons.Filled.PictureAsPdf, contentDescription = null)
|
modifier = Modifier.weight(1f),
|
||||||
Text(stringResource(R.string.scan_export_pdf), modifier = Modifier.padding(start = 4.dp))
|
)
|
||||||
}
|
VerticalActionButton(
|
||||||
Button(
|
icon = Icons.Filled.Save,
|
||||||
|
label = stringResource(R.string.scan_export),
|
||||||
onClick = viewModel::export,
|
onClick = viewModel::export,
|
||||||
modifier = Modifier.weight(1f),
|
|
||||||
enabled = pages.isNotEmpty(),
|
enabled = pages.isNotEmpty(),
|
||||||
) {
|
outlined = false,
|
||||||
Icon(imageVector = Icons.Filled.Save, contentDescription = null)
|
modifier = Modifier.weight(1f),
|
||||||
Text(stringResource(R.string.scan_export), modifier = Modifier.padding(start = 4.dp))
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,18 +130,18 @@ private fun PageCard(
|
|||||||
onMoveDown: () -> Unit,
|
onMoveDown: () -> Unit,
|
||||||
onDelete: () -> Unit,
|
onDelete: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Card(modifier = Modifier.fillMaxWidth()) {
|
KazierCard(modifier = Modifier.fillMaxWidth()) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.padding(8.dp),
|
modifier = Modifier.padding(8.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
AsyncImage(
|
AsyncImage(
|
||||||
model = File(page.tempUri),
|
model = File(page.tempUri),
|
||||||
contentDescription = null,
|
contentDescription = stringResource(R.string.scan_pages_count, index + 1),
|
||||||
contentScale = ContentScale.Crop,
|
contentScale = ContentScale.Crop,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(64.dp)
|
.size(64.dp)
|
||||||
.clip(RoundedCornerShape(8.dp)),
|
.clip(ThumbShape),
|
||||||
)
|
)
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.kazier.mobile.ui.search
|
package com.kazier.mobile.ui.search
|
||||||
|
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
import androidx.compose.foundation.BorderStroke
|
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
@@ -18,15 +17,14 @@ import androidx.compose.foundation.layout.width
|
|||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.LazyRow
|
import androidx.compose.foundation.lazy.LazyRow
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.text.KeyboardActions
|
||||||
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Clear
|
||||||
import androidx.compose.material.icons.filled.Close
|
import androidx.compose.material.icons.filled.Close
|
||||||
import androidx.compose.material.icons.filled.Search
|
import androidx.compose.material.icons.filled.Search
|
||||||
import androidx.compose.material3.Card
|
|
||||||
import androidx.compose.material3.CardDefaults
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.FilterChip
|
import androidx.compose.material3.FilterChip
|
||||||
import androidx.compose.material3.FilterChipDefaults
|
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
@@ -45,9 +43,10 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.text.input.ImeAction
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -65,13 +64,16 @@ import com.kazier.mobile.ui.components.DeleteWarningDialog
|
|||||||
import com.kazier.mobile.ui.components.FileCategoryIcon
|
import com.kazier.mobile.ui.components.FileCategoryIcon
|
||||||
import com.kazier.mobile.ui.components.FilePendingReviewBadge
|
import com.kazier.mobile.ui.components.FilePendingReviewBadge
|
||||||
import com.kazier.mobile.ui.components.FileSyncStatusIcon
|
import com.kazier.mobile.ui.components.FileSyncStatusIcon
|
||||||
|
import com.kazier.mobile.ui.components.KazierCard
|
||||||
import com.kazier.mobile.ui.components.MoveFolderPickerDialog
|
import com.kazier.mobile.ui.components.MoveFolderPickerDialog
|
||||||
import com.kazier.mobile.ui.components.SelectionState
|
import com.kazier.mobile.ui.components.SelectionState
|
||||||
import com.kazier.mobile.ui.components.SelectionStatusIcon
|
import com.kazier.mobile.ui.components.SelectionStatusIcon
|
||||||
import com.kazier.mobile.ui.components.ServerStatusBadge
|
import com.kazier.mobile.ui.components.ServerStatusBadge
|
||||||
import com.kazier.mobile.ui.components.SyncStatusAction
|
import com.kazier.mobile.ui.components.SyncStatusAction
|
||||||
import com.kazier.mobile.ui.components.color
|
import com.kazier.mobile.ui.components.formatFileSize
|
||||||
|
import com.kazier.mobile.ui.components.label
|
||||||
import com.kazier.mobile.ui.components.icon
|
import com.kazier.mobile.ui.components.icon
|
||||||
|
import com.kazier.mobile.ui.components.color
|
||||||
import com.kazier.mobile.ui.components.rememberSelectionState
|
import com.kazier.mobile.ui.components.rememberSelectionState
|
||||||
import com.kazier.mobile.ui.components.reviewDelete
|
import com.kazier.mobile.ui.components.reviewDelete
|
||||||
import com.kazier.mobile.ui.navigation.FloatingNavBar
|
import com.kazier.mobile.ui.navigation.FloatingNavBar
|
||||||
@@ -100,10 +102,10 @@ fun SearchScreen(
|
|||||||
var showMoveDialog by rememberSaveable { mutableStateOf(false) }
|
var showMoveDialog by rememberSaveable { mutableStateOf(false) }
|
||||||
var showDeleteWarning by rememberSaveable { mutableStateOf(false) }
|
var showDeleteWarning by rememberSaveable { mutableStateOf(false) }
|
||||||
var showDeleteConfirm by rememberSaveable { mutableStateOf(false) }
|
var showDeleteConfirm by rememberSaveable { mutableStateOf(false) }
|
||||||
var pendingDeleteMode by remember { mutableStateOf<FileDeleter.DeleteMode?>(null) }
|
var pendingDeleteMode by rememberSaveable { mutableStateOf<FileDeleter.DeleteMode?>(null) }
|
||||||
var pendingDeleteReview by remember { mutableStateOf<DeleteReview?>(null) }
|
var pendingDeleteReview by rememberSaveable { mutableStateOf<DeleteReview?>(null) }
|
||||||
val snackbarHostState = remember { SnackbarHostState() }
|
val snackbarHostState = remember { SnackbarHostState() }
|
||||||
val deletedLabel = stringResource(R.string.delete)
|
val deletedLabel = stringResource(R.string.delete_success)
|
||||||
|
|
||||||
LaunchedEffect(moveError) {
|
LaunchedEffect(moveError) {
|
||||||
val message = moveError
|
val message = moveError
|
||||||
@@ -274,6 +276,7 @@ private fun SearchContent(
|
|||||||
onOpenDocument: (String) -> Unit,
|
onOpenDocument: (String) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
val keyboardController = LocalSoftwareKeyboardController.current
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
@@ -286,9 +289,23 @@ private fun SearchContent(
|
|||||||
onValueChange = onQueryChange,
|
onValueChange = onQueryChange,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
leadingIcon = { Icon(Icons.Filled.Search, contentDescription = null) },
|
leadingIcon = { Icon(Icons.Filled.Search, contentDescription = null) },
|
||||||
|
trailingIcon = {
|
||||||
|
if (uiState.query.isNotBlank() && !selection.active) {
|
||||||
|
IconButton(onClick = { onQueryChange("") }) {
|
||||||
|
Icon(
|
||||||
|
Icons.Filled.Clear,
|
||||||
|
contentDescription = stringResource(R.string.search_clear),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
placeholder = { Text(stringResource(R.string.search_hint)) },
|
placeholder = { Text(stringResource(R.string.search_hint)) },
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
enabled = !selection.active,
|
enabled = !selection.active,
|
||||||
|
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),
|
||||||
|
keyboardActions = KeyboardActions(
|
||||||
|
onSearch = { keyboardController?.hide() },
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
LazyRow(
|
LazyRow(
|
||||||
@@ -307,7 +324,7 @@ private fun SearchContent(
|
|||||||
}
|
}
|
||||||
items(FileCategory.entries, key = { it.name }) { category ->
|
items(FileCategory.entries, key = { it.name }) { category ->
|
||||||
CategoryChip(
|
CategoryChip(
|
||||||
label = categoryLabel(category),
|
label = category.label(),
|
||||||
selected = uiState.selectedCategory == category.dbValue,
|
selected = uiState.selectedCategory == category.dbValue,
|
||||||
enabled = !selection.active,
|
enabled = !selection.active,
|
||||||
onClick = { onCategorySelect(category.dbValue) },
|
onClick = { onCategorySelect(category.dbValue) },
|
||||||
@@ -342,29 +359,14 @@ private fun CategoryChip(
|
|||||||
{
|
{
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = cat.icon,
|
imageVector = cat.icon,
|
||||||
contentDescription = null,
|
contentDescription = cat.label(),
|
||||||
tint = cat.color,
|
tint = cat.color(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
colors = FilterChipDefaults.filterChipColors(
|
|
||||||
containerColor = Color(0xFFF7F8FA),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Libellé français de la catégorie (store = enum.name, affichage = label localisé). */
|
|
||||||
@Composable
|
|
||||||
private fun categoryLabel(category: FileCategory): String = when (category) {
|
|
||||||
FileCategory.PDF -> stringResource(R.string.category_pdf)
|
|
||||||
FileCategory.OFFICE -> stringResource(R.string.category_office)
|
|
||||||
FileCategory.IMAGE -> stringResource(R.string.category_image)
|
|
||||||
FileCategory.TEXT -> stringResource(R.string.category_text)
|
|
||||||
FileCategory.VIDEO -> stringResource(R.string.category_video)
|
|
||||||
FileCategory.AUDIO -> stringResource(R.string.category_audio)
|
|
||||||
FileCategory.OTHER -> stringResource(R.string.category_other)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SearchResults(
|
private fun SearchResults(
|
||||||
uiState: SearchUiState,
|
uiState: SearchUiState,
|
||||||
@@ -413,6 +415,15 @@ private fun SearchResults(
|
|||||||
modifier = Modifier.padding(top = 4.dp),
|
modifier = Modifier.padding(top = 4.dp),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
item(key = "results-count") {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.search_results_count, uiState.results.size),
|
||||||
|
style = MaterialTheme.typography.labelMedium,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
modifier = Modifier.padding(top = 4.dp),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
items(uiState.results, key = { it.resourceId }) { file ->
|
items(uiState.results, key = { it.resourceId }) { file ->
|
||||||
SearchResultCard(
|
SearchResultCard(
|
||||||
@@ -434,11 +445,7 @@ private fun SearchResultCard(
|
|||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val selected = file.resourceId in selection.ids
|
val selected = file.resourceId in selection.ids
|
||||||
Card(
|
KazierCard(
|
||||||
colors = CardDefaults.cardColors(containerColor = Color(0xFFF7F8FA)),
|
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp),
|
|
||||||
border = BorderStroke(1.dp, Color(0xFFEAEAEA)),
|
|
||||||
shape = RoundedCornerShape(10.dp),
|
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.combinedClickable(
|
.combinedClickable(
|
||||||
@@ -466,9 +473,11 @@ private fun SearchResultCard(
|
|||||||
)
|
)
|
||||||
Spacer(Modifier.height(2.dp))
|
Spacer(Modifier.height(2.dp))
|
||||||
Text(
|
Text(
|
||||||
text = file.extension?.let { it.uppercase(Locale.getDefault()) } ?: formatSize(file.size),
|
text = resultSubtitle(file),
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Spacer(Modifier.width(12.dp))
|
Spacer(Modifier.width(12.dp))
|
||||||
@@ -480,11 +489,6 @@ private fun SearchResultCard(
|
|||||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
) {
|
) {
|
||||||
FilePendingReviewBadge(file = file)
|
FilePendingReviewBadge(file = file)
|
||||||
Text(
|
|
||||||
text = formatSize(file.size),
|
|
||||||
style = MaterialTheme.typography.labelMedium,
|
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
)
|
|
||||||
FileSyncStatusIcon(file = file, size = 18.dp)
|
FileSyncStatusIcon(file = file, size = 18.dp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -492,15 +496,10 @@ private fun SearchResultCard(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Sous-titre résultat : `EXT · taille` si l'extension existe, sinon la taille seule. */
|
||||||
@Composable
|
@Composable
|
||||||
private fun formatSize(bytes: Long): String {
|
private fun resultSubtitle(file: FileEntity): String {
|
||||||
if (bytes < 1_024) {
|
val size = formatFileSize(file.size)
|
||||||
return "$bytes ${stringResource(R.string.unit_bytes)}"
|
val ext = file.extension?.takeIf { it.isNotBlank() }?.uppercase(Locale.getDefault())
|
||||||
}
|
return if (ext != null) "$ext · $size" else size
|
||||||
if (bytes < 1_024 * 1_024) {
|
|
||||||
val kb = bytes / 1_024f
|
|
||||||
return String.format(Locale.getDefault(), "%.1f %s", kb, stringResource(R.string.unit_kilobytes))
|
|
||||||
}
|
|
||||||
val mb = bytes / (1_024f * 1_024f)
|
|
||||||
return String.format(Locale.getDefault(), "%.1f %s", mb, stringResource(R.string.unit_megabytes))
|
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
package com.kazier.mobile.ui.settings
|
package com.kazier.mobile.ui.settings
|
||||||
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.horizontalScroll
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.imePadding
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
@@ -16,7 +19,6 @@ import androidx.compose.material.icons.Icons
|
|||||||
import androidx.compose.material.icons.filled.DarkMode
|
import androidx.compose.material.icons.filled.DarkMode
|
||||||
import androidx.compose.material.icons.filled.Folder
|
import androidx.compose.material.icons.filled.Folder
|
||||||
import androidx.compose.material.icons.filled.Person
|
import androidx.compose.material.icons.filled.Person
|
||||||
import androidx.compose.material3.Button
|
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.FilterChip
|
import androidx.compose.material3.FilterChip
|
||||||
@@ -40,17 +42,17 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.input.ImeAction
|
import androidx.compose.ui.text.input.ImeAction
|
||||||
import androidx.compose.ui.text.input.KeyboardType
|
import androidx.compose.ui.text.input.KeyboardType
|
||||||
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.kazier.mobile.R
|
import com.kazier.mobile.R
|
||||||
import com.kazier.mobile.domain.ThemePreference
|
import com.kazier.mobile.domain.ThemePreference
|
||||||
import com.kazier.mobile.features.connection.ConnectionStatusViewModel
|
import com.kazier.mobile.features.connection.ConnectionStatusViewModel
|
||||||
|
import com.kazier.mobile.features.connection.ServerConnectionStatus
|
||||||
import com.kazier.mobile.features.sync.SyncViewModel
|
import com.kazier.mobile.features.sync.SyncViewModel
|
||||||
import com.kazier.mobile.ui.auth.AuthState
|
import com.kazier.mobile.ui.auth.AuthState
|
||||||
import com.kazier.mobile.ui.auth.AuthViewModel
|
import com.kazier.mobile.ui.auth.AuthViewModel
|
||||||
|
import com.kazier.mobile.ui.auth.LoginForm
|
||||||
import com.kazier.mobile.ui.auth.authErrorResFor
|
import com.kazier.mobile.ui.auth.authErrorResFor
|
||||||
import com.kazier.mobile.ui.components.ServerStatusBadge
|
import com.kazier.mobile.ui.components.ServerStatusBadge
|
||||||
import com.kazier.mobile.ui.components.SyncStatusAction
|
import com.kazier.mobile.ui.components.SyncStatusAction
|
||||||
@@ -100,6 +102,7 @@ fun SettingsScreen(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(padding)
|
.padding(padding)
|
||||||
|
.imePadding()
|
||||||
.verticalScroll(rememberScrollState()),
|
.verticalScroll(rememberScrollState()),
|
||||||
) {
|
) {
|
||||||
HorizontalDivider()
|
HorizontalDivider()
|
||||||
@@ -190,7 +193,7 @@ fun SettingsScreen(
|
|||||||
SettingsRow(
|
SettingsRow(
|
||||||
icon = { Icon(Icons.Filled.Person, contentDescription = null) },
|
icon = { Icon(Icons.Filled.Person, contentDescription = null) },
|
||||||
title = stringResource(R.string.settings_connected_as, state.user.username),
|
title = stringResource(R.string.settings_connected_as, state.user.username),
|
||||||
subtitle = stringResource(R.string.settings),
|
subtitle = serverStatusLabel(connectionStatus),
|
||||||
trailing = {
|
trailing = {
|
||||||
TextButton(onClick = authViewModel::signOutToLocal) {
|
TextButton(onClick = authViewModel::signOutToLocal) {
|
||||||
Text(stringResource(R.string.settings_disconnect))
|
Text(stringResource(R.string.settings_disconnect))
|
||||||
@@ -201,59 +204,20 @@ fun SettingsScreen(
|
|||||||
AuthState.Loading -> Unit
|
AuthState.Loading -> Unit
|
||||||
else -> {
|
else -> {
|
||||||
SettingsSectionTitle(stringResource(R.string.settings_connect))
|
SettingsSectionTitle(stringResource(R.string.settings_connect))
|
||||||
OutlinedTextField(
|
LoginForm(
|
||||||
value = username,
|
username = username,
|
||||||
onValueChange = { username = it },
|
onUsernameChange = { username = it },
|
||||||
label = { Text(stringResource(R.string.login_username)) },
|
password = password,
|
||||||
singleLine = true,
|
onPasswordChange = { password = it },
|
||||||
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next),
|
submitting = loginUi.isSubmitting,
|
||||||
|
errorRes = loginUi.error?.let(::authErrorResFor),
|
||||||
|
submitLabel = stringResource(R.string.settings_connect),
|
||||||
|
onSubmit = { authViewModel.signIn(username, password) },
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 16.dp),
|
.padding(horizontal = 16.dp),
|
||||||
)
|
)
|
||||||
Spacer(Modifier.height(12.dp))
|
Spacer(Modifier.height(12.dp))
|
||||||
OutlinedTextField(
|
|
||||||
value = password,
|
|
||||||
onValueChange = { password = it },
|
|
||||||
label = { Text(stringResource(R.string.login_password)) },
|
|
||||||
singleLine = true,
|
|
||||||
visualTransformation = PasswordVisualTransformation(),
|
|
||||||
keyboardOptions = KeyboardOptions(
|
|
||||||
keyboardType = KeyboardType.Password,
|
|
||||||
imeAction = ImeAction.Done,
|
|
||||||
),
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(horizontal = 16.dp),
|
|
||||||
)
|
|
||||||
Spacer(Modifier.height(12.dp))
|
|
||||||
Button(
|
|
||||||
onClick = { authViewModel.signIn(username, password) },
|
|
||||||
enabled = !loginUi.isSubmitting,
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(horizontal = 16.dp),
|
|
||||||
) {
|
|
||||||
if (loginUi.isSubmitting) {
|
|
||||||
CircularProgressIndicator(
|
|
||||||
modifier = Modifier.size(20.dp),
|
|
||||||
strokeWidth = 2.dp,
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
Text(stringResource(R.string.settings_connect))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
loginUi.error?.let { error ->
|
|
||||||
Text(
|
|
||||||
text = stringResource(authErrorResFor(error)),
|
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
|
||||||
color = MaterialTheme.colorScheme.error,
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,7 +232,11 @@ private fun ThemeSelector(
|
|||||||
selected: ThemePreference,
|
selected: ThemePreference,
|
||||||
onSelect: (ThemePreference) -> Unit,
|
onSelect: (ThemePreference) -> Unit,
|
||||||
) {
|
) {
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
|
modifier = Modifier.horizontalScroll(rememberScrollState()),
|
||||||
|
) {
|
||||||
ThemeChip(
|
ThemeChip(
|
||||||
label = stringResource(R.string.settings_theme_system),
|
label = stringResource(R.string.settings_theme_system),
|
||||||
selected = selected == ThemePreference.SYSTEM,
|
selected = selected == ThemePreference.SYSTEM,
|
||||||
@@ -346,3 +314,14 @@ private fun SettingsSectionTitle(title: String) {
|
|||||||
modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),
|
modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Libellé du statut serveur affiché sous le compte connecté. */
|
||||||
|
@Composable
|
||||||
|
private fun serverStatusLabel(status: ServerConnectionStatus): String = stringResource(
|
||||||
|
when (status) {
|
||||||
|
ServerConnectionStatus.Checking -> R.string.status_checking
|
||||||
|
ServerConnectionStatus.Online -> R.string.status_online
|
||||||
|
ServerConnectionStatus.Offline -> R.string.status_offline
|
||||||
|
ServerConnectionStatus.Local -> R.string.status_local
|
||||||
|
},
|
||||||
|
)
|
||||||
@@ -1,23 +1,25 @@
|
|||||||
package com.kazier.mobile.ui.share
|
package com.kazier.mobile.ui.share
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.KeyboardArrowDown
|
import androidx.compose.material.icons.filled.Check
|
||||||
import androidx.compose.material.icons.filled.Share
|
import androidx.compose.material.icons.filled.Share
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
import androidx.compose.material3.DropdownMenu
|
|
||||||
import androidx.compose.material3.DropdownMenuItem
|
import androidx.compose.material3.DropdownMenuItem
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.ExposedDropdownMenuBox
|
||||||
|
import androidx.compose.material3.ExposedDropdownMenuDefaults
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.MenuAnchorType
|
||||||
import androidx.compose.material3.ModalBottomSheet
|
import androidx.compose.material3.ModalBottomSheet
|
||||||
import androidx.compose.material3.OutlinedButton
|
import androidx.compose.material3.OutlinedButton
|
||||||
import androidx.compose.material3.OutlinedTextField
|
import androidx.compose.material3.OutlinedTextField
|
||||||
@@ -27,14 +29,16 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.kazier.mobile.R
|
import com.kazier.mobile.R
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
|
|
||||||
/** Niveau d'accès sélectionnable — miroir de `ShareAccessLevel`. */
|
/** Niveau d'accès sélectionnable — miroir de `ShareAccessLevel`. */
|
||||||
private data class AccessOption(
|
private data class AccessOption(
|
||||||
@@ -58,12 +62,18 @@ fun ShareBottomSheet(
|
|||||||
error: String?,
|
error: String?,
|
||||||
enqueued: Boolean,
|
enqueued: Boolean,
|
||||||
) {
|
) {
|
||||||
var username by remember { mutableStateOf("") }
|
var username by rememberSaveable { mutableStateOf("") }
|
||||||
var access by remember { mutableStateOf(ShareAccessLevel.VIEWER) }
|
var access by rememberSaveable { mutableStateOf(ShareAccessLevel.VIEWER) }
|
||||||
|
// Confirmation visible avant fermeture : fini l'auto-dismiss silencieux.
|
||||||
|
var justShared by rememberSaveable { mutableStateOf(false) }
|
||||||
val sheetState = rememberModalBottomSheetState()
|
val sheetState = rememberModalBottomSheetState()
|
||||||
|
|
||||||
LaunchedEffect(enqueued) {
|
LaunchedEffect(enqueued) {
|
||||||
if (enqueued) onDismiss()
|
if (enqueued && !justShared) {
|
||||||
|
justShared = true
|
||||||
|
delay(1_200)
|
||||||
|
onDismiss()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ModalBottomSheet(
|
ModalBottomSheet(
|
||||||
@@ -94,6 +104,7 @@ fun ShareBottomSheet(
|
|||||||
onValueChange = { username = it },
|
onValueChange = { username = it },
|
||||||
label = { Text(stringResource(R.string.share_username_hint)) },
|
label = { Text(stringResource(R.string.share_username_hint)) },
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
|
enabled = !justShared,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -105,6 +116,7 @@ fun ShareBottomSheet(
|
|||||||
AccessDropdown(
|
AccessDropdown(
|
||||||
selected = access,
|
selected = access,
|
||||||
onSelect = { access = it },
|
onSelect = { access = it },
|
||||||
|
enabled = !justShared,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -118,9 +130,29 @@ fun ShareBottomSheet(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (justShared) {
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.Center,
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Filled.Check,
|
||||||
|
contentDescription = null,
|
||||||
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
|
)
|
||||||
|
Spacer(Modifier.width(8.dp))
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.share_enqueued),
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
color = MaterialTheme.colorScheme.primary,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Button(
|
Button(
|
||||||
onClick = { onShare(username.trim(), access) },
|
onClick = { onShare(username.trim(), access) },
|
||||||
enabled = username.isNotBlank() && !sharing,
|
enabled = username.isNotBlank() && !sharing && !justShared,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
) {
|
) {
|
||||||
if (sharing) {
|
if (sharing) {
|
||||||
@@ -136,7 +168,7 @@ fun ShareBottomSheet(
|
|||||||
}
|
}
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
onClick = onDismiss,
|
onClick = onDismiss,
|
||||||
enabled = !sharing,
|
enabled = !sharing && !justShared,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
) {
|
) {
|
||||||
Text(stringResource(R.string.share_cancel))
|
Text(stringResource(R.string.share_cancel))
|
||||||
@@ -145,32 +177,35 @@ fun ShareBottomSheet(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
private fun AccessDropdown(
|
private fun AccessDropdown(
|
||||||
selected: String,
|
selected: String,
|
||||||
onSelect: (String) -> Unit,
|
onSelect: (String) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
|
enabled: Boolean = true,
|
||||||
) {
|
) {
|
||||||
var expanded by remember { mutableStateOf(false) }
|
var expanded by rememberSaveable { mutableStateOf(false) }
|
||||||
val selectedLabel = ACCESS_OPTIONS.firstOrNull { it.value == selected }?.labelRes
|
val selectedLabel = ACCESS_OPTIONS.firstOrNull { it.value == selected }?.labelRes
|
||||||
?: ACCESS_OPTIONS.first().labelRes
|
?: ACCESS_OPTIONS.first().labelRes
|
||||||
|
|
||||||
Box(modifier = modifier) {
|
ExposedDropdownMenuBox(
|
||||||
OutlinedButton(
|
expanded = expanded,
|
||||||
onClick = { expanded = true },
|
onExpandedChange = { if (enabled) expanded = it },
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = modifier,
|
||||||
) {
|
) {
|
||||||
Text(
|
OutlinedTextField(
|
||||||
text = stringResource(selectedLabel),
|
value = stringResource(selectedLabel),
|
||||||
modifier = Modifier.weight(1f),
|
onValueChange = {},
|
||||||
textAlign = TextAlign.Start,
|
readOnly = true,
|
||||||
|
enabled = enabled,
|
||||||
|
trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) },
|
||||||
|
colors = ExposedDropdownMenuDefaults.outlinedTextFieldColors(),
|
||||||
|
modifier = Modifier
|
||||||
|
.menuAnchor(MenuAnchorType.PrimaryNotEditable)
|
||||||
|
.fillMaxWidth(),
|
||||||
)
|
)
|
||||||
Icon(
|
ExposedDropdownMenu(
|
||||||
imageVector = Icons.Filled.KeyboardArrowDown,
|
|
||||||
contentDescription = null,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
DropdownMenu(
|
|
||||||
expanded = expanded,
|
expanded = expanded,
|
||||||
onDismissRequest = { expanded = false },
|
onDismissRequest = { expanded = false },
|
||||||
) {
|
) {
|
||||||
@@ -181,6 +216,7 @@ private fun AccessDropdown(
|
|||||||
onSelect(option.value)
|
onSelect(option.value)
|
||||||
expanded = false
|
expanded = false
|
||||||
},
|
},
|
||||||
|
contentPadding = ExposedDropdownMenuDefaults.ItemContentPadding,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,31 @@ package com.kazier.mobile.ui.theme
|
|||||||
|
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
// Marque — inchangée (contrat visuel existant).
|
||||||
val BrandBlue = Color(0xFF1A73E8)
|
val BrandBlue = Color(0xFF1A73E8)
|
||||||
|
val BrandBlueDark = Color(0xFF004A9E)
|
||||||
val BondBlueLight = Color(0xFFD2E3FC)
|
val BondBlueLight = Color(0xFFD2E3FC)
|
||||||
|
val BondBlueContainerDark = Color(0xFF004A77)
|
||||||
val InactiveGray = Color(0xFF6B7280)
|
val InactiveGray = Color(0xFF6B7280)
|
||||||
|
|
||||||
|
// Cartes / bordures — déclinaison light + dark (ne plus hardcoder en UI).
|
||||||
val CardBackground = Color(0xFFF7F8FA)
|
val CardBackground = Color(0xFFF7F8FA)
|
||||||
|
val CardBackgroundDark = Color(0xFF1E1F22)
|
||||||
val CardBorder = Color(0xFFEAEAEA)
|
val CardBorder = Color(0xFFEAEAEA)
|
||||||
|
val CardBorderDark = Color(0xFF333639)
|
||||||
|
|
||||||
|
// Sémantique métier — paires light/dark lisibles sur fond clair ET sombre.
|
||||||
|
val SuccessLight = Color(0xFF2E7D32)
|
||||||
|
val SuccessDark = Color(0xFF81C784)
|
||||||
|
val WarningLight = Color(0xFFB26A00)
|
||||||
|
val WarningDark = Color(0xFFFFB74D)
|
||||||
|
val InfoLight = Color(0xFF1565C0)
|
||||||
|
val InfoDark = Color(0xFF90CAF9)
|
||||||
|
val ErrorLight = Color(0xFFB3261E)
|
||||||
|
val ErrorDark = Color(0xFFF2B8B5)
|
||||||
|
|
||||||
|
// Pastilles sync / serveur — versions lisibles en dark (texte blanc exclu).
|
||||||
|
val SyncingLight = Color(0xFF1E88E5)
|
||||||
|
val SyncingDark = Color(0xFF90CAF9)
|
||||||
|
val PendingLight = Color(0xFFB26A00)
|
||||||
|
val PendingDark = Color(0xFFFFB74D)
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.kazier.mobile.ui.theme
|
||||||
|
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
|
/** Espacements et élévations partagés — évite les valeurs magiques dispersées. */
|
||||||
|
object KazierDimens {
|
||||||
|
val SpacingXxs = 2.dp
|
||||||
|
val SpacingXs = 4.dp
|
||||||
|
val SpacingSm = 8.dp
|
||||||
|
val SpacingMd = 12.dp
|
||||||
|
val SpacingLg = 16.dp
|
||||||
|
val SpacingXl = 20.dp
|
||||||
|
|
||||||
|
val CardElevation = 1.dp
|
||||||
|
val NavElevation = 8.dp
|
||||||
|
val CardBorderWidth = 1.dp
|
||||||
|
|
||||||
|
val ListMaxWidth = 400.dp
|
||||||
|
val DialogListMaxHeight = 360.dp
|
||||||
|
val MinTouchTarget = 48.dp
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.kazier.mobile.ui.theme
|
||||||
|
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.material3.Shapes
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
|
/** Rayons unifiés : cartes 12dp, sheets/dialogs 20dp, pills 28dp. */
|
||||||
|
val KazierShapes = Shapes(
|
||||||
|
extraSmall = RoundedCornerShape(8.dp),
|
||||||
|
small = RoundedCornerShape(12.dp),
|
||||||
|
medium = RoundedCornerShape(20.dp),
|
||||||
|
large = RoundedCornerShape(28.dp),
|
||||||
|
extraLarge = RoundedCornerShape(30.dp),
|
||||||
|
)
|
||||||
|
|
||||||
|
/** Formes nommées pour les usages récurrents (listes, nav, badges). */
|
||||||
|
val ListCardShape = RoundedCornerShape(12.dp)
|
||||||
|
val SheetShape = RoundedCornerShape(20.dp)
|
||||||
|
val PillShape = RoundedCornerShape(percent = 50)
|
||||||
|
val NavPillShape = RoundedCornerShape(30.dp)
|
||||||
|
val NavItemShape = RoundedCornerShape(20.dp)
|
||||||
|
val ThumbShape = RoundedCornerShape(8.dp)
|
||||||
@@ -4,18 +4,61 @@ import androidx.compose.material3.MaterialTheme
|
|||||||
import androidx.compose.material3.darkColorScheme
|
import androidx.compose.material3.darkColorScheme
|
||||||
import androidx.compose.material3.lightColorScheme
|
import androidx.compose.material3.lightColorScheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import com.kazier.mobile.domain.ThemePreference
|
import com.kazier.mobile.domain.ThemePreference
|
||||||
|
|
||||||
private val LightColors = lightColorScheme(
|
private val LightColors = lightColorScheme(
|
||||||
primary = BrandBlue,
|
primary = BrandBlue,
|
||||||
onPrimary = androidx.compose.ui.graphics.Color.White,
|
onPrimary = Color.White,
|
||||||
|
primaryContainer = BondBlueLight,
|
||||||
|
onPrimaryContainer = BrandBlueDark,
|
||||||
secondary = InactiveGray,
|
secondary = InactiveGray,
|
||||||
|
onSecondary = Color.White,
|
||||||
|
secondaryContainer = CardBackground,
|
||||||
|
onSecondaryContainer = Color(0xFF1A1C1E),
|
||||||
|
tertiary = SuccessLight,
|
||||||
|
onTertiary = Color.White,
|
||||||
|
tertiaryContainer = Color(0xFFE3F2E6),
|
||||||
|
onTertiaryContainer = Color(0xFF1B4D1F),
|
||||||
|
error = ErrorLight,
|
||||||
|
onError = Color.White,
|
||||||
|
errorContainer = Color(0xFFF9DEDC),
|
||||||
|
onErrorContainer = Color(0xFF410E0B),
|
||||||
|
surface = Color(0xFFFFFBFE),
|
||||||
|
onSurface = Color(0xFF1A1C1E),
|
||||||
surfaceVariant = CardBackground,
|
surfaceVariant = CardBackground,
|
||||||
|
onSurfaceVariant = Color(0xFF43474E),
|
||||||
|
surfaceContainerLowest = Color.White,
|
||||||
|
surfaceContainerLow = CardBackground,
|
||||||
|
outline = Color(0xFFC3C6CF),
|
||||||
|
outlineVariant = CardBorder,
|
||||||
)
|
)
|
||||||
|
|
||||||
private val DarkColors = darkColorScheme(
|
private val DarkColors = darkColorScheme(
|
||||||
primary = BondBlueLight,
|
primary = BondBlueLight,
|
||||||
onPrimary = androidx.compose.ui.graphics.Color.Black,
|
onPrimary = Color(0xFF001D35),
|
||||||
|
primaryContainer = BondBlueContainerDark,
|
||||||
|
onPrimaryContainer = BondBlueLight,
|
||||||
|
secondary = Color(0xFF9AA0AA),
|
||||||
|
onSecondary = Color(0xFF1A1C1E),
|
||||||
|
secondaryContainer = CardBackgroundDark,
|
||||||
|
onSecondaryContainer = Color(0xFFE2E2E6),
|
||||||
|
tertiary = SuccessDark,
|
||||||
|
onTertiary = Color(0xFF00330A),
|
||||||
|
tertiaryContainer = Color(0xFF1B4D1F),
|
||||||
|
onTertiaryContainer = Color(0xFFE3F2E6),
|
||||||
|
error = ErrorDark,
|
||||||
|
onError = Color(0xFF601410),
|
||||||
|
errorContainer = Color(0xFF8C1D18),
|
||||||
|
onErrorContainer = Color(0xFFF9DEDC),
|
||||||
|
surface = Color(0xFF141218),
|
||||||
|
onSurface = Color(0xFFE6E0E9),
|
||||||
|
surfaceVariant = CardBackgroundDark,
|
||||||
|
onSurfaceVariant = Color(0xFFCAC4D0),
|
||||||
|
surfaceContainerLowest = Color(0xFF0F0D13),
|
||||||
|
surfaceContainerLow = CardBackgroundDark,
|
||||||
|
outline = Color(0xFF4A4E57),
|
||||||
|
outlineVariant = CardBorderDark,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -39,6 +82,7 @@ fun KazierTheme(
|
|||||||
MaterialTheme(
|
MaterialTheme(
|
||||||
colorScheme = if (darkTheme) DarkColors else LightColors,
|
colorScheme = if (darkTheme) DarkColors else LightColors,
|
||||||
typography = Typography,
|
typography = Typography,
|
||||||
|
shapes = KazierShapes,
|
||||||
content = content,
|
content = content,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,16 +6,46 @@ import androidx.compose.ui.text.font.FontWeight
|
|||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
val Typography = Typography(
|
val Typography = Typography(
|
||||||
bodyLarge = TextStyle(
|
headlineSmall = TextStyle(
|
||||||
fontSize = 16.sp,
|
fontSize = 20.sp,
|
||||||
lineHeight = 24.sp,
|
lineHeight = 28.sp,
|
||||||
fontWeight = FontWeight.Normal,
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
),
|
||||||
|
headlineMedium = TextStyle(
|
||||||
|
fontSize = 24.sp,
|
||||||
|
lineHeight = 32.sp,
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
),
|
||||||
|
titleSmall = TextStyle(
|
||||||
|
fontSize = 14.sp,
|
||||||
|
lineHeight = 20.sp,
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
),
|
),
|
||||||
titleMedium = TextStyle(
|
titleMedium = TextStyle(
|
||||||
fontSize = 16.sp,
|
fontSize = 16.sp,
|
||||||
lineHeight = 24.sp,
|
lineHeight = 24.sp,
|
||||||
fontWeight = FontWeight.SemiBold,
|
fontWeight = FontWeight.SemiBold,
|
||||||
),
|
),
|
||||||
|
bodyLarge = TextStyle(
|
||||||
|
fontSize = 16.sp,
|
||||||
|
lineHeight = 24.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
bodyMedium = TextStyle(
|
||||||
|
fontSize = 14.sp,
|
||||||
|
lineHeight = 20.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
bodySmall = TextStyle(
|
||||||
|
fontSize = 12.sp,
|
||||||
|
lineHeight = 16.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
labelSmall = TextStyle(
|
||||||
|
fontSize = 11.sp,
|
||||||
|
lineHeight = 16.sp,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
|
),
|
||||||
labelMedium = TextStyle(
|
labelMedium = TextStyle(
|
||||||
fontSize = 12.sp,
|
fontSize = 12.sp,
|
||||||
lineHeight = 16.sp,
|
lineHeight = 16.sp,
|
||||||
|
|||||||
+53
-14
@@ -16,14 +16,13 @@ import androidx.compose.foundation.layout.size
|
|||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||||
import androidx.compose.material.icons.filled.Add
|
import androidx.compose.material.icons.filled.Add
|
||||||
import androidx.compose.material.icons.filled.Folder
|
import androidx.compose.material.icons.filled.Folder
|
||||||
|
import androidx.compose.material.icons.filled.Refresh
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.HorizontalDivider
|
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.LinearProgressIndicator
|
import androidx.compose.material3.LinearProgressIndicator
|
||||||
@@ -33,9 +32,9 @@ import androidx.compose.material3.Text
|
|||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
@@ -127,16 +126,35 @@ fun WatchedFoldersScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
importState.error?.let { message ->
|
||||||
|
item(key = "import-error") {
|
||||||
|
Text(
|
||||||
|
text = message,
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
color = MaterialTheme.colorScheme.error,
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(top = 12.dp),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
items(folders, key = { it.resourceId }) { root ->
|
items(folders, key = { it.resourceId }) { root ->
|
||||||
WatchedFolderRow(root)
|
WatchedFolderRow(
|
||||||
HorizontalDivider()
|
folder = root,
|
||||||
|
rescanEnabled = !importState.isImporting,
|
||||||
|
onRescan = { uri ->
|
||||||
|
syncViewModel.importRoot(uri = uri, name = root.name)
|
||||||
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (folders.isEmpty() && !importState.isImporting) {
|
if (folders.isEmpty() && !importState.isImporting) {
|
||||||
item(key = "empty") {
|
item(key = "empty") {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.settings_saf_folders_empty),
|
text = stringResource(R.string.settings_saf_folders_empty),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -150,7 +168,20 @@ fun WatchedFoldersScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun WatchedFolderRow(folder: FolderEntity) {
|
private fun WatchedFolderRow(
|
||||||
|
folder: FolderEntity,
|
||||||
|
rescanEnabled: Boolean,
|
||||||
|
onRescan: (uri: String) -> Unit,
|
||||||
|
) {
|
||||||
|
val context = LocalContext.current
|
||||||
|
// Nom lisible du dossier au lieu de l'URI brute `content://…`.
|
||||||
|
val location = remember(folder.uri) {
|
||||||
|
folder.uri?.let { raw ->
|
||||||
|
runCatching {
|
||||||
|
Uri.parse(raw)?.safDisplayName(context)
|
||||||
|
}.getOrNull()?.takeIf { it.isNotBlank() && it != folder.name }
|
||||||
|
}
|
||||||
|
}
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
@@ -160,12 +191,9 @@ private fun WatchedFolderRow(folder: FolderEntity) {
|
|||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.Folder,
|
imageVector = Icons.Filled.Folder,
|
||||||
contentDescription = null,
|
contentDescription = folder.name,
|
||||||
tint = MaterialTheme.colorScheme.primary,
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
modifier = Modifier
|
modifier = Modifier.size(28.dp),
|
||||||
.size(40.dp)
|
|
||||||
.clip(CircleShape)
|
|
||||||
.padding(8.dp),
|
|
||||||
)
|
)
|
||||||
Column(modifier = Modifier.weight(1f)) {
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
Text(
|
Text(
|
||||||
@@ -175,9 +203,9 @@ private fun WatchedFolderRow(folder: FolderEntity) {
|
|||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
)
|
)
|
||||||
folder.uri?.let { uri ->
|
location?.let {
|
||||||
Text(
|
Text(
|
||||||
text = uri,
|
text = it,
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
@@ -185,5 +213,16 @@ private fun WatchedFolderRow(folder: FolderEntity) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
folder.uri?.let { uri ->
|
||||||
|
IconButton(
|
||||||
|
onClick = { onRescan(uri) },
|
||||||
|
enabled = rescanEnabled,
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Filled.Refresh,
|
||||||
|
contentDescription = stringResource(R.string.refresh),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
<string name="dashboard_review_title">%1$d document(s) to review</string>
|
<string name="dashboard_review_title">%1$d document(s) to review</string>
|
||||||
<string name="dashboard_review_hint">Review them in swipe mode: keep (and sync) or delete.</string>
|
<string name="dashboard_review_hint">Review them in swipe mode: keep (and sync) or delete.</string>
|
||||||
<string name="dashboard_all_processed">All up to date — nothing to review.</string>
|
<string name="dashboard_all_processed">All up to date — nothing to review.</string>
|
||||||
|
<string name="dashboard_sync_title">Sync</string>
|
||||||
|
|
||||||
<!-- Review mode (swipe) -->
|
<!-- Review mode (swipe) -->
|
||||||
<string name="review_title">New documents</string>
|
<string name="review_title">New documents</string>
|
||||||
@@ -84,6 +85,10 @@
|
|||||||
<string name="document_loading">Reading document…</string>
|
<string name="document_loading">Reading document…</string>
|
||||||
<string name="document_cannot_read">Could not read this document.</string>
|
<string name="document_cannot_read">Could not read this document.</string>
|
||||||
<string name="document_page_unreadable">Unreadable page</string>
|
<string name="document_page_unreadable">Unreadable page</string>
|
||||||
|
<string name="focus_tap_to_exit">Tap to exit</string>
|
||||||
|
<string name="login_show_password">Show password</string>
|
||||||
|
<string name="login_hide_password">Hide password</string>
|
||||||
|
<string name="scan_permission_open_settings">Open Settings</string>
|
||||||
|
|
||||||
<!-- Server OCR -->
|
<!-- Server OCR -->
|
||||||
<string name="ocr_action">OCR</string>
|
<string name="ocr_action">OCR</string>
|
||||||
@@ -132,6 +137,8 @@
|
|||||||
<string name="search_empty">Type a search or pick a category</string>
|
<string name="search_empty">Type a search or pick a category</string>
|
||||||
<string name="search_recent">Recent documents</string>
|
<string name="search_recent">Recent documents</string>
|
||||||
<string name="search_no_results">No results</string>
|
<string name="search_no_results">No results</string>
|
||||||
|
<string name="search_results_count">%1$d result(s)</string>
|
||||||
|
<string name="search_clear">Clear search</string>
|
||||||
<string name="category_all">All</string>
|
<string name="category_all">All</string>
|
||||||
<string name="category_pdf">PDF</string>
|
<string name="category_pdf">PDF</string>
|
||||||
<string name="category_office">Office</string>
|
<string name="category_office">Office</string>
|
||||||
@@ -180,9 +187,14 @@
|
|||||||
<string name="sync_op_move">Move</string>
|
<string name="sync_op_move">Move</string>
|
||||||
<string name="sync_op_delete">Delete</string>
|
<string name="sync_op_delete">Delete</string>
|
||||||
<string name="sync_op_update">Update</string>
|
<string name="sync_op_update">Update</string>
|
||||||
|
<string name="sync_placement_local">Local-only file</string>
|
||||||
|
<string name="sync_placement_cloud">Cloud-only file</string>
|
||||||
|
<string name="sync_placement_local_cloud">Synced file</string>
|
||||||
|
|
||||||
<!-- Multi-select + PDF assembly -->
|
<!-- Multi-select + PDF assembly -->
|
||||||
<string name="selection_count">%1$d selected</string>
|
<string name="selection_count">%1$d selected</string>
|
||||||
|
<string name="selection_selected">Selected</string>
|
||||||
|
<string name="selection_unselected">Not selected</string>
|
||||||
<string name="selection_assemble">Assemble PDF</string>
|
<string name="selection_assemble">Assemble PDF</string>
|
||||||
<string name="selection_cancel">Cancel selection</string>
|
<string name="selection_cancel">Cancel selection</string>
|
||||||
|
|
||||||
@@ -217,6 +229,8 @@
|
|||||||
<string name="pdf_builder_name_hint">e.g. january_invoices</string>
|
<string name="pdf_builder_name_hint">e.g. january_invoices</string>
|
||||||
<string name="pdf_builder_name_save">Save</string>
|
<string name="pdf_builder_name_save">Save</string>
|
||||||
<string name="pdf_builder_saved">PDF created</string>
|
<string name="pdf_builder_saved">PDF created</string>
|
||||||
|
<string name="pdf_builder_view">View</string>
|
||||||
|
<string name="pdf_builder_search_files">Search files…</string>
|
||||||
<string name="pdf_builder_preview">Preview</string>
|
<string name="pdf_builder_preview">Preview</string>
|
||||||
<string name="pdf_builder_close_preview">Close preview</string>
|
<string name="pdf_builder_close_preview">Close preview</string>
|
||||||
<string name="pdf_generated_folder">Generated PDFs</string>
|
<string name="pdf_generated_folder">Generated PDFs</string>
|
||||||
@@ -268,6 +282,7 @@
|
|||||||
<string name="delete_confirm_button">Confirm</string>
|
<string name="delete_confirm_button">Confirm</string>
|
||||||
<string name="delete_cancel">Cancel</string>
|
<string name="delete_cancel">Cancel</string>
|
||||||
<string name="delete_error">Error while deleting</string>
|
<string name="delete_error">Error while deleting</string>
|
||||||
|
<string name="delete_success">Items deleted</string>
|
||||||
|
|
||||||
<!-- Sharing (share grants) -->
|
<!-- Sharing (share grants) -->
|
||||||
<string name="share_title">Share with a user</string>
|
<string name="share_title">Share with a user</string>
|
||||||
@@ -280,6 +295,7 @@
|
|||||||
<string name="share_cancel">Cancel</string>
|
<string name="share_cancel">Cancel</string>
|
||||||
<string name="share_error_not_found">No user found with this username.</string>
|
<string name="share_error_not_found">No user found with this username.</string>
|
||||||
<string name="share_error_generic">Could not share right now.</string>
|
<string name="share_error_generic">Could not share right now.</string>
|
||||||
|
<string name="share_enqueued">Share saved — syncing.</string>
|
||||||
<string name="share_content_description">Share this folder</string>
|
<string name="share_content_description">Share this folder</string>
|
||||||
<string name="share_action">Share</string>
|
<string name="share_action">Share</string>
|
||||||
<string name="more_actions">More actions</string>
|
<string name="more_actions">More actions</string>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<string name="dashboard_review_title">%1$d document(s) à traiter</string>
|
<string name="dashboard_review_title">%1$d document(s) à traiter</string>
|
||||||
<string name="dashboard_review_hint">Révise-les en mode swipe : garder (et synchroniser) ou supprimer.</string>
|
<string name="dashboard_review_hint">Révise-les en mode swipe : garder (et synchroniser) ou supprimer.</string>
|
||||||
<string name="dashboard_all_processed">Tout est à jour — aucun document à traiter.</string>
|
<string name="dashboard_all_processed">Tout est à jour — aucun document à traiter.</string>
|
||||||
|
<string name="dashboard_sync_title">Synchronisation</string>
|
||||||
|
|
||||||
<!-- Mode review (swipe) -->
|
<!-- Mode review (swipe) -->
|
||||||
<string name="review_title">Nouveaux documents</string>
|
<string name="review_title">Nouveaux documents</string>
|
||||||
@@ -84,6 +85,10 @@
|
|||||||
<string name="document_loading">Lecture du document…</string>
|
<string name="document_loading">Lecture du document…</string>
|
||||||
<string name="document_cannot_read">Impossible de lire ce document.</string>
|
<string name="document_cannot_read">Impossible de lire ce document.</string>
|
||||||
<string name="document_page_unreadable">Page illisible</string>
|
<string name="document_page_unreadable">Page illisible</string>
|
||||||
|
<string name="focus_tap_to_exit">Toucher pour quitter</string>
|
||||||
|
<string name="login_show_password">Afficher le mot de passe</string>
|
||||||
|
<string name="login_hide_password">Masquer le mot de passe</string>
|
||||||
|
<string name="scan_permission_open_settings">Ouvrir les Réglages</string>
|
||||||
|
|
||||||
<!-- OCR serveur -->
|
<!-- OCR serveur -->
|
||||||
<string name="ocr_action">OCR</string>
|
<string name="ocr_action">OCR</string>
|
||||||
@@ -132,6 +137,8 @@
|
|||||||
<string name="search_empty">Saisis une recherche ou choisis une catégorie</string>
|
<string name="search_empty">Saisis une recherche ou choisis une catégorie</string>
|
||||||
<string name="search_recent">Documents récents</string>
|
<string name="search_recent">Documents récents</string>
|
||||||
<string name="search_no_results">Aucun résultat</string>
|
<string name="search_no_results">Aucun résultat</string>
|
||||||
|
<string name="search_results_count">%1$d résultat(s)</string>
|
||||||
|
<string name="search_clear">Effacer la recherche</string>
|
||||||
<string name="category_all">Tous</string>
|
<string name="category_all">Tous</string>
|
||||||
<string name="category_pdf">PDF</string>
|
<string name="category_pdf">PDF</string>
|
||||||
<string name="category_office">Bureautique</string>
|
<string name="category_office">Bureautique</string>
|
||||||
@@ -180,9 +187,14 @@
|
|||||||
<string name="sync_op_move">Déplacement</string>
|
<string name="sync_op_move">Déplacement</string>
|
||||||
<string name="sync_op_delete">Suppression</string>
|
<string name="sync_op_delete">Suppression</string>
|
||||||
<string name="sync_op_update">Mise à jour</string>
|
<string name="sync_op_update">Mise à jour</string>
|
||||||
|
<string name="sync_placement_local">Fichier local uniquement</string>
|
||||||
|
<string name="sync_placement_cloud">Fichier distant uniquement</string>
|
||||||
|
<string name="sync_placement_local_cloud">Fichier synchronisé</string>
|
||||||
|
|
||||||
<!-- Sélection multi-fichiers + assemblage PDF -->
|
<!-- Sélection multi-fichiers + assemblage PDF -->
|
||||||
<string name="selection_count">%1$d sélectionné(s)</string>
|
<string name="selection_count">%1$d sélectionné(s)</string>
|
||||||
|
<string name="selection_selected">Sélectionné</string>
|
||||||
|
<string name="selection_unselected">Non sélectionné</string>
|
||||||
<string name="selection_assemble">Assembler en PDF</string>
|
<string name="selection_assemble">Assembler en PDF</string>
|
||||||
<string name="selection_cancel">Annuler la sélection</string>
|
<string name="selection_cancel">Annuler la sélection</string>
|
||||||
|
|
||||||
@@ -217,6 +229,8 @@
|
|||||||
<string name="pdf_builder_name_hint">ex. factures_janvier</string>
|
<string name="pdf_builder_name_hint">ex. factures_janvier</string>
|
||||||
<string name="pdf_builder_name_save">Enregistrer</string>
|
<string name="pdf_builder_name_save">Enregistrer</string>
|
||||||
<string name="pdf_builder_saved">PDF créé</string>
|
<string name="pdf_builder_saved">PDF créé</string>
|
||||||
|
<string name="pdf_builder_view">Voir</string>
|
||||||
|
<string name="pdf_builder_search_files">Rechercher un fichier…</string>
|
||||||
<string name="pdf_builder_preview">Aperçu</string>
|
<string name="pdf_builder_preview">Aperçu</string>
|
||||||
<string name="pdf_builder_close_preview">Fermer l\'aperçu</string>
|
<string name="pdf_builder_close_preview">Fermer l\'aperçu</string>
|
||||||
<string name="pdf_generated_folder">PDF générés</string>
|
<string name="pdf_generated_folder">PDF générés</string>
|
||||||
@@ -268,6 +282,7 @@
|
|||||||
<string name="delete_confirm_button">Confirmer</string>
|
<string name="delete_confirm_button">Confirmer</string>
|
||||||
<string name="delete_cancel">Annuler</string>
|
<string name="delete_cancel">Annuler</string>
|
||||||
<string name="delete_error">Erreur lors de la suppression</string>
|
<string name="delete_error">Erreur lors de la suppression</string>
|
||||||
|
<string name="delete_success">Éléments supprimés</string>
|
||||||
|
|
||||||
<!-- Partage (share grants) -->
|
<!-- Partage (share grants) -->
|
||||||
<string name="share_title">Partager avec un utilisateur</string>
|
<string name="share_title">Partager avec un utilisateur</string>
|
||||||
@@ -280,6 +295,7 @@
|
|||||||
<string name="share_cancel">Annuler</string>
|
<string name="share_cancel">Annuler</string>
|
||||||
<string name="share_error_not_found">Aucun utilisateur connu sous ce nom.</string>
|
<string name="share_error_not_found">Aucun utilisateur connu sous ce nom.</string>
|
||||||
<string name="share_error_generic">Impossible de partager pour le moment.</string>
|
<string name="share_error_generic">Impossible de partager pour le moment.</string>
|
||||||
|
<string name="share_enqueued">Partage enregistré — synchronisation en cours.</string>
|
||||||
<string name="share_content_description">Partager ce dossier</string>
|
<string name="share_content_description">Partager ce dossier</string>
|
||||||
<string name="share_action">Partager</string>
|
<string name="share_action">Partager</string>
|
||||||
<string name="more_actions">Plus d\'actions</string>
|
<string name="more_actions">Plus d\'actions</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user