Add ability to copy hashtags, URLs and timestamps in descriptions on long-press

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.
This commit is contained in:
AudricV 2022-07-16 13:33:25 +02:00 committed by Stypox
parent 262b3a2945
commit cdd5e89b86
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23
16 changed files with 524 additions and 226 deletions

View file

@ -327,6 +327,7 @@
<string name="msg_calculating_hash">Calculating hash</string>
<string name="msg_wait">Please wait…</string>
<string name="msg_copied">Copied to clipboard</string>
<string name="msg_failed_to_copy">Failed to copy to clipboard</string>
<string name="no_available_dir">Please define a download folder later in settings</string>
<string name="no_dir_yet">No download folder set yet, choose the default download folder now</string>
<string name="msg_popup_permission">This permission is needed to\nopen in popup mode</string>