mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
Accept digits in the PIN field in addition to l/r/u/d (#1330)
## Description This enhances the PIN entry system by allowing users to input digits using the numbers 0-9. This is useful for those using a keyboard or universal remote with a number pad. ### Testing Tested on Nvidia Shield Pro and Onn 4k Pro ## Screenshots <img width="3840" height="2160" alt="Screenshot_20260429_083041" src="https://github.com/user-attachments/assets/9e603bda-f1d3-4268-a04c-b077297fdfac" /> --------- Co-authored-by: Damontecres <damontecres@gmail.com>
This commit is contained in:
parent
cb46aa4159
commit
08db2b0efc
2 changed files with 29 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ import androidx.compose.ui.input.key.key
|
|||
import androidx.compose.ui.input.key.onKeyEvent
|
||||
import androidx.compose.ui.input.key.type
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.tv.material3.MaterialTheme
|
||||
|
|
@ -72,6 +73,16 @@ fun PinEntry(
|
|||
Key.DirectionRight -> "R"
|
||||
Key.DirectionDown -> "D"
|
||||
Key.DirectionLeft -> "L"
|
||||
Key.Zero, Key.NumPad0 -> "0"
|
||||
Key.One, Key.NumPad1 -> "1"
|
||||
Key.Two, Key.NumPad2 -> "2"
|
||||
Key.Three, Key.NumPad3 -> "3"
|
||||
Key.Four, Key.NumPad4 -> "4"
|
||||
Key.Five, Key.NumPad5 -> "5"
|
||||
Key.Six, Key.NumPad6 -> "6"
|
||||
Key.Seven, Key.NumPad7 -> "7"
|
||||
Key.Eight, Key.NumPad8 -> "8"
|
||||
Key.Nine, Key.NumPad9 -> "9"
|
||||
else -> return@onKeyEvent false
|
||||
}
|
||||
onTextChange.invoke(str)
|
||||
|
|
@ -122,6 +133,16 @@ fun PinEntryCreate(
|
|||
Key.DirectionRight -> "R"
|
||||
Key.DirectionDown -> "D"
|
||||
Key.DirectionLeft -> "L"
|
||||
Key.Zero, Key.NumPad0 -> "0"
|
||||
Key.One, Key.NumPad1 -> "1"
|
||||
Key.Two, Key.NumPad2 -> "2"
|
||||
Key.Three, Key.NumPad3 -> "3"
|
||||
Key.Four, Key.NumPad4 -> "4"
|
||||
Key.Five, Key.NumPad5 -> "5"
|
||||
Key.Six, Key.NumPad6 -> "6"
|
||||
Key.Seven, Key.NumPad7 -> "7"
|
||||
Key.Eight, Key.NumPad8 -> "8"
|
||||
Key.Nine, Key.NumPad9 -> "9"
|
||||
else -> return@onKeyEvent false
|
||||
}
|
||||
onTextChange.invoke(str)
|
||||
|
|
@ -154,6 +175,7 @@ fun PinEntryCreate(
|
|||
@Composable
|
||||
fun PinArrowRow(modifier: Modifier = Modifier) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
modifier = modifier,
|
||||
) {
|
||||
|
|
@ -167,6 +189,12 @@ fun PinArrowRow(modifier: Modifier = Modifier) {
|
|||
fontFamily = FontAwesome,
|
||||
)
|
||||
}
|
||||
Text(
|
||||
text = stringResource(R.string.pin_digits_hint),
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -390,6 +390,7 @@
|
|||
<string name="incorrect">Incorrect</string>
|
||||
<string name="pin_too_short">PIN must be 4 keys or longer</string>
|
||||
<string name="will_remove_pin">Will remove PIN</string>
|
||||
<string name="pin_digits_hint">[0-9]</string>
|
||||
<string name="image_cache_size">Image disk cache size (MB)</string>
|
||||
<string name="view_options">View options</string>
|
||||
<string name="columns">Columns</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue