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
858a7f1d
Commit
858a7f1d
authored
Aug 28, 2018
by
Max Lv
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Mygod-p-night'
parents
77ca235b
026f07e8
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
15 additions
and
80 deletions
+15
-80
core/src/main/java/com/github/shadowsocks/preference/DataStore.kt
.../main/java/com/github/shadowsocks/preference/DataStore.kt
+0
-7
core/src/main/java/com/github/shadowsocks/utils/Constants.kt
core/src/main/java/com/github/shadowsocks/utils/Constants.kt
+0
-6
core/src/main/java/com/github/shadowsocks/utils/Utils.kt
core/src/main/java/com/github/shadowsocks/utils/Utils.kt
+3
-0
core/src/main/res/values/strings.xml
core/src/main/res/values/strings.xml
+0
-5
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
+2
-1
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
+1
-17
mobile/src/main/java/com/github/shadowsocks/ProfileConfigFragment.kt
...main/java/com/github/shadowsocks/ProfileConfigFragment.kt
+1
-2
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
+8
-10
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
-9
No files found.
core/src/main/java/com/github/shadowsocks/preference/DataStore.kt
View file @
858a7f1d
...
...
@@ -62,13 +62,6 @@ object DataStore : OnPreferenceDataStoreChangeListener {
val
canToggleLocked
:
Boolean
get
()
=
publicStore
.
getBoolean
(
Key
.
directBootAware
)
==
true
val
directBootAware
:
Boolean
get
()
=
Core
.
directBootSupported
&&
canToggleLocked
val
tcpFastOpen
:
Boolean
get
()
=
TcpFastOpen
.
sendEnabled
&&
DataStore
.
publicStore
.
getBoolean
(
Key
.
tfo
,
true
)
@AppCompatDelegate
.
NightMode
val
nightMode
get
()
=
when
(
publicStore
.
getString
(
Key
.
nightMode
))
{
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
val
listenAddress
get
()
=
if
(
publicStore
.
getBoolean
(
Key
.
shareOverLan
,
false
))
"0.0.0.0"
else
"127.0.0.1"
var
portProxy
:
Int
...
...
core/src/main/java/com/github/shadowsocks/utils/Constants.kt
View file @
858a7f1d
...
...
@@ -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"
...
...
core/src/main/java/com/github/shadowsocks/utils/Utils.kt
View file @
858a7f1d
...
...
@@ -32,6 +32,7 @@ import android.net.Uri
import
android.os.Build
import
android.util.TypedValue
import
androidx.annotation.AttrRes
import
androidx.preference.Preference
import
com.crashlytics.android.Crashlytics
import
com.github.shadowsocks.JniHelper
import
java.net.InetAddress
...
...
@@ -88,3 +89,5 @@ fun printLog(t: Throwable) {
Crashlytics
.
logException
(
t
)
t
.
printStackTrace
()
}
fun
Preference
.
remove
()
=
parent
!!
.
removePreference
(
this
)
core/src/main/res/values/strings.xml
View file @
858a7f1d
...
...
@@ -59,11 +59,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/java/com/github/shadowsocks/App.kt
View file @
858a7f1d
...
...
@@ -35,7 +35,6 @@ class App : Application() {
AppCompatDelegate
.
setCompatVectorFromResourcesEnabled
(
true
)
PreferenceFragmentCompat
.
registerPreferenceFragment
(
IconListPreference
::
class
.
java
,
BottomSheetPreferenceDialogFragment
::
class
.
java
)
AppCompatDelegate
.
setDefaultNightMode
(
DataStore
.
nightMode
)
}
override
fun
onConfigurationChanged
(
newConfig
:
Configuration
)
{
...
...
mobile/src/main/java/com/github/shadowsocks/GlobalSettingsPreferenceFragment.kt
View file @
858a7f1d
...
...
@@ -29,6 +29,7 @@ import com.github.shadowsocks.preference.DataStore
import
com.github.shadowsocks.utils.DirectBoot
import
com.github.shadowsocks.utils.Key
import
com.github.shadowsocks.utils.TcpFastOpen
import
com.github.shadowsocks.utils.remove
import
com.takisoft.preferencex.PreferenceFragmentCompat
class
GlobalSettingsPreferenceFragment
:
PreferenceFragmentCompat
()
{
...
...
@@ -48,7 +49,7 @@ class GlobalSettingsPreferenceFragment : PreferenceFragmentCompat() {
if
(
Build
.
VERSION
.
SDK_INT
>=
24
)
canToggleLocked
.
setOnPreferenceChangeListener
{
_
,
newValue
->
if
(
Core
.
directBootSupported
&&
newValue
as
Boolean
)
DirectBoot
.
update
()
else
DirectBoot
.
clean
()
true
}
else
canToggleLocked
.
parent
!!
.
removePreference
(
canToggleLocked
)
}
else
canToggleLocked
.
remove
(
)
val
tfo
=
findPreference
(
Key
.
tfo
)
as
SwitchPreference
tfo
.
isChecked
=
DataStore
.
tcpFastOpen
...
...
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
View file @
858a7f1d
...
...
@@ -21,7 +21,7 @@
package
com.github.shadowsocks
import
android.app.Activity
import
android.app.
UiModeManager
import
android.app.
PendingIntent
import
android.app.backup.BackupManager
import
android.content.ActivityNotFoundException
import
android.content.Intent
...
...
@@ -36,11 +36,9 @@ 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
...
...
@@ -179,11 +177,6 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, OnPre
val
intent
=
this
.
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
)
{
...
...
@@ -221,15 +214,6 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, OnPre
connection
.
disconnect
()
connection
.
connect
()
}
Key
.
nightMode
->
{
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 @
858a7f1d
...
...
@@ -156,8 +156,7 @@ class ProfileConfigFragment : PreferenceFragmentCompat(),
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/res/drawable/ic_image_brightness_3.xml
deleted
100644 → 0
View file @
77ca235b
<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 @
858a7f1d
...
...
@@ -25,16 +25,14 @@
<item>
@string/acl_rule_online_config
</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
name=
"service_modes"
>
<item>
@string/service_mode_proxy
</item>
<item>
@string/service_mode_vpn
</item>
<item>
@string/service_mode_transproxy
</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
name=
"service_mode_values"
translatable=
"false"
>
<item>
proxy
</item>
<item>
vpn
</item>
<item>
transproxy
</item>
</string-array>
</resources>
mobile/src/main/res/xml/pref_global.xml
View file @
858a7f1d
...
...
@@ -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 @
858a7f1d
...
...
@@ -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 @
858a7f1d
...
...
@@ -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,13 +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
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