Skip to content

Offline gym log for Android. No account, no ads, no internet.

Add Android launcher shortcut to start a workout

InlitX0a8b59e8dd5b
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 8cbd9eb..fe00f28 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -54,6 +54,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"/>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
diff --git a/android/app/src/main/res/drawable/ic_shortcut_play.xml b/android/app/src/main/res/drawable/ic_shortcut_play.xml
new file mode 100644
index 0000000..6d1cccd
--- /dev/null
+++ b/android/app/src/main/res/drawable/ic_shortcut_play.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="48dp"
+ android:height="48dp"
+ android:viewportWidth="48"
+ android:viewportHeight="48">
+ <path
+ android:fillColor="#D9A184"
+ android:pathData="M24,24m-24,0a24,24 0,1 1,48 0a24,24 0,1 1,-48 0" />
+ <path
+ android:fillColor="#0A0A0A"
+ android:pathData="M19,15.5v17a1.5,1.5 0,0 0,2.3 1.3l13.6,-8.5a1.5,1.5 0,0 0,0 -2.6l-13.6,-8.5a1.5,1.5 0,0 0,-2.3 1.3z" />
+</vector>
diff --git a/android/app/src/main/res/values-es/shortcuts.xml b/android/app/src/main/res/values-es/shortcuts.xml
new file mode 100644
index 0000000..a6451c2
--- /dev/null
+++ b/android/app/src/main/res/values-es/shortcuts.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="shortcut_start_short">Empezar entreno</string>
+ <string name="shortcut_start_long">Empezar entreno</string>
+</resources>
diff --git a/android/app/src/main/res/values/shortcuts.xml b/android/app/src/main/res/values/shortcuts.xml
new file mode 100644
index 0000000..8c2495c
--- /dev/null
+++ b/android/app/src/main/res/values/shortcuts.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="shortcut_start_short">Start workout</string>
+ <string name="shortcut_start_long">Start workout</string>
+</resources>
diff --git a/android/app/src/main/res/xml/shortcuts.xml b/android/app/src/main/res/xml/shortcuts.xml
new file mode 100644
index 0000000..6b7349a
--- /dev/null
+++ b/android/app/src/main/res/xml/shortcuts.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
+ <shortcut
+ android:shortcutId="start_workout"
+ android:enabled="true"
+ android:icon="@drawable/ic_shortcut_play"
+ android:shortcutShortLabel="@string/shortcut_start_short"
+ android:shortcutLongLabel="@string/shortcut_start_long">
+ <intent
+ android:action="android.intent.action.MAIN"
+ android:targetPackage="com.gymmane.app"
+ android:targetClass="com.gymmane.app.MainActivity">
+ <extra android:name="gymmane_open" android:value="play" />
+ </intent>
+ </shortcut>
+</shortcuts>