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
bbf52c4f
Commit
bbf52c4f
authored
May 17, 2017
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for notification channels for O preview
parent
0acfaa12
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
2 deletions
+11
-2
mobile/src/main/res/values/strings.xml
mobile/src/main/res/values/strings.xml
+1
-0
mobile/src/main/scala/com/github/shadowsocks/ShadowsocksApplication.scala
...scala/com/github/shadowsocks/ShadowsocksApplication.scala
+5
-1
mobile/src/main/scala/com/github/shadowsocks/ShadowsocksNotification.scala
...cala/com/github/shadowsocks/ShadowsocksNotification.scala
+5
-1
No files found.
mobile/src/main/res/values/strings.xml
View file @
bbf52c4f
...
@@ -56,6 +56,7 @@
...
@@ -56,6 +56,7 @@
<string
name=
"udp_dns_summary"
>
Forward all DNS requests to remote
</string>
<string
name=
"udp_dns_summary"
>
Forward all DNS requests to remote
</string>
<!-- notification category -->
<!-- notification category -->
<string
name=
"service"
>
Service
</string>
<string
name=
"forward_success"
>
Shadowsocks started.
</string>
<string
name=
"forward_success"
>
Shadowsocks started.
</string>
<string
name=
"invalid_server"
>
Invalid server name
</string>
<string
name=
"invalid_server"
>
Invalid server name
</string>
<string
name=
"service_failed"
>
Failed to connect the remote server
</string>
<string
name=
"service_failed"
>
Failed to connect the remote server
</string>
...
...
mobile/src/main/scala/com/github/shadowsocks/ShadowsocksApplication.scala
View file @
bbf52c4f
...
@@ -24,11 +24,12 @@ import java.io.{File, FileOutputStream, IOException}
...
@@ -24,11 +24,12 @@ import java.io.{File, FileOutputStream, IOException}
import
java.util.Locale
import
java.util.Locale
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.app.
Application
import
android.app.
{
Application
,
NotificationChannel
,
NotificationManager
}
import
android.content._
import
android.content._
import
android.content.res.Configuration
import
android.content.res.Configuration
import
android.os.
{
Build
,
LocaleList
}
import
android.os.
{
Build
,
LocaleList
}
import
android.preference.PreferenceManager
import
android.preference.PreferenceManager
import
android.support.v4.os.BuildCompat
import
android.support.v7.app.AppCompatDelegate
import
android.support.v7.app.AppCompatDelegate
import
android.util.Log
import
android.util.Log
import
com.evernote.android.job.JobManager
import
com.evernote.android.job.JobManager
...
@@ -154,6 +155,9 @@ class ShadowsocksApplication extends Application {
...
@@ -154,6 +155,9 @@ class ShadowsocksApplication extends Application {
JobManager
.
create
(
this
).
addJobCreator
(
DonaldTrump
)
JobManager
.
create
(
this
).
addJobCreator
(
DonaldTrump
)
TcpFastOpen
.
enabled
(
settings
.
getBoolean
(
Key
.
tfo
,
TcpFastOpen
.
sendEnabled
))
TcpFastOpen
.
enabled
(
settings
.
getBoolean
(
Key
.
tfo
,
TcpFastOpen
.
sendEnabled
))
if
(
BuildCompat
.
isAtLeastO
)
getSystemService
(
classOf
[
NotificationManager
]).
createNotificationChannel
(
new
NotificationChannel
(
"service"
,
getText
(
R
.
string
.
service
),
NotificationManager
.
IMPORTANCE_MIN
))
}
}
def
crashRecovery
()
{
def
crashRecovery
()
{
...
...
mobile/src/main/scala/com/github/shadowsocks/ShadowsocksNotification.scala
View file @
bbf52c4f
...
@@ -28,6 +28,7 @@ import android.os.{Build, PowerManager}
...
@@ -28,6 +28,7 @@ import android.os.{Build, PowerManager}
import
android.support.v4.app.NotificationCompat
import
android.support.v4.app.NotificationCompat
import
android.support.v4.app.NotificationCompat.BigTextStyle
import
android.support.v4.app.NotificationCompat.BigTextStyle
import
android.support.v4.content.ContextCompat
import
android.support.v4.content.ContextCompat
import
android.support.v4.os.BuildCompat
import
com.github.shadowsocks.aidl.IShadowsocksServiceCallback.Stub
import
com.github.shadowsocks.aidl.IShadowsocksServiceCallback.Stub
import
com.github.shadowsocks.utils.
{
Action
,
State
,
TrafficMonitor
,
Utils
}
import
com.github.shadowsocks.utils.
{
Action
,
State
,
TrafficMonitor
,
Utils
}
...
@@ -60,6 +61,7 @@ class ShadowsocksNotification(private val service: BaseService, profileName: Str
...
@@ -60,6 +61,7 @@ class ShadowsocksNotification(private val service: BaseService, profileName: Str
.
setContentIntent
(
PendingIntent
.
getActivity
(
service
,
0
,
new
Intent
(
service
,
classOf
[
MainActivity
])
.
setContentIntent
(
PendingIntent
.
getActivity
(
service
,
0
,
new
Intent
(
service
,
classOf
[
MainActivity
])
.
setFlags
(
Intent
.
FLAG_ACTIVITY_REORDER_TO_FRONT
),
0
))
.
setFlags
(
Intent
.
FLAG_ACTIVITY_REORDER_TO_FRONT
),
0
))
.
setSmallIcon
(
R
.
drawable
.
ic_stat_shadowsocks
)
.
setSmallIcon
(
R
.
drawable
.
ic_stat_shadowsocks
)
.
setChannel
(
"service"
)
if
(
Build
.
VERSION
.
SDK_INT
<
24
)
builder
.
addAction
(
R
.
drawable
.
ic_navigation_close
,
if
(
Build
.
VERSION
.
SDK_INT
<
24
)
builder
.
addAction
(
R
.
drawable
.
ic_navigation_close
,
service
.
getString
(
R
.
string
.
stop
),
PendingIntent
.
getBroadcast
(
service
,
0
,
new
Intent
(
Action
.
CLOSE
),
0
))
service
.
getString
(
R
.
string
.
stop
),
PendingIntent
.
getBroadcast
(
service
,
0
,
new
Intent
(
Action
.
CLOSE
),
0
))
private
lazy
val
style
=
new
BigTextStyle
(
builder
)
private
lazy
val
style
=
new
BigTextStyle
(
builder
)
...
@@ -97,7 +99,9 @@ class ShadowsocksNotification(private val service: BaseService, profileName: Str
...
@@ -97,7 +99,9 @@ class ShadowsocksNotification(private val service: BaseService, profileName: Str
show
()
show
()
}
else
if
(
forceShow
)
show
()
}
else
if
(
forceShow
)
show
()
def
show
()
:
Unit
=
service
.
startForeground
(
1
,
builder
.
build
)
def
show
()
:
Unit
=
if
(
BuildCompat
.
isAtLeastO
)
nm
.
startServiceInForeground
(
new
Intent
(
service
,
service
.
getClass
),
1
,
builder
.
build
())
else
service
.
startForeground
(
1
,
builder
.
build
)
def
destroy
()
{
def
destroy
()
{
if
(
lockReceiver
!=
null
)
{
if
(
lockReceiver
!=
null
)
{
...
...
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