diff --git a/app/src/main/kotlin/com/w2sv/filenavigator/ui/designsystem/SwitchItemRow.kt b/app/src/main/kotlin/com/w2sv/filenavigator/ui/designsystem/SwitchItemRow.kt index de394529..45190969 100644 --- a/app/src/main/kotlin/com/w2sv/filenavigator/ui/designsystem/SwitchItemRow.kt +++ b/app/src/main/kotlin/com/w2sv/filenavigator/ui/designsystem/SwitchItemRow.kt @@ -21,6 +21,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.w2sv.filenavigator.ui.theme.onSurfaceVariantDecreasedAlpha +import com.w2sv.filenavigator.ui.util.CharSequenceText object ItemRowDefaults { val IconTextSpacing = 16.dp @@ -33,7 +34,7 @@ fun ItemRow( icon: @Composable RowScope.() -> Unit, @StringRes labelRes: Int, modifier: Modifier = Modifier, - explanation: String? = null, + explanation: CharSequence? = null, verticalAlignment: Alignment.Vertical = Alignment.Top, content: @Composable RowScope.() -> Unit ) { @@ -57,8 +58,8 @@ fun ItemRow( } @Composable -private fun Explanation(text: String, modifier: Modifier = Modifier) { - Text( +private fun Explanation(text: CharSequence, modifier: Modifier = Modifier) { + CharSequenceText( text = text, color = MaterialTheme.colorScheme.onSurfaceVariantDecreasedAlpha, modifier = modifier, @@ -87,7 +88,7 @@ fun SwitchItemRow( checked: Boolean, onCheckedChange: (Boolean) -> Unit, modifier: Modifier = Modifier, - explanation: String? = null + explanation: CharSequence? = null ) { ItemRow( icon = icon, diff --git a/app/src/main/kotlin/com/w2sv/filenavigator/ui/screen/appsettings/AppSettingsScreen.kt b/app/src/main/kotlin/com/w2sv/filenavigator/ui/screen/appsettings/AppSettingsScreen.kt index 6bbc0b33..00e14df8 100644 --- a/app/src/main/kotlin/com/w2sv/filenavigator/ui/screen/appsettings/AppSettingsScreen.kt +++ b/app/src/main/kotlin/com/w2sv/filenavigator/ui/screen/appsettings/AppSettingsScreen.kt @@ -28,6 +28,7 @@ import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.annotation.RootGraph import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.w2sv.androidutils.os.dynamicColorsSupported +import com.w2sv.composed.rememberStyledTextResource import com.w2sv.filenavigator.R import com.w2sv.filenavigator.ui.LocalUseDarkTheme import com.w2sv.filenavigator.ui.designsystem.AppCardDefaults @@ -82,7 +83,7 @@ private fun SettingsCardColumn(appPreferences: AppPreferences, modifier: Modifie labelRes = R.string.show_storage_volume_names, checked = appPreferences.showStorageVolumeNames(), onCheckedChange = appPreferences.setShowStorageVolumeNames, - explanation = stringResource(R.string.show_storage_volume_names_explanation) + explanation = rememberStyledTextResource(R.string.show_storage_volume_names_explanation) ) } SettingsCard(title = stringResource(id = R.string.appearance)) { diff --git a/app/src/main/kotlin/com/w2sv/filenavigator/ui/screen/home/components/movehistory/MoveHistory.kt b/app/src/main/kotlin/com/w2sv/filenavigator/ui/screen/home/components/movehistory/MoveHistory.kt index 432e7c39..061579cd 100644 --- a/app/src/main/kotlin/com/w2sv/filenavigator/ui/screen/home/components/movehistory/MoveHistory.kt +++ b/app/src/main/kotlin/com/w2sv/filenavigator/ui/screen/home/components/movehistory/MoveHistory.kt @@ -76,7 +76,7 @@ fun MoveHistory( modifier = Modifier.padding(bottom = 4.dp) ) } - MoveEntryView( + MoveRecordView( movedFile = moveEntry, onClick = onRowClick, modifier = Modifier @@ -89,7 +89,7 @@ fun MoveHistory( } @Composable -private fun MoveEntryView( +private fun MoveRecordView( movedFile: MovedFile, onClick: suspend (MovedFile, Boolean) -> Unit, modifier: Modifier = Modifier, diff --git a/app/src/main/kotlin/com/w2sv/filenavigator/ui/screen/home/components/movehistory/MoveHistoryCard.kt b/app/src/main/kotlin/com/w2sv/filenavigator/ui/screen/home/components/movehistory/MoveHistoryCard.kt index 8a58182d..96a0890f 100644 --- a/app/src/main/kotlin/com/w2sv/filenavigator/ui/screen/home/components/movehistory/MoveHistoryCard.kt +++ b/app/src/main/kotlin/com/w2sv/filenavigator/ui/screen/home/components/movehistory/MoveHistoryCard.kt @@ -78,7 +78,7 @@ fun MoveHistoryCard( horizontalArrangement = Arrangement.SpaceBetween ) { Text( - text = stringResource(R.string.history), + text = stringResource(R.string.move_history), style = MaterialTheme.typography.headlineMedium, ) @@ -197,7 +197,7 @@ private fun NoHistoryPlaceHolder(modifier: Modifier = Modifier) { ) Spacer(modifier = Modifier.height(12.dp)) Text( - text = stringResource(R.string.navigated_files_will_appear_here), + text = stringResource(R.string.move_history_placeholder), modifier = Modifier.padding(horizontal = 12.dp) ) } diff --git a/app/src/main/kotlin/com/w2sv/filenavigator/ui/screen/navigatorsettings/NavigatorSettingsScreen.kt b/app/src/main/kotlin/com/w2sv/filenavigator/ui/screen/navigatorsettings/NavigatorSettingsScreen.kt index 7771f463..1babff4e 100644 --- a/app/src/main/kotlin/com/w2sv/filenavigator/ui/screen/navigatorsettings/NavigatorSettingsScreen.kt +++ b/app/src/main/kotlin/com/w2sv/filenavigator/ui/screen/navigatorsettings/NavigatorSettingsScreen.kt @@ -232,17 +232,17 @@ private fun AutoMoveIntroductionDialog( text = { Column(modifier = Modifier.verticalScroll(rememberScrollState())) { Text( - text = stringResource(R.string.you_can_now_enable_file_source_specific_auto_moving_by), + text = stringResource(R.string.auto_move_introduction_paragraph_1), modifier = Modifier.padding(bottom = TextSectionBottomPadding) ) Text( - text = rememberStyledTextResource(R.string._1_clicking_on_the_auto_button_of_an_enabled_file_source_2_selecting_a_destination_3_saving_the_changes), + text = rememberStyledTextResource(R.string.auto_move_introduction_paragraph_2), modifier = Modifier .padding(horizontal = 12.dp) .padding(bottom = TextSectionBottomPadding) ) Text( - text = stringResource(R.string.now_whenever_a_new_file_corresponding_to_the_file_source_is_discovered_it_will_be_automatically_moved_to_the_selected_destination_without_you_needing_to_do_anything_else) + text = stringResource(R.string.auto_move_introduction_paragraph_3) ) } }, diff --git a/app/src/main/kotlin/com/w2sv/filenavigator/ui/util/CharSequenceText.kt b/app/src/main/kotlin/com/w2sv/filenavigator/ui/util/CharSequenceText.kt new file mode 100644 index 00000000..3b8356f1 --- /dev/null +++ b/app/src/main/kotlin/com/w2sv/filenavigator/ui/util/CharSequenceText.kt @@ -0,0 +1,85 @@ +package com.w2sv.filenavigator.ui.util + +import android.annotation.SuppressLint +import androidx.compose.foundation.text.InlineTextContent +import androidx.compose.material3.LocalTextStyle +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.AnnotatedString +import androidx.compose.ui.text.TextLayoutResult +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontStyle +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.text.style.TextDecoration +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.TextUnit + +@Composable +fun CharSequenceText( + text: CharSequence, + modifier: Modifier = Modifier, + color: Color = Color.Unspecified, + fontSize: TextUnit = TextUnit.Unspecified, + fontStyle: FontStyle? = null, + fontWeight: FontWeight? = null, + fontFamily: FontFamily? = null, + letterSpacing: TextUnit = TextUnit.Unspecified, + textDecoration: TextDecoration? = null, + textAlign: TextAlign? = null, + lineHeight: TextUnit = TextUnit.Unspecified, + overflow: TextOverflow = TextOverflow.Clip, + softWrap: Boolean = true, + maxLines: Int = Int.MAX_VALUE, + minLines: Int = 1, + @SuppressLint("ComposeUnstableCollections") inlineContent: Map = mapOf(), + onTextLayout: (TextLayoutResult) -> Unit = {}, + style: TextStyle = LocalTextStyle.current +) { + when (text) { + is AnnotatedString -> androidx.compose.material3.Text( + text = text, + modifier = modifier, + color = color, + fontSize = fontSize, + fontStyle = fontStyle, + fontWeight = fontWeight, + fontFamily = fontFamily, + letterSpacing = letterSpacing, + textDecoration = textDecoration, + textAlign = textAlign, + lineHeight = lineHeight, + overflow = overflow, + softWrap = softWrap, + maxLines = maxLines, + minLines = minLines, + inlineContent = inlineContent, + onTextLayout = onTextLayout, + style = style + ) + + is String -> androidx.compose.material3.Text( + text = text, + modifier = modifier, + color = color, + fontSize = fontSize, + fontStyle = fontStyle, + fontWeight = fontWeight, + fontFamily = fontFamily, + letterSpacing = letterSpacing, + textDecoration = textDecoration, + textAlign = textAlign, + lineHeight = lineHeight, + overflow = overflow, + softWrap = softWrap, + maxLines = maxLines, + minLines = minLines, + onTextLayout = onTextLayout, + style = style + ) + + else -> throw IllegalArgumentException("text has to be either String or AnnotatedString") + } +} \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 761ae908..68b1a588 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -34,10 +34,10 @@ Active Inactive Delete move history? - Navigated files will appear here + Moved files will appear here Return to main screen Discard - History + Move History © 2023 - %1$s | w2sv Navigator Settings Couldn\'t find file. @@ -66,12 +66,12 @@ Start navigator on system boot App Settings Show storage volume names - E.g. primary:Folder/OtherFolder instead of Folder/OtherFolder + E.g. primary:Folder/OtherFolder instead of Folder/OtherFolder Settings General - You can now enable file source specific Auto Moving by - Now, whenever a new file corresponding to the file source is discovered, it will be automatically moved to the selected destination without you needing to do anything else. - 1. Clicking on the Auto button of an enabled file source\n2. Selecting a destination\n3. Saving the changes + You can now enable file source specific Auto Moving by + 1. Clicking on the Auto button of an enabled file source\n2. Selecting a destination\n3. Saving the changes + Then, whenever a new file corresponding to the file source is discovered, it will be automatically moved to the selected destination without you needing to do anything else. Awesome! Introducing Auto Move Notify diff --git a/core/navigator/src/main/res/values/strings.xml b/core/navigator/src/main/res/values/strings.xml index 30a86ae4..71996126 100644 --- a/core/navigator/src/main/res/values/strings.xml +++ b/core/navigator/src/main/res/values/strings.xml @@ -41,7 +41,7 @@ Cancel Directory Access Understood - You need to grant File Navigator access to the selected destination to quick-move files there. This is only necessary once per destination. + You need to grant File Navigator access to the selected destination to quick-move files there.\n\nThis is necessary only once per destination. %2$s exception]]> %2$s exception]]>