From 00d5e2fed36136315de3f135f83468f904d66285 Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Tue, 23 Sep 2025 14:51:05 +0100 Subject: [PATCH] Move strings to stringResources. Refactor names for consistency. Some cleanup. --- .../amethyst/ui/navigation/AppNavigation.kt | 4 +- .../ui/navigation/drawer/DrawerContent.kt | 2 +- .../amethyst/ui/note/elements/DropDownMenu.kt | 2 +- .../loggedIn/lists/CustomListsScreen.kt | 66 ++++++++++--------- .../{CustomListItem.kt => CustomSetItem.kt} | 40 +++++------ .../loggedIn/lists/FollowSetFeedView.kt | 16 ++--- .../followsets/FollowSetsManagementDialog.kt | 47 ++++++++----- .../loggedIn/profile/header/ProfileActions.kt | 5 +- amethyst/src/main/res/values/strings.xml | 33 +++++++++- 9 files changed, 132 insertions(+), 83 deletions(-) rename amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/{CustomListItem.kt => CustomSetItem.kt} (88%) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppNavigation.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppNavigation.kt index 37f9d58eb..ea53ef5ed 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppNavigation.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppNavigation.kt @@ -78,7 +78,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.hashtag.HashtagPostScreen import com.vitorpamplona.amethyst.ui.screen.loggedIn.hashtag.HashtagScreen import com.vitorpamplona.amethyst.ui.screen.loggedIn.home.HomeScreen import com.vitorpamplona.amethyst.ui.screen.loggedIn.home.ShortNotePostScreen -import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.ListsScreen +import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.ListsAndSetsScreen import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.NostrUserListFeedViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.followsets.FollowSetScreen import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.followsets.FollowSetsManagementDialog @@ -127,7 +127,7 @@ fun AppNavigation( composable { DiscoverScreen(accountViewModel, nav) } composable { NotificationScreen(accountViewModel, nav) } - composableFromEnd { ListsScreen(accountViewModel, listsViewModel, nav) } + composableFromEnd { ListsAndSetsScreen(accountViewModel, listsViewModel, nav) } composableArgs { FollowSetScreen(it.setIdentifier, accountViewModel, listsViewModel, nav) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/drawer/DrawerContent.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/drawer/DrawerContent.kt index 04ae50e44..abf9712af 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/drawer/DrawerContent.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/drawer/DrawerContent.kt @@ -436,7 +436,7 @@ fun ListContent( ) NavigationRow( - title = R.string.my_lists, + title = R.string.my_lists_and_sets, icon = ImageVector.vectorResource(R.drawable.format_list_bulleted_type), tint = MaterialTheme.colorScheme.onBackground, nav = nav, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/DropDownMenu.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/DropDownMenu.kt index 8d2337c63..18699875f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/DropDownMenu.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/DropDownMenu.kt @@ -184,7 +184,7 @@ fun NoteDropDownMenu( HorizontalDivider(thickness = DividerThickness) } DropdownMenuItem( - text = { Text(text = "Add author to follow set") }, + text = { Text(text = stringRes(R.string.follow_set_add_author_from_note_action)) }, onClick = { val authorHexKey = note.author?.pubkeyHex ?: return@DropdownMenuItem nav.nav(Route.FollowSetManagement(authorHexKey)) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/CustomListsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/CustomListsScreen.kt index 9a0d18eea..4a8516584 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/CustomListsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/CustomListsScreen.kt @@ -49,6 +49,7 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview @@ -71,7 +72,7 @@ import com.vitorpamplona.amethyst.ui.theme.ThemeComparisonColumn import kotlinx.coroutines.launch @Composable -fun ListsScreen( +fun ListsAndSetsScreen( accountViewModel: AccountViewModel, followSetsViewModel: NostrUserListFeedViewModel, nav: INav, @@ -139,7 +140,6 @@ fun CustomListsScreen( accountViewModel: AccountViewModel, nav: INav, ) { -// val setsState by followSetsViewModel.feedContent.collectAsStateWithLifecycle() val pagerState = rememberPagerState { 3 } val coroutineScope = rememberCoroutineScope() @@ -148,7 +148,7 @@ fun CustomListsScreen( accountViewModel = accountViewModel, topBar = { Column { - TopBarWithBackButton(stringRes(R.string.my_lists), nav::popBack) + TopBarWithBackButton(stringRes(R.string.my_lists_and_sets), nav::popBack) TabRow( selectedTabIndex = pagerState.currentPage, modifier = TabRowHeight, @@ -158,17 +158,17 @@ fun CustomListsScreen( Tab( selected = pagerState.currentPage == 0, onClick = { coroutineScope.launch { pagerState.animateScrollToPage(0) } }, - text = { Text(text = "Follow Sets", overflow = TextOverflow.Visible) }, + text = { Text(text = stringRes(R.string.follow_sets), overflow = TextOverflow.Visible) }, ) Tab( selected = pagerState.currentPage == 1, onClick = { coroutineScope.launch { pagerState.animateScrollToPage(1) } }, - text = { Text(text = "Labeled Bookmarks", overflow = TextOverflow.Visible) }, + text = { Text(text = stringRes(R.string.labeled_bookmarks), overflow = TextOverflow.Visible) }, ) Tab( selected = pagerState.currentPage == 2, onClick = { coroutineScope.launch { pagerState.animateScrollToPage(2) } }, - text = { Text(text = "General Bookmarks", overflow = TextOverflow.Visible) }, + text = { Text(text = stringRes(R.string.general_bookmarks), overflow = TextOverflow.Visible) }, ) } } @@ -176,10 +176,10 @@ fun CustomListsScreen( floatingButton = { // TODO: Show components based on current tab FollowSetFabsAndMenu( - onAddPrivateList = { name: String, description: String? -> + onAddPrivateSet = { name: String, description: String? -> addItem(name, description, ListVisibility.Private) }, - onAddPublicList = { name: String, description: String? -> + onAddPublicSet = { name: String, description: String? -> addItem(name, description, ListVisibility.Public) }, ) @@ -212,10 +212,10 @@ fun CustomListsScreen( @Composable private fun FollowSetFabsAndMenu( modifier: Modifier = Modifier, - onAddPrivateList: (name: String, description: String?) -> Unit, - onAddPublicList: (name: String, description: String?) -> Unit, + onAddPrivateSet: (name: String, description: String?) -> Unit, + onAddPublicSet: (name: String, description: String?) -> Unit, ) { - val isListAdditionDialogOpen = remember { mutableStateOf(false) } + val isSetAdditionDialogOpen = remember { mutableStateOf(false) } val isPrivateOptionTapped = remember { mutableStateOf(false) } Row( @@ -223,9 +223,8 @@ private fun FollowSetFabsAndMenu( ) { FloatingActionButton( onClick = { - println("The private list addition...") isPrivateOptionTapped.value = true - isListAdditionDialogOpen.value = true + isSetAdditionDialogOpen.value = true }, shape = CircleShape, containerColor = ButtonDefaults.filledTonalButtonColors().containerColor, @@ -238,8 +237,7 @@ private fun FollowSetFabsAndMenu( } FloatingActionButton( onClick = { - println("The public list creation...") - isListAdditionDialogOpen.value = true + isSetAdditionDialogOpen.value = true }, shape = CircleShape, containerColor = ButtonDefaults.filledTonalButtonColors().containerColor, @@ -252,18 +250,18 @@ private fun FollowSetFabsAndMenu( } } - if (isListAdditionDialogOpen.value) { - NewListCreationDialog( + if (isSetAdditionDialogOpen.value) { + NewSetCreationDialog( onDismiss = { - isListAdditionDialogOpen.value = false + isSetAdditionDialogOpen.value = false isPrivateOptionTapped.value = false }, shouldBePrivate = isPrivateOptionTapped.value, onCreateList = { name, description -> if (isPrivateOptionTapped.value) { - onAddPrivateList(name, description) + onAddPrivateSet(name, description) } else { - onAddPublicList(name, description) + onAddPublicSet(name, description) } }, ) @@ -271,7 +269,7 @@ private fun FollowSetFabsAndMenu( } @Composable -fun NewListCreationDialog( +fun NewSetCreationDialog( modifier: Modifier = Modifier, onDismiss: () -> Unit, shouldBePrivate: Boolean, @@ -279,12 +277,16 @@ fun NewListCreationDialog( ) { val newListName = remember { mutableStateOf("") } val newListDescription = remember { mutableStateOf(null) } + val context = LocalContext.current val listTypeText = - when (shouldBePrivate) { - true -> "Private" - false -> "Public" - } + stringRes( + context, + when (shouldBePrivate) { + true -> R.string.follow_set_type_private + false -> R.string.follow_set_type_public + }, + ) val listTypeIcon = when (shouldBePrivate) { @@ -304,7 +306,7 @@ fun NewListCreationDialog( contentDescription = null, ) Text( - text = "New $listTypeText List", + text = stringRes(R.string.follow_set_creation_dialog_title, listTypeText), ) } }, @@ -317,7 +319,7 @@ fun NewListCreationDialog( value = newListName.value, onValueChange = { newListName.value = it }, label = { - Text("List name") + Text(text = stringRes(R.string.follow_set_creation_name_label)) }, ) Spacer(modifier = DoubleVertSpacer) @@ -329,7 +331,7 @@ fun NewListCreationDialog( ).toString(), onValueChange = { newListDescription.value = it }, label = { - Text("List description(optional)") + Text(text = stringRes(R.string.follow_set_creation_desc_label)) }, ) } @@ -341,14 +343,14 @@ fun NewListCreationDialog( onDismiss() }, ) { - Text("Create list") + Text(stringRes(R.string.follow_set_creation_action_btn_label)) } }, dismissButton = { Button( onClick = onDismiss, ) { - Text("Cancel") + Text(stringRes(R.string.cancel)) } }, ) @@ -380,7 +382,7 @@ fun GeneralBookmarksFeedView() { @Preview(showSystemUi = true) @Composable -private fun ListItemPreview() { +private fun SetItemPreview() { val sampleFollowSet = FollowSet( identifierTag = "00001-2222", @@ -390,7 +392,7 @@ private fun ListItemPreview() { emptySet(), ) ThemeComparisonColumn { - CustomListItem( + CustomSetItem( modifier = Modifier, sampleFollowSet, onFollowSetClick = { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/CustomListItem.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/CustomSetItem.kt similarity index 88% rename from amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/CustomListItem.kt rename to amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/CustomSetItem.kt index 87d1837c9..35737d74b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/CustomListItem.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/CustomSetItem.kt @@ -46,6 +46,7 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString @@ -59,19 +60,22 @@ import androidx.compose.ui.unit.sp import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.ui.components.ClickableBox import com.vitorpamplona.amethyst.ui.note.VerticalDotsIcon +import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.ButtonBorder import com.vitorpamplona.amethyst.ui.theme.Size5dp import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer +import kotlin.let @Composable -fun CustomListItem( +fun CustomSetItem( modifier: Modifier = Modifier, followSet: FollowSet, onFollowSetClick: () -> Unit, onFollowSetRename: (String) -> Unit, onFollowSetDelete: () -> Unit, ) { + val context = LocalContext.current Row( modifier = modifier @@ -125,9 +129,9 @@ fun CustomListItem( followSet.visibility.let { val text by derivedStateOf { when (it) { - ListVisibility.Public -> "Public" - ListVisibility.Private -> "Private" - ListVisibility.Mixed -> "Mixed" + ListVisibility.Public -> stringRes(context, R.string.follow_set_type_public) + ListVisibility.Private -> stringRes(context, R.string.follow_set_type_private) + ListVisibility.Mixed -> stringRes(context, R.string.follow_set_type_mixed) } } Column( @@ -144,7 +148,7 @@ fun CustomListItem( ListVisibility.Mixed -> R.drawable.format_list_bulleted_type }, ), - contentDescription = "Icon for $text List", + contentDescription = stringRes(R.string.follow_set_type_description, text), ) Text(text, color = Color.Gray, fontWeight = FontWeight.Light) } @@ -159,7 +163,7 @@ fun CustomListItem( verticalArrangement = Arrangement.Top, horizontalAlignment = Alignment.End, ) { - ListOptionsButton( + SetOptionsButton( followSetName = followSet.title, onListRename = onFollowSetRename, onListDelete = onFollowSetDelete, @@ -169,7 +173,7 @@ fun CustomListItem( } @Composable -fun ListOptionsButton( +fun SetOptionsButton( modifier: Modifier = Modifier, followSetName: String, onListRename: (String) -> Unit, @@ -182,7 +186,7 @@ fun ListOptionsButton( ) { VerticalDotsIcon() - ListOptionsMenu( + SetOptionsMenu( listName = followSetName, isExpanded = isMenuOpen.value, onDismiss = { isMenuOpen.value = false }, @@ -193,7 +197,7 @@ fun ListOptionsButton( } @Composable -fun ListOptionsMenu( +private fun SetOptionsMenu( modifier: Modifier = Modifier, isExpanded: Boolean, listName: String, @@ -210,19 +214,17 @@ fun ListOptionsMenu( ) { DropdownMenuItem( text = { - Text(text = "Delete") + Text(text = stringRes(R.string.quick_action_delete)) }, onClick = { - println("The list named $listName has been selected for deletion.") onDelete() }, ) DropdownMenuItem( text = { - Text(text = "Rename list") + Text(text = stringRes(R.string.follow_set_rename_btn_label)) }, onClick = { - println("The list $listName should be renamed...") isRenameDialogOpen.value = true onDismiss() }, @@ -245,7 +247,7 @@ fun ListOptionsMenu( } @Composable -fun RenameDialog( +private fun RenameDialog( modifier: Modifier = Modifier, currentName: String, newName: String, @@ -255,7 +257,7 @@ fun RenameDialog( ) { val renameIndicator = buildAnnotatedString { - append("You are renaming from ") + append(stringRes(R.string.follow_set_rename_dialog_indicator_first_part) + " ") withStyle( SpanStyle( fontWeight = FontWeight.Bold, @@ -265,13 +267,13 @@ fun RenameDialog( ) { append("\"" + currentName + "\"") } - append(" to..") + append(" " + stringRes(R.string.follow_set_rename_dialog_indicator_second_part)) } AlertDialog( onDismissRequest = onDismissDialog, title = { - Text(text = "Rename List") + Text(text = stringRes(R.string.follow_set_rename_btn_label)) }, text = { Column( @@ -296,10 +298,10 @@ fun RenameDialog( onListRename(newName) onDismissDialog() }, - ) { Text(text = "Rename") } + ) { Text(text = stringRes(R.string.rename)) } }, dismissButton = { - Button(onClick = onDismissDialog) { Text(text = "Cancel") } + Button(onClick = onDismissDialog) { Text(text = stringRes(R.string.cancel)) } }, ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/FollowSetFeedView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/FollowSetFeedView.kt index ca75b9ac3..93921305d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/FollowSetFeedView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/FollowSetFeedView.kt @@ -55,7 +55,7 @@ fun FollowSetFeedView( is FollowSetState.Loaded -> { val followSetFeed = followSetState.feed - FollowListLoaded( + FollowSetLoaded( loadedFeedState = followSetFeed, onRefresh = onRefresh, onItemClick = onOpenItem, @@ -65,10 +65,8 @@ fun FollowSetFeedView( } is FollowSetState.Empty -> { - FollowListFeedEmpty( - message = - "It seems you do not have any follow lists yet.\n " + - "Tap below to refresh, or tap the add buttons to create a new one.", + FollowSetFeedEmpty( + message = stringRes(R.string.follow_set_empty_feed_msg), ) { onRefresh() } @@ -84,7 +82,7 @@ fun FollowSetFeedView( } @Composable -fun FollowListLoaded( +fun FollowSetLoaded( modifier: Modifier = Modifier, loadedFeedState: List, onRefresh: () -> Unit = {}, @@ -92,7 +90,7 @@ fun FollowListLoaded( onItemRename: (followSet: FollowSet, newName: String) -> Unit, onItemDelete: (followSet: FollowSet) -> Unit, ) { - Log.d("FollowSetComposable", "FollowListLoaded: Follow Set size: ${loadedFeedState.size}") + Log.d("FollowSetComposable", "FollowSetLoaded: Follow Set size: ${loadedFeedState.size}") val listState = rememberLazyListState() RefresheableBox( @@ -103,7 +101,7 @@ fun FollowListLoaded( contentPadding = FeedPadding, ) { itemsIndexed(loadedFeedState, key = { _, item -> item.identifierTag }) { _, set -> - CustomListItem( + CustomSetItem( modifier = Modifier.animateItem(), followSet = set, onFollowSetClick = { @@ -123,7 +121,7 @@ fun FollowListLoaded( } @Composable -fun FollowListFeedEmpty( +fun FollowSetFeedEmpty( message: String = stringRes(R.string.feed_is_empty), onRefresh: () -> Unit, ) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/followsets/FollowSetsManagementDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/followsets/FollowSetsManagementDialog.kt index 71c702af1..1763f43d6 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/followsets/FollowSetsManagementDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/followsets/FollowSetsManagementDialog.kt @@ -65,6 +65,7 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.semantics.Role import androidx.compose.ui.text.font.FontWeight @@ -80,7 +81,7 @@ import com.vitorpamplona.amethyst.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.note.ArrowBackIcon import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.FollowSetState import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.ListVisibility -import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.NewListCreationDialog +import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.NewSetCreationDialog import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.NostrUserListFeedViewModel import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.ButtonBorder @@ -109,10 +110,9 @@ fun FollowSetsManagementDialog( title = { Column { Text( - text = "Your Lists", + text = stringRes(R.string.follow_set_man_dialog_title), fontWeight = FontWeight.SemiBold, ) -// HorizontalDivider() } }, navigationIcon = { @@ -230,7 +230,7 @@ fun BackActionButton( colors = ButtonDefaults.filledTonalButtonColors(), elevation = ButtonDefaults.elevatedButtonElevation(defaultElevation = 6.0.dp), ) { - Text(text = "Back", fontWeight = FontWeight.SemiBold) + Text(text = stringRes(R.string.back), fontWeight = FontWeight.SemiBold) } } @@ -257,7 +257,7 @@ private fun EmptyOrNoneFound(onRefresh: () -> Unit) { horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center, ) { - Text("No follow sets were found, or you don't have any follow sets. Tap below to refresh, or use the menu to create one.") + Text(text = stringRes(R.string.follow_set_empty_dialog_msg)) Spacer(modifier = StdVertSpacer) OutlinedButton(onClick = onRefresh) { Text(text = stringRes(R.string.refresh)) } } @@ -275,7 +275,7 @@ private fun ErrorMessage( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center, ) { - Text("There was a problem while fetching: $errorMsg") + Text(text = stringRes(R.string.follow_set_error_dialog_msg, errorMsg)) Spacer(modifier = StdVertSpacer) OutlinedButton(onClick = onRefresh) { Text(text = stringRes(R.string.refresh)) } } @@ -291,6 +291,7 @@ fun FollowSetItem( onAddUser: () -> Unit, onRemoveUser: () -> Unit, ) { + val context = LocalContext.current Row( modifier = modifier @@ -313,9 +314,9 @@ fun FollowSetItem( listVisibility.let { val text by derivedStateOf { when (it) { - ListVisibility.Public -> "Public" - ListVisibility.Private -> "Private" - ListVisibility.Mixed -> "Mixed" + ListVisibility.Public -> stringRes(context, R.string.follow_set_type_public) + ListVisibility.Private -> stringRes(context, R.string.follow_set_type_private) + ListVisibility.Mixed -> stringRes(context, R.string.follow_set_type_mixed) } } Icon( @@ -327,7 +328,7 @@ fun FollowSetItem( ListVisibility.Mixed -> R.drawable.format_list_bulleted_type }, ), - contentDescription = "Icon for $text List", + contentDescription = stringRes(R.string.follow_set_type_description, text), ) } } @@ -339,7 +340,14 @@ fun FollowSetItem( enabled = isUserInList, onClick = {}, label = { - Text(text = if (isUserInList) "$userName is present in this list" else "$userName is not in this list") + Text( + text = + if (isUserInList) { + stringRes(R.string.follow_set_presence_indicator, userName) + } else { + stringRes(R.string.follow_set_absence_indicator, userName) + }, + ) }, leadingIcon = if (isUserInList) { @@ -392,7 +400,7 @@ fun FollowSetItem( ) } } - Text(text = if (isUserInList) "Remove" else "Add", color = Color.Gray) + Text(text = stringRes(if (isUserInList) R.string.remove else R.string.add), color = Color.Gray) } } } @@ -410,7 +418,7 @@ fun FollowSetsCreationMenu( modifier = modifier.padding(vertical = 30.dp), ) { Text( - "Make New List", + stringRes(R.string.follow_set_creation_menu_title), fontSize = 18.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Start, @@ -439,7 +447,7 @@ fun FollowSetsCreationMenu( } if (isListAdditionDialogOpen.value) { - NewListCreationDialog( + NewSetCreationDialog( onDismiss = { isListAdditionDialogOpen.value = false isPrivateOptionTapped.value = false @@ -459,6 +467,9 @@ fun FollowSetCreationItem( userName: String, onClick: () -> Unit, ) { + val context = LocalContext.current + val setTypeLabel = stringRes(context, if (setIsPrivate) R.string.follow_set_type_private else R.string.follow_set_type_public) + HorizontalDivider() Column( modifier = @@ -477,7 +488,11 @@ fun FollowSetCreationItem( verticalAlignment = Alignment.CenterVertically, ) { Text( - text = "Create new ${if (setIsPrivate) "Private" else "Public"} list with user", + text = + stringRes( + R.string.follow_set_creation_item_label, + setTypeLabel, + ), fontWeight = FontWeight.SemiBold, ) Spacer(modifier = StdHorzSpacer) @@ -491,7 +506,7 @@ fun FollowSetCreationItem( } Spacer(modifier = StdVertSpacer) Text( - "Creates a ${if (setIsPrivate) "private" else "public"} follow set, and adds $userName to it.", + stringRes(R.string.follow_set_creation_item_description, setTypeLabel, userName), fontWeight = FontWeight.Light, overflow = TextOverflow.Ellipsis, maxLines = 2, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/ProfileActions.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/ProfileActions.kt index 676a2507c..f920efef3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/ProfileActions.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/ProfileActions.kt @@ -23,7 +23,6 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.profile.header import androidx.compose.foundation.shape.CornerSize import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.List -import androidx.compose.material.icons.filled.List import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.Icon import androidx.compose.material3.TextButton @@ -31,12 +30,14 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.remember +import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.User import com.vitorpamplona.amethyst.service.relayClient.reqCommand.account.observeAccountIsHiddenUser import com.vitorpamplona.amethyst.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.navigation.routes.Route import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.profile.zaps.ShowUserButton +import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.ButtonBorder import com.vitorpamplona.amethyst.ui.theme.ZeroPadding @@ -69,7 +70,7 @@ fun ProfileActions( ) { Icon( imageVector = Icons.AutoMirrored.Filled.List, - contentDescription = "Add or remove user from lists, or create a new list with this user.", + contentDescription = stringRes(R.string.follow_set_profile_actions_menu_description), ) } } diff --git a/amethyst/src/main/res/values/strings.xml b/amethyst/src/main/res/values/strings.xml index 7c9e3b16e..d5b837e88 100644 --- a/amethyst/src/main/res/values/strings.xml +++ b/amethyst/src/main/res/values/strings.xml @@ -124,6 +124,7 @@ Post Save Create + Rename Cancel Failed to upload the image Relay Address @@ -508,6 +509,36 @@ Global Mute List + Follow Sets + Labeled Bookmarks + General Bookmarks + Public + Private + Mixed + + It seems you do not have any follow sets yet. + \nTap below to refresh, or tap the add buttons to create a new one. + + Add author to follow set + Add or remove user from lists, or create a new list with this user. + Icon for %1$s List + "%1$s is present in this list" + "%1$s is not in this list" + Your Follow Sets + No follow sets were found, or you don\'t have any follow sets. Tap below to refresh, or use the menu to create one. + There was a problem while fetching: %1$s + Make New List + "Create new %1$s list with user + Creates a %1$s follow set, and adds %2$s to it. + New %1$s List + Set name + Set description(optional) + Create set + Rename set + You are renaming from + to.. + + Default port is 9050 ## Connect through Tor with Orbot @@ -1231,7 +1262,7 @@ No torrent apps installed to open and download the file. Event doesn\'t have enough information to build a magnet link - My Lists + My Lists/Sets Select a list to filter the feed Log off on device lock