implemented app shortcuts, template svg-file for shortcut icons (#183)
|
@ -57,7 +57,14 @@
|
|||
android:theme="@style/DiasporaLight.NoActionBar"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
|
||||
<meta-data android:name="android.app.shortcuts"
|
||||
android:resource="@xml/shortcuts" />
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="sc_new_post" />
|
||||
<action android:name="sc_nav_followed_tags" />
|
||||
<action android:name="sc_aspects" />
|
||||
<action android:name="sc_activities" />
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
|
|
@ -549,6 +549,18 @@ public class MainActivity extends ThemedActivity
|
|||
} else if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) {
|
||||
/* TODO: Implement and add filter to manifest */
|
||||
return;
|
||||
} else if ("sc_new_post".equals(action)) {
|
||||
openDiasporaUrl(urls.getNewPostUrl());
|
||||
return;
|
||||
} else if ("sc_nav_followed_tags".equals(action)) {
|
||||
showFragment(getFragment(TagListFragment.TAG));
|
||||
return;
|
||||
} else if ("sc_aspects".equals(action)) {
|
||||
showFragment(getFragment(AspectListFragment.TAG));
|
||||
return;
|
||||
} else if ("sc_activities".equals(action)) {
|
||||
openDiasporaUrl(urls.getActivityUrl());
|
||||
return;
|
||||
}
|
||||
//Catch split screen recreation
|
||||
if (action != null && action.equals(Intent.ACTION_MAIN) && getTopFragment() != null) {
|
||||
|
|
BIN
app/src/main/res/drawable-hdpi/sc_aspects.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/drawable-hdpi/sc_edit.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/drawable-hdpi/sc_history.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
app/src/main/res/drawable-hdpi/sc_tags.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/drawable-mdpi/sc_aspects.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable-mdpi/sc_edit.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-mdpi/sc_history.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-mdpi/sc_tags.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-xhdpi/sc_aspects.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-xhdpi/sc_edit.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/drawable-xhdpi/sc_history.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
app/src/main/res/drawable-xhdpi/sc_tags.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
app/src/main/res/drawable-xxhdpi/sc_aspects.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
app/src/main/res/drawable-xxhdpi/sc_edit.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/drawable-xxhdpi/sc_history.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/drawable-xxhdpi/sc_tags.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/sc_aspects.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/sc_edit.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/sc_history.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/sc_tags.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
4
app/src/main/res/drawable/ic_mode_edit_black_48px.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<vector android:height="24dp" android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#000000" android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
|
||||
</vector>
|
73
app/src/main/res/xml-v25/shortcuts.xml
Executable file
|
@ -0,0 +1,73 @@
|
|||
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<shortcut
|
||||
android:shortcutId="sc_new_post"
|
||||
android:enabled="true"
|
||||
android:icon="@drawable/sc_edit"
|
||||
android:shortcutShortLabel="@string/new_post"
|
||||
android:shortcutLongLabel="@string/new_post"
|
||||
android:shortcutDisabledMessage="@string/new_post">
|
||||
<intent
|
||||
android:action="sc_new_post"
|
||||
android:targetPackage="com.github.dfa.diaspora_android"
|
||||
android:targetClass="com.github.dfa.diaspora_android.activity.MainActivity" />
|
||||
<!-- If your shortcut is associated with multiple intents, include them
|
||||
here. The last intent in the fragments is what the user sees when they
|
||||
launch this shortcut. -->
|
||||
<categories android:name="android.shortcut.conversation" />
|
||||
</shortcut>
|
||||
|
||||
<shortcut
|
||||
android:shortcutId="sc_activities"
|
||||
android:enabled="true"
|
||||
android:icon="@drawable/sc_history"
|
||||
android:shortcutShortLabel="@string/activities"
|
||||
android:shortcutLongLabel="@string/activities"
|
||||
android:shortcutDisabledMessage="@string/activities">
|
||||
<intent
|
||||
android:action="sc_activities"
|
||||
android:targetPackage="com.github.dfa.diaspora_android"
|
||||
android:targetClass="com.github.dfa.diaspora_android.activity.MainActivity" />
|
||||
<!-- If your shortcut is associated with multiple intents, include them
|
||||
here. The last intent in the fragments is what the user sees when they
|
||||
launch this shortcut. -->
|
||||
<categories android:name="android.shortcut.conversation" />
|
||||
</shortcut>
|
||||
|
||||
<shortcut
|
||||
android:shortcutId="sc_aspects"
|
||||
android:enabled="true"
|
||||
android:icon="@drawable/sc_aspects"
|
||||
android:shortcutShortLabel="@string/aspects"
|
||||
android:shortcutLongLabel="@string/aspects"
|
||||
android:shortcutDisabledMessage="@string/aspects">
|
||||
<intent
|
||||
android:action="sc_aspects"
|
||||
android:targetPackage="com.github.dfa.diaspora_android"
|
||||
android:targetClass="com.github.dfa.diaspora_android.activity.MainActivity" />
|
||||
<!-- If your shortcut is associated with multiple intents, include them
|
||||
here. The last intent in the fragments is what the user sees when they
|
||||
launch this shortcut. -->
|
||||
<categories android:name="android.shortcut.conversation" />
|
||||
</shortcut>
|
||||
|
||||
<shortcut
|
||||
android:shortcutId="sc_nav_followed_tags"
|
||||
android:enabled="true"
|
||||
android:icon="@drawable/sc_tags"
|
||||
android:shortcutShortLabel="@string/nav_followed_tags"
|
||||
android:shortcutLongLabel="@string/nav_followed_tags"
|
||||
android:shortcutDisabledMessage="@string/nav_followed_tags">
|
||||
<intent
|
||||
android:action="sc_nav_followed_tags"
|
||||
android:targetPackage="com.github.dfa.diaspora_android"
|
||||
android:targetClass="com.github.dfa.diaspora_android.activity.MainActivity" />
|
||||
<!-- If your shortcut is associated with multiple intents, include them
|
||||
here. The last intent in the fragments is what the user sees when they
|
||||
launch this shortcut. -->
|
||||
<categories android:name="android.shortcut.conversation" />
|
||||
</shortcut>
|
||||
|
||||
</shortcuts>
|
||||
|
||||
|