Compare commits

..
4 Commits
Author SHA1 Message Date
Codex 7e028b09d4 Reduce terminal key overflow
Gitea Smoke / smoke (push) Successful in 0s
Gitea Android APK / build (push) Failing after 8m17s
2026-07-11 08:01:21 +00:00
Codex f6e801defc Rearrange terminal composer controls
Gitea Smoke / smoke (push) Successful in 0s
Gitea Android APK / build (push) Successful in 12m15s
2026-07-11 03:12:52 +00:00
Codex 90f2088265 Support mixed Gitea runners
Gitea Smoke / smoke (push) Successful in 0s
Gitea Android APK / build (push) Failing after 8m12s
2026-07-10 16:18:55 +00:00
Codex 0d0f218d52 Compact terminal input controls
Gitea Android APK / build (push) Failing after 0s
Gitea Smoke / smoke (push) Successful in 0s
2026-07-10 15:54:51 +00:00
2 changed files with 170 additions and 107 deletions
+22 -4
View File
@@ -16,13 +16,31 @@ jobs:
run: |
set -eu
install_packages() {
if command -v apt-get >/dev/null 2>&1; then
apt-get update
apt-get install -y "$@"
elif command -v apk >/dev/null 2>&1; then
apk add --no-cache "$@"
elif command -v dnf >/dev/null 2>&1; then
dnf install -y "$@"
else
echo "No supported package manager found." >&2
exit 1
fi
}
if ! command -v git >/dev/null 2>&1 || ! command -v curl >/dev/null 2>&1 || ! command -v unzip >/dev/null 2>&1; then
apt-get update
apt-get install -y git curl unzip
install_packages git curl unzip
fi
if ! command -v java >/dev/null 2>&1; then
apt-get update
apt-get install -y openjdk-17-jdk-headless
if command -v apk >/dev/null 2>&1; then
install_packages openjdk17-jdk
elif command -v dnf >/dev/null 2>&1; then
install_packages java-17-openjdk-devel
else
install_packages openjdk-17-jdk-headless
fi
fi
java -version
@@ -66,7 +66,7 @@ public final class MainActivity extends Activity {
private static final int MAX_TERMINAL_COLS = 140;
private static final int MIN_TERMINAL_ROWS = 8;
private static final int MAX_TERMINAL_ROWS = 80;
private static final int TERMINAL_KEYS_HEIGHT_DP = 92;
private static final int TERMINAL_KEYS_HEIGHT_DP = 34;
private static final int STATUS_NORMAL = 0;
private static final int STATUS_BUSY = 1;
private static final int STATUS_SUCCESS = 2;
@@ -126,6 +126,7 @@ public final class MainActivity extends Activity {
private TextView terminalMetaText;
private ScrollView terminalScroll;
private EditText inputField;
private final Button[] terminalAccessoryTabButtons = new Button[4];
private View terminalAccessoryBar;
private View terminalComposerBar;
private LinearLayout terminalGroupRow;
@@ -2067,15 +2068,40 @@ public final class MainActivity extends Activity {
LinearLayout row = new LinearLayout(this);
row.setOrientation(LinearLayout.HORIZONTAL);
row.setGravity(Gravity.BOTTOM);
row.setGravity(Gravity.CENTER_VERTICAL);
LinearLayout tabGrid = new LinearLayout(this);
tabGrid.setOrientation(LinearLayout.VERTICAL);
LinearLayout firstTabRow = terminalKeyRow();
LinearLayout secondTabRow = terminalKeyRow();
addAccessoryTab(firstTabRow, "Edit", 0);
addAccessoryTab(firstTabRow, "Ctrl", 1);
addAccessoryTab(secondTabRow, "Nav", 2);
addAccessoryTab(secondTabRow, "Sym", 3);
tabGrid.addView(firstTabRow, new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
0,
1
));
LinearLayout.LayoutParams secondTabParams = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
0,
1
);
secondTabParams.topMargin = dp(3);
tabGrid.addView(secondTabRow, secondTabParams);
row.addView(tabGrid, new LinearLayout.LayoutParams(
dp(72),
ViewGroup.LayoutParams.MATCH_PARENT
));
inputField = new EditText(this);
inputField.setTextColor(COLOR_TEXT);
inputField.setHintTextColor(COLOR_TEXT_DIM);
inputField.setHint("type command or text");
inputField.setSingleLine(false);
inputField.setMinLines(1);
inputField.setMaxLines(2);
inputField.setMinLines(3);
inputField.setMaxLines(5);
inputField.setCursorVisible(true);
inputField.setFocusableInTouchMode(true);
inputField.setGravity(Gravity.TOP | Gravity.START);
@@ -2100,9 +2126,6 @@ public final class MainActivity extends Activity {
}
return false;
});
Button image = composerButton("Img", view -> pickImageForSession(activeSessionName));
image.setContentDescription("Upload image");
row.addView(image, new LinearLayout.LayoutParams(dp(38), dp(38)));
LinearLayout.LayoutParams inputParams = new LinearLayout.LayoutParams(
0,
ViewGroup.LayoutParams.WRAP_CONTENT,
@@ -2111,9 +2134,29 @@ public final class MainActivity extends Activity {
inputParams.leftMargin = dp(5);
inputParams.rightMargin = dp(5);
row.addView(inputField, inputParams);
LinearLayout actions = new LinearLayout(this);
actions.setOrientation(LinearLayout.VERTICAL);
Button send = composerPrimaryButton("Send", view -> sendLine());
send.setContentDescription("Send input");
row.addView(send, new LinearLayout.LayoutParams(dp(48), dp(38)));
actions.addView(send, new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
0,
1
));
Button image = composerButton("Img", view -> pickImageForSession(activeSessionName));
image.setContentDescription("Upload image");
LinearLayout.LayoutParams imageParams = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
0,
1
);
imageParams.topMargin = dp(3);
actions.addView(image, imageParams);
row.addView(actions, new LinearLayout.LayoutParams(
dp(48),
ViewGroup.LayoutParams.MATCH_PARENT
));
bar.addView(row, matchWrap());
return bar;
}
@@ -2679,37 +2722,22 @@ public final class MainActivity extends Activity {
private LinearLayout createAccessoryBar() {
LinearLayout panel = new LinearLayout(this);
panel.setOrientation(LinearLayout.VERTICAL);
panel.setPadding(dp(6), dp(4), dp(6), dp(4));
panel.setPadding(dp(4), dp(3), dp(4), dp(3));
panel.setBackgroundColor(COLOR_PANEL);
LinearLayout tabs = terminalKeyRow();
tabs.setGravity(Gravity.CENTER_VERTICAL);
addAccessoryTab(tabs, "Edit", 0);
addAccessoryTab(tabs, "Ctrl", 1);
addAccessoryTab(tabs, "Nav", 2);
addAccessoryTab(tabs, "Sym", 3);
panel.addView(tabs, new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
dp(24)
HorizontalScrollView keyScroller = new HorizontalScrollView(this);
keyScroller.setHorizontalScrollBarEnabled(false);
keyScroller.setFillViewport(true);
LinearLayout keyRow = terminalKeyRow();
addAccessoryPageKeys(keyRow);
keyScroller.addView(keyRow, new HorizontalScrollView.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.MATCH_PARENT
));
LinearLayout firstRow = terminalKeyRow();
LinearLayout secondRow = terminalKeyRow();
addAccessoryPageKeys(firstRow, secondRow);
LinearLayout.LayoutParams rowParams = new LinearLayout.LayoutParams(
panel.addView(keyScroller, new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
0,
1
);
rowParams.topMargin = dp(3);
panel.addView(firstRow, rowParams);
LinearLayout.LayoutParams secondParams = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
0,
1
);
secondParams.topMargin = dp(3);
panel.addView(secondRow, secondParams);
ViewGroup.LayoutParams.MATCH_PARENT
));
return panel;
}
@@ -2720,64 +2748,62 @@ public final class MainActivity extends Activity {
return row;
}
private void addAccessoryPageKeys(LinearLayout firstRow, LinearLayout secondRow) {
private void addAccessoryPageKeys(LinearLayout row) {
switch (terminalKeyPage) {
case 1:
addSoftKey(firstRow, "Esc", "\u001b");
addSoftKey(firstRow, "Tab", "\t");
addSoftKey(firstRow, "C-c", "\u0003");
addSoftKey(firstRow, "C-d", "\u0004");
addSoftKey(firstRow, "C-z", "\u001a");
addSoftKey(firstRow, "C-l", "\u000c");
addSoftKey(secondRow, "C-r", "\u0012");
addSoftKey(secondRow, "C-a", "\u0001");
addSoftKey(secondRow, "C-e", "\u0005");
addSoftKey(secondRow, "C-u", "\u0015");
addSoftKey(secondRow, "C-k", "\u000b");
addSoftKey(secondRow, "C-b", "\u0002");
addSoftKey(row, "Esc", "\u001b");
addSoftKey(row, "Tab", "\t");
addSoftKey(row, "C-c", "\u0003");
addSoftKey(row, "C-d", "\u0004");
addSoftKey(row, "C-z", "\u001a");
addSoftKey(row, "C-l", "\u000c");
addSoftKey(row, "C-r", "\u0012");
addSoftKey(row, "C-a", "\u0001");
addSoftKey(row, "C-e", "\u0005");
addSoftKey(row, "C-u", "\u0015");
addSoftKey(row, "C-k", "\u000b");
addSoftKey(row, "C-b", "\u0002");
break;
case 2:
addSoftKey(firstRow, "", "\u001b[D");
addSoftKey(firstRow, "", "\u001b[C");
addSoftKey(firstRow, "", "\u001b[A");
addSoftKey(firstRow, "", "\u001b[B");
addSoftKey(firstRow, "Home", "\u001b[H");
addSoftKey(firstRow, "End", "\u001b[F");
addSoftKey(secondRow, "Pg↑", "\u001b[5~");
addSoftKey(secondRow, "Pg↓", "\u001b[6~");
addComposerButton(secondRow, "Prev", () -> setTerminalKeyPage(terminalKeyPage - 1));
addComposerButton(secondRow, "Next", () -> setTerminalKeyPage(terminalKeyPage + 1));
addSoftKey(secondRow, "Clear", "\u000c");
addSoftKey(secondRow, "Detach", "\u0002d");
addSoftKey(row, "", "\u001b[D");
addSoftKey(row, "", "\u001b[C");
addSoftKey(row, "", "\u001b[A");
addSoftKey(row, "", "\u001b[B");
addSoftKey(row, "Home", "\u001b[H");
addSoftKey(row, "End", "\u001b[F");
addSoftKey(row, "Pg↑", "\u001b[5~");
addSoftKey(row, "Pg↓", "\u001b[6~");
addSoftKey(row, "Clear", "\u000c");
addSoftKey(row, "Detach", "\u0002d");
break;
case 3:
addTextKey(firstRow, "~", "~");
addTextKey(firstRow, "/", "/");
addTextKey(firstRow, "-", "-");
addTextKey(firstRow, "_", "_");
addTextKey(firstRow, ".", ".");
addTextKey(firstRow, "|", "|");
addTextKey(secondRow, "&", "&");
addTextKey(secondRow, ";", ";");
addTextKey(secondRow, "$", "$");
addTextKey(secondRow, "\"", "\"");
addTextKey(secondRow, "'", "'");
addTextKey(secondRow, "Space", " ");
addTextKey(row, "~", "~");
addTextKey(row, "/", "/");
addTextKey(row, "-", "-");
addTextKey(row, "_", "_");
addTextKey(row, ".", ".");
addTextKey(row, "|", "|");
addTextKey(row, "&", "&");
addTextKey(row, ";", ";");
addTextKey(row, "$", "$");
addTextKey(row, "\"", "\"");
addTextKey(row, "'", "'");
addTextKey(row, "Space", " ");
break;
case 0:
default:
addComposerButton(firstRow, "", () -> moveComposerCursor(-1));
addComposerButton(firstRow, "", () -> moveComposerCursor(1));
addSoftKey(firstRow, "", "\u001b[A");
addSoftKey(firstRow, "", "\u001b[B");
addSoftKey(firstRow, "Esc", "\u001b");
addSoftKey(firstRow, "Tab", "\t");
addSoftKey(secondRow, "Enter", TERMINAL_ENTER);
addSoftButton(secondRow, "Paste", view -> pasteClipboard());
addComposerButton(secondRow, "", this::backspaceComposerText);
addTextKey(secondRow, "NL", "\n");
addComposerButton(secondRow, "Bottom", this::scrollTerminalBottom);
addComposerButton(secondRow, "Select", () -> {
addComposerButton(row, "", () -> moveComposerCursor(-1));
addComposerButton(row, "", () -> moveComposerCursor(1));
addSoftKey(row, "", "\u001b[A");
addSoftKey(row, "", "\u001b[B");
addSoftKey(row, "Esc", "\u001b");
addSoftKey(row, "Tab", "\t");
addSoftKey(row, "", TERMINAL_ENTER);
addSoftButton(row, "Paste", view -> pasteClipboard());
addComposerButton(row, "", this::backspaceComposerText);
addTextKey(row, "NL", "\n");
addComposerButton(row, "Bot", this::scrollTerminalBottom);
addComposerButton(row, "Sel", () -> {
terminalSelectionEnabled = !terminalSelectionEnabled;
if (terminalText != null) {
terminalText.setTextIsSelectable(terminalSelectionEnabled);
@@ -3054,6 +3080,7 @@ public final class MainActivity extends Activity {
private void setTerminalKeyPage(int page) {
terminalKeyPage = (page + 4) % 4;
updateAccessoryTabs();
if (activeSessionName != null) {
renderTerminalControlsOnly();
}
@@ -3223,8 +3250,10 @@ public final class MainActivity extends Activity {
Button button = toolbarButton(label, listener);
button.setTextSize(10);
button.setPadding(dp(5), 0, dp(5), 0);
button.setMinWidth(0);
button.setMinimumWidth(0);
button.setMinWidth(dp(38));
button.setMinimumWidth(dp(38));
button.setMinHeight(0);
button.setMinimumHeight(0);
return button;
}
@@ -3249,7 +3278,6 @@ public final class MainActivity extends Activity {
input.setTextColor(COLOR_TEXT);
input.setHintTextColor(COLOR_TEXT_DIM);
input.setTextSize(13);
input.setMinHeight(dp(38));
input.setPadding(dp(8), dp(5), dp(8), dp(5));
input.setBackground(inputBackground());
}
@@ -3308,41 +3336,58 @@ public final class MainActivity extends Activity {
private void addSoftButton(LinearLayout row, String label, View.OnClickListener listener) {
Button button = toolbarButton(label, listener);
button.setTextSize(isArrowLabel(label) ? 15 : 9);
button.setTextSize(isArrowLabel(label) ? 14 : 9);
button.setPadding(dp(2), 0, dp(2), 0);
button.setMinWidth(0);
button.setMinimumWidth(0);
button.setMinWidth(dp(24));
button.setMinimumWidth(dp(24));
button.setMinHeight(0);
button.setMinimumHeight(0);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
0,
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.MATCH_PARENT,
1
0
);
params.leftMargin = dp(2);
params.rightMargin = dp(2);
params.rightMargin = dp(1);
row.addView(button, params);
}
private void addAccessoryTab(LinearLayout row, String label, int page) {
Button button = toolbarButton(label, view -> setTerminalKeyPage(page));
boolean selected = terminalKeyPage == page;
button.setTextSize(9);
button.setPadding(dp(2), 0, dp(2), 0);
button.setTextSize(8);
button.setPadding(dp(3), 0, dp(3), 0);
button.setMinWidth(0);
button.setMinimumWidth(0);
button.setTextColor(selected ? Color.rgb(14, 38, 24) : COLOR_TEXT_MUTED);
button.setBackground(selected
? rounded(COLOR_ACCENT, 7, COLOR_ACCENT, 1)
: rounded(COLOR_CARD_ALT, 7, COLOR_BORDER_SOFT, 1));
button.setMinHeight(0);
button.setMinimumHeight(0);
terminalAccessoryTabButtons[page] = button;
styleAccessoryTab(button, terminalKeyPage == page);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
0,
ViewGroup.LayoutParams.MATCH_PARENT,
1
);
params.leftMargin = dp(2);
params.rightMargin = dp(2);
if (row.getChildCount() > 0) {
params.leftMargin = dp(3);
}
row.addView(button, params);
}
private void updateAccessoryTabs() {
for (int page = 0; page < terminalAccessoryTabButtons.length; page++) {
Button button = terminalAccessoryTabButtons[page];
if (button != null) {
styleAccessoryTab(button, terminalKeyPage == page);
}
}
}
private void styleAccessoryTab(Button button, boolean selected) {
button.setTextColor(selected ? Color.rgb(14, 38, 24) : COLOR_TEXT_MUTED);
button.setBackground(selected
? rounded(COLOR_ACCENT, 6, COLOR_ACCENT, 1)
: rounded(COLOR_CARD_ALT, 6, COLOR_BORDER_SOFT, 1));
}
private boolean isArrowLabel(String label) {
return "".equals(label) || "".equals(label) || "".equals(label) || "".equals(label);
}