diff --git a/app/build.gradle b/app/build.gradle
index 1b029de1..8b7fbb61 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -30,4 +30,5 @@ dependencies {
compile project(':orbotservice')
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
+
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9b65a34f..d0df9e32 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -86,7 +86,9 @@
-
+
= Build.VERSION_CODES.LOLLIPOP;
// message types for mStatusUpdateHandler
private final static int STATUS_UPDATE = 1;
@@ -169,7 +173,8 @@ public class OrbotMainActivity extends AppCompatActivity
private void stopTor() {
- imgStatus.setImageResource(R.drawable.torstarting);
+ requestTorStatus();
+
Intent torService = new Intent(OrbotMainActivity.this, TorService.class);
stopService(torService);
@@ -320,8 +325,12 @@ public class OrbotMainActivity extends AppCompatActivity
Prefs.putUseVpn(isChecked);
- if (isChecked)
- startActivity(new Intent(OrbotMainActivity.this,VPNEnableActivity.class));
+ if (isChecked) {
+ if (mIsLollipop) //let the user choose the apps
+ startActivityForResult(new Intent(OrbotMainActivity.this, AppManager.class),REQUEST_VPN_APPS_SELECT);
+ else
+ startActivity(new Intent(OrbotMainActivity.this, VPNEnableActivity.class));
+ }
else
stopVpnService();
}
@@ -434,11 +443,12 @@ public class OrbotMainActivity extends AppCompatActivity
Intent intent = new Intent(OrbotMainActivity.this, SettingsPreferences.class);
startActivityForResult(intent, REQUEST_SETTINGS);
}
+ /**
else if (item.getItemId() == R.id.menu_promo_apps)
{
startActivity(new Intent(OrbotMainActivity.this, PromoAppsActivity.class));
- }
+ }*/
else if (item.getItemId() == R.id.menu_exit)
{
//exit app
@@ -859,6 +869,10 @@ public class OrbotMainActivity extends AppCompatActivity
}
}
+ else if (request == REQUEST_VPN_APPS_SELECT)
+ {
+ startActivity(new Intent(OrbotMainActivity.this, VPNEnableActivity.class));
+ }
IntentResult scanResult = IntentIntegrator.parseActivityResult(request, response, data);
if (scanResult != null) {
@@ -1190,8 +1204,10 @@ public class OrbotMainActivity extends AppCompatActivity
}
else
lblStatus.setText(getString(R.string.status_starting_up));
-
- mBtnBrowser.setEnabled(false);
+
+ mBtnStart.setText("...");
+
+ mBtnBrowser.setEnabled(false);
} else if (torStatus == TorServiceConstants.STATUS_STOPPING) {
diff --git a/app/src/main/java/org/torproject/android/ui/AppManager.java b/app/src/main/java/org/torproject/android/ui/AppManager.java
index 82a20b3c..84af48d1 100644
--- a/app/src/main/java/org/torproject/android/ui/AppManager.java
+++ b/app/src/main/java/org/torproject/android/ui/AppManager.java
@@ -23,6 +23,8 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
+import android.support.v7.app.ActionBarActivity;
+import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -38,7 +40,7 @@ import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
-public class AppManager extends Activity implements OnCheckedChangeListener, OnClickListener, OrbotConstants {
+public class AppManager extends AppCompatActivity implements OnCheckedChangeListener, OnClickListener, OrbotConstants {
private ListView listApps;
private final static String TAG = "Orbot";
@@ -47,6 +49,8 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC
super.onCreate(savedInstanceState);
this.setContentView(R.layout.layout_apps);
+ setTitle(R.string.apps_mode);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Button buttonSelectAll, buttonSelectNone, buttonInvert;
@@ -108,15 +112,16 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC
app = (TorifiedApp) adapter.getItem(i);
currentView = adapter.getView(i, parentView, viewGroup);
box = (CheckBox) currentView.findViewById(R.id.itemcheck);
+
if (this.status == 0){
- if (!box.isChecked())
- box.performClick();
+ app.setTorified(true);
}else if (this.status == 1){
- if (box.isChecked())
- box.performClick();
+ app.setTorified(false);
}else {
- box.performClick();
+ app.setTorified(!app.isTorified());
}
+
+ box.setChecked(app.isTorified());
}
saveAppSettings(context);
loadApps(prefs);
@@ -128,15 +133,6 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC
super.onResume();
listApps = (ListView)findViewById(R.id.applistview);
- Button btnSave = (Button)findViewById(R.id.btnsave);
- btnSave.setOnClickListener(new OnClickListener()
- {
-
- public void onClick(View v) {
- finish();
- }
- });
-
mPrefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
loadApps(mPrefs);
}
@@ -161,11 +157,18 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC
final LayoutInflater inflater = getLayoutInflater();
ListAdapter adapter = new ArrayAdapter(this, R.layout.layout_apps_item, R.id.itemtext,mApps) {
+
public View getView(int position, View convertView, ViewGroup parent) {
- ListEntry entry;
- if (convertView == null) {
- // Inflate a new view
+
+ ListEntry entry = null;
+
+ if (convertView == null)
convertView = inflater.inflate(R.layout.layout_apps_item, parent, false);
+ else
+ entry = (ListEntry) convertView.getTag();;
+
+ if (entry == null) {
+ // Inflate a new view
entry = new ListEntry();
entry.icon = (ImageView) convertView.findViewById(R.id.itemicon);
entry.box = (CheckBox) convertView.findViewById(R.id.itemcheck);
@@ -177,19 +180,15 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC
convertView.setTag(entry);
entry.box.setOnCheckedChangeListener(AppManager.this);
- } else {
- // Convert an existing view
- entry = (ListEntry) convertView.getTag();
}
-
-
+
final TorifiedApp app = mApps.get(position);
-
- if (app.getIcon() != null)
+
+ if (app.getIcon() != null && entry.icon != null)
entry.icon.setImageDrawable(app.getIcon());
else
entry.icon.setVisibility(View.GONE);
-
+
entry.text.setText(app.getName());
final CheckBox box = entry.box;
diff --git a/app/src/main/res/drawable/rounded_button.xml b/app/src/main/res/drawable/rounded_button.xml
new file mode 100644
index 00000000..528cc411
--- /dev/null
+++ b/app/src/main/res/drawable/rounded_button.xml
@@ -0,0 +1,13 @@
+
+
+
+ // if you want clear round shape then make radius size is half of your button`s height.
+ // Button Colour
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_apps.xml b/app/src/main/res/layout/layout_apps.xml
index d3633a02..00d46d6f 100644
--- a/app/src/main/res/layout/layout_apps.xml
+++ b/app/src/main/res/layout/layout_apps.xml
@@ -1,7 +1,7 @@
@@ -25,20 +25,11 @@
-
-