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
2a473621
Commit
2a473621
authored
Sep 15, 2016
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix profile name not updated in ShadowsocksTileService
parent
02d5951f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
13 deletions
+12
-13
src/main/aidl/com/github/shadowsocks/aidl/IShadowsocksService.aidl
...aidl/com/github/shadowsocks/aidl/IShadowsocksService.aidl
+1
-0
src/main/aidl/com/github/shadowsocks/aidl/IShadowsocksServiceCallback.aidl
.../github/shadowsocks/aidl/IShadowsocksServiceCallback.aidl
+1
-1
src/main/scala/com/github/shadowsocks/BaseService.scala
src/main/scala/com/github/shadowsocks/BaseService.scala
+3
-1
src/main/scala/com/github/shadowsocks/ProfileManagerActivity.scala
...scala/com/github/shadowsocks/ProfileManagerActivity.scala
+2
-2
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+1
-1
src/main/scala/com/github/shadowsocks/ShadowsocksNotification.scala
...cala/com/github/shadowsocks/ShadowsocksNotification.scala
+1
-1
src/main/scala/com/github/shadowsocks/ShadowsocksTileService.scala
...scala/com/github/shadowsocks/ShadowsocksTileService.scala
+3
-7
No files found.
src/main/aidl/com/github/shadowsocks/aidl/IShadowsocksService.aidl
View file @
2a473621
...
...
@@ -4,6 +4,7 @@ import com.github.shadowsocks.aidl.IShadowsocksServiceCallback;
interface
IShadowsocksService
{
int
getState
();
String
getProfileName
();
oneway
void
registerCallback
(
IShadowsocksServiceCallback
cb
);
oneway
void
unregisterCallback
(
IShadowsocksServiceCallback
cb
);
...
...
src/main/aidl/com/github/shadowsocks/aidl/IShadowsocksServiceCallback.aidl
View file @
2a473621
package
com
.
github
.
shadowsocks
.
aidl
;
interface
IShadowsocksServiceCallback
{
oneway
void
stateChanged
(
int
state
,
String
msg
);
oneway
void
stateChanged
(
int
state
,
String
profileName
,
String
msg
);
oneway
void
trafficUpdated
(
long
txRate
,
long
rxRate
,
long
txTotal
,
long
rxTotal
);
}
src/main/scala/com/github/shadowsocks/BaseService.scala
View file @
2a473621
...
...
@@ -91,6 +91,8 @@ trait BaseService extends Service {
state
}
override
def
getProfileName
:
String
=
if
(
profile
==
null
)
null
else
profile
.
name
override
def
unregisterCallback
(
cb
:
IShadowsocksServiceCallback
)
{
if
(
cb
!=
null
&&
callbacks
.
unregister
(
cb
))
{
callbacksCount
-=
1
...
...
@@ -282,7 +284,7 @@ trait BaseService extends Service {
val
n
=
callbacks
.
beginBroadcast
()
for
(
i
<-
0
until
n
)
{
try
{
callbacks
.
getBroadcastItem
(
i
).
stateChanged
(
s
,
msg
)
callbacks
.
getBroadcastItem
(
i
).
stateChanged
(
s
,
binder
.
getProfileName
,
msg
)
}
catch
{
case
_:
Exception
=>
// Ignore
}
...
...
src/main/scala/com/github/shadowsocks/ProfileManagerActivity.scala
View file @
2a473621
...
...
@@ -235,7 +235,7 @@ final class ProfileManagerActivity extends AppCompatActivity with OnMenuItemClic
}).
attachToRecyclerView
(
profilesList
)
attachService
(
new
IShadowsocksServiceCallback
.
Stub
{
def
stateChanged
(
state
:
Int
,
msg
:
String
)
=
()
// ignore
def
stateChanged
(
state
:
Int
,
profileName
:
String
,
msg
:
String
)
=
()
// ignore
def
trafficUpdated
(
txRate
:
Long
,
rxRate
:
Long
,
txTotal
:
Long
,
rxTotal
:
Long
)
=
if
(
selectedItem
!=
null
)
selectedItem
.
updateText
(
txTotal
,
rxTotal
)
})
...
...
@@ -276,7 +276,7 @@ final class ProfileManagerActivity extends AppCompatActivity with OnMenuItemClic
updateNfcState
()
}
override
def
onNewIntent
(
intent
:
Intent
)
:
Unit
=
{
override
def
onNewIntent
(
intent
:
Intent
)
{
super
.
onNewIntent
(
intent
)
handleShareIntent
(
intent
)
}
...
...
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
2a473621
...
...
@@ -111,7 +111,7 @@ class Shadowsocks extends AppCompatActivity with ServiceBoundContext {
// Services
private
val
callback
=
new
IShadowsocksServiceCallback
.
Stub
{
def
stateChanged
(
s
:
Int
,
m
:
String
)
{
def
stateChanged
(
s
:
Int
,
profileName
:
String
,
m
:
String
)
{
handler
.
post
(()
=>
{
s
match
{
case
State
.
CONNECTING
=>
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksNotification.scala
View file @
2a473621
...
...
@@ -19,7 +19,7 @@ class ShadowsocksNotification(private val service: BaseService, profileName: Str
private
val
keyGuard
=
service
.
getSystemService
(
Context
.
KEYGUARD_SERVICE
).
asInstanceOf
[
KeyguardManager
]
private
lazy
val
nm
=
service
.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
).
asInstanceOf
[
NotificationManager
]
private
lazy
val
callback
=
new
Stub
{
override
def
stateChanged
(
state
:
Int
,
msg
:
String
)
=
()
// ignore
override
def
stateChanged
(
state
:
Int
,
profileName
:
String
,
msg
:
String
)
=
()
// ignore
override
def
trafficUpdated
(
txRate
:
Long
,
rxRate
:
Long
,
txTotal
:
Long
,
rxTotal
:
Long
)
{
val
txr
=
TrafficMonitor
.
formatTraffic
(
txRate
)
val
rxr
=
TrafficMonitor
.
formatTraffic
(
rxRate
)
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksTileService.scala
View file @
2a473621
...
...
@@ -5,7 +5,6 @@ import android.graphics.drawable.Icon
import
android.service.quicksettings.
{
Tile
,
TileService
}
import
com.github.shadowsocks.aidl.IShadowsocksServiceCallback
import
com.github.shadowsocks.utils.
{
State
,
Utils
}
import
com.github.shadowsocks.ShadowsocksApplication.app
/**
* @author Mygod
...
...
@@ -23,7 +22,7 @@ final class ShadowsocksTileService extends TileService with ServiceBoundContext
private
lazy
val
iconConnected
=
Icon
.
createWithResource
(
this
,
R
.
drawable
.
ic_start_connected
)
private
lazy
val
callback
=
new
IShadowsocksServiceCallback
.
Stub
{
def
trafficUpdated
(
txRate
:
Long
,
rxRate
:
Long
,
txTotal
:
Long
,
rxTotal
:
Long
)
=
()
def
stateChanged
(
state
:
Int
,
msg
:
String
)
{
def
stateChanged
(
state
:
Int
,
profileName
:
String
,
msg
:
String
)
{
val
tile
=
getQsTile
if
(
tile
!=
null
)
{
state
match
{
...
...
@@ -33,10 +32,7 @@ final class ShadowsocksTileService extends TileService with ServiceBoundContext
tile
.
setState
(
Tile
.
STATE_INACTIVE
)
case
State
.
CONNECTED
=>
tile
.
setIcon
(
iconConnected
)
tile
.
setLabel
(
app
.
currentProfile
match
{
case
Some
(
profile
)
=>
profile
.
name
case
None
=>
getString
(
R
.
string
.
app_name
)
})
tile
.
setLabel
(
if
(
profileName
==
null
)
getString
(
R
.
string
.
app_name
)
else
profileName
)
tile
.
setState
(
Tile
.
STATE_ACTIVE
)
case
_
=>
tile
.
setIcon
(
iconBusy
)
...
...
@@ -48,7 +44,7 @@ final class ShadowsocksTileService extends TileService with ServiceBoundContext
}
}
override
def
onServiceConnected
()
=
callback
.
stateChanged
(
bgService
.
getState
,
null
)
override
def
onServiceConnected
()
=
callback
.
stateChanged
(
bgService
.
getState
,
bgService
.
getProfileName
,
null
)
override
def
onCreate
{
super
.
onCreate
...
...
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