Skip to content
This repository was archived by the owner on Apr 9, 2021. It is now read-only.

feat: Add shortcuts on long pressing of app icon #328

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions skunkworks_crow/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>
<activity
android:name=".views.ui.hotspot.HpReceiverActivity"
Expand Down
9 changes: 9 additions & 0 deletions skunkworks_crow/src/main/res/drawable/ic_send_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z" />
</vector>
8 changes: 8 additions & 0 deletions skunkworks_crow/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@
<string name="feedback_sent">\nFeedback sent by reviewer: %s</string>
<string name="no_feedback_sent">\nNo feedback sent by the reviewer</string>

<!--App shortcuts-->
<string name="send_short">Send</string>
<string name="send_long">Send forms in skunkworks-crow</string>
<string name="receive_hotspot_short">Receive-hotspot</string>
<string name="receive_hotspot_long">Receive forms through hotspot in skunkworks-crow</string>
<string name="receive_bluetooth_short">Receive-bluetooth</string>
<string name="receive_bluetooth_long">Receive forms through bluetooth in skunkworks-crow</string>

<string-array name="stats_field">
<item name="sent">Sent</item>
<item name="received">Received</item>
Expand Down
45 changes: 45 additions & 0 deletions skunkworks_crow/src/main/res/xml/shortcuts.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<shortcuts xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:shortcutId="send"
android:enabled="true"
android:icon="@drawable/ic_send_black_24dp"
android:shortcutShortLabel="@string/send_short"
android:shortcutLongLabel="@string/send_long"
android:shortcutDisabledMessage="@string/send_short"
tools:targetApi="n_mr1">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="org.odk.share"
android:targetClass="org.odk.share.views.ui.send.SendFormsActivity" />
<categories android:name="android.intent.category.DEFAULT" />
</shortcut>
<shortcut
android:shortcutId="receive hotspot"
android:enabled="true"
android:icon="@drawable/ic_wifi_tethering_black_24dp"
android:shortcutShortLabel="@string/receive_hotspot_short"
android:shortcutLongLabel="@string/receive_hotspot_long"
android:shortcutDisabledMessage="@string/receive_hotspot_short"
tools:targetApi="n_mr1">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="org.odk.share"
android:targetClass="org.odk.share.views.ui.hotspot.HpReceiverActivity" />
<categories android:name="android.intent.category.DEFAULT" />
</shortcut>
<shortcut
android:shortcutId="receive bluetooth"
android:enabled="true"
android:icon="@drawable/ic_bluetooth_black_24dp"
android:shortcutShortLabel="@string/receive_bluetooth_short"
android:shortcutLongLabel="@string/receive_bluetooth_long"
android:shortcutDisabledMessage="@string/receive_bluetooth_short"
tools:targetApi="n_mr1">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="org.odk.share"
android:targetClass="org.odk.share.views.ui.bluetooth.BtReceiverActivity" />
<categories android:name="android.intent.category.DEFAULT" />
</shortcut>
</shortcuts>