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
c996fa26
Unverified
Commit
c996fa26
authored
Jul 12, 2018
by
Max Lv
Committed by
GitHub
Jul 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1869 from onlymash/master-night_mode
Fix night mode
parents
1a890b12
06da1726
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
+13
-1
No files found.
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
View file @
c996fa26
...
@@ -22,6 +22,7 @@ package com.github.shadowsocks
...
@@ -22,6 +22,7 @@ package com.github.shadowsocks
import
android.app.Activity
import
android.app.Activity
import
android.app.PendingIntent
import
android.app.PendingIntent
import
android.app.UiModeManager
import
android.app.backup.BackupManager
import
android.app.backup.BackupManager
import
android.content.ActivityNotFoundException
import
android.content.ActivityNotFoundException
import
android.content.Context
import
android.content.Context
...
@@ -57,6 +58,7 @@ import com.github.shadowsocks.preference.DataStore
...
@@ -57,6 +58,7 @@ import com.github.shadowsocks.preference.DataStore
import
com.github.shadowsocks.preference.OnPreferenceDataStoreChangeListener
import
com.github.shadowsocks.preference.OnPreferenceDataStoreChangeListener
import
com.github.shadowsocks.utils.Key
import
com.github.shadowsocks.utils.Key
import
com.github.shadowsocks.utils.responseLength
import
com.github.shadowsocks.utils.responseLength
import
com.github.shadowsocks.utils.systemService
import
com.github.shadowsocks.utils.thread
import
com.github.shadowsocks.utils.thread
import
com.github.shadowsocks.widget.ServiceButton
import
com.github.shadowsocks.widget.ServiceButton
import
com.mikepenz.materialdrawer.Drawer
import
com.mikepenz.materialdrawer.Drawer
...
@@ -290,6 +292,11 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, Drawe
...
@@ -290,6 +292,11 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, Drawe
val
intent
=
this
.
intent
val
intent
=
this
.
intent
if
(
intent
!=
null
)
handleShareIntent
(
intent
)
if
(
intent
!=
null
)
handleShareIntent
(
intent
)
if
(
savedInstanceState
!=
null
&&
DataStore
.
nightMode
==
AppCompatDelegate
.
MODE_NIGHT_FOLLOW_SYSTEM
&&
AppCompatDelegate
.
getDefaultNightMode
()
!=
AppCompatDelegate
.
MODE_NIGHT_FOLLOW_SYSTEM
)
{
AppCompatDelegate
.
setDefaultNightMode
(
AppCompatDelegate
.
MODE_NIGHT_FOLLOW_SYSTEM
)
}
}
}
override
fun
onNewIntent
(
intent
:
Intent
)
{
override
fun
onNewIntent
(
intent
:
Intent
)
{
...
@@ -328,7 +335,12 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, Drawe
...
@@ -328,7 +335,12 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, Drawe
connection
.
connect
()
connection
.
connect
()
}
}
Key
.
nightMode
->
{
Key
.
nightMode
->
{
AppCompatDelegate
.
setDefaultNightMode
(
DataStore
.
nightMode
)
val
mode
=
DataStore
.
nightMode
AppCompatDelegate
.
setDefaultNightMode
(
when
(
mode
)
{
AppCompatDelegate
.
getDefaultNightMode
()
->
return
AppCompatDelegate
.
MODE_NIGHT_FOLLOW_SYSTEM
->
systemService
<
UiModeManager
>().
nightMode
else
->
mode
})
recreate
()
recreate
()
}
}
}
}
...
...
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