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 b5faaa7f75
commit 6de5a8cf04
16 changed files with 524 additions and 226 deletions

View file

@ -741,4 +741,5 @@
<string name="import_subscriptions_hint">Importer ou exporter des abonnements à partir du menu</string>
<string name="app_update_unavailable_toast">Vous utilisez la dernière version de NewPipe</string>
<string name="app_update_available_notification_text">Appuyez pour télécharger %s</string>
<string name="msg_failed_to_copy">Échec de la copie dans le presse-papiers</string>
</resources>