This commit is contained in:
@@ -298,7 +298,12 @@ class MainActivity : ComponentActivity() {
|
||||
return true
|
||||
}
|
||||
KeyEvent.KEYCODE_ENTER, KeyEvent.KEYCODE_NUMPAD_ENTER -> {
|
||||
viewModel.sendAid(AID_ENTER)
|
||||
if (shift) {
|
||||
viewModel.eraseEof()
|
||||
isShiftPressedState.value = false
|
||||
} else {
|
||||
viewModel.sendAid(AID_ENTER)
|
||||
}
|
||||
return true
|
||||
}
|
||||
KeyEvent.KEYCODE_TAB -> {
|
||||
@@ -320,7 +325,7 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
KeyEvent.KEYCODE_ESCAPE -> {
|
||||
if (shift) {
|
||||
viewModel.sendAid(AID_CLEAR)
|
||||
viewModel.eraseInput()
|
||||
isShiftPressedState.value = false
|
||||
} else {
|
||||
viewModel.resetKeyboard()
|
||||
@@ -577,6 +582,10 @@ fun MainScreen(
|
||||
viewModel.eraseInput()
|
||||
terminalInputViewRef?.showSoftKeyboard()
|
||||
},
|
||||
onEraseEof = {
|
||||
viewModel.eraseEof()
|
||||
terminalInputViewRef?.showSoftKeyboard()
|
||||
},
|
||||
onAttn = {
|
||||
viewModel.sendAid(AID_PA1)
|
||||
terminalInputViewRef?.showSoftKeyboard()
|
||||
|
||||
@@ -40,6 +40,7 @@ fun TwoRowKeyBar(
|
||||
onTab: () -> Unit,
|
||||
onBackTab: () -> Unit,
|
||||
onEraseInput: () -> Unit = {},
|
||||
onEraseEof: () -> Unit = {},
|
||||
onAttn: () -> Unit = {},
|
||||
onSysReq: () -> Unit = {},
|
||||
onCursorSelect: () -> Unit = {},
|
||||
@@ -219,14 +220,59 @@ fun TwoRowKeyBar(
|
||||
}
|
||||
)
|
||||
|
||||
// 3. RESET
|
||||
KeyButton("RESET", Color(0xFFE67700), modifier = Modifier.weight(1f), hapticFeedbackEnabled = hapticFeedbackEnabled, innerPaddingHorizontal = 0.dp, onClick = onReset)
|
||||
// 3. RESET / ERASE (Erase Input) depending on Shift state
|
||||
val resetLabel = if (isShiftPressed) "ERASE" else "RESET"
|
||||
KeyButton(
|
||||
label = resetLabel,
|
||||
color = Color(0xFFE67700),
|
||||
modifier = Modifier.weight(1f),
|
||||
hapticFeedbackEnabled = hapticFeedbackEnabled,
|
||||
innerPaddingHorizontal = 0.dp,
|
||||
onClick = {
|
||||
if (isShiftPressed) {
|
||||
onEraseInput()
|
||||
onClearShift()
|
||||
} else {
|
||||
onReset()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// 4. ENTER
|
||||
KeyButton("ENTER", Color(0xFF2B8A3E), modifier = Modifier.weight(1f), hapticFeedbackEnabled = hapticFeedbackEnabled, innerPaddingHorizontal = 0.dp, onClick = { onSendAid(AID_ENTER) })
|
||||
// 4. ENTER / EOF (Erase EOF) depending on Shift state
|
||||
val enterLabel = if (isShiftPressed) "EOF" else "ENTER"
|
||||
KeyButton(
|
||||
label = enterLabel,
|
||||
color = Color(0xFF2B8A3E),
|
||||
modifier = Modifier.weight(1f),
|
||||
hapticFeedbackEnabled = hapticFeedbackEnabled,
|
||||
innerPaddingHorizontal = 0.dp,
|
||||
onClick = {
|
||||
if (isShiftPressed) {
|
||||
onEraseEof()
|
||||
onClearShift()
|
||||
} else {
|
||||
onSendAid(AID_ENTER)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// 5. CLEAR
|
||||
KeyButton("CLEAR", Color(0xFFC92A2A), modifier = Modifier.weight(1f), hapticFeedbackEnabled = hapticFeedbackEnabled, innerPaddingHorizontal = 0.dp, onClick = { onSendAid(AID_CLEAR) })
|
||||
// 5. CLEAR / ATTN (Attention) depending on Shift state
|
||||
val clearLabel = if (isShiftPressed) "ATTN" else "CLEAR"
|
||||
KeyButton(
|
||||
label = clearLabel,
|
||||
color = Color(0xFFC92A2A),
|
||||
modifier = Modifier.weight(1f),
|
||||
hapticFeedbackEnabled = hapticFeedbackEnabled,
|
||||
innerPaddingHorizontal = 0.dp,
|
||||
onClick = {
|
||||
if (isShiftPressed) {
|
||||
onAttn()
|
||||
onClearShift()
|
||||
} else {
|
||||
onSendAid(AID_CLEAR)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// 6. PA1
|
||||
KeyButton("PA1", Color(0xFF495057), modifier = Modifier.weight(1f), hapticFeedbackEnabled = hapticFeedbackEnabled, innerPaddingHorizontal = 0.dp, onClick = { onSendAid(AID_PA1) })
|
||||
|
||||
Reference in New Issue
Block a user