summaryrefslogtreecommitdiff
path: root/ui/app-start-intent
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2023-05-05 23:09:03 +0200
committerGitHub <noreply@github.com>2023-05-05 23:09:03 +0200
commit6d7bfef8a5fe8180f13904739996bb2b8de8a0d4 (patch)
tree84f246b74fe7254678788e9f206d81d1a30ffa5e /ui/app-start-intent
parent4c286931cd2dbd9038022f808f9d8a73ccbb6759 (diff)
downloadAntennaPod-6d7bfef8a5fe8180f13904739996bb2b8de8a0d4.zip
Download Service Rewrite (#6420)
Diffstat (limited to 'ui/app-start-intent')
-rw-r--r--ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/DownloadAuthenticationActivityStarter.java39
-rw-r--r--ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/MainActivityStarter.java9
2 files changed, 9 insertions, 39 deletions
diff --git a/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/DownloadAuthenticationActivityStarter.java b/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/DownloadAuthenticationActivityStarter.java
deleted file mode 100644
index 03c5e915e..000000000
--- a/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/DownloadAuthenticationActivityStarter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package de.danoeh.antennapod.ui.appstartintent;
-
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Build;
-import android.os.Parcelable;
-
-/**
- * Launches the download authentication activity of the app with specific arguments.
- * Does not require a dependency on the actual implementation of the activity.
- */
-public class DownloadAuthenticationActivityStarter {
- public static final String INTENT = "de.danoeh.antennapod.intents.DOWNLOAD_AUTH_ACTIVITY";
- public static final String EXTRA_DOWNLOAD_REQUEST = "download_request";
-
- private final Intent intent;
- private final Context context;
- private final long feedFileId;
-
- public DownloadAuthenticationActivityStarter(Context context, long feedFileId, Parcelable downloadRequest) {
- this.context = context;
- this.feedFileId = feedFileId;
- intent = new Intent(INTENT);
- intent.setAction("request" + feedFileId);
- intent.putExtra(EXTRA_DOWNLOAD_REQUEST, downloadRequest);
- intent.setPackage(context.getPackageName());
- }
-
- public Intent getIntent() {
- return intent;
- }
-
- public PendingIntent getPendingIntent() {
- return PendingIntent.getActivity(context.getApplicationContext(),
- ("downloadAuth" + feedFileId).hashCode(), getIntent(),
- PendingIntent.FLAG_ONE_SHOT | (Build.VERSION.SDK_INT >= 23 ? PendingIntent.FLAG_IMMUTABLE : 0));
- }
-}
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
index 1463978ee..c635ff0cc 100644
--- 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
@@ -17,6 +17,7 @@ public class MainActivityStarter {
public static final String EXTRA_ADD_TO_BACK_STACK = "add_to_back_stack";
public static final String EXTRA_FRAGMENT_TAG = "fragment_tag";
public static final String EXTRA_OPEN_DRAWER = "open_drawer";
+ public static final String EXTRA_OPEN_DOWNLOAD_LOGS = "open_download_logs";
public static final String EXTRA_FRAGMENT_ARGS = "fragment_args";
private final Intent intent;
@@ -30,6 +31,9 @@ public class MainActivityStarter {
}
public Intent getIntent() {
+ if (fragmentArgs != null) {
+ intent.putExtra(EXTRA_FRAGMENT_ARGS, fragmentArgs);
+ }
return intent;
}
@@ -67,6 +71,11 @@ public class MainActivityStarter {
return this;
}
+ public MainActivityStarter withDownloadLogsOpen() {
+ intent.putExtra(EXTRA_OPEN_DOWNLOAD_LOGS, true);
+ return this;
+ }
+
public MainActivityStarter withFragmentArgs(String name, boolean value) {
if (fragmentArgs == null) {
fragmentArgs = new Bundle();