Skip to content

Commit

Permalink
Add app shortcuts for launchers that support them
Browse files Browse the repository at this point in the history
So a user can go directly to the preferences for example.
  • Loading branch information
markusfisch committed Apr 14, 2020
1 parent 4de7d5d commit 4135dfb
Show file tree
Hide file tree
Showing 35 changed files with 319 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/src/main/AndroidManifest.xml
Expand Up @@ -31,6 +31,9 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts"/>
</activity>
<activity
android:name=".activity.CameraActivity"
Expand Down Expand Up @@ -71,7 +74,8 @@
</activity>
<activity
android:name=".activity.MainActivity"
android:label="@string/app_name"/>
android:label="@string/app_name"
android:exported="true"/>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/src/main/res/values-de/strings.xml
Expand Up @@ -86,4 +86,7 @@
<string name="rotate_image_cw">Bild im Uhrzeigersinn rotieren</string>
<string name="pick_file">Bilddatei auswählen</string>
<string name="pick_code_to_scan">Code im Bild auswählen</string>
<string name="shortcut_decode">Barcode einlesen</string>
<string name="shortcut_encode">Barcode erstellen</string>
<string name="shortcut_preferences">Einstellungen</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Expand Up @@ -86,4 +86,7 @@
<string name="rotate_image_cw">Rotate image clockwise</string>
<string name="pick_file">Pick image file</string>
<string name="pick_code_to_scan">Pick code to scan</string>
<string name="shortcut_decode">Scan a barcode</string>
<string name="shortcut_encode">Create a barcode</string>
<string name="shortcut_preferences">Settings</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-hu/strings.xml
Expand Up @@ -86,4 +86,7 @@
<string name="rotate_image_cw">Kép forgatása jobbra</string>
<string name="pick_file">Képfájl kiválasztása</string>
<string name="pick_code_to_scan">Kód kiválasztása a beolvasáshoz</string>
<string name="shortcut_decode">Scan a barcode</string>
<string name="shortcut_encode">Create a barcode</string>
<string name="shortcut_preferences">Settings</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-in/strings.xml
Expand Up @@ -85,4 +85,7 @@
<string name="rotate_image_cw">Putar gambar searah jarum jam</string>
<string name="pick_file">Pilih berkas gambar</string>
<string name="pick_code_to_scan">Pilih kode untuk dipindai</string>
<string name="shortcut_decode">Scan a barcode</string>
<string name="shortcut_encode">Create a barcode</string>
<string name="shortcut_preferences">Settings</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-it/strings.xml
Expand Up @@ -86,4 +86,7 @@
<string name="rotate_image_cw">Ruota immagine in senso orario</string>
<string name="pick_file">Scegli file immagine</string>
<string name="pick_code_to_scan">Scegli codice da scansionare</string>
<string name="shortcut_decode">Scan a barcode</string>
<string name="shortcut_encode">Create a barcode</string>
<string name="shortcut_preferences">Settings</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-nl/strings.xml
Expand Up @@ -86,4 +86,7 @@
<string name="rotate_image_cw">Rotate image clockwise</string>
<string name="pick_file">Pick image file</string>
<string name="pick_code_to_scan">Pick code to scan</string>
<string name="shortcut_decode">Scan a barcode</string>
<string name="shortcut_encode">Create a barcode</string>
<string name="shortcut_preferences">Settings</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-pt-rBR/strings.xml
Expand Up @@ -86,4 +86,7 @@
<string name="rotate_image_cw">Rotate image clockwise</string>
<string name="pick_file">Pick image file</string>
<string name="pick_code_to_scan">Pick code to scan</string>
<string name="shortcut_decode">Scan a barcode</string>
<string name="shortcut_encode">Create a barcode</string>
<string name="shortcut_preferences">Settings</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-ru-rRU/strings.xml
Expand Up @@ -82,4 +82,7 @@
<string name="rotate_image_cw">Rotate image clockwise</string>
<string name="pick_file">Pick image file</string>
<string name="pick_code_to_scan">Pick code to scan</string>
<string name="shortcut_decode">Scan a barcode</string>
<string name="shortcut_encode">Create a barcode</string>
<string name="shortcut_preferences">Settings</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Expand Up @@ -85,4 +85,7 @@
<string name="rotate_image_cw">旋转图片</string>
<string name="pick_file">选择图片文件</string>
<string name="pick_code_to_scan">选择扫描的编码</string>
<string name="shortcut_decode">Scan a barcode</string>
<string name="shortcut_encode">Create a barcode</string>
<string name="shortcut_preferences">Settings</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-zh/strings.xml
Expand Up @@ -85,4 +85,7 @@
<string name="rotate_image_cw">Rotate image clockwise</string>
<string name="pick_file">Pick image file</string>
<string name="pick_code_to_scan">Pick code to scan</string>
<string name="shortcut_decode">Scan a barcode</string>
<string name="shortcut_encode">Create a barcode</string>
<string name="shortcut_preferences">Settings</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Expand Up @@ -86,4 +86,7 @@
<string name="rotate_image_cw">Rotate image clockwise</string>
<string name="pick_file">Pick image file</string>
<string name="pick_code_to_scan">Pick code to scan</string>
<string name="shortcut_decode">Scan a barcode</string>
<string name="shortcut_encode">Create a barcode</string>
<string name="shortcut_preferences">Settings</string>
</resources>
42 changes: 42 additions & 0 deletions app/src/main/res/xml/shortcuts.xml
@@ -0,0 +1,42 @@
<shortcuts
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="UnusedAttribute">
<shortcut
android:shortcutId="decode"
android:enabled="true"
android:icon="@drawable/ic_shortcut_decode"
android:shortcutShortLabel="@string/shortcut_decode"
android:shortcutDisabledMessage="@string/shortcut_decode">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="de.markusfisch.android.binaryeye"
android:targetClass="de.markusfisch.android.binaryeye.activity.CameraActivity"/>
</shortcut>
<shortcut
android:shortcutId="encode"
android:enabled="true"
android:icon="@drawable/ic_shortcut_encode"
android:shortcutShortLabel="@string/shortcut_encode"
android:shortcutDisabledMessage="@string/shortcut_encode">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="de.markusfisch.android.binaryeye"
android:targetClass="de.markusfisch.android.binaryeye.activity.MainActivity">
<extra android:name="encode" android:value="encode"/>
</intent>
</shortcut>
<shortcut
android:shortcutId="preferences"
android:enabled="true"
android:icon="@drawable/ic_shortcut_preferences"
android:shortcutShortLabel="@string/shortcut_preferences"
android:shortcutDisabledMessage="@string/shortcut_preferences">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="de.markusfisch.android.binaryeye"
android:targetClass="de.markusfisch.android.binaryeye.activity.MainActivity">
<extra android:name="preferences" android:value="preferences"/>
</intent>
</shortcut>
</shortcuts>
91 changes: 91 additions & 0 deletions svg/ic_shortcut_decode.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions svg/ic_shortcut_encode.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions svg/ic_shortcut_preferences.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion svg/update.sh
Expand Up @@ -111,6 +111,9 @@ svg/ic_launcher.svg 48
EOF

update app/src/main/res/drawable << EOF
svg/wallpaper.svg 384
svg/ic_shortcut_decode.svg 48
svg/ic_shortcut_encode.svg 48
svg/ic_shortcut_preferences.svg 48
svg/logo.svg 80
svg/wallpaper.svg 384
EOF

0 comments on commit 4135dfb

Please sign in to comment.