Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ANON-Public
orbot
Commits
c53204f9
Commit
c53204f9
authored
Oct 31, 2017
by
n8fr8
Browse files
only refresh VPN settings if app selection changes
parent
5b9eedba
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/org/torproject/android/OrbotMainActivity.java
View file @
c53204f9
...
...
@@ -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
);
...
...
app/src/main/java/org/torproject/android/ui/AppManagerActivity.java
View file @
c53204f9
...
...
@@ -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,9 +145,7 @@ 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
);
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
);
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
(
app
!=
null
)
{
app
.
setTorified
(!
app
.
isTorified
());
cbox
.
setChecked
(
app
.
isTorified
());
}
if
(
v
instanceof
CheckBox
)
cbox
=
(
CheckBox
)
v
;
else
if
(
v
.
getTag
()
instanceof
CheckBox
)
cbox
=
(
CheckBox
)
v
.
getTag
();
saveAppSettings
(
this
);
if
(
cbox
!=
null
)
{
final
TorifiedApp
app
=
(
TorifiedApp
)
cbox
.
getTag
();
if
(
app
!=
null
)
{
app
.
setTorified
(!
app
.
isTorified
());
cbox
.
setChecked
(
app
.
isTorified
());
}
saveAppSettings
(
this
);
}
}
...
...
orbotservice/src/main/java/org/torproject/android/service/vpn/OrbotVpnManager.java
View file @
c53204f9
...
...
@@ -114,7 +114,6 @@ public class OrbotVpnManager implements Handler.Callback {
if
(!
mIsLollipop
)
{
startSocksBypass
();
}
...
...
orbotservice/src/main/java/org/torproject/android/service/vpn/TorVpnService.java
View file @
c53204f9
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment