From 8486c338152ae09414ce628ff028720f5d15b200 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Tue, 17 Mar 2020 23:14:09 +0100 Subject: [PATCH] Tiny add feed improvements --- .../danoeh/antennapod/activity/OnlineFeedViewActivity.java | 7 +++++++ .../antennapod/adapter/FeedItemlistDescriptionAdapter.java | 3 +++ .../de/danoeh/antennapod/fragment/AddFeedFragment.java | 5 ++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java index 4e849b9d9..124394b64 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java @@ -573,6 +573,13 @@ public class OnlineFeedViewActivity extends AppCompatActivity { titles.add(urlsMap.get(url)); } + if (urls.size() == 1) { + // Skip dialog and display the item directly + resetIntent(urls.get(0), titles.get(0)); + startFeedDownload(urls.get(0), null, null); + return true; + } + final ArrayAdapter adapter = new ArrayAdapter<>(OnlineFeedViewActivity.this, R.layout.ellipsize_start_listitem, R.id.txtvTitle, titles); DialogInterface.OnClickListener onClickListener = (dialog, which) -> { String selectedUrl = urls.get(which); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java index f49892b63..849bb3b64 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java @@ -63,6 +63,9 @@ public class FeedItemlistDescriptionAdapter extends ArrayAdapter { holder.description.setTag(Boolean.FALSE); // not expanded holder.preview.setVisibility(View.GONE); holder.preview.setOnClickListener(v -> { + if (item.getMedia() == null) { + return; + } Playable playable = new RemoteMedia(item); if (!NetworkUtils.isStreamingAllowed()) { new StreamingConfirmationDialog(getContext(), playable).show(); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java index 3ba6be3d9..8f6f4d964 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java @@ -76,7 +76,10 @@ public class AddFeedFragment extends Fragment { EditText editText = content.findViewById(R.id.text); editText.setHint(R.string.add_podcast_by_url_hint); ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE); - editText.setText(clipboard.getText()); + String clipboardContent = clipboard.getText().toString(); + if (clipboardContent.startsWith("http")) { + editText.setText(clipboardContent); + } builder.setView(content); builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> addUrl(editText.getText().toString())); builder.setNegativeButton(R.string.cancel_label, null);