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
dbc7292a
Commit
dbc7292a
authored
Nov 09, 2015
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust preference order
parent
a7d72938
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
58 additions
and
44 deletions
+58
-44
src/main/jni/iptables
src/main/jni/iptables
+1
-1
src/main/jni/shadowsocks-libev
src/main/jni/shadowsocks-libev
+1
-1
src/main/res/values/strings.xml
src/main/res/values/strings.xml
+4
-3
src/main/res/xml/pref_all.xml
src/main/res/xml/pref_all.xml
+16
-9
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+4
-30
src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala
...in/scala/com/github/shadowsocks/ShadowsocksSettings.scala
+31
-0
src/main/scala/com/github/shadowsocks/utils/Constants.scala
src/main/scala/com/github/shadowsocks/utils/Constants.scala
+1
-0
No files found.
iptables
@
177a84bc
Subproject commit
67560ab12c1ff3413f971f9f1ba59ff28cb052ce
Subproject commit
177a84bc6b77c53e1ccc22b97170928d54c1ce92
shadowsocks-libev
@
890e880d
Subproject commit
772de6fdeb15fd7d2b7853b4d3e0372713f16b81
Subproject commit
890e880dc61ad4f2e9a340a78c797c4aabee6429
src/main/res/values/strings.xml
View file @
dbc7292a
...
...
@@ -4,12 +4,13 @@
<string
name=
"app_name"
>
Shadowsocks
</string>
<string
name=
"screen_name"
>
shadowsocks
</string>
<!-- global category -->
<!-- global
/misc
category -->
<string
name=
"global_cat"
>
Global Settings
</string>
<string
name=
"misc_cat"
>
Misc
</string>
<string
name=
"profile"
>
Profile
</string>
<string
name=
"profile_summary"
>
Switch to another profile
</string>
<string
name=
"nat"
>
NAT mode
</string>
<string
name=
"nat_summary"
>
Use NAT
/
VPN mode.
</string>
<string
name=
"nat"
>
NAT mode
(deprecated)
</string>
<string
name=
"nat_summary"
>
Use NAT
mode instead of
VPN mode.
</string>
<string
name=
"nat_summary_no_root"
>
NAT mode is disabled without root.
</string>
<!-- proxy category -->
...
...
src/main/res/xml/pref_all.xml
View file @
dbc7292a
...
...
@@ -2,12 +2,21 @@
<PreferenceScreen
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res/com.github.shadowsocks"
>
<PreferenceCategory
android:title=
"@string/proxy_cat"
>
<PreferenceCategory
android:title=
"@string/global_cat"
>
<Preference
android:summary=
"@string/profile_summary"
android:title=
"@string/profiles"
>
<Preference
android:
key=
"profiles"
android:
summary=
"@string/profile_summary"
android:title=
"@string/profiles"
>
<intent
android:action=
"com.github.shadowsocks.ProfileManagerActivity"
/>
</Preference>
<SwitchPreference
android:key=
"isAutoConnect"
android:summary=
"@string/auto_connect_summary"
android:title=
"@string/auto_connect"
/>
</PreferenceCategory>
<PreferenceCategory
android:title=
"@string/proxy_cat"
>
<com.github.shadowsocks.preferences.SummaryEditTextPreference
android:defaultValue=
"Default"
android:key=
"profileName"
...
...
@@ -86,18 +95,16 @@
</PreferenceCategory>
<PreferenceCategory
android:title=
"@string/global_cat"
>
<PreferenceCategory
android:title=
"@string/misc_cat"
>
<com.github.shadowsocks.preferences.NatSwitchPreference
android:key=
"isNAT"
android:title=
"@string/nat"
android:summary=
"@string/nat_summary"
/>
<SwitchPreference
android:key=
"isAutoConnect"
android:summary=
"@string/auto_connect_summary"
android:title=
"@string/auto_connect"
/>
<Preference
android:key=
"recovery"
android:title=
"@string/recovery"
android:summary=
"@string/recovery_summary"
/>
<Preference
android:key=
"flush_dnscache"
android:title=
"@string/flush_dnscache"
android:summary=
"@string/flush_dnscache_summary"
/>
android:summary=
"@string/flush_dnscache_summary"
/>
<Preference
android:key=
"about"
android:title=
"@string/about"
/>
</PreferenceCategory>
...
...
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
dbc7292a
...
...
@@ -43,11 +43,11 @@ import java.util
import
java.util.Locale
import
android.app.backup.BackupManager
import
android.app.
{
Activity
,
AlertDialog
,
ProgressDialog
}
import
android.app.
{
Activity
,
ProgressDialog
}
import
android.content._
import
android.content.res.AssetManager
import
android.graphics.Typeface
import
android.net.
{
Uri
,
VpnService
}
import
android.net.
VpnService
import
android.os._
import
android.preference.
{
Preference
,
SwitchPreference
}
import
android.support.design.widget.
{
FloatingActionButton
,
Snackbar
}
...
...
@@ -56,7 +56,6 @@ import android.support.v7.app.AppCompatActivity
import
android.support.v7.widget.Toolbar
import
android.util.Log
import
android.view.
{
View
,
ViewGroup
,
ViewParent
}
import
android.webkit.
{
WebView
,
WebViewClient
}
import
android.widget._
import
com.github.jorgecastilloprz.FABProgressCircle
import
com.github.shadowsocks.aidl.
{
IShadowsocksService
,
IShadowsocksServiceCallback
}
...
...
@@ -97,7 +96,7 @@ object Shadowsocks {
val
REQUEST_CONNECT
=
1
val
PREFS_NAME
=
"Shadowsocks"
val
PROXY_PREFS
=
Array
(
Key
.
proxy
,
Key
.
remotePort
,
Key
.
localPort
,
Key
.
sitekey
,
Key
.
encMethod
)
val
PROXY_PREFS
=
Array
(
Key
.
pro
fileName
,
Key
.
pro
xy
,
Key
.
remotePort
,
Key
.
localPort
,
Key
.
sitekey
,
Key
.
encMethod
)
val
FEATURE_PREFS
=
Array
(
Key
.
route
,
Key
.
isGlobalProxy
,
Key
.
proxyedApps
,
Key
.
isUdpDns
,
Key
.
isAuth
,
Key
.
isIpv6
)
val
EXECUTABLES
=
Array
(
Executable
.
PDNSD
,
Executable
.
REDSOCKS
,
Executable
.
SS_TUNNEL
,
Executable
.
SS_LOCAL
,
Executable
.
TUN2SOCKS
)
...
...
@@ -141,7 +140,6 @@ object Shadowsocks {
class
Shadowsocks
extends
AppCompatActivity
{
import
Shadowsocks._
// Variables
private
var
serviceStarted
=
false
...
...
@@ -377,10 +375,6 @@ class Shadowsocks
val
title
:
TextView
=
field
.
get
(
toolbar
).
asInstanceOf
[
TextView
]
val
tf
:
Typeface
=
Typefaces
.
get
(
this
,
"fonts/Iceland.ttf"
)
if
(
tf
!=
null
)
title
.
setTypeface
(
tf
)
title
.
setOnClickListener
((
view
:
View
)
=>
{
ShadowsocksApplication
.
track
(
TAG
,
"about"
)
showAbout
()
})
fab
=
findViewById
(
R
.
id
.
fab
).
asInstanceOf
[
FloatingActionButton
]
fabProgressCircle
=
findViewById
(
R
.
id
.
fabProgressCircle
).
asInstanceOf
[
FABProgressCircle
]
...
...
@@ -496,6 +490,7 @@ class Shadowsocks
}
private
def
setPreferenceEnabled
(
enabled
:
Boolean
)
{
preferences
.
findPreference
(
Key
.
profiles
).
setEnabled
(
enabled
)
preferences
.
findPreference
(
Key
.
isNAT
).
setEnabled
(
enabled
)
for
(
name
<-
Shadowsocks
.
PROXY_PREFS
)
{
val
pref
=
preferences
.
findPreference
(
name
)
...
...
@@ -518,7 +513,6 @@ class Shadowsocks
private
def
updatePreferenceScreen
()
{
val
profile
=
currentProfile
Shadowsocks
.
updatePreference
(
preferences
.
findPreference
(
Key
.
profileName
),
Key
.
profileName
,
profile
)
for
(
name
<-
Shadowsocks
.
PROXY_PREFS
)
{
val
pref
=
preferences
.
findPreference
(
name
)
Shadowsocks
.
updatePreference
(
pref
,
name
,
profile
)
...
...
@@ -636,26 +630,6 @@ class Shadowsocks
}
}
private
def
showAbout
()
{
val
web
=
new
WebView
(
this
)
web
.
loadUrl
(
"file:///android_asset/pages/about.html"
)
web
.
setWebViewClient
(
new
WebViewClient
()
{
override
def
shouldOverrideUrlLoading
(
view
:
WebView
,
url
:
String
)
:
Boolean
=
{
startActivity
(
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
url
)))
true
}
})
new
AlertDialog
.
Builder
(
this
)
.
setTitle
(
getString
(
R
.
string
.
about_title
).
formatLocal
(
Locale
.
ENGLISH
,
ShadowsocksApplication
.
getVersionName
))
.
setCancelable
(
false
)
.
setNegativeButton
(
getString
(
android
.
R
.
string
.
ok
),
((
dialog
:
DialogInterface
,
id
:
Int
)
=>
dialog
.
cancel
())
:
DialogInterface.OnClickListener
)
.
setView
(
web
)
.
create
()
.
show
()
}
def
clearDialog
()
{
if
(
progressDialog
!=
null
)
{
progressDialog
.
dismiss
()
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala
View file @
dbc7292a
package
com.github.shadowsocks
import
java.util.Locale
import
android.app.AlertDialog
import
android.content.
{
DialogInterface
,
Intent
}
import
android.net.Uri
import
android.os.Bundle
import
android.preference.
{
Preference
,
PreferenceFragment
}
import
android.webkit.
{
WebViewClient
,
WebView
}
import
com.github.shadowsocks.utils.Key
// TODO: Move related logic here
...
...
@@ -11,20 +17,45 @@ class ShadowsocksSettings extends PreferenceFragment {
override
def
onCreate
(
savedInstanceState
:
Bundle
)
{
super
.
onCreate
(
savedInstanceState
)
addPreferencesFromResource
(
R
.
xml
.
pref_all
)
findPreference
(
Key
.
isNAT
).
setOnPreferenceChangeListener
((
preference
:
Preference
,
newValue
:
Any
)
=>
if
(
ShadowsocksApplication
.
isRoot
)
activity
.
handler
.
post
(()
=>
{
activity
.
deattachService
()
activity
.
attachService
()
})
else
false
)
findPreference
(
"recovery"
).
setOnPreferenceClickListener
((
preference
:
Preference
)
=>
{
ShadowsocksApplication
.
track
(
Shadowsocks
.
TAG
,
"reset"
)
activity
.
recovery
()
true
})
findPreference
(
"flush_dnscache"
).
setOnPreferenceClickListener
((
preference
:
Preference
)
=>
{
ShadowsocksApplication
.
track
(
Shadowsocks
.
TAG
,
"flush_dnscache"
)
activity
.
flushDnsCache
()
true
})
findPreference
(
"about"
).
setOnPreferenceClickListener
((
preference
:
Preference
)
=>
{
ShadowsocksApplication
.
track
(
Shadowsocks
.
TAG
,
"about"
)
val
web
=
new
WebView
(
activity
)
web
.
loadUrl
(
"file:///android_asset/pages/about.html"
)
web
.
setWebViewClient
(
new
WebViewClient
()
{
override
def
shouldOverrideUrlLoading
(
view
:
WebView
,
url
:
String
)
:
Boolean
=
{
startActivity
(
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
url
)))
true
}
})
new
AlertDialog
.
Builder
(
activity
)
.
setTitle
(
getString
(
R
.
string
.
about_title
).
formatLocal
(
Locale
.
ENGLISH
,
ShadowsocksApplication
.
getVersionName
))
.
setCancelable
(
false
)
.
setNegativeButton
(
getString
(
android
.
R
.
string
.
ok
),
((
dialog
:
DialogInterface
,
id
:
Int
)
=>
dialog
.
cancel
())
:
DialogInterface.OnClickListener
)
.
setView
(
web
)
.
create
()
.
show
()
true
})
}
}
src/main/scala/com/github/shadowsocks/utils/Constants.scala
View file @
dbc7292a
...
...
@@ -65,6 +65,7 @@ object Key {
val
proxied
=
"Proxyed"
val
profiles
=
"profiles"
val
isNAT
=
"isNAT"
val
proxyedApps
=
"proxyedApps"
val
route
=
"route"
...
...
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