aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout/act_console.xml11
-rw-r--r--src/org/connectbot/ConsoleActivity.java9
-rw-r--r--src/org/connectbot/service/PromptHelper.java22
-rw-r--r--src/org/connectbot/service/TerminalBridge.java15
4 files changed, 38 insertions, 19 deletions
diff --git a/res/layout/act_console.xml b/res/layout/act_console.xml
index 2a995fc..6dc0968 100644
--- a/res/layout/act_console.xml
+++ b/res/layout/act_console.xml
@@ -45,15 +45,18 @@
android:layout_alignParentBottom="true"
android:padding="5dip"
android:background="#80000000"
+ android:fadingEdge="horizontal"
+ android:fadingEdgeLength="25dip"
android:visibility="gone"
>
<TextView
- android:id="@+id/console_password_hint"
+ android:id="@+id/console_password_instructions"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="fill_parent"
android:visibility="gone"
+ android:layout_marginBottom="5dip"
/>
<EditText
@@ -62,7 +65,7 @@
android:layout_height="wrap_content"
android:password="true"
android:singleLine="true"
- android:layout_below="@+id/console_password_hint"
+ android:layout_below="@+id/console_password_instructions"
/>
</RelativeLayout>
@@ -73,7 +76,7 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:padding="5dip"
- android:background="#88000000"
+ android:background="#80000000"
android:fadingEdge="horizontal"
android:fadingEdgeLength="25dip"
android:visibility="gone"
@@ -82,8 +85,8 @@
<TextView
android:id="@+id/console_prompt"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="fill_parent"
+ android:textAppearance="?android:attr/textAppearanceMedium"
/>
<Button
diff --git a/src/org/connectbot/ConsoleActivity.java b/src/org/connectbot/ConsoleActivity.java
index 7e43424..dcd2488 100644
--- a/src/org/connectbot/ConsoleActivity.java
+++ b/src/org/connectbot/ConsoleActivity.java
@@ -89,6 +89,7 @@ public class ConsoleActivity extends Activity {
protected ClipboardManager clipboard;
private RelativeLayout stringPromptGroup;
protected EditText stringPrompt;
+ private TextView stringPromptInstructions;
private RelativeLayout booleanPromptGroup;
private TextView booleanPrompt;
@@ -337,6 +338,7 @@ public class ConsoleActivity extends Activity {
empty = (TextView)findViewById(android.R.id.empty);
stringPromptGroup = (RelativeLayout) findViewById(R.id.console_password_group);
+ stringPromptInstructions = (TextView) findViewById(R.id.console_password_instructions);
stringPrompt = (EditText)findViewById(R.id.console_password);
stringPrompt.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
@@ -834,6 +836,13 @@ public class ConsoleActivity extends Activity {
PromptHelper prompt = ((TerminalView)view).bridge.promptHelper;
if(String.class.equals(prompt.promptRequested)) {
stringPromptGroup.setVisibility(View.VISIBLE);
+
+ String instructions = prompt.promptInstructions;
+ if (instructions != null && instructions.length() > 0) {
+ stringPromptInstructions.setVisibility(View.VISIBLE);
+ stringPromptInstructions.setText(instructions);
+ } else
+ stringPromptInstructions.setVisibility(View.GONE);
stringPrompt.setText("");
stringPrompt.setHint(prompt.promptHint);
stringPrompt.requestFocus();
diff --git a/src/org/connectbot/service/PromptHelper.java b/src/org/connectbot/service/PromptHelper.java
index 1523324..682fa52 100644
--- a/src/org/connectbot/service/PromptHelper.java
+++ b/src/org/connectbot/service/PromptHelper.java
@@ -19,6 +19,7 @@ public class PromptHelper {
private Semaphore promptToken;
private Semaphore promptResponse;
+ public String promptInstructions = null;
public String promptHint = null;
public Object promptRequested = null;
@@ -67,7 +68,7 @@ public class PromptHelper {
* Only one thread can call this at a time. cancelPrompt() will force this to
* immediately return.
*/
- private Object requestPrompt(String hint, Object type, boolean immediate) throws InterruptedException {
+ private Object requestPrompt(String instructions, String hint, Object type, boolean immediate) throws InterruptedException {
Object response = null;
if (immediate)
@@ -76,6 +77,7 @@ public class PromptHelper {
promptToken.acquire();
try {
+ promptInstructions = instructions;
promptHint = hint;
promptRequested = type;
@@ -85,6 +87,8 @@ public class PromptHelper {
// acquire lock until user passes back value
promptResponse.acquire();
+ promptInstructions = null;
+ promptHint = null;
promptRequested = null;
response = popResponse();
@@ -102,10 +106,10 @@ public class PromptHelper {
* @param immediate whether to cancel other in-progress prompts
* @return string user has entered
*/
- public String requestStringPrompt(String hint, boolean immediate) {
+ public String requestStringPrompt(String instructions, String hint, boolean immediate) {
String value = null;
try {
- value = (String)this.requestPrompt(hint, String.class, immediate);
+ value = (String)this.requestPrompt(instructions, hint, String.class, immediate);
} catch(Exception e) {
}
return value;
@@ -116,8 +120,8 @@ public class PromptHelper {
* @param hint prompt hint for user to answer
* @return string user has entered
*/
- public String requestStringPrompt(String hint) {
- return requestStringPrompt(hint, false);
+ public String requestStringPrompt(String instructions, String hint) {
+ return requestStringPrompt(instructions, hint, false);
}
/**
@@ -127,10 +131,10 @@ public class PromptHelper {
* @param immediate whether to cancel other in-progress prompts
* @return choice user has made (yes/no)
*/
- public Boolean requestBooleanPrompt(String hint, boolean immediate) {
+ public Boolean requestBooleanPrompt(String instructions, String hint, boolean immediate) {
Boolean value = null;
try {
- value = (Boolean)this.requestPrompt(hint, Boolean.class, immediate);
+ value = (Boolean)this.requestPrompt(instructions, hint, Boolean.class, immediate);
} catch(Exception e) {
}
return value;
@@ -141,8 +145,8 @@ public class PromptHelper {
* @param hint String to present to user in prompt
* @return choice user has made (yes/no)
*/
- public Boolean requestBooleanPrompt(String hint) {
- return requestBooleanPrompt(hint, false);
+ public Boolean requestBooleanPrompt(String instructions, String hint) {
+ return requestBooleanPrompt(instructions, hint, false);
}
/**
diff --git a/src/org/connectbot/service/TerminalBridge.java b/src/org/connectbot/service/TerminalBridge.java
index 9803118..98c75f1 100644
--- a/src/org/connectbot/service/TerminalBridge.java
+++ b/src/org/connectbot/service/TerminalBridge.java
@@ -357,7 +357,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal
outputLine(String.format(manager.res.getString(R.string.host_authenticity_warning), hostname));
outputLine(String.format(manager.res.getString(R.string.host_fingerprint), algorithmName, fingerprint));
- result = promptHelper.requestBooleanPrompt(manager.res.getString(R.string.prompt_continue_connecting));
+ result = promptHelper.requestBooleanPrompt(null, manager.res.getString(R.string.prompt_continue_connecting));
if(result == null) return false;
if(result.booleanValue()) {
// save this key in known database
@@ -381,7 +381,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal
algorithmName, fingerprint));
// Users have no way to delete keys, so we'll prompt them for now.
- result = promptHelper.requestBooleanPrompt(manager.res.getString(R.string.prompt_continue_connecting));
+ result = promptHelper.requestBooleanPrompt(null, manager.res.getString(R.string.prompt_continue_connecting));
if(result == null) return false;
if(result.booleanValue()) {
// save this key in known database
@@ -583,7 +583,9 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal
// otherwise load key from database and prompt for password as needed
String password = null;
if (pubkey.isEncrypted()) {
- password = promptHelper.requestStringPrompt(String.format("Password for key '%s'", pubkey.getNickname()));
+ password = promptHelper.requestStringPrompt(null,
+ String.format(manager.res.getString(R.string.prompt_pubkey_password),
+ pubkey.getNickname()));
// Something must have interrupted the prompt.
if (password == null)
@@ -681,7 +683,8 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal
pubkeysExhausted = true;
} else if (connection.isAuthMethodAvailable(host.getUsername(), AUTH_PASSWORD)) {
outputLine("Attempting 'password' authentication");
- String password = promptHelper.requestStringPrompt("Password");
+ String password = promptHelper.requestStringPrompt(null,
+ manager.res.getString(R.string.prompt_password));
if (password != null
&& connection.authenticateWithPassword(host.getUsername(), password)) {
finishConnection();
@@ -716,7 +719,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal
String[] responses = new String[numPrompts];
for(int i = 0; i < numPrompts; i++) {
// request response from user for each prompt
- responses[i] = promptHelper.requestStringPrompt(prompt[i]);
+ responses[i] = promptHelper.requestStringPrompt(instruction, prompt[i]);
}
return responses;
}
@@ -859,7 +862,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal
} else {
Thread disconnectPromptThread = new Thread(new Runnable() {
public void run() {
- Boolean result = promptHelper.requestBooleanPrompt(
+ Boolean result = promptHelper.requestBooleanPrompt(null,
manager.res.getString(R.string.prompt_host_disconnected), true);
if (result == null || result.booleanValue()) {
awaitingClose = true;