这是indexloc提供的服务,不要输入任何密码
Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion app/src/main/java/com/termux/app/ExtraKeysView.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ static void sendKey(View view, String keyName) {
}

private ToggleButton controlButton;
private ToggleButton shiftButton;
private ToggleButton altButton;
private ToggleButton fnButton;

Expand All @@ -80,6 +81,16 @@ public boolean readControlButton() {
}
return result;
}

public boolean readShiftButton() {
if (shiftButton.isPressed()) return true;
boolean result = shiftButton.isChecked();
if (result) {
shiftButton.setChecked(false);
shiftButton.setTextColor(TEXT_COLOR);
}
return result;
}

public boolean readAltButton() {
if (altButton.isPressed()) return true;
Expand All @@ -106,7 +117,7 @@ void reload() {
removeAllViews();

String[][] buttons = {
{"ESC", "CTRL", "ALT", "TAB", "―", "/", "|"}
{"ESC", "CTRL", "SHIFT", "ALT", "TAB", "―", "/", "|"}
};

final int rows = buttons.length;
Expand All @@ -125,6 +136,10 @@ void reload() {
button = controlButton = new ToggleButton(getContext(), null, android.R.attr.buttonBarButtonStyle);
button.setClickable(true);
break;
case "SHIFT":
button = shiftButton = new ToggleButton(getContext(), null, android.R.attr.buttonBarButtonStyle);
button.setClickable(true);
break;
case "ALT":
button = altButton = new ToggleButton(getContext(), null, android.R.attr.buttonBarButtonStyle);
button.setClickable(true);
Expand All @@ -149,6 +164,7 @@ public void onClick(View v) {
View root = getRootView();
switch (buttonText) {
case "CTRL":
case "SHIFT":
case "ALT":
case "FN":
ToggleButton self = (ToggleButton) finalButton;
Expand Down