Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a1052d437 | ||
|
|
7e028b09d4 |
@@ -2722,7 +2722,7 @@ public final class MainActivity extends Activity {
|
|||||||
private LinearLayout createAccessoryBar() {
|
private LinearLayout createAccessoryBar() {
|
||||||
LinearLayout panel = new LinearLayout(this);
|
LinearLayout panel = new LinearLayout(this);
|
||||||
panel.setOrientation(LinearLayout.VERTICAL);
|
panel.setOrientation(LinearLayout.VERTICAL);
|
||||||
panel.setPadding(dp(6), dp(3), dp(6), dp(3));
|
panel.setPadding(dp(4), dp(3), dp(4), dp(3));
|
||||||
panel.setBackgroundColor(COLOR_PANEL);
|
panel.setBackgroundColor(COLOR_PANEL);
|
||||||
|
|
||||||
HorizontalScrollView keyScroller = new HorizontalScrollView(this);
|
HorizontalScrollView keyScroller = new HorizontalScrollView(this);
|
||||||
@@ -2773,8 +2773,6 @@ public final class MainActivity extends Activity {
|
|||||||
addSoftKey(row, "End", "\u001b[F");
|
addSoftKey(row, "End", "\u001b[F");
|
||||||
addSoftKey(row, "Pg↑", "\u001b[5~");
|
addSoftKey(row, "Pg↑", "\u001b[5~");
|
||||||
addSoftKey(row, "Pg↓", "\u001b[6~");
|
addSoftKey(row, "Pg↓", "\u001b[6~");
|
||||||
addComposerButton(row, "Prev", () -> setTerminalKeyPage(terminalKeyPage - 1));
|
|
||||||
addComposerButton(row, "Next", () -> setTerminalKeyPage(terminalKeyPage + 1));
|
|
||||||
addSoftKey(row, "Clear", "\u000c");
|
addSoftKey(row, "Clear", "\u000c");
|
||||||
addSoftKey(row, "Detach", "\u0002d");
|
addSoftKey(row, "Detach", "\u0002d");
|
||||||
break;
|
break;
|
||||||
@@ -2800,12 +2798,12 @@ public final class MainActivity extends Activity {
|
|||||||
addSoftKey(row, "↓", "\u001b[B");
|
addSoftKey(row, "↓", "\u001b[B");
|
||||||
addSoftKey(row, "Esc", "\u001b");
|
addSoftKey(row, "Esc", "\u001b");
|
||||||
addSoftKey(row, "Tab", "\t");
|
addSoftKey(row, "Tab", "\t");
|
||||||
addSoftKey(row, "Enter", TERMINAL_ENTER);
|
addSoftKey(row, "↵", TERMINAL_ENTER);
|
||||||
addSoftButton(row, "Paste", view -> pasteClipboard());
|
addSoftButton(row, "Paste", view -> pasteClipboard());
|
||||||
addComposerButton(row, "⌫", this::backspaceComposerText);
|
addComposerButton(row, "⌫", this::backspaceComposerText);
|
||||||
addTextKey(row, "NL", "\n");
|
addTextKey(row, "NL", "\n");
|
||||||
addComposerButton(row, "Bottom", this::scrollTerminalBottom);
|
addComposerButton(row, "Bot", this::scrollTerminalBottom);
|
||||||
addComposerButton(row, "Select", () -> {
|
addComposerButton(row, "Sel", () -> {
|
||||||
terminalSelectionEnabled = !terminalSelectionEnabled;
|
terminalSelectionEnabled = !terminalSelectionEnabled;
|
||||||
if (terminalText != null) {
|
if (terminalText != null) {
|
||||||
terminalText.setTextIsSelectable(terminalSelectionEnabled);
|
terminalText.setTextIsSelectable(terminalSelectionEnabled);
|
||||||
@@ -3339,9 +3337,9 @@ public final class MainActivity extends Activity {
|
|||||||
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.setTextSize(isArrowLabel(label) ? 14 : 9);
|
button.setTextSize(isArrowLabel(label) ? 14 : 9);
|
||||||
button.setPadding(dp(5), 0, dp(5), 0);
|
button.setPadding(dp(2), 0, dp(2), 0);
|
||||||
button.setMinWidth(dp(38));
|
button.setMinWidth(dp(24));
|
||||||
button.setMinimumWidth(dp(38));
|
button.setMinimumWidth(dp(24));
|
||||||
button.setMinHeight(0);
|
button.setMinHeight(0);
|
||||||
button.setMinimumHeight(0);
|
button.setMinimumHeight(0);
|
||||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||||
@@ -3349,7 +3347,6 @@ public final class MainActivity extends Activity {
|
|||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
params.leftMargin = dp(1);
|
|
||||||
params.rightMargin = dp(1);
|
params.rightMargin = dp(1);
|
||||||
row.addView(button, params);
|
row.addView(button, params);
|
||||||
}
|
}
|
||||||
@@ -3698,9 +3695,14 @@ public final class MainActivity extends Activity {
|
|||||||
throw new IllegalStateException("Cannot open selected image");
|
throw new IllegalStateException("Cannot open selected image");
|
||||||
}
|
}
|
||||||
String response = api.uploadImage(sessionName, readAllBytes(input));
|
String response = api.uploadImage(sessionName, readAllBytes(input));
|
||||||
|
String imagePath = new JSONObject(response).optString("absolutePath", "").trim();
|
||||||
|
if (imagePath.isEmpty()) {
|
||||||
|
throw new IllegalStateException("Upload response did not include absolutePath");
|
||||||
|
}
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
showTextDialog("Image upload", response);
|
insertComposerPath(imagePath);
|
||||||
|
setStatus("Image path inserted");
|
||||||
});
|
});
|
||||||
} catch (Exception error) {
|
} catch (Exception error) {
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
@@ -3722,6 +3724,21 @@ public final class MainActivity extends Activity {
|
|||||||
return output.toByteArray();
|
return output.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void insertComposerPath(String path) {
|
||||||
|
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);
|
||||||
|
CharSequence current = inputField.getText();
|
||||||
|
String prefix = from > 0 && !Character.isWhitespace(current.charAt(from - 1)) ? " " : "";
|
||||||
|
String suffix = to < current.length() && Character.isWhitespace(current.charAt(to)) ? "" : " ";
|
||||||
|
inputField.getText().replace(from, to, prefix + path + suffix);
|
||||||
|
inputField.requestFocus();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (activeSessionName != null) {
|
if (activeSessionName != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user