Improve some strings and add some comments

This commit is contained in:
Stypox 2026-01-06 20:30:59 +01:00
parent 4d8cdc4681
commit 1a42f300f2
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
2 changed files with 19 additions and 6 deletions

View File

@ -21,7 +21,6 @@ package org.schabi.newpipe.ui.components.menu
import android.util.Log
import androidx.annotation.StringRes
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.gestures.scrollBy
import androidx.compose.foundation.layout.BoxWithConstraints
@ -97,7 +96,20 @@ import kotlin.math.min
internal const val TAG = "LongPressMenuEditor"
// TODO padding doesn't seem to work as expected when the list becomes scrollable?
/**
* When making changes to this composable, make sure to test the following use cases still work:
* - both the actions and the header can be dragged around
* - the header can only be dragged to the first position in each section
* - when a section is empty the None marker will appear
* - actions and header are loaded from and stored to settings properly
* - it is possible to move items around using DPAD on Android TVs, and there are no strange bugs
* - when dragging items around, a Drag marker appears at the would-be position of the item being
* dragged, and the item being dragged is "picked up" and shown below the user's finger (at an
* offset to ensure the user can see the thing being dragged under their finger)
* - when the view does not fit the page, it is possible to scroll without moving any item, and
* dragging an item towards the top/bottom of the page scrolls up/down
* @author This composable was originally copied from FlorisBoard.
*/
@Composable
fun LongPressMenuEditor(modifier: Modifier = Modifier) {
// We get the current arrangement once and do not observe on purpose
@ -604,9 +616,9 @@ private fun ItemInListUi(
modifier = modifier,
selected = selected,
icon = Icons.Default.ArtTrack,
text = R.string.header,
text = R.string.long_press_menu_header,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant,
backgroundColor = MaterialTheme.colorScheme.surfaceVariant,
backgroundColor = MaterialTheme.colorScheme.surfaceContainer,
horizontalPadding = 12.dp,
)
}
@ -633,6 +645,7 @@ private fun ItemInListUi(
}
@Preview
@Preview(device = "spec:width=1080px,height=1000px,dpi=440")
@Composable
private fun LongPressMenuEditorPreview() {
AppTheme {

View File

@ -904,10 +904,10 @@
<string name="popup_from_here">Popup\nfrom here</string>
<string name="play_from_here">Play\nfrom here</string>
<string name="long_press_menu_enabled_actions">Enabled actions:</string>
<string name="long_press_menu_enabled_actions_description">Reorder the actions by long pressing and then dragging them around</string>
<string name="long_press_menu_enabled_actions_description">Reorder the actions by long pressing them and then dragging them around</string>
<string name="long_press_menu_hidden_actions">Hidden actions:</string>
<string name="long_press_menu_hidden_actions_description">Drag the header or the actions to this section to hide them</string>
<string name="header">Header</string>
<string name="long_press_menu_header">Header with title, thumbnail, and clickable channel</string>
<string name="back">Back</string>
<string name="long_press_menu_actions_editor">Reorder and hide actions</string>
</resources>