Index: remoting/android/java/src/org/chromium/chromoting/Chromoting.java |
diff --git a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java |
index 148ff58b51eaa0cce00eb9b04ac30aeaf1fea465..c082b7a4f0bb2d4d36b599403f7a15792bf72b92 100644 |
--- a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java |
+++ b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java |
@@ -229,6 +229,14 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe |
/** Called when the user taps on a host entry. */ |
public void connectToHost(HostInfo host) { |
+ mProgressIndicator = ProgressDialog.show(this, |
Jamie
2014/03/05 20:51:31
Any reason not to create the progress dialog befor
Lambros
2014/03/05 23:36:54
I think that's fine.
|
+ host.name, getString(R.string.footer_connecting), true, true, |
+ new DialogInterface.OnCancelListener() { |
+ @Override |
+ public void onCancel(DialogInterface dialog) { |
+ JniInterface.disconnectFromHost(); |
+ } |
+ }); |
SessionConnector connector = new SessionConnector(this, this, mHostListLoader); |
connector.connectToHost(mAccount.name, mToken, host); |
} |
@@ -365,41 +373,23 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe |
@Override |
public void onConnectionState(JniInterface.ConnectionListener.State state, |
JniInterface.ConnectionListener.Error error) { |
- String stateText = getResources().getStringArray(R.array.protoc_states)[state.value()]; |
boolean dismissProgress = false; |
switch (state) { |
case INITIALIZING: |
case CONNECTING: |
case AUTHENTICATED: |
- // The connection is still being established, so we'll report the current progress. |
- if (mProgressIndicator == null) { |
- mProgressIndicator = ProgressDialog.show(this, |
- getString(R.string.footer_connecting), stateText, true, true, |
- new DialogInterface.OnCancelListener() { |
- @Override |
- public void onCancel(DialogInterface dialog) { |
- JniInterface.disconnectFromHost(); |
- } |
- }); |
- } else { |
- mProgressIndicator.setMessage(stateText); |
- } |
+ // The connection is still being established. |
break; |
case CONNECTED: |
dismissProgress = true; |
- Toast.makeText(this, stateText, Toast.LENGTH_SHORT).show(); |
Jamie
2014/03/05 20:51:31
I think this is unnecessary, although it might not
Lambros
2014/03/05 23:56:36
If we maybe change the title (or subtitle) of this
Jamie
2014/03/06 01:29:32
Do you want me to make that change in this CL, or
|
- |
// Display the remote desktop. |
startActivityForResult(new Intent(this, Desktop.class), 0); |
break; |
case FAILED: |
dismissProgress = true; |
- Toast.makeText(this, stateText + ": " |
- + getResources().getStringArray(R.array.protoc_errors)[error.value()], |
- Toast.LENGTH_LONG).show(); |
- |
+ Toast.makeText(this, getString(error.toResourceId()), Toast.LENGTH_LONG).show(); |
// Close the Desktop view, if it is currently running. |
finishActivity(0); |
break; |