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
8127b9f8
Commit
8127b9f8
authored
Feb 08, 2016
by
Max Lv
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #570 from Mygod/master
General enhancements
parents
4258e95f
3556eebf
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
11 deletions
+27
-11
src/main/res/values-v21/strings.xml
src/main/res/values-v21/strings.xml
+4
-0
src/main/res/values-zh-v21/strings.xml
src/main/res/values-zh-v21/strings.xml
+4
-0
src/main/res/values-zh/strings.xml
src/main/res/values-zh/strings.xml
+2
-1
src/main/res/values/strings.xml
src/main/res/values/strings.xml
+2
-1
src/main/scala/com/github/shadowsocks/ProfileManagerActivity.scala
...scala/com/github/shadowsocks/ProfileManagerActivity.scala
+4
-7
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+5
-0
src/main/scala/com/github/shadowsocks/TaskerActivity.scala
src/main/scala/com/github/shadowsocks/TaskerActivity.scala
+6
-2
No files found.
src/main/res/values-v21/strings.xml
0 → 100644
View file @
8127b9f8
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string
name=
"proxied_apps_summary"
>
Set proxy for selected apps
</string>
</resources>
src/main/res/values-zh-v21/strings.xml
0 → 100644
View file @
8127b9f8
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string
name=
"proxied_apps_summary"
>
为应用程序分别设置代理
</string>
</resources>
src/main/res/values-zh/strings.xml
View file @
8127b9f8
...
...
@@ -26,7 +26,7 @@
<string
name=
"auto_set_gfwlist_summary"
>
绕过所有位于中国的网站
</string>
<string
name=
"route_list"
>
路由
</string>
<string
name=
"proxied_apps"
>
分应用代理
</string>
<string
name=
"proxied_apps_summary"
>
为应用程序分别设置代理
</string>
<string
name=
"proxied_apps_summary"
>
为应用程序分别设置代理
,在 4.x 下需要启用 NAT 模式
</string>
<string
name=
"on"
>
开
</string>
<string
name=
"bypass_apps"
>
绕行模式
</string>
<string
name=
"bypass_apps_summary"
>
启用该选项,以使所选应用程序的流量不经过代理
</string>
...
...
@@ -34,6 +34,7 @@
<string
name=
"auto_connect_summary"
>
随系统启动后台服务
</string>
<string
name=
"forward_success"
>
后台服务已开始运行。
</string>
<string
name=
"service_failed"
>
无法连接远程服务器
</string>
<string
name=
"nat_deprecated"
>
警告:在 Android 5.0 及更高版本中不建议使用 NAT 模式
</string>
<string
name=
"nat_no_root"
>
NAT 模式需要 ROOT 权限
</string>
<string
name=
"switch_to_vpn"
>
切换到 VPN 模式
</string>
<string
name=
"stop"
>
停止服务
</string>
...
...
src/main/res/values/strings.xml
View file @
8127b9f8
...
...
@@ -54,7 +54,7 @@
</string>
<string
name=
"route_list"
>
Route
</string>
<string
name=
"proxied_apps"
>
Per-App Proxy
</string>
<string
name=
"proxied_apps_summary"
>
Set proxy for selected apps
</string>
<string
name=
"proxied_apps_summary"
>
Set proxy for selected apps
, requires NAT mode under Android 4.x
</string>
<string
name=
"on"
>
On
</string>
<string
name=
"bypass_apps"
>
Bypass Mode
</string>
<string
name=
"bypass_apps_summary"
>
Enable this option to bypass selected apps
</string>
...
...
@@ -66,6 +66,7 @@
<!-- notification category -->
<string
name=
"forward_success"
>
Shadowsocks started.
</string>
<string
name=
"service_failed"
>
Failed to connect the remote server
</string>
<string
name=
"nat_deprecated"
>
WARNING: NAT mode has been deprecated since Android 5.0
</string>
<string
name=
"nat_no_root"
>
NAT mode requires ROOT permission
</string>
<string
name=
"switch_to_vpn"
>
Switch to VPN mode
</string>
<string
name=
"stop"
>
Stop the service
</string>
...
...
src/main/scala/com/github/shadowsocks/ProfileManagerActivity.scala
View file @
8127b9f8
...
...
@@ -76,12 +76,11 @@ class ProfileManagerActivity extends AppCompatActivity with OnMenuItemClickListe
handler
.
post
(()
=>
text
.
setText
(
builder
))
}
def
bind
(
item
:
Profile
,
i
:
Int
)
{
def
bind
(
item
:
Profile
)
{
this
.
item
=
item
updateText
()
if
(
item
.
id
==
ShadowsocksApplication
.
profileId
)
{
text
.
setChecked
(
true
)
selectedIndex
=
i
selectedItem
=
this
}
else
{
text
.
setChecked
(
false
)
...
...
@@ -102,7 +101,7 @@ class ProfileManagerActivity extends AppCompatActivity with OnMenuItemClickListe
def
getItemCount
=
profiles
.
length
def
onBindViewHolder
(
vh
:
ProfileViewHolder
,
i
:
Int
)
=
vh
.
bind
(
profiles
(
i
)
,
i
)
def
onBindViewHolder
(
vh
:
ProfileViewHolder
,
i
:
Int
)
=
vh
.
bind
(
profiles
(
i
))
def
onCreateViewHolder
(
vg
:
ViewGroup
,
i
:
Int
)
=
new
ProfileViewHolder
(
LayoutInflater
.
from
(
vg
.
getContext
).
inflate
(
R
.
layout
.
layout_profiles_item
,
vg
,
false
))
...
...
@@ -154,7 +153,6 @@ class ProfileManagerActivity extends AppCompatActivity with OnMenuItemClickListe
}
}
private
var
selectedIndex
=
-
1
private
var
selectedItem
:
ProfileViewHolder
=
_
private
val
handler
=
new
Handler
...
...
@@ -181,10 +179,9 @@ class ProfileManagerActivity extends AppCompatActivity with OnMenuItemClickListe
profilesList
.
setLayoutManager
(
layoutManager
)
profilesList
.
setItemAnimator
(
new
DefaultItemAnimator
)
profilesList
.
setAdapter
(
profilesAdapter
)
if
(
selectedIndex
<
0
)
selectedIndex
=
profilesAdapter
.
profiles
.
zipWithIndex
.
collectFirst
{
layoutManager
.
scrollToPosition
(
profilesAdapter
.
profiles
.
zipWithIndex
.
collectFirst
{
case
(
profile
,
i
)
if
profile
.
id
==
ShadowsocksApplication
.
profileId
=>
i
}.
getOrElse
(-
1
)
layoutManager
.
scrollToPosition
(
selectedIndex
)
}.
getOrElse
(-
1
))
removedSnackbar
=
Snackbar
.
make
(
profilesList
,
R
.
string
.
removed
,
Snackbar
.
LENGTH_LONG
)
.
setAction
(
R
.
string
.
undo
,
((
v
:
View
)
=>
profilesAdapter
.
undoRemoves
)
:
OnClickListener
)
removedSnackbar
.
getView
.
addOnAttachStateChangeListener
(
new
OnAttachStateChangeListener
{
...
...
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
8127b9f8
...
...
@@ -168,6 +168,11 @@ class Shadowsocks
// Update the UI
if
(
fab
!=
null
)
fab
.
setEnabled
(
true
)
updateState
()
if
(
Build
.
VERSION
.
SDK_INT
>=
21
&&
!
ShadowsocksApplication
.
isVpnEnabled
)
{
val
snackbar
=
Snackbar
.
make
(
findViewById
(
android
.
R
.
id
.
content
),
R
.
string
.
nat_deprecated
,
Snackbar
.
LENGTH_LONG
)
snackbar
.
setAction
(
R
.
string
.
switch_to_vpn
,
(
_
=>
preferences
.
natSwitch
.
setChecked
(
false
))
:
View.OnClickListener
)
snackbar
.
show
}
if
(!
ShadowsocksApplication
.
settings
.
getBoolean
(
ShadowsocksApplication
.
getVersionName
,
false
))
{
ShadowsocksApplication
.
settings
.
edit
.
putBoolean
(
ShadowsocksApplication
.
getVersionName
,
true
).
apply
()
...
...
src/main/scala/com/github/shadowsocks/TaskerActivity.scala
View file @
8127b9f8
...
...
@@ -82,7 +82,7 @@ class TaskerActivity extends AppCompatActivity {
}
private
class
ProfilesAdapter
extends
RecyclerView
.
Adapter
[
ProfileViewHolder
]
{
private
val
profiles
=
ShadowsocksApplication
.
profileManager
.
getAllProfiles
.
getOrElse
(
List
.
empty
[
Profile
])
val
profiles
=
ShadowsocksApplication
.
profileManager
.
getAllProfiles
.
getOrElse
(
List
.
empty
[
Profile
])
def
getItemCount
=
1
+
profiles
.
length
def
onBindViewHolder
(
vh
:
ProfileViewHolder
,
i
:
Int
)
=
i
match
{
case
0
=>
vh
.
bindDefault
...
...
@@ -110,9 +110,13 @@ class TaskerActivity extends AppCompatActivity {
switch
=
findViewById
(
R
.
id
.
serviceSwitch
).
asInstanceOf
[
Switch
]
switch
.
setChecked
(
taskerOption
.
switchOn
)
val
profilesList
=
findViewById
(
R
.
id
.
profilesList
).
asInstanceOf
[
RecyclerView
]
profilesList
.
setLayoutManager
(
new
LinearLayoutManager
(
this
))
val
lm
=
new
LinearLayoutManager
(
this
)
profilesList
.
setLayoutManager
(
lm
)
profilesList
.
setItemAnimator
(
new
DefaultItemAnimator
)
profilesList
.
setAdapter
(
profilesAdapter
)
if
(
taskerOption
.
profileId
>=
0
)
lm
.
scrollToPosition
(
profilesAdapter
.
profiles
.
zipWithIndex
.
collectFirst
{
case
(
profile
,
i
)
if
profile
.
id
==
taskerOption
.
profileId
=>
i
+
1
}.
getOrElse
(
0
))
}
}
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