Commit 06da1726 authored by Mygod's avatar Mygod

Reformat

parent 02268a07
...@@ -58,6 +58,7 @@ import com.github.shadowsocks.preference.DataStore ...@@ -58,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
...@@ -335,13 +336,11 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, Drawe ...@@ -335,13 +336,11 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, Drawe
} }
Key.nightMode -> { Key.nightMode -> {
val mode = DataStore.nightMode val mode = DataStore.nightMode
if (mode == AppCompatDelegate.getDefaultNightMode()) return AppCompatDelegate.setDefaultNightMode(when (mode) {
if (mode == AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM) { AppCompatDelegate.getDefaultNightMode() -> return
val uiModeManager = getSystemService(Context.UI_MODE_SERVICE) as UiModeManager AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM -> systemService<UiModeManager>().nightMode
AppCompatDelegate.setDefaultNightMode(uiModeManager.nightMode) else -> mode
} else { })
AppCompatDelegate.setDefaultNightMode(mode)
}
recreate() recreate()
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment