mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
support zero in pin keypad for onekey classic pin entry
This commit is contained in:
parent
4632850e1e
commit
f48fa7e23c
3 changed files with 17 additions and 11 deletions
2
drongo
2
drongo
|
|
@ -1 +1 @@
|
||||||
Subproject commit 056d5f83a6296ad8f673066ea9dbc68972a183e9
|
Subproject commit 0ce32e431460dca67dfca8c34c609ac54579b6a6
|
||||||
2
lark
2
lark
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0b1d5f06a830aa40407fd7d50ebace0767db6ec6
|
Subproject commit 91140aa6f73ef20577cacb78fc51d0e125e30807
|
||||||
|
|
@ -453,20 +453,26 @@ public class DevicePane extends TitledDescriptionPane {
|
||||||
});
|
});
|
||||||
vBox.getChildren().addAll(pinField, enterPinButton);
|
vBox.getChildren().addAll(pinField, enterPinButton);
|
||||||
|
|
||||||
TilePane tilePane = new TilePane();
|
GridPane gridPane = new GridPane();
|
||||||
tilePane.setPrefColumns(3);
|
gridPane.setHgap(10);
|
||||||
tilePane.setHgap(10);
|
gridPane.setVgap(10);
|
||||||
tilePane.setVgap(10);
|
gridPane.setMaxWidth(150);
|
||||||
tilePane.setMaxWidth(150);
|
gridPane.setMaxHeight(device.getModel().hasZeroInPin() ? 160 : 120);
|
||||||
tilePane.setMaxHeight(120);
|
|
||||||
|
|
||||||
int[] digits = new int[] {7, 8, 9, 4, 5, 6, 1, 2, 3};
|
int[] digits = device.getModel().hasZeroInPin() ? new int[] {7, 8, 9, 4, 5, 6, 1, 2, 3, 0} : new int[] {7, 8, 9, 4, 5, 6, 1, 2, 3};
|
||||||
for(int i = 0; i < digits.length; i++) {
|
for(int i = 0; i < digits.length; i++) {
|
||||||
Button pinButton = new Button();
|
Button pinButton = new Button();
|
||||||
Glyph circle = new Glyph(FontAwesome5.FONT_NAME, "CIRCLE");
|
Glyph circle = new Glyph(FontAwesome5.FONT_NAME, "CIRCLE");
|
||||||
pinButton.setGraphic(circle);
|
pinButton.setGraphic(circle);
|
||||||
pinButton.setUserData(digits[i]);
|
pinButton.setUserData(digits[i]);
|
||||||
tilePane.getChildren().add(pinButton);
|
GridPane.setRowIndex(pinButton, i / 3);
|
||||||
|
GridPane.setColumnIndex(pinButton, i % 3);
|
||||||
|
if((i / 3) == 3) {
|
||||||
|
GridPane.setHgrow(pinButton, Priority.ALWAYS);
|
||||||
|
GridPane.setColumnSpan(pinButton, 3);
|
||||||
|
pinButton.setMaxWidth(Double.MAX_VALUE);
|
||||||
|
}
|
||||||
|
gridPane.getChildren().add(pinButton);
|
||||||
pinButton.setOnAction(event -> {
|
pinButton.setOnAction(event -> {
|
||||||
pinField.setText(pinField.getText() + pinButton.getUserData());
|
pinField.setText(pinField.getText() + pinButton.getUserData());
|
||||||
});
|
});
|
||||||
|
|
@ -474,7 +480,7 @@ public class DevicePane extends TitledDescriptionPane {
|
||||||
|
|
||||||
HBox contentBox = new HBox();
|
HBox contentBox = new HBox();
|
||||||
contentBox.setSpacing(50);
|
contentBox.setSpacing(50);
|
||||||
contentBox.getChildren().add(tilePane);
|
contentBox.getChildren().add(gridPane);
|
||||||
contentBox.getChildren().add(vBox);
|
contentBox.getChildren().add(vBox);
|
||||||
contentBox.setPadding(new Insets(10, 0, 10, 0));
|
contentBox.setPadding(new Insets(10, 0, 10, 0));
|
||||||
contentBox.setAlignment(Pos.TOP_CENTER);
|
contentBox.setAlignment(Pos.TOP_CENTER);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue