Apps targeting {@link android.os.Build.VERSION_CODES#R} on devices running OS versions {@link android.os.Build.VERSION_CODES#R Android R} or later, will receive a {@code null} value when preferences are cleared.
This commit adds the ability to copy to clipboard hashtags, URLs and timestamps
when long-pressing them.
Some changes in our TextView class related to text setting have been required
and metadata items are now using a NewPipeTextView instead of a standard
TextView.
Six new classes have been added:
- a custom LinkMovementMethod class;
- a custom ClickableSpan class, LongPressClickableSpan, in order to set a long
press event;
- a class to avoid code duplication in CommentTextOnTouchListener, TouchUtils;
- three implementations of LongPressClickableSpan used when linkifying text:
- HashtagLongPressClickableSpan for hashtags;
- TimestampLongPressClickableSpan for timestamps;
- UrlLongPressClickableSpan for URLs.
We provide visual feedback via a toast to the user that, well, they're supposed to wait; but with the benefit of the cache openAddToPlaylistDialog() may return (almost) immediately, which would render the toast otiose (if not a bit confusing). This commit improves that by cancelling the toast once the wait's over
... (by 'abusing' RxJava's ambWith();
ref on compose() and Transformer: https://blog.danlew.net/2015/03/02/dont-break-the-chain/
and for me, first time laying my hands at RxJava so kindly bear with me; open for suggestions)
pending result for openAddToPlaylistDialog() and openDownloadDialog()
Despite marked deprecated, setRetainInstance(true) is probably our best bet (since a ViewModel is probably too overkill for our present purpose)
so we won't hold up UI while fetching media info for Add to Playlist or Download actions
lest user might think it freezes when in fact a network request is underway
- Handle finish() call instead of passing around callbacks to setOnDismissListener()
- Don't start over again if returning to DialogFragment before orientation change
This seems to solve a bug where the Open action menu dialog does not appear the first time on cold start on older Android (8.0).
This is also the order of things in MainActivity and probably good practice.