App shortcuts (#3748)
This commit is contained in:
parent
ec0255b743
commit
001583a4e0
|
@ -198,3 +198,7 @@ task copyLicense(type: Copy) {
|
|||
|
||||
preBuild.dependsOn copyLicense
|
||||
|
||||
apply plugin: 'de.timfreiheit.resourceplaceholders.plugin'
|
||||
resourcePlaceholders {
|
||||
files = ['xml/shortcuts.xml']
|
||||
}
|
||||
|
|
|
@ -64,6 +64,10 @@
|
|||
<category android:name=
|
||||
"android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.app.shortcuts"
|
||||
android:resource="@xml/shortcuts" />
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
|
|
|
@ -30,6 +30,7 @@ import de.danoeh.antennapod.R;
|
|||
import de.danoeh.antennapod.core.event.MessageEvent;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.util.StorageUtils;
|
||||
import de.danoeh.antennapod.core.util.download.AutoUpdateManager;
|
||||
import de.danoeh.antennapod.dialog.RatingDialog;
|
||||
import de.danoeh.antennapod.fragment.AddFeedFragment;
|
||||
import de.danoeh.antennapod.fragment.AudioPlayerFragment;
|
||||
|
@ -64,6 +65,7 @@ public class MainActivity extends CastEnabledActivity {
|
|||
public static final String EXTRA_FRAGMENT_ARGS = "fragment_args";
|
||||
public static final String EXTRA_FEED_ID = "fragment_feed_id";
|
||||
public static final String EXTRA_OPEN_PLAYER = "open_player";
|
||||
public static final String EXTRA_REFRESH_ON_START = "refresh_on_start";
|
||||
|
||||
private static final String SAVE_BACKSTACK_COUNT = "backstackCount";
|
||||
|
||||
|
@ -407,10 +409,15 @@ public class MainActivity extends CastEnabledActivity {
|
|||
|
||||
private void handleNavIntent() {
|
||||
Intent intent = getIntent();
|
||||
if (intent.hasExtra(EXTRA_FEED_ID) || intent.hasExtra(EXTRA_FRAGMENT_TAG)) {
|
||||
if (intent.hasExtra(EXTRA_FEED_ID) || intent.hasExtra(EXTRA_FRAGMENT_TAG) || intent.hasExtra(EXTRA_REFRESH_ON_START)) {
|
||||
Log.d(TAG, "handleNavIntent()");
|
||||
String tag = intent.getStringExtra(EXTRA_FRAGMENT_TAG);
|
||||
Bundle args = intent.getBundleExtra(EXTRA_FRAGMENT_ARGS);
|
||||
boolean refreshOnStart = intent.getBooleanExtra(EXTRA_REFRESH_ON_START, false);
|
||||
if (refreshOnStart) {
|
||||
AutoUpdateManager.runImmediate(this);
|
||||
}
|
||||
|
||||
long feedId = intent.getLongExtra(EXTRA_FEED_ID, 0);
|
||||
if (tag != null) {
|
||||
loadFragment(tag, args);
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<shortcut
|
||||
android:enabled="true"
|
||||
android:icon="@drawable/ic_playlist_shortcut"
|
||||
android:shortcutId="queue"
|
||||
android:shortcutShortLabel="@string/queue_label">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:targetClass="de.danoeh.antennapod.activity.MainActivity"
|
||||
android:targetPackage="${applicationId}">
|
||||
<extra
|
||||
android:name="fragment_tag"
|
||||
android:value="QueueFragment" />
|
||||
</intent>
|
||||
</shortcut>
|
||||
|
||||
<shortcut
|
||||
android:enabled="true"
|
||||
android:icon="@drawable/ic_feed_shortcut"
|
||||
android:shortcutId="episodes"
|
||||
android:shortcutShortLabel="@string/episodes_label">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:targetClass="de.danoeh.antennapod.activity.MainActivity"
|
||||
android:targetPackage="${applicationId}">
|
||||
<extra
|
||||
android:name="fragment_tag"
|
||||
android:value="EpisodesFragment" />
|
||||
</intent>
|
||||
</shortcut>
|
||||
|
||||
<shortcut
|
||||
android:enabled="true"
|
||||
android:icon="@drawable/ic_folder_shortcut"
|
||||
android:shortcutId="subscriptions"
|
||||
android:shortcutShortLabel="@string/subscriptions_label">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:targetClass="de.danoeh.antennapod.activity.MainActivity"
|
||||
android:targetPackage="${applicationId}">
|
||||
<extra
|
||||
android:name="fragment_tag"
|
||||
android:value="SubscriptionFragment" />
|
||||
</intent>
|
||||
</shortcut>
|
||||
|
||||
<shortcut
|
||||
android:enabled="true"
|
||||
android:icon="@drawable/ic_refresh_shortcut"
|
||||
android:shortcutId="refresh"
|
||||
android:shortcutShortLabel="@string/refresh_label">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:targetClass="de.danoeh.antennapod.activity.MainActivity"
|
||||
android:targetPackage="${applicationId}">
|
||||
<extra
|
||||
android:name="refresh_on_start"
|
||||
android:value="true" />
|
||||
</intent>
|
||||
</shortcut>
|
||||
</shortcuts>
|
|
@ -3,10 +3,12 @@ buildscript {
|
|||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url "https://plugins.gradle.org/m2/" }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.5.0'
|
||||
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.5'
|
||||
classpath 'de.timfreiheit.resourceplaceholders:placeholders:0.3'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/grey100" />
|
||||
<foreground>
|
||||
<inset
|
||||
android:drawable="@drawable/ic_feed_black"
|
||||
android:inset="33.3%" />
|
||||
</foreground>
|
||||
</adaptive-icon>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/grey100" />
|
||||
<foreground>
|
||||
<inset
|
||||
android:drawable="@drawable/ic_folder_black"
|
||||
android:inset="33.3%" />
|
||||
</foreground>
|
||||
</adaptive-icon>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/grey100" />
|
||||
<foreground>
|
||||
<inset
|
||||
android:drawable="@drawable/ic_playlist_black"
|
||||
android:inset="33.3%" />
|
||||
</foreground>
|
||||
</adaptive-icon>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/grey100" />
|
||||
<foreground>
|
||||
<inset
|
||||
android:drawable="@drawable/ic_refresh_black"
|
||||
android:inset="33.3%" />
|
||||
</foreground>
|
||||
</adaptive-icon>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_shortcut_background" />
|
||||
<item
|
||||
android:drawable="@drawable/ic_feed_black"
|
||||
android:gravity="center" />
|
||||
</layer-list>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_shortcut_background" />
|
||||
<item
|
||||
android:drawable="@drawable/ic_folder_black"
|
||||
android:gravity="center" />
|
||||
</layer-list>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_shortcut_background" />
|
||||
<item
|
||||
android:drawable="@drawable/ic_playlist_black"
|
||||
android:gravity="center" />
|
||||
</layer-list>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_shortcut_background" />
|
||||
<item
|
||||
android:drawable="@drawable/ic_refresh_black"
|
||||
android:gravity="center" />
|
||||
</layer-list>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<inset xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:inset="2dp">
|
||||
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="@color/grey100" />
|
||||
<size
|
||||
android:width="44dp"
|
||||
android:height="44dp" />
|
||||
</shape>
|
||||
</inset>
|
|
@ -2,6 +2,7 @@
|
|||
<resources>
|
||||
|
||||
<color name="white">#FFFFFF</color>
|
||||
<color name="grey100">#f5f5f5</color>
|
||||
<color name="grey600">#757575</color>
|
||||
<color name="light_gray">#bfbfbf</color>
|
||||
<color name="black">#000000</color>
|
||||
|
|
Loading…
Reference in New Issue