1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-16 09:22:08 +01:00

app shortcut for Android N

This commit is contained in:
scoute-dich 2017-05-02 20:55:52 +02:00
parent e0a6c79836
commit 7327c279af
10 changed files with 31 additions and 3 deletions

View file

@ -2,8 +2,8 @@ apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
compileSdkVersion 25
buildToolsVersion "25.0.2"
def VERSION_CODE = 15
def VERSION_NAME = "0.2.5"
@ -13,7 +13,7 @@ android {
defaultConfig {
minSdkVersion 17
targetSdkVersion 24
targetSdkVersion 25
buildConfigField "boolean", "IS_TEST_BUILD", "false"
buildConfigField "boolean", "IS_GPLAY_BUILD", "false"

View file

@ -54,6 +54,7 @@
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="app_shortcut" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
@ -227,6 +228,9 @@
<!--@@@ PODLIST END-->
</intent-filter>
<meta-data android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>
</application>

View file

@ -548,6 +548,8 @@ 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 ("app_shortcut".equals(action)) {
openDiasporaUrl(urls.getNewPostUrl());
}
//Catch split screen recreation
if (action != null && action.equals(Intent.ACTION_MAIN) && getTopFragment() != null) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View file

@ -0,0 +1,22 @@
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:shortcutId="shortcut_new_post"
android:enabled="true"
android:icon="@drawable/qc_post_plus"
android:shortcutShortLabel="@string/new_post"
android:shortcutLongLabel="@string/new_post"
android:shortcutDisabledMessage="@string/new_post">
<intent
android:action="app_shortcut"
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 list is what the user sees when they
launch this shortcut. -->
<categories android:name="android.shortcut.conversation" />
</shortcut>
</shortcuts>