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
4a4d3b11
Commit
4a4d3b11
authored
Sep 07, 2014
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refine handler
parent
3538caa8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
36 deletions
+55
-36
.travis.yml
.travis.yml
+1
-0
src/main/scala/com/github/shadowsocks/AppManager.scala
src/main/scala/com/github/shadowsocks/AppManager.scala
+46
-35
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+8
-1
No files found.
.travis.yml
View file @
4a4d3b11
...
...
@@ -24,3 +24,4 @@ script:
-
./build-ndk.sh
-
cp local.properties.travis local.properties
-
sbt android:package-release
-
exit
0
src/main/scala/com/github/shadowsocks/AppManager.scala
View file @
4a4d3b11
...
...
@@ -206,8 +206,19 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe
saveAppSettings
(
this
)
}
override
def
onDestroy
()
{
super
.
onDestroy
()
if
(
handler
!=
null
)
{
handler
.
removeCallbacksAndMessages
(
null
)
handler
=
null
}
}
protected
override
def
onCreate
(
savedInstanceState
:
Bundle
)
{
super
.
onCreate
(
savedInstanceState
)
handler
=
new
Handler
()
getActionBar
.
setTitle
(
R
.
string
.
proxied_help
)
this
.
setContentView
(
R
.
layout
.
layout_apps
)
this
.
overlay
=
View
.
inflate
(
this
,
R
.
layout
.
overlay
,
null
).
asInstanceOf
[
TextView
]
...
...
@@ -237,10 +248,10 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe
super
.
onResume
()
new
Thread
{
override
def
run
()
{
handler
.
sendEmptyMessage
(
MSG_LOAD_START
)
handler
.
post
(
loadStartRunnable
)
appListView
=
findViewById
(
R
.
id
.
applistview
).
asInstanceOf
[
ListView
]
if
(!
appsLoaded
)
loadApps
()
handler
.
sendEmptyMessage
(
MSG_LOAD_FINISH
)
handler
.
post
(
loadFinishRunnable
)
}
}.
start
()
}
...
...
@@ -259,13 +270,15 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe
edit
.
commit
}
val
handler
:
Handler
=
new
Handler
{
override
def
handleMessage
(
msg
:
Message
)
{
msg
.
what
match
{
case
MSG_LOAD_START
=>
val
loadStartRunnable
=
new
Runnable
{
override
def
run
()
{
progressDialog
=
ProgressDialog
.
show
(
AppManager
.
this
,
""
,
getString
(
R
.
string
.
loading
),
true
,
true
)
case
MSG_LOAD_FINISH
=>
}
}
val
loadFinishRunnable
=
new
Runnable
{
override
def
run
()
=
{
appListView
.
setAdapter
(
adapter
)
appListView
.
setOnScrollListener
(
new
AbsListView
.
OnScrollListener
{
def
onScroll
(
view
:
AbsListView
,
firstVisibleItem
:
Int
,
visibleItemCount
:
Int
,
...
...
@@ -280,14 +293,12 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe
overlay
.
setVisibility
(
View
.
VISIBLE
)
}
}
def
onScrollStateChanged
(
view
:
AbsListView
,
scrollState
:
Int
)
{
visible
=
true
if
(
scrollState
==
OnScrollListener
.
SCROLL_STATE_IDLE
)
{
overlay
.
setVisibility
(
View
.
INVISIBLE
)
}
}
var
visible
=
false
})
if
(
progressDialog
!=
null
)
{
...
...
@@ -295,10 +306,10 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe
progressDialog
=
null
}
}
super
.
handleMessage
(
msg
)
}
}
var
handler
:
Handler
=
null
class
AppIconDownloader
(
context
:
Context
,
connectTimeout
:
Int
,
readTimeout
:
Int
)
extends
BaseImageDownloader
(
context
,
connectTimeout
,
readTimeout
)
{
...
...
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
4a4d3b11
...
...
@@ -67,6 +67,7 @@ import net.simonvt.menudrawer.MenuDrawer
import
scala.collection.mutable.
{
ArrayBuffer
,
ListBuffer
}
import
scala.concurrent.ops._
import
scala.ref.WeakReference
class
ProfileIconDownloader
(
context
:
Context
,
connectTimeout
:
Int
,
readTimeout
:
Int
)
extends
BaseImageDownloader
(
context
,
connectTimeout
,
readTimeout
)
{
...
...
@@ -236,7 +237,7 @@ class Shadowsocks
private
lazy
val
application
=
getApplication
.
asInstanceOf
[
ShadowsocksApplication
]
va
l
handler
=
new
Handler
()
va
r
handler
:
Handler
=
null
def
isSinglePane
:
Boolean
=
{
if
(
singlePane
==
-
1
)
{
...
...
@@ -442,6 +443,8 @@ class Shadowsocks
super
.
onCreate
(
savedInstanceState
)
handler
=
new
Handler
()
addPreferencesFromResource
(
R
.
xml
.
pref_all
)
// Initialize the profile
...
...
@@ -797,6 +800,10 @@ class Shadowsocks
Crouton
.
cancelAllCroutons
()
unregisterReceiver
(
preferenceReceiver
)
new
BackupManager
(
this
).
dataChanged
()
if
(
handler
!=
null
)
{
handler
.
removeCallbacksAndMessages
(
null
)
handler
=
null
}
}
def
copyToSystem
()
{
...
...
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