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
46fd69db
Commit
46fd69db
authored
Nov 08, 2015
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change checkboxes to switches to match system settings
parent
136a1535
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
38 deletions
+40
-38
src/main/res/layout/layout_apps.xml
src/main/res/layout/layout_apps.xml
+18
-16
src/main/res/layout/layout_apps_item.xml
src/main/res/layout/layout_apps_item.xml
+1
-1
src/main/res/xml/pref_all.xml
src/main/res/xml/pref_all.xml
+10
-10
src/main/scala/com/github/shadowsocks/AppManager.scala
src/main/scala/com/github/shadowsocks/AppManager.scala
+11
-11
No files found.
src/main/res/layout/layout_apps.xml
View file @
46fd69db
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"fill_parent"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
android:orientation=
"vertical"
android:duplicateParentState=
"false"
>
<include
layout=
"@layout/toolbar_light_dark"
/>
<
Relative
Layout
<include
layout=
"@layout/toolbar_light_dark"
/>
<
Linear
Layout
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"6dp"
android:layout_marginBottom=
"8dp"
>
android:paddingBottom=
"8dp"
android:paddingLeft=
"48dp"
android:paddingStart=
"48dp"
android:paddingTop=
"8dp"
android:background=
"@android:color/white"
android:elevation=
"1dp"
tools:ignore=
"RtlSymmetry"
>
<TextView
android:id=
"@+id/bypassLabel"
android:layout_width=
"wrap_content"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"wrap_content"
android:padding=
"3dp"
android:gravity=
"center_vertical"
android:layout_marginLeft=
"16dp"
android:textSize=
"18sp"
android:text=
"@string/bypass_apps"
android:layout_alignParentLeft=
"true"
android:layout_centerVertical=
"true"
/>
android:text=
"@string/bypass_apps"
/>
<Switch
android:id=
"@+id/bypassSwitch"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentRight=
"true"
android:layout_centerVertical=
"true"
android:layout_marginRight=
"16dp"
/>
</RelativeLayout>
android:layout_marginEnd=
"6dp"
android:layout_marginRight=
"6dp"
/>
</LinearLayout>
<ListView
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
...
...
src/main/res/layout/layout_apps_item.xml
View file @
46fd69db
...
...
@@ -24,7 +24,7 @@
android:textSize=
"18sp"
android:padding=
"3dp"
/>
<
CheckBox
<
Switch
android:id=
"@+id/itemcheck"
android:layout_width=
"wrap_content"
android:layout_height=
"fill_parent"
...
...
src/main/res/xml/pref_all.xml
View file @
46fd69db
...
...
@@ -58,19 +58,19 @@
android:summary=
"@string/route_list_summary"
android:title=
"@string/route_list"
>
</com.github.shadowsocks.preferences.SummaryListPreference>
<
CheckBox
Preference
<
Switch
Preference
android:key=
"isIpv6"
android:defaultValue=
"false"
android:summary=
"@string/ipv6_summary"
android:title=
"@string/ipv6"
>
</
CheckBox
Preference>
<
CheckBox
Preference
</
Switch
Preference>
<
Switch
Preference
android:defaultValue=
"true"
android:key=
"isGlobalProxy"
android:disableDependentsState=
"true"
android:summary=
"@string/auto_set_proxy_summary"
android:title=
"@string/auto_set_proxy"
>
</
CheckBox
Preference>
</
Switch
Preference>
<Preference
android:key=
"proxyedApps"
android:dependency=
"isGlobalProxy"
...
...
@@ -78,23 +78,23 @@
android:title=
"@string/proxied_apps"
>
<intent
android:action=
"com.github.shadowsocks.AppManager"
/>
</Preference>
<
CheckBox
Preference
<
Switch
Preference
android:key=
"isUdpDns"
android:defaultValue=
"false"
android:summary=
"@string/udp_dns_summary"
android:title=
"@string/udp_dns"
>
</
CheckBox
Preference>
<
CheckBox
Preference
</
Switch
Preference>
<
Switch
Preference
android:key=
"isAuth"
android:defaultValue=
"false"
android:summary=
"@string/onetime_auth_summary"
android:title=
"@string/onetime_auth"
>
</
CheckBox
Preference>
<
CheckBox
Preference
</
Switch
Preference>
<
Switch
Preference
android:key=
"isAutoConnect"
android:summary=
"@string/auto_connect_summary"
android:title=
"@string/auto_connect"
>
</
CheckBox
Preference>
</
Switch
Preference>
</PreferenceCategory>
...
...
src/main/scala/com/github/shadowsocks/AppManager.scala
View file @
46fd69db
...
...
@@ -78,7 +78,7 @@ class ObjectArrayTools[T <: AnyRef](a: Array[T]) {
}
}
case
class
ListEntry
(
box
:
CheckBox
,
text
:
TextView
,
icon
:
ImageView
)
case
class
ListEntry
(
switch
:
Switch
,
text
:
TextView
,
icon
:
ImageView
)
object
AppManager
{
...
...
@@ -162,13 +162,13 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe
if
(
convertView
==
null
)
{
convertView
=
getLayoutInflater
.
inflate
(
R
.
layout
.
layout_apps_item
,
parent
,
false
)
val
icon
=
convertView
.
findViewById
(
R
.
id
.
itemicon
).
asInstanceOf
[
ImageView
]
val
box
=
convertView
.
findViewById
(
R
.
id
.
itemcheck
).
asInstanceOf
[
CheckBox
]
val
switch
=
convertView
.
findViewById
(
R
.
id
.
itemcheck
).
asInstanceOf
[
Switch
]
val
text
=
convertView
.
findViewById
(
R
.
id
.
itemtext
).
asInstanceOf
[
TextView
]
entry
=
new
ListEntry
(
box
,
text
,
icon
)
entry
=
new
ListEntry
(
switch
,
text
,
icon
)
entry
.
text
.
setOnClickListener
(
AppManager
.
this
)
entry
.
text
.
setOnClickListener
(
AppManager
.
this
)
convertView
.
setTag
(
entry
)
entry
.
box
.
setOnCheckedChangeListener
(
AppManager
.
this
)
entry
.
switch
.
setOnCheckedChangeListener
(
AppManager
.
this
)
}
else
{
entry
=
convertView
.
getTag
.
asInstanceOf
[
ListEntry
]
}
...
...
@@ -187,10 +187,10 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe
ImageLoader
.
getInstance
().
displayImage
(
Scheme
.
APP
+
app
.
packageName
,
entry
.
icon
,
options
)
entry
.
text
.
setText
(
app
.
name
)
val
box
:
CheckBox
=
entry
.
box
box
.
setTag
(
app
)
box
.
setChecked
(
app
.
proxied
)
entry
.
text
.
setTag
(
box
)
val
switch
=
entry
.
switch
switch
.
setTag
(
app
)
switch
.
setChecked
(
app
.
proxied
)
entry
.
text
.
setTag
(
switch
)
convertView
}
}
...
...
@@ -207,11 +207,11 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe
}
def
onClick
(
v
:
View
)
{
val
cbox
:
CheckBox
=
v
.
getTag
.
asInstanceOf
[
CheckBox
]
val
app
:
ProxiedApp
=
cbox
.
getTag
.
asInstanceOf
[
ProxiedApp
]
val
switch
=
v
.
getTag
.
asInstanceOf
[
Switch
]
val
app
:
ProxiedApp
=
switch
.
getTag
.
asInstanceOf
[
ProxiedApp
]
if
(
app
!=
null
)
{
app
.
proxied
=
!
app
.
proxied
cbox
.
setChecked
(
app
.
proxied
)
switch
.
setChecked
(
app
.
proxied
)
}
saveAppSettings
(
this
)
}
...
...
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