Open the app list after successfully pairing

This commit is contained in:
Cameron Gutman 2014-11-13 21:22:45 -08:00
parent 0bceadbd9a
commit 312ca27906

View File

@ -295,6 +295,7 @@ public class PcView extends Activity {
public void run() { public void run() {
NvHTTP httpConn; NvHTTP httpConn;
String message; String message;
boolean success = false;
try { try {
// Stop updates and wait while pairing // Stop updates and wait while pairing
stopComputerUpdates(true); stopComputerUpdates(true);
@ -312,7 +313,9 @@ public class PcView extends Activity {
PlatformBinding.getDeviceName(), PlatformBinding.getDeviceName(),
PlatformBinding.getCryptoProvider(PcView.this)); PlatformBinding.getCryptoProvider(PcView.this));
if (httpConn.getPairState() == PairingManager.PairState.PAIRED) { if (httpConn.getPairState() == PairingManager.PairState.PAIRED) {
message = "Already paired"; // Don't display any toast, but open the app list
message = null;
success = true;
} }
else { else {
final String pinStr = PairingManager.generatePinString(); final String pinStr = PairingManager.generatePinString();
@ -329,6 +332,7 @@ public class PcView extends Activity {
} }
else if (pairState == PairingManager.PairState.PAIRED) { else if (pairState == PairingManager.PairState.PAIRED) {
message = "Paired successfully"; message = "Paired successfully";
success = true;
} }
else { else {
// Should be no other values // Should be no other values
@ -348,10 +352,18 @@ public class PcView extends Activity {
Dialog.closeDialogs(); Dialog.closeDialogs();
final String toastMessage = message; final String toastMessage = message;
final boolean toastSuccess = success;
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
Toast.makeText(PcView.this, toastMessage, Toast.LENGTH_LONG).show(); if (toastMessage != null) {
Toast.makeText(PcView.this, toastMessage, Toast.LENGTH_LONG).show();
}
if (toastSuccess) {
// Open the app list after a successful pairing attemp
doAppList(computer);
}
} }
}); });