only refresh VPN settings if app selection changes
This commit is contained in:
parent
5b9eedba1d
commit
c53204f9c3
|
@ -609,6 +609,12 @@ public class OrbotMainActivity extends AppCompatActivity
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void refreshVPNApps ()
|
||||||
|
{
|
||||||
|
stopVpnService();
|
||||||
|
startActivity(new Intent(OrbotMainActivity.this, VPNEnableActivity.class));
|
||||||
|
}
|
||||||
|
|
||||||
private void enableVPN (boolean enable)
|
private void enableVPN (boolean enable)
|
||||||
{
|
{
|
||||||
Prefs.putUseVpn(enable);
|
Prefs.putUseVpn(enable);
|
||||||
|
@ -798,10 +804,8 @@ public class OrbotMainActivity extends AppCompatActivity
|
||||||
|
|
||||||
case INTENT_ACTION_REQUEST_START_TOR:
|
case INTENT_ACTION_REQUEST_START_TOR:
|
||||||
autoStartFromIntent = true;
|
autoStartFromIntent = true;
|
||||||
|
|
||||||
startTor();
|
startTor();
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Intent.ACTION_VIEW:
|
case Intent.ACTION_VIEW:
|
||||||
String urlString = intent.getDataString();
|
String urlString = intent.getDataString();
|
||||||
|
@ -967,7 +971,9 @@ public class OrbotMainActivity extends AppCompatActivity
|
||||||
}
|
}
|
||||||
else if (request == REQUEST_VPN_APPS_SELECT)
|
else if (request == REQUEST_VPN_APPS_SELECT)
|
||||||
{
|
{
|
||||||
startActivity(new Intent(OrbotMainActivity.this, VPNEnableActivity.class));
|
if (response == RESULT_OK)
|
||||||
|
refreshVPNApps();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IntentResult scanResult = IntentIntegrator.parseActivityResult(request, response, data);
|
IntentResult scanResult = IntentIntegrator.parseActivityResult(request, response, data);
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.torproject.android.service.vpn.TorifiedApp;
|
||||||
|
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.SharedPreferences.Editor;
|
import android.content.SharedPreferences.Editor;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
|
@ -41,7 +42,7 @@ import android.widget.ImageView;
|
||||||
import android.widget.ListAdapter;
|
import android.widget.ListAdapter;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
public class AppManagerActivity extends AppCompatActivity implements OnCheckedChangeListener, OnClickListener, OrbotConstants {
|
public class AppManagerActivity extends AppCompatActivity implements OnClickListener, OrbotConstants {
|
||||||
|
|
||||||
private GridView listApps;
|
private GridView listApps;
|
||||||
private ListAdapter adapterApps;
|
private ListAdapter adapterApps;
|
||||||
|
@ -132,8 +133,6 @@ public class AppManagerActivity extends AppCompatActivity implements OnCheckedCh
|
||||||
entry.icon = (ImageView) convertView.findViewById(R.id.itemicon);
|
entry.icon = (ImageView) convertView.findViewById(R.id.itemicon);
|
||||||
entry.box = (CheckBox) convertView.findViewById(R.id.itemcheck);
|
entry.box = (CheckBox) convertView.findViewById(R.id.itemcheck);
|
||||||
entry.text = (TextView) convertView.findViewById(R.id.itemtext);
|
entry.text = (TextView) convertView.findViewById(R.id.itemtext);
|
||||||
|
|
||||||
|
|
||||||
convertView.setTag(entry);
|
convertView.setTag(entry);
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,8 +145,6 @@ public class AppManagerActivity extends AppCompatActivity implements OnCheckedCh
|
||||||
try {
|
try {
|
||||||
entry.icon.setImageDrawable(pMgr.getApplicationIcon(app.getPackageName()));
|
entry.icon.setImageDrawable(pMgr.getApplicationIcon(app.getPackageName()));
|
||||||
entry.icon.setOnClickListener(AppManagerActivity.this);
|
entry.icon.setOnClickListener(AppManagerActivity.this);
|
||||||
|
|
||||||
if (entry.box != null)
|
|
||||||
entry.icon.setTag(entry.box);
|
entry.icon.setTag(entry.box);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -159,17 +156,12 @@ public class AppManagerActivity extends AppCompatActivity implements OnCheckedCh
|
||||||
if (entry.text != null) {
|
if (entry.text != null) {
|
||||||
entry.text.setText(app.getName());
|
entry.text.setText(app.getName());
|
||||||
entry.text.setOnClickListener(AppManagerActivity.this);
|
entry.text.setOnClickListener(AppManagerActivity.this);
|
||||||
|
|
||||||
if (entry.box != null)
|
|
||||||
entry.text.setTag(entry.box);
|
entry.text.setTag(entry.box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (entry.box != null) {
|
if (entry.box != null) {
|
||||||
entry.box.setOnCheckedChangeListener(AppManagerActivity.this);
|
entry.box.setOnClickListener(AppManagerActivity.this);
|
||||||
entry.box.setTag(app);
|
|
||||||
entry.box.setChecked(app.isTorified());
|
entry.box.setChecked(app.isTorified());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return convertView;
|
return convertView;
|
||||||
|
@ -307,6 +299,7 @@ public class AppManagerActivity extends AppCompatActivity implements OnCheckedCh
|
||||||
{
|
{
|
||||||
|
|
||||||
StringBuilder tordApps = new StringBuilder();
|
StringBuilder tordApps = new StringBuilder();
|
||||||
|
Intent response = new Intent();
|
||||||
|
|
||||||
for (TorifiedApp tApp:mApps)
|
for (TorifiedApp tApp:mApps)
|
||||||
{
|
{
|
||||||
|
@ -314,6 +307,7 @@ public class AppManagerActivity extends AppCompatActivity implements OnCheckedCh
|
||||||
{
|
{
|
||||||
tordApps.append(tApp.getUsername());
|
tordApps.append(tApp.getUsername());
|
||||||
tordApps.append("|");
|
tordApps.append("|");
|
||||||
|
response.putExtra(tApp.getUsername(),true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,12 +315,14 @@ public class AppManagerActivity extends AppCompatActivity implements OnCheckedCh
|
||||||
edit.putString(PREFS_KEY_TORIFIED, tordApps.toString());
|
edit.putString(PREFS_KEY_TORIFIED, tordApps.toString());
|
||||||
edit.commit();
|
edit.commit();
|
||||||
|
|
||||||
|
setResult(RESULT_OK,response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called an application is check/unchecked
|
* Called an application is check/unchecked
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
final TorifiedApp app = (TorifiedApp) buttonView.getTag();
|
final TorifiedApp app = (TorifiedApp) buttonView.getTag();
|
||||||
if (app != null) {
|
if (app != null) {
|
||||||
|
@ -335,23 +331,29 @@ public class AppManagerActivity extends AppCompatActivity implements OnCheckedCh
|
||||||
|
|
||||||
saveAppSettings(this);
|
saveAppSettings(this);
|
||||||
|
|
||||||
}
|
}**/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
||||||
CheckBox cbox = (CheckBox)v.getTag();
|
CheckBox cbox = null;
|
||||||
|
|
||||||
final TorifiedApp app = (TorifiedApp)cbox.getTag();
|
if (v instanceof CheckBox)
|
||||||
|
cbox = (CheckBox)v;
|
||||||
|
else if (v.getTag() instanceof CheckBox)
|
||||||
|
cbox = (CheckBox)v.getTag();
|
||||||
|
|
||||||
|
if (cbox != null) {
|
||||||
|
final TorifiedApp app = (TorifiedApp) cbox.getTag();
|
||||||
if (app != null) {
|
if (app != null) {
|
||||||
app.setTorified(!app.isTorified());
|
app.setTorified(!app.isTorified());
|
||||||
cbox.setChecked(app.isTorified());
|
cbox.setChecked(app.isTorified());
|
||||||
}
|
}
|
||||||
|
|
||||||
saveAppSettings(this);
|
saveAppSettings(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,6 @@ public class OrbotVpnManager implements Handler.Callback {
|
||||||
|
|
||||||
if (!mIsLollipop)
|
if (!mIsLollipop)
|
||||||
{
|
{
|
||||||
|
|
||||||
startSocksBypass();
|
startSocksBypass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,6 @@ import android.app.Service;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.VpnService;
|
import android.net.VpnService;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.torproject.android.service.OrbotConstants;
|
|
||||||
import org.torproject.android.service.TorServiceConstants;
|
|
||||||
import org.torproject.android.service.util.Prefs;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by n8fr8 on 9/26/16.
|
* Created by n8fr8 on 9/26/16.
|
||||||
|
|
Loading…
Reference in New Issue