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
a1871f79
Commit
a1871f79
authored
May 21, 2016
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix building
parent
0b7fb75b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
12 deletions
+18
-12
src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala
...in/scala/com/github/shadowsocks/ShadowsocksSettings.scala
+7
-6
src/main/scala/com/github/shadowsocks/database/ProfileManager.scala
...cala/com/github/shadowsocks/database/ProfileManager.scala
+11
-6
No files found.
src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala
View file @
a1871f79
...
@@ -15,10 +15,11 @@ import com.github.shadowsocks.utils.{Key, Utils}
...
@@ -15,10 +15,11 @@ import com.github.shadowsocks.utils.{Key, Utils}
object
ShadowsocksSettings
{
object
ShadowsocksSettings
{
// Constants
// Constants
val
PREFS_NAME
=
"Shadowsocks"
private
final
val
TAG
=
"ShadowsocksSettings"
val
PROXY_PREFS
=
Array
(
Key
.
profileName
,
Key
.
proxy
,
Key
.
remotePort
,
Key
.
localPort
,
Key
.
sitekey
,
Key
.
encMethod
,
private
final
val
PREFS_NAME
=
"Shadowsocks"
private
val
PROXY_PREFS
=
Array
(
Key
.
profileName
,
Key
.
proxy
,
Key
.
remotePort
,
Key
.
localPort
,
Key
.
sitekey
,
Key
.
encMethod
,
Key
.
isAuth
)
Key
.
isAuth
)
val
FEATURE_PREFS
=
Array
(
Key
.
route
,
Key
.
isProxyApps
,
Key
.
isUdpDns
,
Key
.
isIpv6
)
private
val
FEATURE_PREFS
=
Array
(
Key
.
route
,
Key
.
isProxyApps
,
Key
.
isUdpDns
,
Key
.
isIpv6
)
// Helper functions
// Helper functions
def
updateDropDownPreference
(
pref
:
Preference
,
value
:
String
)
{
def
updateDropDownPreference
(
pref
:
Preference
,
value
:
String
)
{
...
@@ -81,7 +82,7 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan
...
@@ -81,7 +82,7 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan
})
})
findPreference
(
"recovery"
).
setOnPreferenceClickListener
((
preference
:
Preference
)
=>
{
findPreference
(
"recovery"
).
setOnPreferenceClickListener
((
preference
:
Preference
)
=>
{
ShadowsocksApplication
.
track
(
Shadowsocks
.
TAG
,
"reset"
)
ShadowsocksApplication
.
track
(
TAG
,
"reset"
)
activity
.
recovery
()
activity
.
recovery
()
true
true
})
})
...
@@ -89,13 +90,13 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan
...
@@ -89,13 +90,13 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan
val
flush
=
findPreference
(
"flush_dnscache"
)
val
flush
=
findPreference
(
"flush_dnscache"
)
if
(
Build
.
VERSION
.
SDK_INT
<
17
)
flush
.
setSummary
(
R
.
string
.
flush_dnscache_summary
)
if
(
Build
.
VERSION
.
SDK_INT
<
17
)
flush
.
setSummary
(
R
.
string
.
flush_dnscache_summary
)
flush
.
setOnPreferenceClickListener
(
_
=>
{
flush
.
setOnPreferenceClickListener
(
_
=>
{
ShadowsocksApplication
.
track
(
Shadowsocks
.
TAG
,
"flush_dnscache"
)
ShadowsocksApplication
.
track
(
TAG
,
"flush_dnscache"
)
activity
.
flushDnsCache
()
activity
.
flushDnsCache
()
true
true
})
})
findPreference
(
"about"
).
setOnPreferenceClickListener
((
preference
:
Preference
)
=>
{
findPreference
(
"about"
).
setOnPreferenceClickListener
((
preference
:
Preference
)
=>
{
ShadowsocksApplication
.
track
(
Shadowsocks
.
TAG
,
"about"
)
ShadowsocksApplication
.
track
(
TAG
,
"about"
)
val
web
=
new
WebView
(
activity
)
val
web
=
new
WebView
(
activity
)
web
.
loadUrl
(
"file:///android_asset/pages/about.html"
)
web
.
loadUrl
(
"file:///android_asset/pages/about.html"
)
web
.
setWebViewClient
(
new
WebViewClient
()
{
web
.
setWebViewClient
(
new
WebViewClient
()
{
...
...
src/main/scala/com/github/shadowsocks/database/ProfileManager.scala
View file @
a1871f79
...
@@ -44,7 +44,12 @@ import android.util.Log
...
@@ -44,7 +44,12 @@ import android.util.Log
import
com.github.shadowsocks._
import
com.github.shadowsocks._
import
com.github.shadowsocks.utils.Key
import
com.github.shadowsocks.utils.Key
object
ProfileManager
{
private
final
val
TAG
=
"ProfileManager"
}
class
ProfileManager
(
settings
:
SharedPreferences
,
dbHelper
:
DBHelper
)
{
class
ProfileManager
(
settings
:
SharedPreferences
,
dbHelper
:
DBHelper
)
{
import
ProfileManager._
var
profileAddedListener
:
Profile
=>
Any
=
_
var
profileAddedListener
:
Profile
=>
Any
=
_
def
setProfileAddedListener
(
listener
:
Profile
=>
Any
)
=
this
.
profileAddedListener
=
listener
def
setProfileAddedListener
(
listener
:
Profile
=>
Any
)
=
this
.
profileAddedListener
=
listener
...
@@ -72,7 +77,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
...
@@ -72,7 +77,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
profile
profile
}
catch
{
}
catch
{
case
ex
:
Exception
=>
case
ex
:
Exception
=>
Log
.
e
(
Shadowsocks
.
TAG
,
"addProfile"
,
ex
)
Log
.
e
(
TAG
,
"addProfile"
,
ex
)
p
p
}
}
}
}
...
@@ -83,7 +88,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
...
@@ -83,7 +88,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
true
true
}
catch
{
}
catch
{
case
ex
:
Exception
=>
case
ex
:
Exception
=>
Log
.
e
(
Shadowsocks
.
TAG
,
"updateProfile"
,
ex
)
Log
.
e
(
TAG
,
"updateProfile"
,
ex
)
false
false
}
}
}
}
...
@@ -96,7 +101,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
...
@@ -96,7 +101,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
}
}
}
catch
{
}
catch
{
case
ex
:
Exception
=>
case
ex
:
Exception
=>
Log
.
e
(
Shadowsocks
.
TAG
,
"getProfile"
,
ex
)
Log
.
e
(
TAG
,
"getProfile"
,
ex
)
None
None
}
}
}
}
...
@@ -107,7 +112,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
...
@@ -107,7 +112,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
true
true
}
catch
{
}
catch
{
case
ex
:
Exception
=>
case
ex
:
Exception
=>
Log
.
e
(
Shadowsocks
.
TAG
,
"delProfile"
,
ex
)
Log
.
e
(
TAG
,
"delProfile"
,
ex
)
false
false
}
}
}
}
...
@@ -118,7 +123,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
...
@@ -118,7 +123,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
if
(
result
.
size
==
1
)
Option
(
result
.
get
(
0
))
else
None
if
(
result
.
size
==
1
)
Option
(
result
.
get
(
0
))
else
None
}
catch
{
}
catch
{
case
ex
:
Exception
=>
case
ex
:
Exception
=>
Log
.
e
(
Shadowsocks
.
TAG
,
"getAllProfiles"
,
ex
)
Log
.
e
(
TAG
,
"getAllProfiles"
,
ex
)
None
None
}
}
}
}
...
@@ -129,7 +134,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
...
@@ -129,7 +134,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
Option
(
dbHelper
.
profileDao
.
query
(
dbHelper
.
profileDao
.
queryBuilder
.
orderBy
(
"userOrder"
,
true
).
prepare
).
toList
)
Option
(
dbHelper
.
profileDao
.
query
(
dbHelper
.
profileDao
.
queryBuilder
.
orderBy
(
"userOrder"
,
true
).
prepare
).
toList
)
}
catch
{
}
catch
{
case
ex
:
Exception
=>
case
ex
:
Exception
=>
Log
.
e
(
Shadowsocks
.
TAG
,
"getAllProfiles"
,
ex
)
Log
.
e
(
TAG
,
"getAllProfiles"
,
ex
)
None
None
}
}
}
}
...
...
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