Skip to content

Commit 0f25b38

Browse files
committed
Improve some strings and add some comments
1 parent 793bd6f commit 0f25b38

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

app/src/main/java/org/schabi/newpipe/ui/components/menu/LongPressMenuEditor.kt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ package org.schabi.newpipe.ui.components.menu
2121
import android.util.Log
2222
import androidx.annotation.StringRes
2323
import androidx.compose.foundation.BorderStroke
24-
import androidx.compose.foundation.background
2524
import androidx.compose.foundation.border
2625
import androidx.compose.foundation.gestures.scrollBy
2726
import androidx.compose.foundation.layout.BoxWithConstraints
@@ -97,7 +96,20 @@ import kotlin.math.min
9796

9897
internal const val TAG = "LongPressMenuEditor"
9998

100-
// TODO padding doesn't seem to work as expected when the list becomes scrollable?
99+
/**
100+
* When making changes to this composable, make sure to test the following use cases still work:
101+
* - both the actions and the header can be dragged around
102+
* - the header can only be dragged to the first position in each section
103+
* - when a section is empty the None marker will appear
104+
* - actions and header are loaded from and stored to settings properly
105+
* - it is possible to move items around using DPAD on Android TVs, and there are no strange bugs
106+
* - when dragging items around, a Drag marker appears at the would-be position of the item being
107+
* dragged, and the item being dragged is "picked up" and shown below the user's finger (at an
108+
* offset to ensure the user can see the thing being dragged under their finger)
109+
* - when the view does not fit the page, it is possible to scroll without moving any item, and
110+
* dragging an item towards the top/bottom of the page scrolls up/down
111+
* @author This composable was originally copied from FlorisBoard.
112+
*/
101113
@Composable
102114
fun LongPressMenuEditor(modifier: Modifier = Modifier) {
103115
// We get the current arrangement once and do not observe on purpose
@@ -604,9 +616,9 @@ private fun ItemInListUi(
604616
modifier = modifier,
605617
selected = selected,
606618
icon = Icons.Default.ArtTrack,
607-
text = R.string.header,
619+
text = R.string.long_press_menu_header,
608620
contentColor = MaterialTheme.colorScheme.onSurfaceVariant,
609-
backgroundColor = MaterialTheme.colorScheme.surfaceVariant,
621+
backgroundColor = MaterialTheme.colorScheme.surfaceContainer,
610622
horizontalPadding = 12.dp,
611623
)
612624
}
@@ -633,6 +645,7 @@ private fun ItemInListUi(
633645
}
634646

635647
@Preview
648+
@Preview(device = "spec:width=1080px,height=1000px,dpi=440")
636649
@Composable
637650
private fun LongPressMenuEditorPreview() {
638651
AppTheme {

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -904,10 +904,10 @@
904904
<string name="popup_from_here">Popup\nfrom here</string>
905905
<string name="play_from_here">Play\nfrom here</string>
906906
<string name="long_press_menu_enabled_actions">Enabled actions:</string>
907-
<string name="long_press_menu_enabled_actions_description">Reorder the actions by long pressing and then dragging them around</string>
907+
<string name="long_press_menu_enabled_actions_description">Reorder the actions by long pressing them and then dragging them around</string>
908908
<string name="long_press_menu_hidden_actions">Hidden actions:</string>
909909
<string name="long_press_menu_hidden_actions_description">Drag the header or the actions to this section to hide them</string>
910-
<string name="header">Header</string>
910+
<string name="long_press_menu_header">Header with title, thumbnail, and clickable channel</string>
911911
<string name="back">Back</string>
912912
<string name="long_press_menu_actions_editor">Reorder and hide actions</string>
913913
</resources>

0 commit comments

Comments
 (0)