summaryrefslogtreecommitdiff
path: root/ui/app-start-intent/src
diff options
context:
space:
mode:
authorByteHamster <info@bytehamster.com>2021-02-07 11:29:39 +0100
committerByteHamster <info@bytehamster.com>2021-02-12 18:08:58 +0100
commit24ea4708ea318e923eafdc222c89a158567d1f52 (patch)
tree8ce1e0f0066915f211e3a5d5c951c5c3e93f3e98 /ui/app-start-intent/src
parent60968089ae4afe13ba48d64346ea39c542ad457b (diff)
downloadAntennaPod-24ea4708ea318e923eafdc222c89a158567d1f52.zip
Remove PlaybackServiceCallbacks
Diffstat (limited to 'ui/app-start-intent/src')
-rw-r--r--ui/app-start-intent/src/main/AndroidManifest.xml1
-rw-r--r--ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/MainActivityStarter.java41
-rw-r--r--ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/VideoPlayerActivityStarter.java38
-rw-r--r--ui/app-start-intent/src/main/res/values/pending_intent.xml12
4 files changed, 92 insertions, 0 deletions
diff --git a/ui/app-start-intent/src/main/AndroidManifest.xml b/ui/app-start-intent/src/main/AndroidManifest.xml
new file mode 100644
index 000000000..9296616f9
--- /dev/null
+++ b/ui/app-start-intent/src/main/AndroidManifest.xml
@@ -0,0 +1 @@
+<manifest package="de.danoeh.antennapod.ui.appstartintent" />
diff --git a/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/MainActivityStarter.java b/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/MainActivityStarter.java
new file mode 100644
index 000000000..33f96f141
--- /dev/null
+++ b/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/MainActivityStarter.java
@@ -0,0 +1,41 @@
+package de.danoeh.antennapod.ui.appstartintent;
+
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+
+/**
+ * Launches the main activity of the app with specific arguments.
+ * Does not require a dependency on the actual implementation of the activity.
+ */
+public class MainActivityStarter {
+ public static final String INTENT = "de.danoeh.antennapod.intents.MAIN_ACTIVITY";
+ public static final String EXTRA_OPEN_PLAYER = "open_player";
+
+ private final Intent intent;
+ private final Context context;
+
+ public MainActivityStarter(Context context) {
+ this.context = context;
+ intent = new Intent(INTENT);
+ intent.setPackage(context.getPackageName());
+ }
+
+ public Intent getIntent() {
+ return intent;
+ }
+
+ public PendingIntent getPendingIntent() {
+ return PendingIntent.getActivity(context, R.id.pending_intent_player_activity,
+ getIntent(), PendingIntent.FLAG_UPDATE_CURRENT);
+ }
+
+ public void start() {
+ context.startActivity(getIntent());
+ }
+
+ public MainActivityStarter withOpenPlayer() {
+ intent.putExtra(EXTRA_OPEN_PLAYER, true);
+ return this;
+ }
+}
diff --git a/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/VideoPlayerActivityStarter.java b/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/VideoPlayerActivityStarter.java
new file mode 100644
index 000000000..7536d34b6
--- /dev/null
+++ b/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/VideoPlayerActivityStarter.java
@@ -0,0 +1,38 @@
+package de.danoeh.antennapod.ui.appstartintent;
+
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Build;
+
+/**
+ * Launches the video player activity of the app with specific arguments.
+ * Does not require a dependency on the actual implementation of the activity.
+ */
+public class VideoPlayerActivityStarter {
+ public static final String INTENT = "de.danoeh.antennapod.intents.VIDEO_PLAYER";
+ private final Intent intent;
+ private final Context context;
+
+ public VideoPlayerActivityStarter(Context context) {
+ this.context = context;
+ intent = new Intent(INTENT);
+ intent.setPackage(context.getPackageName());
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
+ }
+ }
+
+ public Intent getIntent() {
+ return intent;
+ }
+
+ public PendingIntent getPendingIntent() {
+ return PendingIntent.getActivity(context, R.id.pending_intent_video_player,
+ getIntent(), PendingIntent.FLAG_UPDATE_CURRENT);
+ }
+
+ public void start() {
+ context.startActivity(getIntent());
+ }
+}
diff --git a/ui/app-start-intent/src/main/res/values/pending_intent.xml b/ui/app-start-intent/src/main/res/values/pending_intent.xml
new file mode 100644
index 000000000..1e426e954
--- /dev/null
+++ b/ui/app-start-intent/src/main/res/values/pending_intent.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <item name="pending_intent_download_service_notification" type="id"/>
+ <item name="pending_intent_download_service_auth" type="id"/>
+ <item name="pending_intent_download_service_report" type="id"/>
+ <item name="pending_intent_download_service_autodownload_report" type="id"/>
+ <item name="pending_intent_allow_stream_always" type="id"/>
+ <item name="pending_intent_allow_stream_this_time" type="id"/>
+ <item name="pending_intent_player_activity" type="id"/>
+ <item name="pending_intent_video_player" type="id"/>
+ <item name="pending_intent_sync_error" type="id"/>
+</resources>