implemented app shortcuts, template svg-file for shortcut icons (#183)

This commit is contained in:
Gaukler Faun 2018-01-07 16:03:02 +01:00 committed by Gregor Santner
parent 32a74e293a
commit a3cb818db4
26 changed files with 483 additions and 1 deletions

View File

@ -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>

View File

@ -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) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View 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>

View 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>

View File

@ -23,7 +23,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
if (project.enable_plugin_kotlin) {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$version_plugin_kotlin"

386
sc_edit.svg Normal file
View File

@ -0,0 +1,386 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48"
height="48"
viewBox="0 0 48 48"
id="svg2"
version="1.1"
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
sodipodi:docname="sc_edit.svg"
inkscape:export-filename="/home/juergen/Desktop/sc_edit.png"
inkscape:export-xdpi="144"
inkscape:export-ydpi="144">
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="4.0000002"
inkscape:cx="-19.294902"
inkscape:cy="0.029871"
inkscape:document-units="px"
inkscape:current-layer="layer2"
showgrid="false"
fit-margin-top="2"
fit-margin-left="2"
fit-margin-right="2"
fit-margin-bottom="2"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1366"
inkscape:window-height="699"
inkscape:window-x="0"
inkscape:window-y="33"
inkscape:window-maximized="1"
inkscape:snap-grids="false"
inkscape:snap-to-guides="false"
units="px">
<inkscape:grid
type="xygrid"
id="grid4138"
originx="79.999996"
originy="-27.999998" />
<sodipodi:guide
position="89.999996,-9.9999981"
orientation="0,1"
id="guide4140"
inkscape:locked="false" />
<sodipodi:guide
position="89.999996,-25.999998"
orientation="0,1"
id="guide4142"
inkscape:locked="false" />
<sodipodi:guide
position="81.999996,-17.999998"
orientation="1,0"
id="guide4144"
inkscape:locked="false" />
<sodipodi:guide
position="79.999996,-27.999998"
orientation="0,20"
id="guide4146"
inkscape:locked="false" />
<sodipodi:guide
position="99.999996,-27.999998"
orientation="-20,0"
id="guide4148"
inkscape:locked="false" />
<sodipodi:guide
position="99.999996,-7.9999981"
orientation="0,-20"
id="guide4150"
inkscape:locked="false" />
<sodipodi:guide
position="79.999996,-7.9999981"
orientation="20,0"
id="guide4152"
inkscape:locked="false" />
<sodipodi:guide
position="97.999996,-17.999998"
orientation="1,0"
id="guide4154"
inkscape:locked="false" />
<sodipodi:guide
position="89.999996,-17.999998"
orientation="-0.70710678,0.70710678"
id="guide4156"
inkscape:locked="false" />
<sodipodi:guide
position="83.999996,-17.999998"
orientation="1,0"
id="guide4160"
inkscape:locked="false" />
<sodipodi:guide
position="95.999996,-17.999998"
orientation="1,0"
id="guide4162"
inkscape:locked="false" />
<sodipodi:guide
position="89.999996,-11.999998"
orientation="0,1"
id="guide4164"
inkscape:locked="false" />
<sodipodi:guide
position="89.999996,-23.999998"
orientation="0,1"
id="guide4166"
inkscape:locked="false" />
<sodipodi:guide
position="89.999996,-12.999998"
orientation="0,1"
id="guide4168"
inkscape:locked="false" />
<sodipodi:guide
position="89.999996,-22.999998"
orientation="0,1"
id="guide4170"
inkscape:locked="false" />
<sodipodi:guide
position="84.999996,-17.999998"
orientation="1,0"
id="guide4172"
inkscape:locked="false" />
<sodipodi:guide
position="94.999996,-17.999998"
orientation="1,0"
id="guide4174"
inkscape:locked="false" />
</sodipodi:namedview>
<defs
id="defs4">
<clipPath
id="clipPath12478"
clipPathUnits="userSpaceOnUse">
<circle
r="10"
cy="10.000005"
cx="9.9999781"
id="circle12480"
style="opacity:1;fill:#2196f3;fill-opacity:1;stroke:none;stroke-width:0.05069799;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath5790">
<circle
r="10"
cy="10.000005"
cx="9.9999781"
id="circle5792"
style="opacity:1;fill:#2196f3;fill-opacity:1;stroke:none;stroke-width:0.05069799;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:export-filename="/home/juergen/path4136.png"
inkscape:export-xdpi="648"
inkscape:export-ydpi="648" />
</clipPath>
<clipPath
id="clipPath5055"
clipPathUnits="userSpaceOnUse">
<circle
r="10"
cy="10.000005"
cx="9.9999781"
id="circle5057"
style="opacity:1;fill:#2196f3;fill-opacity:1;stroke:none;stroke-width:0.05069799;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:export-filename="/home/juergen/path4136.png"
inkscape:export-xdpi="648"
inkscape:export-ydpi="648" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath5119">
<circle
r="10"
cy="10.000005"
cx="9.9999781"
id="circle5121"
style="opacity:1;fill:#2196f3;fill-opacity:1;stroke:none;stroke-width:0.05069799;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:export-filename="/home/juergen/Schreibtisch/path4136.png"
inkscape:export-xdpi="648"
inkscape:export-ydpi="648" />
</clipPath>
<clipPath
id="clipPath5194"
clipPathUnits="userSpaceOnUse">
<circle
r="10"
cy="10.000005"
cx="9.9999781"
id="circle5196"
style="opacity:1;fill:#cddc39;fill-opacity:1;stroke:none;stroke-width:0.05069799;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:export-filename="/home/juergen/Schreibtisch/path4136.png"
inkscape:export-xdpi="648"
inkscape:export-ydpi="648" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath6175">
<circle
r="10"
cy="10.000005"
cx="9.9999781"
id="circle6177"
style="opacity:1;fill:#f44336;fill-opacity:1;stroke:none;stroke-width:0.05069799;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:export-filename="/home/juergen/Schreibtisch/path4136.png"
inkscape:export-xdpi="648"
inkscape:export-ydpi="648" />
</clipPath>
<clipPath
id="clipPath7176"
clipPathUnits="userSpaceOnUse">
<circle
r="10"
cy="10.000005"
cx="9.9999781"
id="circle7178"
style="opacity:1;fill:#9c27b0;fill-opacity:1;stroke:none;stroke-width:0.05069799;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:export-filename="/home/juergen/Schreibtisch/path4136.png"
inkscape:export-xdpi="648"
inkscape:export-ydpi="648" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath8165">
<circle
r="10"
cy="10.000005"
cx="9.9999781"
id="circle8167"
style="opacity:1;fill:#ffc107;fill-opacity:1;stroke:none;stroke-width:0.05069799;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:export-filename="/home/juergen/Schreibtisch/path4136.png"
inkscape:export-xdpi="648"
inkscape:export-ydpi="648" />
</clipPath>
<clipPath
id="clipPath9162"
clipPathUnits="userSpaceOnUse">
<circle
r="10"
cy="10.000005"
cx="9.9999781"
id="circle9164"
style="opacity:1;fill:#ff9800;fill-opacity:1;stroke:none;stroke-width:0.05069799;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:export-filename="/home/juergen/Schreibtisch/path4136.png"
inkscape:export-xdpi="648"
inkscape:export-ydpi="648" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath10753">
<circle
r="10"
cy="10.000005"
cx="9.9999781"
id="circle10755"
style="opacity:1;fill:#607d8b;fill-opacity:1;stroke:none;stroke-width:0.05069799;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:export-filename="/home/juergen/Schreibtisch/path4136.png"
inkscape:export-xdpi="648"
inkscape:export-ydpi="648" />
</clipPath>
<clipPath
id="clipPath5153"
clipPathUnits="userSpaceOnUse">
<circle
r="10"
cy="10.000005"
cx="9.9999781"
id="circle5155"
style="opacity:1;fill:#2196f3;fill-opacity:1;stroke:none;stroke-width:0.05069799;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:export-filename="/home/juergen/Schreibtisch/path4136.png"
inkscape:export-xdpi="648"
inkscape:export-ydpi="648" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath6158">
<circle
inkscape:export-ydpi="648"
inkscape:export-xdpi="648"
inkscape:export-filename="/home/juergen/Schreibtisch/path4136.png"
style="opacity:1;fill:#ff9800;fill-opacity:1;stroke:none;stroke-width:0.05069799;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="circle6160"
cx="9.9999781"
cy="10.000005"
r="10" />
</clipPath>
<clipPath
id="clipPath5176"
clipPathUnits="userSpaceOnUse">
<circle
inkscape:export-ydpi="648"
inkscape:export-xdpi="648"
inkscape:export-filename="/home/juergen/Schreibtisch/path4136.png"
style="opacity:1;fill:#ff9800;fill-opacity:1;stroke:none;stroke-width:0.05069799;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="circle5178"
cx="9.9999781"
cy="10.000005"
r="10" />
</clipPath>
<clipPath
id="clipPath4243"
clipPathUnits="userSpaceOnUse">
<path
inkscape:connector-curvature="0"
id="path4245"
d="m 5.9662132,10.012117 0,3.270369 3.8006988,1.723573 4.110058,-1.944544 -0.220971,-3.0935919 -3.6681162,1.8561549 z"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath5197">
<circle
inkscape:export-ydpi="863.99994"
inkscape:export-xdpi="863.99994"
inkscape:export-filename="/home/juergen/Desktop/ic_launcher.png"
style="opacity:1;fill:#880e4f;fill-opacity:1;stroke:none;stroke-width:0.05069799;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="circle5199"
cx="9.9999781"
cy="10.000005"
r="10" />
</clipPath>
</defs>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Hintergrund"
inkscape:groupmode="layer"
id="layer1"
transform="translate(1138.1428,-805.93365)">
<circle
r="10"
cy="871.93365"
cx="-1048.1428"
id="circle6153"
style="opacity:1;fill:#a00000;fill-opacity:0;stroke:none;stroke-width:0.05069799;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:export-filename="/home/juergen/Schreibtisch/path4136.png"
inkscape:export-xdpi="648"
inkscape:export-ydpi="648" />
</g>
<g
style="display:inline"
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Icon"
transform="translate(79.999996,55.999998)">
<path
d="m 3.9999777,4.0333382 12.0000003,0 0,11.9333328 -12.0000003,0 z"
id="path4"
inkscape:connector-curvature="0"
style="fill:none" />
<path
style="fill:none"
inkscape:connector-curvature="0"
id="path9754"
d="m 18.999978,19.033339 12,0 0,11.933333 -12,0 z" />
<circle
style="opacity:1;fill:#f5f5f5;fill-opacity:1;stroke:none"
id="path4186"
cx="-55.999996"
cy="-31.999998"
r="22" />
<path
id="path1091"
d="m -46.324951,-37.508955 c 0.433273,-0.433273 0.433273,-1.155395 0,-1.566449 l -2.599639,-2.599639 c -0.411054,-0.433273 -1.133176,-0.433273 -1.566449,0 l -2.04416,2.033051 4.166088,4.166088 m -17.630885,9.309818 v 4.166088 h 4.166088 l 12.287182,-12.298292 -4.166088,-4.166088 z"
inkscape:connector-curvature="0"
style="stroke-width:1.11095679;fill:#616161" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 13 KiB