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
860f3bca
Commit
860f3bca
authored
Aug 26, 2018
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove night mode switch
parent
512ca9db
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1 addition
and
86 deletions
+1
-86
mobile/src/main/java/com/github/shadowsocks/App.kt
mobile/src/main/java/com/github/shadowsocks/App.kt
+0
-1
mobile/src/main/java/com/github/shadowsocks/GlobalSettingsPreferenceFragment.kt
...om/github/shadowsocks/GlobalSettingsPreferenceFragment.kt
+0
-1
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
+0
-18
mobile/src/main/java/com/github/shadowsocks/ProfileConfigFragment.kt
...main/java/com/github/shadowsocks/ProfileConfigFragment.kt
+1
-2
mobile/src/main/java/com/github/shadowsocks/preference/DataStore.kt
.../main/java/com/github/shadowsocks/preference/DataStore.kt
+0
-9
mobile/src/main/java/com/github/shadowsocks/utils/Constants.kt
...e/src/main/java/com/github/shadowsocks/utils/Constants.kt
+0
-6
mobile/src/main/res/drawable/ic_image_brightness_3.xml
mobile/src/main/res/drawable/ic_image_brightness_3.xml
+0
-6
mobile/src/main/res/values/arrays.xml
mobile/src/main/res/values/arrays.xml
+0
-12
mobile/src/main/res/values/strings.xml
mobile/src/main/res/values/strings.xml
+0
-5
mobile/src/main/res/xml/pref_global.xml
mobile/src/main/res/xml/pref_global.xml
+0
-8
plugin/src/main/java/com/github/shadowsocks/plugin/OptionsCapableActivity.kt
...a/com/github/shadowsocks/plugin/OptionsCapableActivity.kt
+0
-8
plugin/src/main/java/com/github/shadowsocks/plugin/PluginContract.kt
...main/java/com/github/shadowsocks/plugin/PluginContract.kt
+0
-10
No files found.
mobile/src/main/java/com/github/shadowsocks/App.kt
View file @
860f3bca
...
...
@@ -136,7 +136,6 @@ class App : Application() {
}
DataStore
.
publicStore
.
putLong
(
Key
.
assetUpdateTime
,
info
.
lastUpdateTime
)
}
if
(
Build
.
VERSION
.
SDK_INT
<
28
)
AppCompatDelegate
.
setDefaultNightMode
(
DataStore
.
nightMode
)
updateNotificationChannels
()
}
...
...
mobile/src/main/java/com/github/shadowsocks/GlobalSettingsPreferenceFragment.kt
View file @
860f3bca
...
...
@@ -64,7 +64,6 @@ class GlobalSettingsPreferenceFragment : PreferenceFragmentCompat() {
tfo
.
isEnabled
=
false
tfo
.
summary
=
getString
(
R
.
string
.
tcp_fastopen_summary_unsupported
,
System
.
getProperty
(
"os.version"
))
}
if
(
Build
.
VERSION
.
SDK_INT
>=
28
)
findPreference
(
Key
.
nightMode
).
remove
()
val
serviceMode
=
findPreference
(
Key
.
serviceMode
)
val
portProxy
=
findPreference
(
Key
.
portProxy
)
...
...
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
View file @
860f3bca
...
...
@@ -22,7 +22,6 @@ package com.github.shadowsocks
import
android.app.Activity
import
android.app.PendingIntent
import
android.app.UiModeManager
import
android.app.backup.BackupManager
import
android.content.ActivityNotFoundException
import
android.content.Context
...
...
@@ -30,18 +29,15 @@ import android.content.Intent
import
android.net.VpnService
import
android.nfc.NdefMessage
import
android.nfc.NfcAdapter
import
android.os.Build
import
android.os.Bundle
import
android.util.Log
import
android.view.MenuItem
import
android.view.View
import
androidx.appcompat.app.AlertDialog
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.app.AppCompatDelegate
import
androidx.browser.customtabs.CustomTabsIntent
import
androidx.coordinatorlayout.widget.CoordinatorLayout
import
androidx.core.content.ContextCompat
import
androidx.core.content.getSystemService
import
androidx.core.net.toUri
import
androidx.core.view.GravityCompat
import
androidx.core.view.updateLayoutParams
...
...
@@ -185,11 +181,6 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, OnPre
val
intent
=
this
.
intent
if
(
intent
!=
null
)
handleShareIntent
(
intent
)
if
(
Build
.
VERSION
.
SDK_INT
<
28
&&
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
)
{
...
...
@@ -227,15 +218,6 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, OnPre
connection
.
disconnect
()
connection
.
connect
()
}
Key
.
nightMode
->
if
(
Build
.
VERSION
.
SDK_INT
<
28
)
{
val
mode
=
DataStore
.
nightMode
AppCompatDelegate
.
setDefaultNightMode
(
when
(
mode
)
{
AppCompatDelegate
.
getDefaultNightMode
()
->
return
AppCompatDelegate
.
MODE_NIGHT_FOLLOW_SYSTEM
->
getSystemService
<
UiModeManager
>()
!!
.
nightMode
else
->
mode
})
recreate
()
}
}
}
...
...
mobile/src/main/java/com/github/shadowsocks/ProfileConfigFragment.kt
View file @
860f3bca
...
...
@@ -157,8 +157,7 @@ class ProfileConfigFragment : PreferenceFragmentCompat(), Toolbar.OnMenuItemClic
val
intent
=
PluginManager
.
buildIntent
(
pluginConfiguration
.
selected
,
PluginContract
.
ACTION_CONFIGURE
)
if
(
intent
.
resolveActivity
(
requireContext
().
packageManager
)
==
null
)
showPluginEditor
()
else
startActivityForResult
(
intent
.
putExtra
(
PluginContract
.
EXTRA_OPTIONS
,
pluginConfiguration
.
selectedOptions
.
toString
())
.
putExtra
(
PluginContract
.
EXTRA_NIGHT_MODE
,
DataStore
.
nightMode
),
.
putExtra
(
PluginContract
.
EXTRA_OPTIONS
,
pluginConfiguration
.
selectedOptions
.
toString
()),
REQUEST_CODE_PLUGIN_CONFIGURE
)
}
else
super
.
onDisplayPreferenceDialog
(
preference
)
}
...
...
mobile/src/main/java/com/github/shadowsocks/preference/DataStore.kt
View file @
860f3bca
...
...
@@ -21,8 +21,6 @@
package
com.github.shadowsocks.preference
import
android.os.Binder
import
android.os.Build
import
androidx.appcompat.app.AppCompatDelegate
import
com.github.shadowsocks.App.Companion.app
import
com.github.shadowsocks.database.PrivateDatabase
import
com.github.shadowsocks.database.PublicDatabase
...
...
@@ -55,13 +53,6 @@ object DataStore {
val
canToggleLocked
:
Boolean
get
()
=
publicStore
.
getBoolean
(
Key
.
directBootAware
)
==
true
val
directBootAware
:
Boolean
get
()
=
app
.
directBootSupported
&&
canToggleLocked
val
tcpFastOpen
:
Boolean
get
()
=
TcpFastOpen
.
sendEnabled
&&
DataStore
.
publicStore
.
getBoolean
(
Key
.
tfo
,
true
)
@AppCompatDelegate
.
NightMode
val
nightMode
get
()
=
when
(
if
(
Build
.
VERSION
.
SDK_INT
<
28
)
publicStore
.
getString
(
Key
.
nightMode
)
else
null
)
{
Key
.
nightModeAuto
->
AppCompatDelegate
.
MODE_NIGHT_AUTO
Key
.
nightModeOff
->
AppCompatDelegate
.
MODE_NIGHT_NO
Key
.
nightModeOn
->
AppCompatDelegate
.
MODE_NIGHT_YES
else
->
AppCompatDelegate
.
MODE_NIGHT_FOLLOW_SYSTEM
}
val
serviceMode
get
()
=
publicStore
.
getString
(
Key
.
serviceMode
)
?:
Key
.
modeVpn
var
portProxy
:
Int
get
()
=
getLocalPort
(
Key
.
portProxy
,
1080
)
...
...
mobile/src/main/java/com/github/shadowsocks/utils/Constants.kt
View file @
860f3bca
...
...
@@ -32,12 +32,6 @@ object Key {
const
val
individual
=
"Proxyed"
const
val
nightMode
=
"nightMode"
const
val
nightModeSystem
=
"system"
const
val
nightModeAuto
=
"auto"
const
val
nightModeOff
=
"off"
const
val
nightModeOn
=
"on"
const
val
serviceMode
=
"serviceMode"
const
val
modeProxy
=
"proxy"
const
val
modeVpn
=
"vpn"
...
...
mobile/src/main/res/drawable/ic_image_brightness_3.xml
deleted
100644 → 0
View file @
512ca9db
<vector
android:autoMirrored=
"true"
android:height=
"24dp"
android:viewportHeight=
"24.0"
android:viewportWidth=
"24.0"
android:width=
"24dp"
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:tint=
"?attr/colorControlNormal"
>
<path
android:fillColor=
"#FF000000"
android:pathData=
"M9,2c-1.05,0 -2.05,0.16 -3,0.46 4.06,1.27 7,5.06 7,9.54 0,4.48 -2.94,8.27 -7,9.54 0.95,0.3 1.95,0.46 3,0.46 5.52,0 10,-4.48 10,-10S14.52,2 9,2z"
/>
</vector>
mobile/src/main/res/values/arrays.xml
View file @
860f3bca
...
...
@@ -237,16 +237,4 @@
<item>
vpn
</item>
<item>
transproxy
</item>
</string-array>
<string-array
name=
"night_modes"
>
<item>
@string/night_mode_system
</item>
<item>
@string/night_mode_auto
</item>
<item>
@string/night_mode_off
</item>
<item>
@string/night_mode_on
</item>
</string-array>
<string-array
name=
"night_mode_values"
translatable=
"false"
>
<item>
system
</item>
<item>
auto
</item>
<item>
off
</item>
<item>
on
</item>
</string-array>
</resources>
mobile/src/main/res/values/strings.xml
View file @
860f3bca
...
...
@@ -57,11 +57,6 @@
<string
name=
"tcp_fastopen_summary_unsupported"
>
Unsupported kernel version: %s
<
3.7.1
</string>
<string
name=
"udp_dns"
>
DNS Forwarding
</string>
<string
name=
"udp_dns_summary"
>
Forward all DNS requests to remote
</string>
<string
name=
"night_mode"
>
Night mode
</string>
<string
name=
"night_mode_system"
>
Follow system
</string>
<string
name=
"night_mode_auto"
>
Auto
</string>
<string
name=
"night_mode_on"
>
On
</string>
<string
name=
"night_mode_off"
>
Off
</string>
<!-- notification category -->
<string
name=
"service_vpn"
>
VPN Service
</string>
...
...
mobile/src/main/res/xml/pref_global.xml
View file @
860f3bca
...
...
@@ -15,14 +15,6 @@
android:icon=
"@drawable/ic_action_offline_bolt"
android:summary=
"@string/tcp_fastopen_summary"
android:title=
"TCP Fast Open"
/>
<SimpleMenuPreference
android:key=
"nightMode"
android:icon=
"@drawable/ic_image_brightness_3"
android:entries=
"@array/night_modes"
android:entryValues=
"@array/night_mode_values"
android:defaultValue=
"system"
android:summary=
"%s"
android:title=
"@string/night_mode"
/>
<PreferenceCategory
android:title=
"@string/advanced"
>
<SimpleMenuPreference
...
...
plugin/src/main/java/com/github/shadowsocks/plugin/OptionsCapableActivity.kt
View file @
860f3bca
...
...
@@ -24,7 +24,6 @@ import android.content.Intent
import
android.os.Bundle
import
android.widget.Toast
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.app.AppCompatDelegate
/**
* Activity that's capable of getting EXTRA_OPTIONS input.
...
...
@@ -44,13 +43,6 @@ abstract class OptionsCapableActivity : AppCompatActivity() {
*/
protected
abstract
fun
onInitializePluginOptions
(
options
:
PluginOptions
=
pluginOptions
())
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
val
nightMode
=
intent
.
getIntExtra
(
PluginContract
.
EXTRA_NIGHT_MODE
,
-
100
)
// MODE_NIGHT_UNSPECIFIED
if
(
nightMode
>=
AppCompatDelegate
.
MODE_NIGHT_FOLLOW_SYSTEM
&&
nightMode
<=
AppCompatDelegate
.
MODE_NIGHT_YES
)
AppCompatDelegate
.
setDefaultNightMode
(
nightMode
)
super
.
onCreate
(
savedInstanceState
)
// applyDayNight is called in AppCompatActivity.onCreate
}
override
fun
onPostCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onPostCreate
(
savedInstanceState
)
if
(
savedInstanceState
==
null
)
onInitializePluginOptions
()
...
...
plugin/src/main/java/com/github/shadowsocks/plugin/PluginContract.kt
View file @
860f3bca
...
...
@@ -20,8 +20,6 @@
package
com.github.shadowsocks.plugin
import
androidx.appcompat.app.AppCompatDelegate
/**
* The contract between the plugin provider and host. Contains definitions for the supported actions, extras, etc.
*
...
...
@@ -73,14 +71,6 @@ object PluginContract {
* Constant Value: "com.github.shadowsocks.plugin.EXTRA_HELP_MESSAGE"
</host_name> */
const
val
EXTRA_HELP_MESSAGE
=
"com.github.shadowsocks.plugin.EXTRA_HELP_MESSAGE"
/**
* The lookup key for an @NightMode int that suggests a night mode that is being used in the main app.
*
* Constant Value: "com.github.shadowsocks.plugin.EXTRA_NIGHT_MODE"
*/
@AppCompatDelegate
.
NightMode
@Deprecated
(
"On Android 9.0+, this will always return system as AOSP has support for night mode since 9.0."
)
const
val
EXTRA_NIGHT_MODE
=
"com.github.shadowsocks.plugin.EXTRA_NIGHT_MODE"
/**
* The metadata key to retrieve plugin id. Required for plugins.
...
...
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