Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1874d23716 | ||
|
|
c4ec2fd2ef |
@@ -95,6 +95,7 @@ public final class MainActivity extends Activity {
|
|||||||
private TextView terminalText;
|
private TextView terminalText;
|
||||||
private ScrollView terminalScroll;
|
private ScrollView terminalScroll;
|
||||||
private EditText inputField;
|
private EditText inputField;
|
||||||
|
private View terminalComposerBar;
|
||||||
private String activeSessionName;
|
private String activeSessionName;
|
||||||
private String activeMainPage = PAGE_SESSIONS;
|
private String activeMainPage = PAGE_SESSIONS;
|
||||||
private String pendingImageUploadSession;
|
private String pendingImageUploadSession;
|
||||||
@@ -102,6 +103,9 @@ public final class MainActivity extends Activity {
|
|||||||
private final StringBuilder queuedTerminalInput = new StringBuilder();
|
private final StringBuilder queuedTerminalInput = new StringBuilder();
|
||||||
private boolean terminalConnected;
|
private boolean terminalConnected;
|
||||||
private boolean terminalRenderPending;
|
private boolean terminalRenderPending;
|
||||||
|
private boolean terminalSelectionEnabled;
|
||||||
|
private boolean terminalFollowOutput = true;
|
||||||
|
private int terminalKeyPage;
|
||||||
private long lastTerminalRenderMs;
|
private long lastTerminalRenderMs;
|
||||||
private int terminalCols = DEFAULT_TERMINAL_COLS;
|
private int terminalCols = DEFAULT_TERMINAL_COLS;
|
||||||
private int terminalRows = DEFAULT_TERMINAL_ROWS;
|
private int terminalRows = DEFAULT_TERMINAL_ROWS;
|
||||||
@@ -173,7 +177,7 @@ public final class MainActivity extends Activity {
|
|||||||
view.setOnApplyWindowInsetsListener((target, insets) -> {
|
view.setOnApplyWindowInsetsListener((target, insets) -> {
|
||||||
int bottom = insets.getSystemWindowInsetBottom();
|
int bottom = insets.getSystemWindowInsetBottom();
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
bottom = Math.max(bottom, insets.getInsets(WindowInsets.Type.ime()).bottom);
|
bottom = insets.getInsets(WindowInsets.Type.systemBars()).bottom;
|
||||||
}
|
}
|
||||||
target.setPadding(
|
target.setPadding(
|
||||||
0,
|
0,
|
||||||
@@ -971,6 +975,9 @@ public final class MainActivity extends Activity {
|
|||||||
queuedTerminalInput.setLength(0);
|
queuedTerminalInput.setLength(0);
|
||||||
terminalConnected = false;
|
terminalConnected = false;
|
||||||
terminalRenderPending = false;
|
terminalRenderPending = false;
|
||||||
|
terminalSelectionEnabled = false;
|
||||||
|
terminalFollowOutput = true;
|
||||||
|
terminalKeyPage = 0;
|
||||||
lastTerminalRenderMs = 0L;
|
lastTerminalRenderMs = 0L;
|
||||||
terminalCols = DEFAULT_TERMINAL_COLS;
|
terminalCols = DEFAULT_TERMINAL_COLS;
|
||||||
terminalRows = DEFAULT_TERMINAL_ROWS;
|
terminalRows = DEFAULT_TERMINAL_ROWS;
|
||||||
@@ -987,7 +994,7 @@ public final class MainActivity extends Activity {
|
|||||||
terminalText.setIncludeFontPadding(false);
|
terminalText.setIncludeFontPadding(false);
|
||||||
terminalText.setLineSpacing(0, 1.05f);
|
terminalText.setLineSpacing(0, 1.05f);
|
||||||
terminalText.setGravity(Gravity.BOTTOM | Gravity.START);
|
terminalText.setGravity(Gravity.BOTTOM | Gravity.START);
|
||||||
terminalText.setTextIsSelectable(false);
|
terminalText.setTextIsSelectable(terminalSelectionEnabled);
|
||||||
terminalText.setPadding(dp(10), dp(10), dp(10), dp(10));
|
terminalText.setPadding(dp(10), dp(10), dp(10), dp(10));
|
||||||
terminalText.setBackgroundColor(Color.rgb(4, 7, 10));
|
terminalText.setBackgroundColor(Color.rgb(4, 7, 10));
|
||||||
terminalScroll.addView(terminalText, new ScrollView.LayoutParams(
|
terminalScroll.addView(terminalText, new ScrollView.LayoutParams(
|
||||||
@@ -996,24 +1003,31 @@ public final class MainActivity extends Activity {
|
|||||||
));
|
));
|
||||||
terminalScroll.addOnLayoutChangeListener((view, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) ->
|
terminalScroll.addOnLayoutChangeListener((view, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) ->
|
||||||
resizeTerminalToViewport(false));
|
resizeTerminalToViewport(false));
|
||||||
|
terminalScroll.setOnScrollChangeListener((view, scrollX, scrollY, oldScrollX, oldScrollY) ->
|
||||||
|
terminalFollowOutput = !view.canScrollVertically(1));
|
||||||
root.addView(terminalScroll, new LinearLayout.LayoutParams(
|
root.addView(terminalScroll, new LinearLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
0,
|
0,
|
||||||
1
|
1
|
||||||
));
|
));
|
||||||
root.addView(createComposerBar(), matchWrap());
|
|
||||||
root.addView(createSoftKeyPad(), new LinearLayout.LayoutParams(
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
dp(92)
|
|
||||||
));
|
|
||||||
root.addView(statusText, new LinearLayout.LayoutParams(
|
root.addView(statusText, new LinearLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
dp(28)
|
dp(28)
|
||||||
));
|
));
|
||||||
|
terminalComposerBar = createComposerBar();
|
||||||
|
root.addView(terminalComposerBar, matchWrap());
|
||||||
|
root.addView(createAccessoryBar(), new LinearLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
dp(48)
|
||||||
|
));
|
||||||
terminalScroll.post(() -> {
|
terminalScroll.post(() -> {
|
||||||
resizeTerminalToViewport(false);
|
resizeTerminalToViewport(false);
|
||||||
connectTerminal(sessionName);
|
connectTerminal(sessionName);
|
||||||
});
|
});
|
||||||
|
inputField.post(() -> {
|
||||||
|
inputField.requestFocus();
|
||||||
|
hideKeyboard();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private LinearLayout createTerminalTopBar(String sessionName) {
|
private LinearLayout createTerminalTopBar(String sessionName) {
|
||||||
@@ -1191,10 +1205,12 @@ public final class MainActivity extends Activity {
|
|||||||
inputField = new EditText(this);
|
inputField = new EditText(this);
|
||||||
inputField.setTextColor(Color.WHITE);
|
inputField.setTextColor(Color.WHITE);
|
||||||
inputField.setHintTextColor(Color.rgb(150, 158, 168));
|
inputField.setHintTextColor(Color.rgb(150, 158, 168));
|
||||||
inputField.setHint("type command, text, or multi-line paste");
|
inputField.setHint("type, edit, paste");
|
||||||
inputField.setSingleLine(false);
|
inputField.setSingleLine(false);
|
||||||
inputField.setMinLines(1);
|
inputField.setMinLines(1);
|
||||||
inputField.setMaxLines(4);
|
inputField.setMaxLines(3);
|
||||||
|
inputField.setCursorVisible(true);
|
||||||
|
inputField.setFocusableInTouchMode(true);
|
||||||
inputField.setGravity(Gravity.TOP | Gravity.START);
|
inputField.setGravity(Gravity.TOP | Gravity.START);
|
||||||
inputField.setImeOptions(EditorInfo.IME_ACTION_NONE);
|
inputField.setImeOptions(EditorInfo.IME_ACTION_NONE);
|
||||||
inputField.setInputType(InputType.TYPE_CLASS_TEXT
|
inputField.setInputType(InputType.TYPE_CLASS_TEXT
|
||||||
@@ -1214,19 +1230,9 @@ public final class MainActivity extends Activity {
|
|||||||
row.addView(inputField, new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1));
|
row.addView(inputField, new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1));
|
||||||
row.addView(toolbarButton("Send", view -> sendLine()), new LinearLayout.LayoutParams(
|
row.addView(toolbarButton("Send", view -> sendLine()), new LinearLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||||
dp(54)
|
dp(48)
|
||||||
));
|
));
|
||||||
bar.addView(row, matchWrap());
|
bar.addView(row, matchWrap());
|
||||||
|
|
||||||
LinearLayout actions = new LinearLayout(this);
|
|
||||||
actions.setOrientation(LinearLayout.HORIZONTAL);
|
|
||||||
actions.setGravity(Gravity.CENTER_VERTICAL);
|
|
||||||
actions.setPadding(0, dp(5), 0, 0);
|
|
||||||
actions.addView(compactButton("Enter", view -> sendTerminalInput("\r")));
|
|
||||||
actions.addView(compactButton("NL", view -> insertComposerText("\n")));
|
|
||||||
actions.addView(compactButton("Hide", view -> hideKeyboard()));
|
|
||||||
actions.addView(compactButton("Clear", view -> inputField.setText("")));
|
|
||||||
bar.addView(actions, matchWrap());
|
|
||||||
return bar;
|
return bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1747,22 +1753,7 @@ public final class MainActivity extends Activity {
|
|||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LinearLayout createSoftKeyPad() {
|
private HorizontalScrollView createAccessoryBar() {
|
||||||
LinearLayout pad = new LinearLayout(this);
|
|
||||||
pad.setOrientation(LinearLayout.VERTICAL);
|
|
||||||
pad.setBackgroundColor(Color.rgb(22, 27, 34));
|
|
||||||
pad.addView(createSoftKeyRow(
|
|
||||||
new String[]{"Esc", "Tab", "^C", "^D", "^L", "^R", "^A", "^E", "^V", "^Z", "^\\", "Paste"},
|
|
||||||
new String[]{"\u001b", "\t", "\u0003", "\u0004", "\u000c", "\u0012", "\u0001", "\u0005", "\u0016", "\u001a", "\u001c", null}
|
|
||||||
), new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1));
|
|
||||||
pad.addView(createSoftKeyRow(
|
|
||||||
new String[]{"Tmux", "Detach", "NewWin", "PrevWin", "NextWin", "Left", "Down", "Up", "Right", "PgUp", "PgDn", "Home", "End"},
|
|
||||||
new String[]{"\u0002", "\u0002d", "\u0002c", "\u0002p", "\u0002n", "\u001b[D", "\u001b[B", "\u001b[A", "\u001b[C", "\u001b[5~", "\u001b[6~", "\u001b[H", "\u001b[F"}
|
|
||||||
), new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1));
|
|
||||||
return pad;
|
|
||||||
}
|
|
||||||
|
|
||||||
private HorizontalScrollView createSoftKeyRow(String[] labels, String[] sequences) {
|
|
||||||
HorizontalScrollView scroller = new HorizontalScrollView(this);
|
HorizontalScrollView scroller = new HorizontalScrollView(this);
|
||||||
scroller.setHorizontalScrollBarEnabled(false);
|
scroller.setHorizontalScrollBarEnabled(false);
|
||||||
scroller.setBackgroundColor(Color.rgb(22, 27, 34));
|
scroller.setBackgroundColor(Color.rgb(22, 27, 34));
|
||||||
@@ -1771,15 +1762,10 @@ public final class MainActivity extends Activity {
|
|||||||
row.setOrientation(LinearLayout.HORIZONTAL);
|
row.setOrientation(LinearLayout.HORIZONTAL);
|
||||||
row.setGravity(Gravity.CENTER_VERTICAL);
|
row.setGravity(Gravity.CENTER_VERTICAL);
|
||||||
row.setPadding(dp(6), dp(4), dp(6), dp(4));
|
row.setPadding(dp(6), dp(4), dp(6), dp(4));
|
||||||
for (int index = 0; index < labels.length; index++) {
|
addAccessoryButton(row, "<", view -> setTerminalKeyPage(terminalKeyPage - 1));
|
||||||
String label = labels[index];
|
addPageLabel(row);
|
||||||
String sequence = sequences[index];
|
addAccessoryPageKeys(row);
|
||||||
if (sequence == null) {
|
addAccessoryButton(row, ">", view -> setTerminalKeyPage(terminalKeyPage + 1));
|
||||||
addSoftButton(row, label, view -> pasteClipboard());
|
|
||||||
} else {
|
|
||||||
addSoftKey(row, label, sequence);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
scroller.addView(row, new HorizontalScrollView.LayoutParams(
|
scroller.addView(row, new HorizontalScrollView.LayoutParams(
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT
|
ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
@@ -1787,6 +1773,87 @@ public final class MainActivity extends Activity {
|
|||||||
return scroller;
|
return scroller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addPageLabel(LinearLayout row) {
|
||||||
|
TextView label = new TextView(this);
|
||||||
|
label.setText(accessoryPageName());
|
||||||
|
label.setTextColor(Color.rgb(139, 148, 158));
|
||||||
|
label.setTextSize(11);
|
||||||
|
label.setGravity(Gravity.CENTER);
|
||||||
|
label.setTypeface(Typeface.DEFAULT_BOLD);
|
||||||
|
row.addView(label, new LinearLayout.LayoutParams(dp(58), ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addAccessoryPageKeys(LinearLayout row) {
|
||||||
|
switch (terminalKeyPage) {
|
||||||
|
case 1:
|
||||||
|
addSoftKey(row, "Esc", "\u001b");
|
||||||
|
addSoftKey(row, "Tab", "\t");
|
||||||
|
addSoftKey(row, "^C", "\u0003");
|
||||||
|
addSoftKey(row, "^D", "\u0004");
|
||||||
|
addSoftKey(row, "^L", "\u000c");
|
||||||
|
addSoftKey(row, "^R", "\u0012");
|
||||||
|
addSoftKey(row, "^A", "\u0001");
|
||||||
|
addSoftKey(row, "^E", "\u0005");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
addSoftKey(row, "Left", "\u001b[D");
|
||||||
|
addSoftKey(row, "Right", "\u001b[C");
|
||||||
|
addSoftKey(row, "Up", "\u001b[A");
|
||||||
|
addSoftKey(row, "Down", "\u001b[B");
|
||||||
|
addSoftKey(row, "Home", "\u001b[H");
|
||||||
|
addSoftKey(row, "End", "\u001b[F");
|
||||||
|
addSoftKey(row, "PgUp", "\u001b[5~");
|
||||||
|
addSoftKey(row, "PgDn", "\u001b[6~");
|
||||||
|
addSoftKey(row, "Tmux", "\u0002");
|
||||||
|
addSoftKey(row, "Detach", "\u0002d");
|
||||||
|
addSoftKey(row, "New", "\u0002c");
|
||||||
|
addSoftKey(row, "Prev", "\u0002p");
|
||||||
|
addSoftKey(row, "Next", "\u0002n");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
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(row, "Left", () -> moveComposerCursor(-1));
|
||||||
|
addComposerButton(row, "Right", () -> moveComposerCursor(1));
|
||||||
|
addSoftKey(row, "Up", "\u001b[A");
|
||||||
|
addSoftKey(row, "Down", "\u001b[B");
|
||||||
|
addSoftKey(row, "Enter", "\r");
|
||||||
|
addAccessoryButton(row, "NL", view -> insertComposerText("\n"));
|
||||||
|
addSoftButton(row, "Paste", view -> pasteClipboard());
|
||||||
|
addAccessoryButton(row, "Back", view -> backspaceComposerText());
|
||||||
|
addAccessoryButton(row, "Kbd", view -> showKeyboard());
|
||||||
|
addAccessoryButton(row, "Hide", view -> hideKeyboard());
|
||||||
|
addAccessoryButton(row, "Bottom", view -> scrollTerminalBottom());
|
||||||
|
addAccessoryButton(row, "Select", view -> toggleTerminalSelection());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String accessoryPageName() {
|
||||||
|
switch (terminalKeyPage) {
|
||||||
|
case 1:
|
||||||
|
return "CTRL";
|
||||||
|
case 2:
|
||||||
|
return "NAV";
|
||||||
|
case 3:
|
||||||
|
return "SYM";
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
return "EDIT";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void connectTerminal(String sessionName) {
|
private void connectTerminal(String sessionName) {
|
||||||
closeTerminalSocket();
|
closeTerminalSocket();
|
||||||
queuedTerminalInput.setLength(0);
|
queuedTerminalInput.setLength(0);
|
||||||
@@ -1876,6 +1943,7 @@ public final class MainActivity extends Activity {
|
|||||||
if (!normalized.endsWith("\r")) {
|
if (!normalized.endsWith("\r")) {
|
||||||
normalized = normalized + "\r";
|
normalized = normalized + "\r";
|
||||||
}
|
}
|
||||||
|
terminalFollowOutput = true;
|
||||||
sendTerminalInput(normalized);
|
sendTerminalInput(normalized);
|
||||||
inputField.setText("");
|
inputField.setText("");
|
||||||
hideKeyboard();
|
hideKeyboard();
|
||||||
@@ -1947,6 +2015,43 @@ public final class MainActivity extends Activity {
|
|||||||
inputField.requestFocus();
|
inputField.requestFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void moveComposerCursor(int delta) {
|
||||||
|
if (inputField == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int current = Math.max(0, inputField.getSelectionEnd());
|
||||||
|
int next = clamp(current + delta, 0, inputField.getText().length());
|
||||||
|
inputField.setSelection(next);
|
||||||
|
inputField.requestFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void backspaceComposerText() {
|
||||||
|
if (inputField == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int start = Math.max(0, inputField.getSelectionStart());
|
||||||
|
int end = Math.max(0, inputField.getSelectionEnd());
|
||||||
|
int from = Math.min(start, end);
|
||||||
|
int to = Math.max(start, end);
|
||||||
|
if (from != to) {
|
||||||
|
inputField.getText().delete(from, to);
|
||||||
|
} else if (from > 0) {
|
||||||
|
inputField.getText().delete(from - 1, from);
|
||||||
|
}
|
||||||
|
inputField.requestFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showKeyboard() {
|
||||||
|
if (inputField == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
inputField.requestFocus();
|
||||||
|
InputMethodManager manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
if (manager != null) {
|
||||||
|
manager.showSoftInput(inputField, InputMethodManager.SHOW_IMPLICIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void hideKeyboard() {
|
private void hideKeyboard() {
|
||||||
if (inputField == null) {
|
if (inputField == null) {
|
||||||
return;
|
return;
|
||||||
@@ -1955,7 +2060,41 @@ public final class MainActivity extends Activity {
|
|||||||
if (manager != null) {
|
if (manager != null) {
|
||||||
manager.hideSoftInputFromWindow(inputField.getWindowToken(), 0);
|
manager.hideSoftInputFromWindow(inputField.getWindowToken(), 0);
|
||||||
}
|
}
|
||||||
inputField.clearFocus();
|
}
|
||||||
|
|
||||||
|
private void toggleTerminalSelection() {
|
||||||
|
terminalSelectionEnabled = !terminalSelectionEnabled;
|
||||||
|
if (terminalText != null) {
|
||||||
|
terminalText.setTextIsSelectable(terminalSelectionEnabled);
|
||||||
|
}
|
||||||
|
setStatus(terminalSelectionEnabled ? "Terminal selection on" : "Terminal selection off");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void scrollTerminalBottom() {
|
||||||
|
terminalFollowOutput = true;
|
||||||
|
if (terminalScroll != null) {
|
||||||
|
terminalScroll.post(() -> terminalScroll.fullScroll(View.FOCUS_DOWN));
|
||||||
|
}
|
||||||
|
setStatus("Following terminal output");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTerminalKeyPage(int page) {
|
||||||
|
terminalKeyPage = (page + 4) % 4;
|
||||||
|
if (activeSessionName != null) {
|
||||||
|
renderTerminalControlsOnly();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderTerminalControlsOnly() {
|
||||||
|
int composerIndex = terminalComposerBar == null ? -1 : root.indexOfChild(terminalComposerBar);
|
||||||
|
if (composerIndex < 0 || composerIndex + 1 >= root.getChildCount()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
root.removeViewAt(composerIndex + 1);
|
||||||
|
root.addView(createAccessoryBar(), composerIndex + 1, new LinearLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
dp(48)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void appendTerminal(String data) {
|
private void appendTerminal(String data) {
|
||||||
@@ -1982,7 +2121,9 @@ public final class MainActivity extends Activity {
|
|||||||
}
|
}
|
||||||
lastTerminalRenderMs = System.currentTimeMillis();
|
lastTerminalRenderMs = System.currentTimeMillis();
|
||||||
terminalText.setText(terminalScreen.render());
|
terminalText.setText(terminalScreen.render());
|
||||||
terminalScroll.post(() -> terminalScroll.fullScroll(View.FOCUS_DOWN));
|
if (terminalFollowOutput) {
|
||||||
|
terminalScroll.post(() -> terminalScroll.fullScroll(View.FOCUS_DOWN));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveServerAndRefresh() {
|
private void saveServerAndRefresh() {
|
||||||
@@ -2131,10 +2272,24 @@ public final class MainActivity extends Activity {
|
|||||||
addSoftButton(row, label, view -> sendTerminalInput(sequence));
|
addSoftButton(row, label, view -> sendTerminalInput(sequence));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addTextKey(LinearLayout row, String label, String text) {
|
||||||
|
addSoftButton(row, label, view -> insertComposerText(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addAccessoryButton(LinearLayout row, String label, View.OnClickListener listener) {
|
||||||
|
addSoftButton(row, label, listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addComposerButton(LinearLayout row, String label, Runnable action) {
|
||||||
|
addSoftButton(row, label, view -> action.run());
|
||||||
|
}
|
||||||
|
|
||||||
private void addSoftButton(LinearLayout row, String label, View.OnClickListener listener) {
|
private void addSoftButton(LinearLayout row, String label, View.OnClickListener listener) {
|
||||||
Button button = toolbarButton(label, listener);
|
Button button = toolbarButton(label, listener);
|
||||||
button.setMinWidth(dp(50));
|
button.setTextSize(11);
|
||||||
button.setMinimumWidth(dp(50));
|
button.setPadding(dp(8), 0, dp(8), 0);
|
||||||
|
button.setMinWidth(dp("Space".equals(label) ? 72 : 50));
|
||||||
|
button.setMinimumWidth(dp("Space".equals(label) ? 72 : 50));
|
||||||
row.addView(button, new LinearLayout.LayoutParams(
|
row.addView(button, new LinearLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT
|
ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
|
|||||||
Reference in New Issue
Block a user