Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
12527be0
Commit
12527be0
authored
Mar 08, 2019
by
Mygod
Committed by
Max Lv
Mar 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bypass wiped on selecting off
parent
95883bac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
27 deletions
+16
-27
mobile/src/main/java/com/github/shadowsocks/AppManager.kt
mobile/src/main/java/com/github/shadowsocks/AppManager.kt
+12
-23
mobile/src/main/res/layout/layout_apps.xml
mobile/src/main/res/layout/layout_apps.xml
+4
-4
No files found.
mobile/src/main/java/com/github/shadowsocks/AppManager.kt
View file @
12527be0
...
@@ -197,7 +197,7 @@ class AppManager : AppCompatActivity() {
...
@@ -197,7 +197,7 @@ class AppManager : AppCompatActivity() {
private
lateinit
var
proxiedApps
:
HashSet
<
String
>
private
lateinit
var
proxiedApps
:
HashSet
<
String
>
private
lateinit
var
proxiedUidMap
:
Multimap
<
Int
,
String
>
private
lateinit
var
proxiedUidMap
:
Multimap
<
Int
,
String
>
private
lateinit
var
toolbar
:
Toolbar
private
lateinit
var
toolbar
:
Toolbar
private
lateinit
var
bypass
Switch
:
RadioButton
private
lateinit
var
bypass
Group
:
RadioGroup
private
lateinit
var
appListView
:
RecyclerView
private
lateinit
var
appListView
:
RecyclerView
private
lateinit
var
loadingView
:
View
private
lateinit
var
loadingView
:
View
private
lateinit
var
editQuery
:
EditText
private
lateinit
var
editQuery
:
EditText
...
@@ -258,30 +258,19 @@ class AppManager : AppCompatActivity() {
...
@@ -258,30 +258,19 @@ class AppManager : AppCompatActivity() {
DataStore
.
dirty
=
true
DataStore
.
dirty
=
true
}
}
val
switchListener
=
{
switch
:
Boolean
->
bypassGroup
=
findViewById
(
R
.
id
.
bypass_group
)
DataStore
.
proxyApps
=
switch
bypassGroup
.
check
(
if
(
DataStore
.
bypass
)
R
.
id
.
btn_bypass
else
R
.
id
.
btn_on
)
bypassGroup
.
setOnCheckedChangeListener
{
_
,
checkedId
->
DataStore
.
dirty
=
true
DataStore
.
dirty
=
true
if
(!
switch
)
{
when
(
checkedId
)
{
finish
()
R
.
id
.
btn_off
->
{
DataStore
.
proxyApps
=
false
finish
()
}
R
.
id
.
btn_on
->
DataStore
.
bypass
=
false
R
.
id
.
btn_bypass
->
DataStore
.
bypass
=
true
}
}
}
}
val
btnOn
=
findViewById
<
RadioButton
>(
R
.
id
.
btn_on
)
val
btnOff
=
findViewById
<
RadioButton
>(
R
.
id
.
btn_off
)
(
if
(
DataStore
.
proxyApps
)
btnOn
else
btnOff
).
isChecked
=
true
btnOn
.
setOnCheckedChangeListener
{
_
,
b
->
if
(
b
)
switchListener
(
true
)
}
btnOff
.
setOnCheckedChangeListener
{
_
,
b
->
if
(
b
)
switchListener
(
false
)
}
bypassSwitch
=
findViewById
(
R
.
id
.
btn_bypass
)
bypassSwitch
.
isChecked
=
DataStore
.
bypass
bypassSwitch
.
setOnCheckedChangeListener
{
_
,
checked
->
DataStore
.
bypass
=
checked
DataStore
.
dirty
=
true
}
initProxiedApps
()
initProxiedApps
()
loadingView
=
findViewById
(
R
.
id
.
loading
)
loadingView
=
findViewById
(
R
.
id
.
loading
)
...
@@ -340,7 +329,7 @@ class AppManager : AppCompatActivity() {
...
@@ -340,7 +329,7 @@ class AppManager : AppCompatActivity() {
try
{
try
{
val
(
enabled
,
apps
)
=
if
(
i
<
0
)
Pair
(
proxiedAppString
,
""
)
else
val
(
enabled
,
apps
)
=
if
(
i
<
0
)
Pair
(
proxiedAppString
,
""
)
else
Pair
(
proxiedAppString
.
substring
(
0
,
i
),
proxiedAppString
.
substring
(
i
+
1
))
Pair
(
proxiedAppString
.
substring
(
0
,
i
),
proxiedAppString
.
substring
(
i
+
1
))
bypass
Switch
.
isChecked
=
enabled
.
toBoolean
(
)
bypass
Group
.
check
(
if
(
enabled
.
toBoolean
())
R
.
id
.
btn_bypass
else
R
.
id
.
btn_on
)
DataStore
.
individual
=
apps
DataStore
.
individual
=
apps
DataStore
.
dirty
=
true
DataStore
.
dirty
=
true
Snackbar
.
make
(
appListView
,
R
.
string
.
action_import_msg
,
Snackbar
.
LENGTH_LONG
).
show
()
Snackbar
.
make
(
appListView
,
R
.
string
.
action_import_msg
,
Snackbar
.
LENGTH_LONG
).
show
()
...
...
mobile/src/main/res/layout/layout_apps.xml
View file @
12527be0
...
@@ -23,12 +23,12 @@
...
@@ -23,12 +23,12 @@
android:layout_marginStart=
"16dp"
android:layout_marginStart=
"16dp"
android:minWidth=
"40dp"
android:minWidth=
"40dp"
android:text=
"@string/mode"
android:text=
"@string/mode"
app:layout_constraintBottom_toBottomOf=
"@+id/
radioG
roup"
app:layout_constraintBottom_toBottomOf=
"@+id/
bypass_g
roup"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"@+id/
radioG
roup"
/>
app:layout_constraintTop_toTopOf=
"@+id/
bypass_g
roup"
/>
<RadioGroup
<RadioGroup
android:id=
"@+id/
radioG
roup"
android:id=
"@+id/
bypass_g
roup"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
android:layout_marginStart=
"8dp"
...
@@ -74,7 +74,7 @@
...
@@ -74,7 +74,7 @@
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/
radioG
roup"
/>
app:layout_constraintTop_toBottomOf=
"@+id/
bypass_g
roup"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
...
...
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