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
b6fc013a
Commit
b6fc013a
authored
Dec 27, 2015
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unregister preference change callback in onDestroy instead of onPause
Fix #496
parent
4d7bf8d7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
11 deletions
+6
-11
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+0
-3
src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala
...in/scala/com/github/shadowsocks/ShadowsocksSettings.scala
+6
-8
No files found.
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
b6fc013a
...
...
@@ -104,7 +104,6 @@ class Shadowsocks
var
progressDialog
:
ProgressDialog
=
_
var
progressTag
=
-
1
var
state
=
State
.
STOPPED
var
prepared
=
false
var
currentProfile
=
new
Profile
var
vpnEnabled
=
-
1
var
trafficCache
:
String
=
_
...
...
@@ -402,7 +401,6 @@ class Shadowsocks
protected
override
def
onPause
()
{
super
.
onPause
()
ShadowsocksApplication
.
profileManager
.
save
prepared
=
false
}
private
def
stateUpdate
()
{
...
...
@@ -517,7 +515,6 @@ class Shadowsocks
override
def
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
)
=
resultCode
match
{
case
Activity
.
RESULT_OK
=>
prepared
=
true
serviceStart
()
case
_
=>
cancelStart
()
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala
View file @
b6fc013a
...
...
@@ -166,18 +166,16 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan
isProxyApps
.
setChecked
(
ShadowsocksApplication
.
settings
.
getBoolean
(
Key
.
isProxyApps
,
false
))
// update
}
override
def
on
Pause
{
super
.
on
Pause
()
override
def
on
Destroy
{
super
.
on
Destroy
()
ShadowsocksApplication
.
settings
.
unregisterOnSharedPreferenceChangeListener
(
this
)
}
def
onSharedPreferenceChanged
(
sharedPreferences
:
SharedPreferences
,
key
:
String
)
=
key
match
{
case
Key
.
isNAT
=>
activity
.
handler
.
post
(()
=>
{
case
Key
.
isNAT
=>
activity
.
handler
.
post
(()
=>
{
activity
.
deattachService
activity
.
attachService
})
setEnabled
(
enabled
)
case
_
=>
}
...
...
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