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
56728a3f
Commit
56728a3f
authored
Dec 29, 2017
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide profileName in secure lock screen
parent
cc070223
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
mobile/src/main/java/com/github/shadowsocks/bg/TileService.kt
...le/src/main/java/com/github/shadowsocks/bg/TileService.kt
+8
-6
No files found.
mobile/src/main/java/com/github/shadowsocks/bg/TileService.kt
View file @
56728a3f
...
...
@@ -20,8 +20,9 @@
package
com.github.shadowsocks.bg
import
android.app.KeyguardManager
import
android.content.Context
import
android.graphics.drawable.Icon
import
android.os.Build
import
android.service.quicksettings.Tile
import
android.support.annotation.RequiresApi
import
com.github.shadowsocks.App.Companion.app
...
...
@@ -31,34 +32,35 @@ import com.github.shadowsocks.aidl.IShadowsocksService
import
com.github.shadowsocks.aidl.IShadowsocksServiceCallback
import
android.service.quicksettings.TileService
as
BaseTileService
@RequiresApi
(
Build
.
VERSION_CODES
.
N
)
@RequiresApi
(
24
)
class
TileService
:
BaseTileService
(),
ShadowsocksConnection
.
Interface
{
private
val
iconIdle
by
lazy
{
Icon
.
createWithResource
(
this
,
R
.
drawable
.
ic_service_idle
).
setTint
(
0x79ffffff
)
}
private
val
iconBusy
by
lazy
{
Icon
.
createWithResource
(
this
,
R
.
drawable
.
ic_service_busy
)
}
private
val
iconConnected
by
lazy
{
Icon
.
createWithResource
(
this
,
R
.
drawable
.
ic_service_active
)
}
private
val
keyguard
by
lazy
{
getSystemService
(
Context
.
KEYGUARD_SERVICE
)
as
KeyguardManager
}
override
val
serviceCallback
:
IShadowsocksServiceCallback
.
Stub
by
lazy
{
@RequiresApi
(
Build
.
VERSION_CODES
.
N
)
@RequiresApi
(
24
)
object
:
IShadowsocksServiceCallback
.
Stub
()
{
override
fun
stateChanged
(
state
:
Int
,
profileName
:
String
?,
msg
:
String
?)
{
val
tile
=
qsTile
?:
return
var
label
:
String
?
=
null
when
(
state
)
{
BaseService
.
STOPPED
->
{
tile
.
icon
=
iconIdle
tile
.
label
=
getString
(
R
.
string
.
app_name
)
tile
.
state
=
Tile
.
STATE_INACTIVE
}
BaseService
.
CONNECTED
->
{
tile
.
icon
=
iconConnected
tile
.
label
=
profileName
?:
getString
(
R
.
string
.
app_name
)
if
(!
keyguard
.
isDeviceLocked
)
label
=
profileName
tile
.
state
=
Tile
.
STATE_ACTIVE
}
else
->
{
tile
.
icon
=
iconBusy
tile
.
label
=
getString
(
R
.
string
.
app_name
)
tile
.
state
=
Tile
.
STATE_UNAVAILABLE
}
}
tile
.
label
=
label
?:
getString
(
R
.
string
.
app_name
)
tile
.
updateTile
()
}
override
fun
trafficUpdated
(
profileId
:
Int
,
txRate
:
Long
,
rxRate
:
Long
,
txTotal
:
Long
,
rxTotal
:
Long
)
{
}
...
...
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