Skip to content

Commit 0ac63b4

Browse files
committed
Fixes commons-app#814 Added App Shortcuts
1 parent b13d888 commit 0ac63b4

File tree

4 files changed

+75
-0
lines changed

4 files changed

+75
-0
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747

4848
<action android:name="android.intent.action.MAIN" />
4949
</intent-filter>
50+
51+
<meta-data android:name="android.app.shortcuts"
52+
android:resource="@xml/shortcuts" />
53+
5054
</activity>
5155
<activity android:name=".WelcomeActivity" />
5256

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24.0"
5+
android:viewportHeight="24.0">
6+
<path
7+
android:fillColor="#FF000000"
8+
android:pathData="M12,17.27L18.18,21l-1.64,-7.03L22,9.24l-7.19,-0.61L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21z"/>
9+
</vector>

app/src/main/res/values/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,4 +591,8 @@ Upload your first media by tapping on the add button.</string>
591591

592592
<string name="upload_nearby_place_found_title">Nearby Place Found</string>
593593
<string name="upload_nearby_place_found_description">Is this a photo of Place %1$s?</string>
594+
<string name="title_app_shortcut_explore">Explore</string>
595+
<string name="title_app_shortcut_bookmark">Bookmarks</string>
596+
<string name="title_app_shortcut_setting">Settings</string>
597+
<string name="title_app_shortcut_review">Reviews</string>
594598
</resources>

app/src/main/res/xml/shortcuts.xml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
<shortcut
5+
android:enabled="true"
6+
android:icon="@drawable/ic_explore_24dp"
7+
android:shortcutId="Explore"
8+
android:shortcutLongLabel="@string/title_app_shortcut_explore"
9+
android:shortcutShortLabel="@string/title_app_shortcut_explore"
10+
tools:targetApi="n_mr1">
11+
<intent
12+
android:action="android.intent.action.VIEW"
13+
android:targetClass="fr.free.nrw.commons.explore.categories.ExploreActivity"
14+
android:targetPackage="fr.free.nrw.commons.beta" />
15+
</shortcut>
16+
17+
<shortcut
18+
android:enabled="true"
19+
android:icon="@drawable/ic_filled_star_24dp"
20+
android:shortcutId="Bookmark"
21+
android:shortcutLongLabel="@string/title_app_shortcut_bookmark"
22+
android:shortcutShortLabel="@string/title_app_shortcut_bookmark"
23+
tools:targetApi="n_mr1">
24+
<intent
25+
android:action="android.intent.action.VIEW"
26+
android:targetClass="fr.free.nrw.commons.bookmarks.BookmarksActivity"
27+
android:targetPackage="fr.free.nrw.commons.beta" />
28+
</shortcut>
29+
30+
<shortcut
31+
android:enabled="true"
32+
android:icon="@drawable/ic_settings_black_24dp"
33+
android:shortcutId="Setting"
34+
android:shortcutLongLabel="@string/title_app_shortcut_setting"
35+
android:shortcutShortLabel="@string/title_app_shortcut_setting"
36+
tools:targetApi="n_mr1">
37+
<intent
38+
android:action="android.intent.action.VIEW"
39+
android:targetClass="fr.free.nrw.commons.settings.SettingsActivity"
40+
android:targetPackage="fr.free.nrw.commons.beta" />
41+
</shortcut>
42+
43+
<shortcut
44+
android:enabled="true"
45+
android:icon="@drawable/ic_check_black_24dp"
46+
android:shortcutId="Review"
47+
android:shortcutLongLabel="@string/title_app_shortcut_review"
48+
android:shortcutShortLabel="@string/title_app_shortcut_review"
49+
tools:targetApi="n_mr1">
50+
<intent
51+
android:action="android.intent.action.VIEW"
52+
android:targetClass="fr.free.nrw.commons.review.ReviewActivity"
53+
android:targetPackage="fr.free.nrw.commons.beta" />
54+
</shortcut>
55+
56+
57+
</shortcuts>
58+

0 commit comments

Comments
 (0)