summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2015-04-27 17:10:20 +0200
committerParménides GV <parmegv@sdf.org>2015-04-27 17:10:20 +0200
commit8707f9e9a07f8c53955df14ef9b26d13a0eb60da (patch)
treee39f6e0977439de8be63aebac34bc4daeee47fea /app/src/main/java
parentf349ab1a50d807afd49d8bef912438d64f6f6db8 (diff)
testEveryProvider also works
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Dashboard.java14
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/EipFragment.java34
2 files changed, 18 insertions, 30 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
index ddd03dbc..afc6b131 100644
--- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
+++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
@@ -161,7 +161,7 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
providerToPreferences(provider);
buildDashboard(false);
- invalidateOptionsMenu();
+ invalidateOptionsMenuOnUiThread();
if (data.hasExtra(SessionDialog.TAG)) {
sessionDialog(Bundle.EMPTY);
}
@@ -322,7 +322,7 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
else
hideUserSessionProgressBar();
changeSessionStatusMessage(user_session_status.toString());
- invalidateOptionsMenu();
+ invalidateOptionsMenuOnUiThread();
}
}
@@ -432,7 +432,6 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
setResult(RESULT_CANCELED);
} else if (resultCode == ProviderAPI.CORRECTLY_DOWNLOADED_CERTIFICATE) {
eip_fragment.updateEipService();
- eip_fragment.handleNewVpnCertificate();
setResult(RESULT_OK);
} else if (resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_CERTIFICATE) {
setResult(RESULT_CANCELED);
@@ -453,4 +452,13 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
intent.putExtra(Dashboard.REQUEST_CODE, requestCode);
super.startActivityForResult(intent, requestCode);
}
+
+ public void invalidateOptionsMenuOnUiThread() {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ invalidateOptionsMenu();
+ }
+ });
+ }
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
index a13cab09..6decacb7 100644
--- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
@@ -111,10 +111,6 @@ public class EipFragment extends Fragment implements Observer {
saveStatus();
}
- void handleNewVpnCertificate() {
- handleIcon();
- }
-
private void handleSwitchOn() {
if (canStartEIP())
startEipFromScratch();
@@ -144,20 +140,20 @@ public class EipFragment extends Fragment implements Observer {
} else if (eip_status.isConnected()) {
askToStopEIP();
} else
- setDisconnectedUI();
+ updateIcon();
}
private void askPendingStartCancellation() {
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(dashboard);
alertBuilder.setTitle(dashboard.getString(R.string.eip_cancel_connect_title))
.setMessage(dashboard.getString(R.string.eip_cancel_connect_text))
- .setPositiveButton((R.string.yes), new DialogInterface.OnClickListener() {
+ .setPositiveButton((android.R.string.yes), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
askToStopEIP();
}
})
- .setNegativeButton(dashboard.getString(R.string.no), new DialogInterface.OnClickListener() {
+ .setNegativeButton(dashboard.getString(android.R.string.no), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
@@ -193,13 +189,13 @@ public class EipFragment extends Fragment implements Observer {
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(dashboard);
alertBuilder.setTitle(dashboard.getString(R.string.eip_cancel_connect_title))
.setMessage(dashboard.getString(R.string.eip_warning_browser_inconsistency))
- .setPositiveButton((R.string.yes), new DialogInterface.OnClickListener() {
+ .setPositiveButton((android.R.string.yes), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
stopEipIfPossible();
}
})
- .setNegativeButton(dashboard.getString(R.string.no), new DialogInterface.OnClickListener() {
+ .setNegativeButton(dashboard.getString(android.R.string.no), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
@@ -247,18 +243,10 @@ public class EipFragment extends Fragment implements Observer {
dashboard.showLog();
VoidVpnService.stop();
}
- adjustSwitch();
- }
-
- private void setConnectedUI() {
- adjustSwitch();
- }
-
- private void setDisconnectedUI() {
- adjustSwitch();
+ updateIcon();
}
- private void adjustSwitch() {
+ private void updateIcon() {
if (eip_status.isConnected() || eip_status.isConnecting()) {
if(eip_status.isConnecting()) {
vpn_status_image.showProgress(true);
@@ -273,13 +261,6 @@ public class EipFragment extends Fragment implements Observer {
}
}
- private void setInProgressUI(EipStatus eip_status) {
- adjustSwitch();
- }
-
- private void updatingCertificateUI() {
- }
-
protected class EIPReceiver extends ResultReceiver {
protected EIPReceiver(Handler handler) {
@@ -320,7 +301,6 @@ public class EipFragment extends Fragment implements Observer {
case Activity.RESULT_OK:
break;
case Activity.RESULT_CANCELED:
- updatingCertificateUI();
dashboard.downloadVpnCertificate();
break;
}