Merge pull request #3939 from ByteHamster/add-feed-only-url

Tiny add feed improvements
This commit is contained in:
H. Lehmann 2020-03-18 00:08:23 +01:00 committed by GitHub
commit 05495d2110
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View File

@ -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<String> adapter = new ArrayAdapter<>(OnlineFeedViewActivity.this, R.layout.ellipsize_start_listitem, R.id.txtvTitle, titles);
DialogInterface.OnClickListener onClickListener = (dialog, which) -> {
String selectedUrl = urls.get(which);

View File

@ -63,6 +63,9 @@ public class FeedItemlistDescriptionAdapter extends ArrayAdapter<FeedItem> {
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();

View File

@ -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);