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
179e5456
Commit
179e5456
authored
Nov 03, 2016
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine shortcuts on Android 7.1
parent
30700fac
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
9 deletions
+59
-9
src/main/res/drawable-anydpi-v21/ic_qu_camera_launcher.xml
src/main/res/drawable-anydpi-v21/ic_qu_camera_launcher.xml
+20
-0
src/main/res/drawable-anydpi-v21/ic_qu_shadowsocks_launcher.xml
...in/res/drawable-anydpi-v21/ic_qu_shadowsocks_launcher.xml
+18
-0
src/main/res/xml/shortcuts.xml
src/main/res/xml/shortcuts.xml
+10
-4
src/main/scala/com/github/shadowsocks/QuickToggleShortcut.scala
...in/scala/com/github/shadowsocks/QuickToggleShortcut.scala
+5
-2
src/main/scala/com/github/shadowsocks/ScannerActivity.scala
src/main/scala/com/github/shadowsocks/ScannerActivity.scala
+4
-3
src/main/scala/com/github/shadowsocks/ShadowsocksQuickSwitchActivity.scala
...m/github/shadowsocks/ShadowsocksQuickSwitchActivity.scala
+2
-0
No files found.
src/main/res/drawable-anydpi-v21/ic_qu_camera_launcher.xml
0 → 100755
View file @
179e5456
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"48"
android:viewportHeight=
"48"
>
<path
android:fillColor=
"#f5f5f5"
android:pathData=
"M24,24m-22,0a22,22 0,1 1,44 0a22,22 0,1 1,-44 0Z"
/>
<path
android:fillColor=
"#546e7a"
android:pathData=
"M24,21.8 C25.7673,21.8,27.2,23.2327,27.2,25 C27.2,26.7673,25.7673,28.2,24,28.2
C22.2327,28.2,20.8,26.7673,20.8,25 C20.8,23.2327,22.2327,21.8,24,21.8 Z"
/>
<path
android:fillColor=
"#546e7a"
android:pathData=
"M21,15 L19.17,17 L16,17 A2,2,0,0,0,14,19 L14,31 A2,2,0,0,0,16,33 L32,33
A2,2,0,0,0,34,31 L34,19 A2,2,0,0,0,32,17 L28.83,17 L27,15 Z M24,30
A5,5,0,1,1,29,25 A5,5,0,0,1,24,30 Z"
/>
</vector>
src/main/res/drawable-anydpi-v21/ic_qu_shadowsocks_launcher.xml
0 → 100755
View file @
179e5456
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"48"
android:viewportHeight=
"48"
>
<path
android:fillColor=
"#f5f5f5"
android:pathData=
"M24,24m-22,0a22,22 0,1 1,44 0a22,22 0,1 1,-44 0Z"
/>
<path
android:fillColor=
"#546e7a"
android:pathData=
"M34,14.72 L30.52,30.04 L22.72,27.53 L29.61,19.31 L20.43,27.04 L14,24.62
L34,14.72 Z"
/>
<path
android:fillColor=
"#546e7a"
android:pathData=
"M22.89,29.1 L25.38,29.9 L22.9,33.28 L22.89,29.1 Z"
/>
</vector>
src/main/res/xml/shortcuts.xml
View file @
179e5456
<?xml version="1.0" encoding="utf-8"?>
<shortcuts
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<shortcut
android:shortcutId=
"toggle"
android:enabled=
"true"
android:icon=
"@mipmap/ic_launcher"
android:icon=
"@drawable/ic_qu_shadowsocks_launcher"
android:shortcutShortLabel=
"@string/quick_toggle"
android:shortcutLongLabel=
"@string/quick_toggle"
>
<intent
android:action=
"android.intent.action.MAIN"
...
...
@@ -10,12 +9,19 @@
android:targetClass=
"com.github.shadowsocks.QuickToggleShortcut"
/>
</shortcut>
<shortcut
android:shortcutId=
"switch"
android:enabled=
"true"
android:icon=
"@mipmap/ic_launcher"
android:icon=
"@drawable/ic_qu_shadowsocks_launcher"
android:shortcutShortLabel=
"@string/quick_switch"
android:shortcutLongLabel=
"@string/quick_switch"
>
<intent
android:action=
"android.intent.action.MAIN"
android:targetPackage=
"com.github.shadowsocks"
android:targetClass=
"com.github.shadowsocks.ShadowsocksQuickSwitchActivity"
/>
</shortcut>
<shortcut
android:shortcutId=
"scan"
android:icon=
"@drawable/ic_qu_camera_launcher"
android:shortcutShortLabel=
"@string/add_profile_methods_scan_qr_code"
android:shortcutLongLabel=
"@string/add_profile_methods_scan_qr_code"
>
<intent
android:action=
"android.intent.action.MAIN"
android:targetPackage=
"com.github.shadowsocks"
android:targetClass=
"com.github.shadowsocks.ScannerActivity"
/>
</shortcut>
</shortcuts>
src/main/scala/com/github/shadowsocks/QuickToggleShortcut.scala
View file @
179e5456
...
...
@@ -2,7 +2,8 @@ package com.github.shadowsocks
import
android.app.Activity
import
android.content.Intent
import
android.os.Bundle
import
android.content.pm.ShortcutManager
import
android.os.
{
Build
,
Bundle
}
import
com.github.shadowsocks.utils.
{
State
,
Utils
}
/**
...
...
@@ -19,7 +20,9 @@ class QuickToggleShortcut extends Activity with ServiceBoundContext {
.
putExtra
(
Intent
.
EXTRA_SHORTCUT_ICON_RESOURCE
,
Intent
.
ShortcutIconResource
.
fromContext
(
this
,
R
.
mipmap
.
ic_launcher
)))
finish
()
case
_
=>
attachService
()
case
_
=>
attachService
()
if
(
Build
.
VERSION
.
SDK_INT
>=
25
)
getSystemService
(
classOf
[
ShortcutManager
]).
reportShortcutUsed
(
"toggle"
)
}
}
...
...
src/main/scala/com/github/shadowsocks/ScannerActivity.scala
View file @
179e5456
...
...
@@ -2,8 +2,8 @@ package com.github.shadowsocks
import
android.app.Activity
import
android.content.Intent
import
android.content.pm.
PackageManager
import
android.os.
Bundle
import
android.content.pm.
{
PackageManager
,
ShortcutManager
}
import
android.os.
{
Build
,
Bundle
}
import
android.support.v4.app.ActivityCompat
import
android.support.v4.content.ContextCompat
import
android.support.v7.app.AppCompatActivity
...
...
@@ -42,6 +42,7 @@ class ScannerActivity extends AppCompatActivity with ZXingScannerView.ResultHand
scannerView
=
new
ZXingScannerView
(
this
)
val
contentFrame
=
findViewById
(
R
.
id
.
content_frame
).
asInstanceOf
[
ViewGroup
]
contentFrame
.
addView
(
scannerView
)
if
(
Build
.
VERSION
.
SDK_INT
>=
25
)
getSystemService
(
classOf
[
ShortcutManager
]).
reportShortcutUsed
(
"scan"
)
}
override
def
onResume
()
{
...
...
@@ -66,7 +67,7 @@ class ScannerActivity extends AppCompatActivity with ZXingScannerView.ResultHand
val
intent
=
new
Intent
()
intent
.
putExtra
(
"uri"
,
rawResult
.
getText
)
setResult
(
Activity
.
RESULT_OK
,
intent
)
finish
(
)
navigateUpTo
(
getParentActivityIntent
)
}
def
setupToolbar
()
{
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksQuickSwitchActivity.scala
View file @
179e5456
package
com.github.shadowsocks
import
android.content.pm.ShortcutManager
import
android.content.res.Resources
import
android.os.
{
Build
,
Bundle
}
import
android.support.v7.app.AppCompatActivity
...
...
@@ -70,5 +71,6 @@ class ShadowsocksQuickSwitchActivity extends AppCompatActivity {
if
(
app
.
profileId
>=
0
)
lm
.
scrollToPosition
(
profilesAdapter
.
profiles
.
zipWithIndex
.
collectFirst
{
case
(
profile
,
i
)
if
profile
.
id
==
app
.
profileId
=>
i
}.
getOrElse
(
0
))
if
(
Build
.
VERSION
.
SDK_INT
>=
25
)
getSystemService
(
classOf
[
ShortcutManager
]).
reportShortcutUsed
(
"switch"
)
}
}
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