diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java
index a148ddb4f..7bb7361f0 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java
@@ -391,7 +391,8 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
break;
case R.id.share_item:
if (feedItem != null) {
- new ShareDialog(this, feedItem).show(((AppCompatActivity) this).getSupportFragmentManager(), "ShareEpisodeDialog");
+ new ShareDialog(this, feedItem)
+ .show(((AppCompatActivity) this).getSupportFragmentManager(), "ShareEpisodeDialog");
}
break;
default:
diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/ShareDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/ShareDialog.java
index 2a8364199..7bc7f5e67 100644
--- a/app/src/main/java/de/danoeh/antennapod/dialog/ShareDialog.java
+++ b/app/src/main/java/de/danoeh/antennapod/dialog/ShareDialog.java
@@ -3,7 +3,9 @@ package de.danoeh.antennapod.dialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.SharedPreferences;
import android.os.Bundle;
+import android.preference.PreferenceManager;
import android.view.View;
import android.widget.RadioButton;
import android.widget.RadioGroup;
@@ -15,6 +17,7 @@ import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.feed.FeedItem;
+import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.util.ShareUtils;
public class ShareDialog extends DialogFragment {
@@ -27,10 +30,12 @@ public class ShareDialog extends DialogFragment {
private RadioButton radioEpisodeWebsite;
private RadioButton radioMediaFile;
private Switch switchStartAt;
+ private SharedPreferences prefs;
public ShareDialog(Context ctx, FeedItem item) {
this.ctx = ctx;
this.item = item;
+ prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
}
@NonNull
@@ -55,15 +60,23 @@ public class ShareDialog extends DialogFragment {
if (radioEpisodeWebsite.isChecked()) {
if (switchStartAt.isChecked()) {
ShareUtils.shareFeedItemLink(ctx, item, true);
+ prefs.edit().putBoolean(UserPreferences.PREF_SHARE_EPISODE_START_AT, true).apply();
} else {
ShareUtils.shareFeedItemLink(ctx, item);
+ prefs.edit().putBoolean(UserPreferences.PREF_SHARE_EPISODE_START_AT, false).apply();
}
+ prefs.edit().putBoolean(UserPreferences.PREF_SHARE_EPISODE_WEBSITE, true).apply();
+ prefs.edit().putBoolean(UserPreferences.PREF_SHARE_EPISODE_MEDIA, false).apply();
} else {
if (switchStartAt.isChecked()) {
ShareUtils.shareFeedItemDownloadLink(ctx, item, true);
+ prefs.edit().putBoolean(UserPreferences.PREF_SHARE_EPISODE_START_AT, true).apply();
} else {
ShareUtils.shareFeedItemDownloadLink(ctx, item);
+ prefs.edit().putBoolean(UserPreferences.PREF_SHARE_EPISODE_START_AT, false).apply();
}
+ prefs.edit().putBoolean(UserPreferences.PREF_SHARE_EPISODE_MEDIA, true).apply();
+ prefs.edit().putBoolean(UserPreferences.PREF_SHARE_EPISODE_WEBSITE, false).apply();
}
}
})
@@ -87,5 +100,16 @@ public class ShareDialog extends DialogFragment {
radioMediaFile.setVisibility(View.GONE);
radioEpisodeWebsite.setChecked(true);
}
+
+ if (radioEpisodeWebsite.getVisibility() == View.VISIBLE && radioMediaFile.getVisibility() == View.VISIBLE) {
+ boolean radioEpisodeWebsiteIsChecked = prefs.getBoolean(UserPreferences.PREF_SHARE_EPISODE_WEBSITE, false);
+ radioEpisodeWebsite.setChecked(radioEpisodeWebsiteIsChecked);
+
+ boolean radioMediaIsChecked = prefs.getBoolean(UserPreferences.PREF_SHARE_EPISODE_MEDIA, false);
+ radioMediaFile.setChecked(radioMediaIsChecked);
+ }
+
+ boolean switchIsChecked = prefs.getBoolean(UserPreferences.PREF_SHARE_EPISODE_START_AT, false);
+ switchStartAt.setChecked(switchIsChecked);
}
}
diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java
index 92a88263a..c63bdc3c4 100644
--- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java
+++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java
@@ -236,7 +236,8 @@ public class FeedItemMenuHandler {
IntentUtils.openInBrowser(context, FeedItemUtil.getLinkWithFallback(selectedItem));
break;
case R.id.share_item:
- new ShareDialog(context, selectedItem).show(((AppCompatActivity) context).getSupportFragmentManager(), "ShareEpisodeDialog");
+ new ShareDialog(context, selectedItem)
+ .show(((AppCompatActivity) context).getSupportFragmentManager(), "ShareEpisodeDialog");
break;
default:
Log.d(TAG, "Unknown menuItemId: " + menuItemId);
diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java
index 876251563..8c80ff61d 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java
@@ -112,6 +112,11 @@ public class UserPreferences {
public static final String PREF_IMAGE_CACHE_SIZE = "prefImageCacheSize";
public static final String PREF_DELETE_REMOVES_FROM_QUEUE = "prefDeleteRemovesFromQueue";
+ // Dialogs
+ public static final String PREF_SHARE_EPISODE_WEBSITE = "prefShareEpisodeWebsite";
+ public static final String PREF_SHARE_EPISODE_MEDIA = "prefShareEpisodeMedia";
+ public static final String PREF_SHARE_EPISODE_START_AT = "prefShareEpisodeStartAt";
+
// Mediaplayer
public static final String PREF_MEDIA_PLAYER = "prefMediaPlayer";
public static final String PREF_MEDIA_PLAYER_EXOPLAYER = "exoplayer";
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index 071e18119..3a2ae59df 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -765,7 +765,7 @@
Remind me later
Sure, let\'s do this!
-
+
Share…
Include:
Start at (timer)