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
d2f245fd
Commit
d2f245fd
authored
Dec 08, 2015
by
Max Lv
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #472 from Mygod/master
Fix #471
parents
38b33381
7e6bc0d7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
13 deletions
+18
-13
src/main/res/values/colors.xml
src/main/res/values/colors.xml
+1
-1
src/main/scala/com/github/shadowsocks/AppManager.scala
src/main/scala/com/github/shadowsocks/AppManager.scala
+5
-2
src/main/scala/com/github/shadowsocks/AppManagerReceiver.scala
...ain/scala/com/github/shadowsocks/AppManagerReceiver.scala
+1
-1
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+11
-9
No files found.
src/main/res/values/colors.xml
View file @
d2f245fd
...
...
@@ -2,7 +2,7 @@
<resources>
<color
name=
"material_green_
700"
>
#388E3C
</color>
<color
name=
"material_green_
a700"
>
#64DD17
</color>
<color
name=
"material_blue_grey_300"
>
#90A4AE
</color>
<color
name=
"material_blue_grey_500"
>
#607D8B
</color>
<color
name=
"material_blue_grey_700"
>
#455A64
</color>
...
...
src/main/scala/com/github/shadowsocks/AppManager.scala
View file @
d2f245fd
...
...
@@ -54,6 +54,7 @@ import android.view._
import
android.widget.AbsListView.OnScrollListener
import
android.widget.CompoundButton.OnCheckedChangeListener
import
android.widget._
import
android.Manifest.permission
import
com.github.shadowsocks.utils.
{
Key
,
Utils
}
import
scala.collection.JavaConversions._
...
...
@@ -66,8 +67,10 @@ object AppManager {
var
cachedApps
:
Array
[
ProxiedApp
]
=
_
private
def
getApps
(
pm
:
PackageManager
)
=
{
if
(
cachedApps
==
null
)
cachedApps
=
pm
.
getInstalledApplications
(
0
)
.
map
(
a
=>
new
ProxiedApp
(
pm
.
getApplicationLabel
(
a
).
toString
,
a
.
packageName
,
a
.
loadIcon
(
pm
))).
toArray
if
(
cachedApps
==
null
)
cachedApps
=
pm
.
getInstalledPackages
(
PackageManager
.
GET_PERMISSIONS
)
.
filter
(
p
=>
p
.
requestedPermissions
!=
null
&&
p
.
requestedPermissions
.
contains
(
permission
.
INTERNET
))
.
map
(
p
=>
new
ProxiedApp
(
pm
.
getApplicationLabel
(
p
.
applicationInfo
).
toString
,
p
.
packageName
,
p
.
applicationInfo
.
loadIcon
(
pm
))).
toArray
cachedApps
}
}
...
...
src/main/scala/com/github/shadowsocks/AppManagerReceiver.scala
View file @
d2f245fd
...
...
@@ -7,5 +7,5 @@ import android.content.{Intent, Context, BroadcastReceiver}
*/
class
AppManagerReceiver
extends
BroadcastReceiver
{
override
def
onReceive
(
context
:
Context
,
intent
:
Intent
)
=
if
(
intent
.
getAction
!=
Intent
.
ACTION_PACKAGE_REMOVED
||
!
intent
.
getBooleanExtra
(
Intent
.
EXTRA_REPLACING
,
false
))
AppManager
.
cachedApps
=
null
!
intent
.
getBooleanExtra
(
Intent
.
EXTRA_REPLACING
,
false
))
AppManager
.
synchronized
(
AppManager
.
cachedApps
=
null
)
}
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
d2f245fd
...
...
@@ -246,7 +246,7 @@ class Shadowsocks
getFragmentManager
.
findFragmentById
(
android
.
R
.
id
.
content
).
asInstanceOf
[
ShadowsocksSettings
]
private
var
adView
:
AdView
=
_
private
lazy
val
greyTint
=
ContextCompat
.
getColorStateList
(
this
,
R
.
color
.
material_blue_grey_700
)
private
lazy
val
greenTint
=
ContextCompat
.
getColorStateList
(
this
,
R
.
color
.
material_green_700
)
private
lazy
val
greenTint
=
ContextCompat
.
getColorStateList
(
this
,
R
.
color
.
material_green_
a
700
)
var
handler
=
new
Handler
()
...
...
@@ -450,26 +450,28 @@ class Shadowsocks
bgService
.
getState
match
{
case
State
.
CONNECTING
=>
fab
.
setBackgroundTintList
(
greyTint
)
changeSwitch
(
checked
=
true
)
serviceStarted
=
false
fab
.
setImageResource
(
R
.
drawable
.
ic_cloud_queue
)
setPreferenceEnabled
(
false
)
fabProgressCircle
.
show
()
case
State
.
CONNECTED
=>
fab
.
setBackgroundTintList
(
greenTint
)
changeSwitch
(
checked
=
true
)
serviceStarted
=
true
fab
.
setImageResource
(
R
.
drawable
.
ic_cloud
)
setPreferenceEnabled
(
false
)
fabProgressCircle
.
show
()
handler
.
postDelayed
(()
=>
fabProgressCircle
.
hide
(),
1000
)
fabProgressCircle
.
postDelayed
(
fabProgressCircle
.
hide
,
100
)
case
State
.
STOPPING
=>
fab
.
setBackgroundTintList
(
greyTint
)
changeSwitch
(
checked
=
false
)
serviceStarted
=
false
fab
.
setImageResource
(
R
.
drawable
.
ic_cloud_queue
)
setPreferenceEnabled
(
false
)
fabProgressCircle
.
show
()
case
_
=>
fab
.
setBackgroundTintList
(
greyTint
)
changeSwitch
(
checked
=
false
)
serviceStarted
=
false
fab
.
setImageResource
(
R
.
drawable
.
ic_cloud_off
)
setPreferenceEnabled
(
true
)
fabProgressCircle
.
show
()
handler
.
postDelayed
(()
=>
fabProgressCircle
.
hide
(),
1000
)
fabProgressCircle
.
postDelayed
(
fabProgressCircle
.
hide
,
100
)
}
state
=
bgService
.
getState
}
...
...
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