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
2ca9b6d8
Commit
2ca9b6d8
authored
Aug 11, 2019
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Supply day/night colors in custom tabs
parent
a8b01b66
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
13 deletions
+25
-13
mobile/build.gradle
mobile/build.gradle
+1
-1
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
+10
-3
plugin/src/main/res/values-night/colors.xml
plugin/src/main/res/values-night/colors.xml
+4
-6
plugin/src/main/res/values/colors.xml
plugin/src/main/res/values/colors.xml
+10
-3
No files found.
mobile/build.gradle
View file @
2ca9b6d8
...
@@ -60,7 +60,7 @@ androidExtensions {
...
@@ -60,7 +60,7 @@ androidExtensions {
dependencies
{
dependencies
{
implementation
project
(
':core'
)
implementation
project
(
':core'
)
implementation
'androidx.browser:browser:1.
0.0
'
implementation
'androidx.browser:browser:1.
2.0-alpha07
'
implementation
'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation
'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation
'com.google.android.gms:play-services-vision:18.0.0'
implementation
'com.google.android.gms:play-services-vision:18.0.0'
implementation
'com.google.firebase:firebase-ads:18.1.1'
implementation
'com.google.firebase:firebase-ads:18.1.1'
...
...
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
View file @
2ca9b6d8
...
@@ -33,6 +33,7 @@ import android.view.KeyCharacterMap
...
@@ -33,6 +33,7 @@ import android.view.KeyCharacterMap
import
android.view.KeyEvent
import
android.view.KeyEvent
import
android.view.MenuItem
import
android.view.MenuItem
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.app.AppCompatActivity
import
androidx.browser.customtabs.CustomTabColorSchemeParams
import
androidx.browser.customtabs.CustomTabsIntent
import
androidx.browser.customtabs.CustomTabsIntent
import
androidx.coordinatorlayout.widget.CoordinatorLayout
import
androidx.coordinatorlayout.widget.CoordinatorLayout
import
androidx.core.content.ContextCompat
import
androidx.core.content.ContextCompat
...
@@ -76,9 +77,15 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Callback, OnPref
...
@@ -76,9 +77,15 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Callback, OnPref
}
}
private
val
customTabsIntent
by
lazy
{
private
val
customTabsIntent
by
lazy
{
CustomTabsIntent
.
Builder
()
CustomTabsIntent
.
Builder
().
apply
{
.
setToolbarColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
color_primary
))
setColorScheme
(
CustomTabsIntent
.
COLOR_SCHEME_SYSTEM
)
.
build
()
setColorSchemeParams
(
CustomTabsIntent
.
COLOR_SCHEME_LIGHT
,
CustomTabColorSchemeParams
.
Builder
().
apply
{
setToolbarColor
(
ContextCompat
.
getColor
(
this
@MainActivity
,
R
.
color
.
light_color_primary
))
}.
build
())
setColorSchemeParams
(
CustomTabsIntent
.
COLOR_SCHEME_DARK
,
CustomTabColorSchemeParams
.
Builder
().
apply
{
setToolbarColor
(
ContextCompat
.
getColor
(
this
@MainActivity
,
R
.
color
.
dark_color_primary
))
}.
build
())
}.
build
()
}
}
fun
launchUrl
(
uri
:
String
)
=
try
{
fun
launchUrl
(
uri
:
String
)
=
try
{
customTabsIntent
.
launchUrl
(
this
,
uri
.
toUri
())
customTabsIntent
.
launchUrl
(
this
,
uri
.
toUri
())
...
...
plugin/src/main/res/values-night/colors.xml
View file @
2ca9b6d8
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources>
<color
name=
"color_primary"
>
@color/dark_color_primary
</color>
<color
name=
"color_primary"
>
@color/material_primary_800
</color>
<color
name=
"color_primary_dark"
>
@color/dark_color_primary_dark
</color>
<color
name=
"color_primary_dark"
>
@color/material_primary_900
</color>
<color
name=
"color_primary_text"
>
@color/dark_color_primary_text
</color>
<color
name=
"color_primary_text"
>
@color/material_primary_300
</color>
</resources>
</resources>
\ No newline at end of file
plugin/src/main/res/values/colors.xml
View file @
2ca9b6d8
...
@@ -18,8 +18,15 @@
...
@@ -18,8 +18,15 @@
<color
name=
"material_primary_900"
>
@color/material_blue_grey_900
</color>
<color
name=
"material_primary_900"
>
@color/material_blue_grey_900
</color>
<color
name=
"material_accent_200"
>
@color/material_green_a700
</color>
<color
name=
"material_accent_200"
>
@color/material_green_a700
</color>
<color
name=
"color_primary"
>
@color/material_primary_500
</color>
<color
name=
"light_color_primary"
>
@color/material_primary_500
</color>
<color
name=
"color_primary_dark"
>
@color/material_primary_700
</color>
<color
name=
"light_color_primary_dark"
>
@color/material_primary_700
</color>
<color
name=
"color_primary_text"
>
@color/material_primary_500
</color>
<color
name=
"light_color_primary_text"
>
@color/material_primary_500
</color>
<color
name=
"dark_color_primary"
>
@color/material_primary_800
</color>
<color
name=
"dark_color_primary_dark"
>
@color/material_primary_900
</color>
<color
name=
"dark_color_primary_text"
>
@color/material_primary_300
</color>
<color
name=
"color_primary"
>
@color/light_color_primary
</color>
<color
name=
"color_primary_dark"
>
@color/light_color_primary_dark
</color>
<color
name=
"color_primary_text"
>
@color/light_color_primary_text
</color>
</resources>
</resources>
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