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)
|
||||
{
|
||||
Prefs.putUseVpn(enable);
|
||||
|
@ -798,10 +804,8 @@ public class OrbotMainActivity extends AppCompatActivity
|
|||
|
||||
case INTENT_ACTION_REQUEST_START_TOR:
|
||||
autoStartFromIntent = true;
|
||||
|
||||
startTor();
|
||||
|
||||
|
||||
break;
|
||||
case Intent.ACTION_VIEW:
|
||||
String urlString = intent.getDataString();
|
||||
|
@ -967,7 +971,9 @@ public class OrbotMainActivity extends AppCompatActivity
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.torproject.android.service.vpn.TorifiedApp;
|
|||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
|
@ -41,7 +42,7 @@ import android.widget.ImageView;
|
|||
import android.widget.ListAdapter;
|
||||
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 ListAdapter adapterApps;
|
||||
|
@ -132,8 +133,6 @@ public class AppManagerActivity extends AppCompatActivity implements OnCheckedCh
|
|||
entry.icon = (ImageView) convertView.findViewById(R.id.itemicon);
|
||||
entry.box = (CheckBox) convertView.findViewById(R.id.itemcheck);
|
||||
entry.text = (TextView) convertView.findViewById(R.id.itemtext);
|
||||
|
||||
|
||||
convertView.setTag(entry);
|
||||
|
||||
|
||||
|
@ -146,8 +145,6 @@ public class AppManagerActivity extends AppCompatActivity implements OnCheckedCh
|
|||
try {
|
||||
entry.icon.setImageDrawable(pMgr.getApplicationIcon(app.getPackageName()));
|
||||
entry.icon.setOnClickListener(AppManagerActivity.this);
|
||||
|
||||
if (entry.box != null)
|
||||
entry.icon.setTag(entry.box);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -159,17 +156,12 @@ public class AppManagerActivity extends AppCompatActivity implements OnCheckedCh
|
|||
if (entry.text != null) {
|
||||
entry.text.setText(app.getName());
|
||||
entry.text.setOnClickListener(AppManagerActivity.this);
|
||||
|
||||
if (entry.box != null)
|
||||
entry.text.setTag(entry.box);
|
||||
}
|
||||
|
||||
|
||||
if (entry.box != null) {
|
||||
entry.box.setOnCheckedChangeListener(AppManagerActivity.this);
|
||||
entry.box.setTag(app);
|
||||
entry.box.setOnClickListener(AppManagerActivity.this);
|
||||
entry.box.setChecked(app.isTorified());
|
||||
|
||||
}
|
||||
|
||||
return convertView;
|
||||
|
@ -307,6 +299,7 @@ public class AppManagerActivity extends AppCompatActivity implements OnCheckedCh
|
|||
{
|
||||
|
||||
StringBuilder tordApps = new StringBuilder();
|
||||
Intent response = new Intent();
|
||||
|
||||
for (TorifiedApp tApp:mApps)
|
||||
{
|
||||
|
@ -314,6 +307,7 @@ public class AppManagerActivity extends AppCompatActivity implements OnCheckedCh
|
|||
{
|
||||
tordApps.append(tApp.getUsername());
|
||||
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.commit();
|
||||
|
||||
setResult(RESULT_OK,response);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called an application is check/unchecked
|
||||
*/
|
||||
/**
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
final TorifiedApp app = (TorifiedApp) buttonView.getTag();
|
||||
if (app != null) {
|
||||
|
@ -335,23 +331,29 @@ public class AppManagerActivity extends AppCompatActivity implements OnCheckedCh
|
|||
|
||||
saveAppSettings(this);
|
||||
|
||||
}
|
||||
}**/
|
||||
|
||||
|
||||
|
||||
|
||||
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) {
|
||||
app.setTorified(!app.isTorified());
|
||||
cbox.setChecked(app.isTorified());
|
||||
}
|
||||
|
||||
saveAppSettings(this);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -114,7 +114,6 @@ public class OrbotVpnManager implements Handler.Callback {
|
|||
|
||||
if (!mIsLollipop)
|
||||
{
|
||||
|
||||
startSocksBypass();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,12 +5,6 @@ import android.app.Service;
|
|||
import android.content.Intent;
|
||||
import android.net.VpnService;
|
||||
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.
|
||||
|
|
Loading…
Reference in New Issue