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
77d5c72a
Commit
77d5c72a
authored
Aug 16, 2018
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix port default values not populated
parent
3ae993e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
mobile/src/main/java/com/github/shadowsocks/GlobalSettingsPreferenceFragment.kt
...om/github/shadowsocks/GlobalSettingsPreferenceFragment.kt
+1
-0
mobile/src/main/java/com/github/shadowsocks/preference/DataStore.kt
.../main/java/com/github/shadowsocks/preference/DataStore.kt
+18
-3
No files found.
mobile/src/main/java/com/github/shadowsocks/GlobalSettingsPreferenceFragment.kt
View file @
77d5c72a
...
@@ -35,6 +35,7 @@ import com.takisoft.preferencex.PreferenceFragmentCompat
...
@@ -35,6 +35,7 @@ import com.takisoft.preferencex.PreferenceFragmentCompat
class
GlobalSettingsPreferenceFragment
:
PreferenceFragmentCompat
()
{
class
GlobalSettingsPreferenceFragment
:
PreferenceFragmentCompat
()
{
override
fun
onCreatePreferencesFix
(
savedInstanceState
:
Bundle
?,
rootKey
:
String
?)
{
override
fun
onCreatePreferencesFix
(
savedInstanceState
:
Bundle
?,
rootKey
:
String
?)
{
preferenceManager
.
preferenceDataStore
=
DataStore
.
publicStore
preferenceManager
.
preferenceDataStore
=
DataStore
.
publicStore
DataStore
.
initGlobal
()
addPreferencesFromResource
(
R
.
xml
.
pref_global
)
addPreferencesFromResource
(
R
.
xml
.
pref_global
)
val
boot
=
findPreference
(
Key
.
isAutoConnect
)
as
SwitchPreference
val
boot
=
findPreference
(
Key
.
isAutoConnect
)
as
SwitchPreference
boot
.
setOnPreferenceChangeListener
{
_
,
value
->
boot
.
setOnPreferenceChangeListener
{
_
,
value
->
...
...
mobile/src/main/java/com/github/shadowsocks/preference/DataStore.kt
View file @
77d5c72a
...
@@ -62,9 +62,24 @@ object DataStore {
...
@@ -62,9 +62,24 @@ object DataStore {
else
->
AppCompatDelegate
.
MODE_NIGHT_FOLLOW_SYSTEM
else
->
AppCompatDelegate
.
MODE_NIGHT_FOLLOW_SYSTEM
}
}
val
serviceMode
get
()
=
publicStore
.
getString
(
Key
.
serviceMode
)
?:
Key
.
modeVpn
val
serviceMode
get
()
=
publicStore
.
getString
(
Key
.
serviceMode
)
?:
Key
.
modeVpn
val
portProxy
get
()
=
getLocalPort
(
Key
.
portProxy
,
1080
)
var
portProxy
:
Int
val
portLocalDns
get
()
=
getLocalPort
(
Key
.
portLocalDns
,
5450
)
get
()
=
getLocalPort
(
Key
.
portProxy
,
1080
)
val
portTransproxy
get
()
=
getLocalPort
(
Key
.
portTransproxy
,
8200
)
set
(
value
)
=
publicStore
.
putString
(
Key
.
portProxy
,
value
.
toString
())
var
portLocalDns
:
Int
get
()
=
getLocalPort
(
Key
.
portLocalDns
,
5450
)
set
(
value
)
=
publicStore
.
putString
(
Key
.
portLocalDns
,
value
.
toString
())
var
portTransproxy
:
Int
get
()
=
getLocalPort
(
Key
.
portTransproxy
,
8200
)
set
(
value
)
=
publicStore
.
putString
(
Key
.
portTransproxy
,
value
.
toString
())
/**
* Initialize settings that have complicated default values.
*/
fun
initGlobal
()
{
if
(
publicStore
.
getString
(
Key
.
portProxy
)
==
null
)
portProxy
=
portProxy
if
(
publicStore
.
getString
(
Key
.
portLocalDns
)
==
null
)
portLocalDns
=
portLocalDns
if
(
publicStore
.
getString
(
Key
.
portTransproxy
)
==
null
)
portTransproxy
=
portTransproxy
}
var
proxyApps
:
Boolean
var
proxyApps
:
Boolean
get
()
=
privateStore
.
getBoolean
(
Key
.
proxyApps
)
?:
false
get
()
=
privateStore
.
getBoolean
(
Key
.
proxyApps
)
?:
false
...
...
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