Tiny add feed improvements

This commit is contained in:
ByteHamster 2020-03-17 23:14:09 +01:00
parent bb13b1e5f3
commit 8486c33815
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);