commit 3741434eaf1149ffd17e22080c44dde17f9b47fd Author: n8fr8 nathan@freitas.net Date: Thu Dec 7 15:45:23 2017 -0500
don't show app selection each time you turn VPN on/off --- .../org/torproject/android/OrbotMainActivity.java | 25 +++++++++++++--------- .../torproject/android/vpn/VPNEnableActivity.java | 8 ++++--- app/src/main/res/layout/layout_main.xml | 2 -- 3 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java index 17a81806..dcae5305 100644 --- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java +++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java @@ -353,13 +353,21 @@ public class OrbotMainActivity extends AppCompatActivity } });
+ if (PermissionManager.isLollipopOrHigher()) {
- findViewById(R.id.btnApps).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - enableVPN(true); - } - }); + findViewById(R.id.btnApps).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + startActivityForResult(new Intent(OrbotMainActivity.this, AppManagerActivity.class), REQUEST_VPN_APPS_SELECT); + + } + }); + } + else + { + findViewById(R.id.btnApps).setVisibility(View.GONE); + } } @@ -621,10 +629,7 @@ public class OrbotMainActivity extends AppCompatActivity Prefs.putUseVpn(enable);
if (enable) { - if (PermissionManager.isLollipopOrHigher()) //let the user choose the apps - startActivityForResult(new Intent(OrbotMainActivity.this, AppManagerActivity.class), REQUEST_VPN_APPS_SELECT); - else - startActivity(new Intent(OrbotMainActivity.this, VPNEnableActivity.class)); + startActivity(new Intent(OrbotMainActivity.this, VPNEnableActivity.class)); } else stopVpnService(); } diff --git a/app/src/main/java/org/torproject/android/vpn/VPNEnableActivity.java b/app/src/main/java/org/torproject/android/vpn/VPNEnableActivity.java index 9dd05d8c..7f24dabf 100644 --- a/app/src/main/java/org/torproject/android/vpn/VPNEnableActivity.java +++ b/app/src/main/java/org/torproject/android/vpn/VPNEnableActivity.java @@ -62,6 +62,9 @@ public class VPNEnableActivity extends AppCompatActivity { public void promptStartVpnService () { + Prefs.putUseVpn(true); + startVpnService(); + /** AlertDialog dialog = new AlertDialog.Builder(this) .setTitle(getString(R.string.app_name) + ' ' + getString(R.string.apps_mode)) @@ -71,8 +74,7 @@ public class VPNEnableActivity extends AppCompatActivity {
@Override public void onClick(DialogInterface dialog, int which) { - Prefs.putUseVpn(true); - startVpnService(); + }
@@ -97,7 +99,7 @@ public class VPNEnableActivity extends AppCompatActivity { }).create();
dialog.show(); - + **/
} diff --git a/app/src/main/res/layout/layout_main.xml b/app/src/main/res/layout/layout_main.xml index 030257cf..e8c93336 100644 --- a/app/src/main/res/layout/layout_main.xml +++ b/app/src/main/res/layout/layout_main.xml @@ -1,8 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> - <LinearLayout android:gravity="center_vertical|center_horizontal" xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"
tor-commits@lists.torproject.org