summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurt Snyder <snyder.burt@gmail.com>2020-07-11 12:01:41 -0400
committerGitHub <noreply@github.com>2020-07-11 12:01:41 -0400
commitd90ca124c0f755651334011d11584f58dd0ce3bc (patch)
tree83a5357d61a70c49b1064699e024e662bb23711a
parent2ce23f6868a1205996955f7cbbbb004246ebf9b1 (diff)
parentd110b1818bbfb0bbc9677b9fc44860c2a1a870ea (diff)
downloadAntennaPod-d90ca124c0f755651334011d11584f58dd0ce3bc.zip
Merge pull request #9 from AntennaPod/develop
update me
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.md53
-rw-r--r--.github/ISSUE_TEMPLATE/config.yml5
-rw-r--r--.github/ISSUE_TEMPLATE/feature_request.md25
-rw-r--r--app/src/androidTest/java/de/test/antennapod/dialogs/ShareDialogTest.java92
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java53
-rw-r--r--app/src/main/java/de/danoeh/antennapod/dialog/ShareDialog.java120
-rw-r--r--app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java36
-rw-r--r--app/src/main/res/layout/share_episode_dialog.xml40
-rw-r--r--app/src/main/res/menu/feeditem_options.xml24
-rw-r--r--app/src/main/res/menu/feedlist.xml24
-rw-r--r--app/src/main/res/menu/mediaplayer.xml24
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java3
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java3
-rw-r--r--core/src/main/res/values/strings.xml13
14 files changed, 341 insertions, 174 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index cb7c71b63..25697186a 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -4,46 +4,24 @@ about: Create a report to help us improve existing features
---
-<!--
-DELETE ME
+# Checklist
+<!-- Place an x in the boxes to tick them: [x] -->
-Use the search function to see if someone else has already submitted the same bug report.
+- [ ] I have used the search function to see if someone else has already submitted the same bug report.
+- [ ] I will describe the problem with as much detail as possible.
+- [ ] If the bug only to occurs with a certain podcast, I will include the URL of that podcast.
-Try to describe the problem with as much detail as possible.
-
-Some bugs may only occur on certain devices or versions of Android. Please add information about your device and the version of Android that is running on it (you can look these up under `Settings → About Phone`), as well as which version of AntennaPod you are using.
-
-If the bug only seems to occur with a certain podcast, please include the URL of that podcast.
-
-If possible, add instructions on how to reproduce the bug.
-
-If possible, add a logfile to your post. This is especially useful if the bug makes the application crash. AntennaPod has an `export logs` feature for this.
-
-Usually, you can take a screenshot of your smartphone by pressing *Power* + *Volume down* for a few seconds.
-
-You don't need to adhere to the template strictly. Feel free to leave out information you feel is not important or does not make sense.
-
-If you are experiencing a crash, including the stacktrace will likely get it fixed sooner.
--->
-
-<!-- READ THIS: The latest version may be different depending on your device. You can find the version in AntennaPod's settings. -->
-**App version**: x.y.z (state whether from Google Play/F-Droid/Custom built APK)
+# System info
+<!-- The following information is very important to fill out because some bugs may only occur on certain devices or versions of Android. -->
+**App version**: x.y.z (Where did you download the app?)
+<!-- The latest version may be different depending on your device. You can find the version in AntennaPod's settings. -->
**Android version**: 5.x (Please mention if you are using a custom rom!)
-
**Device model**:
-
-**Expected behaviour**:
-
-
-**Current behaviour**:
-
-
-**First occurred**: (e.g. about x days/weeks ago)
-
+# Bug description
**Steps to reproduce**:
1. This
@@ -51,11 +29,18 @@ If you are experiencing a crash, including the stacktrace will likely get it fix
3. Then this
4. Etc.
+**Expected behaviour**:
+<!-- After following the steps, what did you think AntennaPod would do? -->
-**Environment**: (Settings you have changed (e.g. Auto Download). "Unusual" devices you use (e.g. Bluetooth headphones). Did you select another media player?)
+**Current behaviour**:
+<!-- What did AntennaPod do instead? Screenshots might help. Usually, you can take a screenshot of your smartphone by pressing *Power* + *Volume down* for a few seconds. -->
+**First occurred**: (e.g. about x days/weeks ago)
+
+**Environment**: (Settings you have changed (e.g. Auto Download). "Unusual" devices you use (e.g. Bluetooth headphones). Did you select another media player?)
-**Stacktrace/Logcat**:
+**Stacktrace/Logcat**:
+<!-- If you are experiencing a crash, including the stacktrace will likely get it fixed sooner. AntennaPod has an `export logs` feature for this. -->
```
[if available]
```
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 000000000..04c65727a
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,5 @@
+blank_issues_enabled: false
+contact_links:
+ - name: AntennaPod Forum
+ url: https://forum.antennapod.org/
+ about: Reduce developer's workload by asking other users.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
index 8719120cd..bb60476d6 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -4,28 +4,25 @@ about: Request a new feature
---
-<!--
-DELETE ME
+# Checklist
+<!-- Place an x in the boxes to tick them: [x] -->
-Make sure you are using the latest version of AntennaPod. Perhaps the feature you are looking for has already been implemented.
+- [ ] I have used the search function to see if someone else has already submitted the same feature request.
+- [ ] I will only create one feature request per issue.
+- [ ] I will describe the problem with as much detail as possible.
-Use the search function to see if someone else has already submitted the same feature request. If there is another request already, please upvote the first post instead of commenting something like "I also want this".
+# System info
-To make it easier for us to keep track of requests, please only make one feature request per issue.
-
-Give a brief explanation about the problem that may currently exist and how your requested feature solves this problem.
-
-Try to be as specific as possible. Please not only explain what the feature does, but also how. If your request is about (or includes) changing or extending the UI, describe what the UI would look like and how the user would interact with it.
--->
-
-<!-- READ THIS: The latest version may be different depending on your device. You can find the version in AntennaPod's settings. -->
+<!-- The latest version may be different depending on your device. You can find the version in AntennaPod's settings. -->
**App version**: x.y.z (state whether from Google Play/F-Droid/Custom built APK)
+# Feature description
**Problem you may be having, or feature you want**:
-
+<!-- Give a brief explanation about the problem that may currently exist -->
**Suggested solution**:
-
+<!-- Describe how your requested feature solves this problem. Try to be as specific as possible. Please not only explain what the feature does, but also how. -->
**Screenshots / Drawings / Technical details**:
+<!-- If your request is about (or includes) changing or extending the UI, describe what the UI would look like and how the user would interact with it. -->
diff --git a/app/src/androidTest/java/de/test/antennapod/dialogs/ShareDialogTest.java b/app/src/androidTest/java/de/test/antennapod/dialogs/ShareDialogTest.java
new file mode 100644
index 000000000..3f90f9ce8
--- /dev/null
+++ b/app/src/androidTest/java/de/test/antennapod/dialogs/ShareDialogTest.java
@@ -0,0 +1,92 @@
+package de.test.antennapod.dialogs;
+
+import android.content.Context;
+import android.content.Intent;
+import android.view.View;
+
+import org.hamcrest.Matcher;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.List;
+
+import androidx.test.espresso.intent.rule.IntentsTestRule;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+import de.danoeh.antennapod.R;
+import de.danoeh.antennapod.activity.MainActivity;
+import de.danoeh.antennapod.core.feed.FeedItem;
+import de.danoeh.antennapod.core.storage.DBReader;
+import de.danoeh.antennapod.fragment.EpisodesFragment;
+import de.test.antennapod.EspressoTestUtils;
+import de.test.antennapod.ui.UITestUtils;
+
+import static androidx.test.espresso.Espresso.onView;
+import static androidx.test.espresso.action.ViewActions.click;
+import static androidx.test.espresso.action.ViewActions.scrollTo;
+import static androidx.test.espresso.assertion.ViewAssertions.matches;
+import static androidx.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition;
+import static androidx.test.espresso.matcher.ViewMatchers.hasMinimumChildCount;
+import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
+import static androidx.test.espresso.matcher.ViewMatchers.isRoot;
+import static androidx.test.espresso.matcher.ViewMatchers.withId;
+import static androidx.test.espresso.matcher.ViewMatchers.withText;
+import static de.test.antennapod.EspressoTestUtils.onDrawerItem;
+import static de.test.antennapod.EspressoTestUtils.openNavDrawer;
+import static de.test.antennapod.EspressoTestUtils.waitForView;
+import static de.test.antennapod.NthMatcher.first;
+import static org.hamcrest.CoreMatchers.allOf;
+
+/**
+ * User interface tests for share dialog.
+ */
+@RunWith(AndroidJUnit4.class)
+public class ShareDialogTest {
+
+ @Rule
+ public IntentsTestRule<MainActivity> activityRule = new IntentsTestRule<>(MainActivity.class, false, false);
+
+ private UITestUtils uiTestUtils;
+ protected Context context;
+
+ @Before
+ public void setUp() throws Exception {
+ context = InstrumentationRegistry.getInstrumentation().getTargetContext();
+ EspressoTestUtils.clearPreferences();
+ EspressoTestUtils.clearDatabase();
+ EspressoTestUtils.setLastNavFragment(EpisodesFragment.TAG);
+ uiTestUtils = new UITestUtils(context);
+ uiTestUtils.setup();
+ uiTestUtils.addLocalFeedData(true);
+
+ activityRule.launchActivity(new Intent());
+
+ openNavDrawer();
+ onDrawerItem(withText(R.string.episodes_label)).perform(click());
+ onView(isRoot()).perform(waitForView(withText(R.string.all_episodes_short_label), 1000));
+ onView(withText(R.string.all_episodes_short_label)).perform(click());
+
+ Matcher<View> allEpisodesMatcher;
+ final List<FeedItem> episodes = DBReader.getRecentlyPublishedEpisodes(0, 10);
+ allEpisodesMatcher = Matchers.allOf(withId(android.R.id.list), isDisplayed(), hasMinimumChildCount(2));
+ onView(isRoot()).perform(waitForView(allEpisodesMatcher, 1000));
+ onView(allEpisodesMatcher).perform(actionOnItemAtPosition(0, click()));
+ onView(first(EspressoTestUtils.actionBarOverflow())).perform(click());
+ }
+
+ @Test
+ public void testShareDialogDisplayed() throws InterruptedException {
+ onView(withText(R.string.share_label_with_ellipses)).perform(click());
+ onView(allOf(isDisplayed(), withText(R.string.share_label)));
+ }
+
+ @Test
+ public void testShareDialogCancelButton() {
+ onView(withText(R.string.share_label_with_ellipses)).perform(scrollTo()).perform(click());
+ onView(withText(R.string.cancel_label)).check(matches(isDisplayed())).perform(scrollTo()).perform(click());
+ }
+
+}
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 34c7e3aba..886835095 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java
@@ -18,16 +18,23 @@ import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
+
+import com.bumptech.glide.Glide;
+
+import org.apache.commons.lang3.StringUtils;
+import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
+
+import java.text.NumberFormat;
+
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
-import androidx.arch.core.util.Function;
+import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.app.ActivityOptionsCompat;
import androidx.core.content.ContextCompat;
-import androidx.core.util.Consumer;
-import androidx.core.util.Supplier;
-import com.bumptech.glide.Glide;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.event.PlaybackPositionEvent;
import de.danoeh.antennapod.core.feed.FeedItem;
@@ -39,7 +46,6 @@ import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter;
import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.core.util.FeedItemUtil;
-import de.danoeh.antennapod.core.util.Flavors;
import de.danoeh.antennapod.core.util.IntentUtils;
import de.danoeh.antennapod.core.util.ShareUtils;
import de.danoeh.antennapod.core.util.StorageUtils;
@@ -51,18 +57,13 @@ import de.danoeh.antennapod.core.util.playback.Playable;
import de.danoeh.antennapod.core.util.playback.PlaybackController;
import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter;
import de.danoeh.antennapod.dialog.PlaybackControlsDialog;
+import de.danoeh.antennapod.dialog.ShareDialog;
import de.danoeh.antennapod.dialog.SkipPreferenceDialog;
import de.danoeh.antennapod.dialog.SleepTimerDialog;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
-import org.apache.commons.lang3.StringUtils;
-import org.greenrobot.eventbus.EventBus;
-import org.greenrobot.eventbus.Subscribe;
-import org.greenrobot.eventbus.ThreadMode;
-
-import java.text.NumberFormat;
/**
@@ -313,13 +314,8 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
boolean isItemAndHasLink = isFeedMedia &&
ShareUtils.hasLinkToShare(((FeedMedia) media).getItem());
- menu.findItem(R.id.share_link_item).setVisible(isItemAndHasLink);
- menu.findItem(R.id.share_link_with_position_item).setVisible(isItemAndHasLink);
boolean isItemHasDownloadLink = isFeedMedia && ((FeedMedia) media).getDownload_url() != null;
- menu.findItem(R.id.share_download_url_item).setVisible(isItemHasDownloadLink);
- menu.findItem(R.id.share_download_url_with_position_item).setVisible(isItemHasDownloadLink);
- menu.findItem(R.id.share_file).setVisible(isFeedMedia && ((FeedMedia) media).fileExists());
menu.findItem(R.id.share_item).setVisible(hasWebsiteLink || isItemAndHasLink || isItemHasDownloadLink);
@@ -393,29 +389,10 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
case R.id.visit_website_item:
IntentUtils.openInBrowser(MediaplayerActivity.this, getWebsiteLinkWithFallback(media));
break;
- case R.id.share_link_item:
- if (feedItem != null) {
- ShareUtils.shareFeedItemLink(this, feedItem);
- }
- break;
- case R.id.share_download_url_item:
- if (feedItem != null) {
- ShareUtils.shareFeedItemDownloadLink(this, feedItem);
- }
- break;
- case R.id.share_link_with_position_item:
+ case R.id.share_item:
if (feedItem != null) {
- ShareUtils.shareFeedItemLink(this, feedItem, true);
- }
- break;
- case R.id.share_download_url_with_position_item:
- if (feedItem != null) {
- ShareUtils.shareFeedItemDownloadLink(this, feedItem, true);
- }
- break;
- case R.id.share_file:
- if (media instanceof FeedMedia) {
- ShareUtils.shareFeedItemFile(this, ((FeedMedia) media));
+ ShareDialog shareDialog = ShareDialog.newInstance(feedItem);
+ shareDialog.show(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
new file mode 100644
index 000000000..bb2d34ac0
--- /dev/null
+++ b/app/src/main/java/de/danoeh/antennapod/dialog/ShareDialog.java
@@ -0,0 +1,120 @@
+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.view.View;
+import android.widget.CheckBox;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+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.util.ShareUtils;
+
+public class ShareDialog extends DialogFragment {
+
+ private static final String ARGUMENT_FEED_ITEM = "feedItem";
+
+ private static final String TAG = "ShareDialog";
+ private Context ctx;
+ private FeedItem item;
+
+ private static final String PREF_SHARE_DIALOG_OPTION = "prefShareDialogOption";
+ private static final String PREF_SHARE_EPISODE_START_AT = "prefShareEpisodeStartAt";
+
+ private RadioGroup radioGroup;
+ private RadioButton radioEpisodeWebsite;
+ private RadioButton radioMediaFile;
+ private CheckBox checkBoxStartAt;
+ private SharedPreferences prefs;
+
+ public ShareDialog() {
+ // Empty constructor required for DialogFragment
+ }
+
+ public static ShareDialog newInstance(FeedItem item) {
+ Bundle arguments = new Bundle();
+ arguments.putSerializable(ARGUMENT_FEED_ITEM, item);
+ ShareDialog dialog = new ShareDialog();
+ dialog.setArguments(arguments);
+ return dialog;
+ }
+
+ @NonNull
+ @Override
+ public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
+ if (getArguments() != null) {
+ ctx = getActivity();
+ item = (FeedItem) getArguments().getSerializable(ARGUMENT_FEED_ITEM);
+ prefs = getActivity().getSharedPreferences("ShareDialog", Context.MODE_PRIVATE);
+ }
+
+ View content = View.inflate(ctx, R.layout.share_episode_dialog, null);
+ AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
+ builder.setTitle(R.string.share_label);
+ builder.setView(content);
+
+ radioGroup = content.findViewById(R.id.share_dialog_radio_group);
+ radioEpisodeWebsite = content.findViewById(R.id.share_episode_website_radio);
+ radioMediaFile = content.findViewById(R.id.share_media_file_radio);
+ checkBoxStartAt = content.findViewById(R.id.share_start_at_timer_dialog);
+
+ setupOptions();
+
+ builder.setPositiveButton(R.string.share_label, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ boolean includePlaybackPosition = checkBoxStartAt.isChecked();
+ if (radioEpisodeWebsite.isChecked()) {
+ ShareUtils.shareFeedItemLink(ctx, item, includePlaybackPosition);
+ prefs.edit().putString(PREF_SHARE_DIALOG_OPTION, "website").apply();
+ } else {
+ ShareUtils.shareFeedItemDownloadLink(ctx, item, includePlaybackPosition);
+ prefs.edit().putString(PREF_SHARE_DIALOG_OPTION, "media").apply();
+ }
+ prefs.edit().putBoolean(PREF_SHARE_EPISODE_START_AT, includePlaybackPosition).apply();
+ }
+ }).setNegativeButton(R.string.cancel_label, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int id) {
+ dialog.dismiss();
+ }
+ });
+
+ return builder.create();
+ }
+
+ private void setupOptions() {
+ final boolean hasMedia = item.getMedia() != null;
+
+ if (!ShareUtils.hasLinkToShare(item)) {
+ radioEpisodeWebsite.setVisibility(View.GONE);
+ radioMediaFile.setChecked(true);
+ }
+
+ if (!hasMedia || item.getMedia().getDownload_url() == null) {
+ radioMediaFile.setVisibility(View.GONE);
+ radioEpisodeWebsite.setChecked(true);
+ }
+
+ if (radioEpisodeWebsite.getVisibility() == View.VISIBLE && radioMediaFile.getVisibility() == View.VISIBLE) {
+ String option = prefs.getString(PREF_SHARE_DIALOG_OPTION, "website");
+ if (option.equals("website")) {
+ radioEpisodeWebsite.setChecked(true);
+ radioMediaFile.setChecked(false);
+ } else {
+ radioEpisodeWebsite.setChecked(false);
+ radioMediaFile.setChecked(true);
+ }
+ }
+
+ boolean switchIsChecked = prefs.getBoolean(PREF_SHARE_EPISODE_START_AT, false);
+ checkBoxStartAt.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 1f15f66ec..bddafb75e 100644
--- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java
+++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java
@@ -2,13 +2,14 @@ package de.danoeh.antennapod.menuhandler;
import android.content.Context;
import android.os.Handler;
-import androidx.annotation.NonNull;
-import com.google.android.material.snackbar.Snackbar;
-import androidx.fragment.app.Fragment;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
+import com.google.android.material.snackbar.Snackbar;
+
+import androidx.annotation.NonNull;
+import androidx.fragment.app.Fragment;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.core.feed.FeedItem;
@@ -23,6 +24,7 @@ import de.danoeh.antennapod.core.sync.model.EpisodeAction;
import de.danoeh.antennapod.core.util.FeedItemUtil;
import de.danoeh.antennapod.core.util.IntentUtils;
import de.danoeh.antennapod.core.util.ShareUtils;
+import de.danoeh.antennapod.dialog.ShareDialog;
/**
* Handles interactions with the FeedItemMenu.
@@ -61,20 +63,9 @@ public class FeedItemMenuHandler {
}
if (!ShareUtils.hasLinkToShare(selectedItem)) {
setItemVisibility(menu, R.id.visit_website_item, false);
- setItemVisibility(menu, R.id.share_link_item, false);
- setItemVisibility(menu, R.id.share_link_with_position_item, false);
- }
- if (!hasMedia || selectedItem.getMedia().getDownload_url() == null) {
- setItemVisibility(menu, R.id.share_download_url_item, false);
- setItemVisibility(menu, R.id.share_download_url_with_position_item, false);
- }
- if(!hasMedia || selectedItem.getMedia().getPosition() <= 0) {
- setItemVisibility(menu, R.id.share_download_url_with_position_item, false);
- setItemVisibility(menu, R.id.share_link_with_position_item, false);
}
boolean fileDownloaded = hasMedia && selectedItem.getMedia().fileExists();
- setItemVisibility(menu, R.id.share_file, fileDownloaded);
setItemVisibility(menu, R.id.remove_new_flag_item, selectedItem.isNew());
if (selectedItem.isPlayed()) {
@@ -243,20 +234,9 @@ public class FeedItemMenuHandler {
case R.id.visit_website_item:
IntentUtils.openInBrowser(context, FeedItemUtil.getLinkWithFallback(selectedItem));
break;
- case R.id.share_link_item:
- ShareUtils.shareFeedItemLink(context, selectedItem);
- break;
- case R.id.share_download_url_item:
- ShareUtils.shareFeedItemDownloadLink(context, selectedItem);
- break;
- case R.id.share_link_with_position_item:
- ShareUtils.shareFeedItemLink(context, selectedItem, true);
- break;
- case R.id.share_download_url_with_position_item:
- ShareUtils.shareFeedItemDownloadLink(context, selectedItem, true);
- break;
- case R.id.share_file:
- ShareUtils.shareFeedItemFile(context, selectedItem.getMedia());
+ case R.id.share_item:
+ ShareDialog shareDialog = ShareDialog.newInstance(selectedItem);
+ shareDialog.show((fragment.getActivity().getSupportFragmentManager()), "ShareEpisodeDialog");
break;
default:
Log.d(TAG, "Unknown menuItemId: " + menuItemId);
diff --git a/app/src/main/res/layout/share_episode_dialog.xml b/app/src/main/res/layout/share_episode_dialog.xml
new file mode 100644
index 000000000..8cf955d4c
--- /dev/null
+++ b/app/src/main/res/layout/share_episode_dialog.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center"
+ android:padding="16dp">
+
+ <RadioGroup
+ android:id="@+id/share_dialog_radio_group"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:orientation="vertical">
+
+ <RadioButton android:id="@+id/share_episode_website_radio"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/share_dialog_episode_website_label"
+ android:checked="true"
+ />
+ <RadioButton android:id="@+id/share_media_file_radio"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/share_dialog_media_file_label"
+ />
+ </RadioGroup>
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="@string/share_dialog_include_label"/>
+
+ <CheckBox
+ android:id="@+id/share_start_at_timer_dialog"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/share_playback_position_dialog_label" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/app/src/main/res/menu/feeditem_options.xml b/app/src/main/res/menu/feeditem_options.xml
index e415ff85a..c29229e37 100644
--- a/app/src/main/res/menu/feeditem_options.xml
+++ b/app/src/main/res/menu/feeditem_options.xml
@@ -71,29 +71,7 @@
<item
android:id="@+id/share_item"
android:menuCategory="container"
- android:title="@string/share_label">
- <menu>
- <item
- android:id="@+id/share_link_item"
- android:menuCategory="container"
- android:title="@string/share_link_label" />
- <item
- android:id="@+id/share_link_with_position_item"
- android:menuCategory="container"
- android:title="@string/share_link_with_position_label" />
- <item
- android:id="@+id/share_download_url_item"
- android:menuCategory="container"
- android:title="@string/share_item_url_label" />
- <item
- android:id="@+id/share_download_url_with_position_item"
- android:menuCategory="container"
- android:title="@string/share_item_url_with_position_label" />
- <item
- android:id="@+id/share_file"
- android:menuCategory="container"
- android:title="@string/share_file_label" />
- </menu>
+ android:title="@string/share_label_with_ellipses">
</item>
<item
diff --git a/app/src/main/res/menu/feedlist.xml b/app/src/main/res/menu/feedlist.xml
index 939a51ab2..3614cfffa 100644
--- a/app/src/main/res/menu/feedlist.xml
+++ b/app/src/main/res/menu/feedlist.xml
@@ -52,19 +52,25 @@
android:title="@string/visit_website_label"
android:visible="true">
</item>
+
<item
- android:id="@+id/share_link_item"
- android:menuCategory="container"
- custom:showAsAction="collapseActionView"
- android:title="@string/share_website_url_label">
- </item>
- <item
- android:id="@+id/share_download_url_item"
+ android:id="@+id/share_item"
android:menuCategory="container"
- custom:showAsAction="collapseActionView"
- android:title="@string/share_feed_url_label">
+ custom:showAsAction="never"
+ android:title="@string/share_label_with_ellipses">
+ <menu>
+ <item
+ android:id="@+id/share_link_item"
+ android:title="@string/share_website_url_label">
+ </item>
+ <item
+ android:id="@+id/share_download_url_item"
+ android:title="@string/share_feed_url_label">
+ </item>
+ </menu>
</item>
+
<item
android:id="@+id/rename_item"
android:menuCategory="container"
diff --git a/app/src/main/res/menu/mediaplayer.xml b/app/src/main/res/menu/mediaplayer.xml
index a61616ce9..8afdba369 100644
--- a/app/src/main/res/menu/mediaplayer.xml
+++ b/app/src/main/res/menu/mediaplayer.xml
@@ -62,28 +62,6 @@
android:id="@+id/share_item"
android:menuCategory="container"
custom:showAsAction="never"
- android:title="@string/share_label">
- <menu>
- <item
- android:id="@+id/share_link_item"
- android:menuCategory="container"
- android:title="@string/share_link_label" />
- <item
- android:id="@+id/share_link_with_position_item"
- android:menuCategory="container"
- android:title="@string/share_link_with_position_label" />
- <item
- android:id="@+id/share_download_url_item"
- android:menuCategory="container"
- android:title="@string/share_item_url_label" />
- <item
- android:id="@+id/share_download_url_with_position_item"
- android:menuCategory="container"
- android:title="@string/share_item_url_with_position_label" />
- <item
- android:id="@+id/share_file"
- android:menuCategory="container"
- android:title="@string/share_file_label" />
- </menu>
+ android:title="@string/share_label_with_ellipses">
</item>
</menu> \ No newline at end of file
diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java
index 20ed402fc..60ebe6965 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java
@@ -7,6 +7,7 @@ import android.text.TextUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
+import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
@@ -24,7 +25,7 @@ import de.danoeh.antennapod.core.util.ShownotesProvider;
*
* @author daniel
*/
-public class FeedItem extends FeedComponent implements ShownotesProvider, ImageResource {
+public class FeedItem extends FeedComponent implements ShownotesProvider, ImageResource, Serializable {
/** tag that indicates this item is in the queue */
public static final String TAG_QUEUE = "Queue";
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
index 585510ef8..08480fddb 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java
@@ -1158,7 +1158,8 @@ public class PlaybackService extends MediaBrowserServiceCompat {
long capabilities = PlaybackStateCompat.ACTION_PLAY_PAUSE
| PlaybackStateCompat.ACTION_REWIND
| PlaybackStateCompat.ACTION_FAST_FORWARD
- | PlaybackStateCompat.ACTION_SKIP_TO_NEXT;
+ | PlaybackStateCompat.ACTION_SKIP_TO_NEXT
+ | PlaybackStateCompat.ACTION_SEEK_TO;
if (useSkipToPreviousForRewindInLockscreen()) {
// Workaround to fool Android so that Lockscreen will expose a skip-to-previous button,
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index 3e4891952..b5b327a90 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -136,12 +136,13 @@
<string name="feed_settings_label">Podcast settings</string>
<string name="rename_feed_label">Rename podcast</string>
<string name="remove_feed_label">Remove podcast</string>
- <string name="share_label">Share&#8230;</string>
+ <string name="share_label">Share</string>
+ <string name="share_label_with_ellipses">Share…</string>
<string name="share_link_label">Share Episode URL</string>
<string name="share_link_with_position_label">Share Episode URL with Position</string>
<string name="share_file_label">Share File</string>
- <string name="share_website_url_label">Share Website URL</string>
- <string name="share_feed_url_label">Share Podcast URL</string>
+ <string name="share_website_url_label">Website address</string>
+ <string name="share_feed_url_label">Podcast feed URL</string>
<string name="share_item_url_label">Share Media File URL</string>
<string name="share_item_url_with_position_label">Share Media File URL with Position</string>
<string name="feed_delete_confirmation_msg">Please confirm that you want to delete the podcast \"%1$s\" and ALL its episodes (including downloaded episodes).</string>
@@ -770,6 +771,12 @@
<string name="rating_later_label">Remind me later</string>
<string name="rating_now_label">Sure, let\'s do this!</string>
+ <!-- Share episode dialog -->
+ <string name="share_dialog_include_label">Include:</string>
+ <string name="share_playback_position_dialog_label">Playback position</string>
+ <string name="share_dialog_media_file_label">Media file URL</string>
+ <string name="share_dialog_episode_website_label">Episode webpage</string>
+
<!-- Audio controls -->
<string name="audio_controls">Audio controls</string>
<string name="playback_speed">Playback Speed</string>