Commit Graph

16 Commits

Author SHA1 Message Date
AudricV 1a8aa8b17e
Use a system chooser when opening links in browser in the case there is no browser available
This change makes the app using the behavior when there is no default browser
on Android 11 and lower, by opening a system chooser when there is no browser
available (on all Android versions).

Also catch any exception when the system chooser cannot be opened and show the
"No app on your device can open this" toast in this case, as an
`ActivityNotFoundException` could be thrown if no app is available to open a
given web link.
2023-03-26 00:04:38 +01:00
Stypox be4f3d9d62
Improve javadocs in ShareUtils 2023-02-25 13:14:31 +01:00
Stypox c2968a3ff2
Use non-deprecated resolveActivity method on API 33+
But such method is not available before API 33
2023-02-25 13:14:31 +01:00
Stypox 600ebdae18
Correctly open urls in browser on Android 11+
- Fix misconfiguration in manifest ('http|https|market' is not valid)
- Split ShareUtils functions taking a boolean parameter into pairs of functions with better names and less runtime checks
- Move all Kore-related functions to KoreUtils
- Remove the toast_no_player string
2023-02-25 09:13:59 +01:00
Stypox 4cc653fdf1
Fix opening links on Android 12+ 2023-02-07 22:39:12 +01:00
AudricV cdd5e89b86
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.
2023-01-15 11:40:27 +01:00
dhruvpatidar359 ef35b36eba
Remove the redundant/overlapping toast "Copied to clipboard" for Android 13+
Signed-off-by: dhruv <dhruvpatidar35@gmail.com>

Co-authored-by: Tobi <TobiGr@users.noreply.github.com>
Co-authored-by: AudricV <74829229+AudricV@users.noreply.github.com>
2022-11-08 20:47:50 +01:00
litetex 99104fc11d
Clean up pre-Lollipop checks 2022-07-13 19:02:24 +02:00
Stypox bd5eda92a7
Improvements to sharing content with thumbnail 2022-05-22 21:34:10 +02:00
TiA4f8R 761c0ff9ac
[Android 10+] Add image preview of the content shared where possible
These previews will be only available for images cached in the cache used by Picasso.
The Bitmap of the content is compressed in JPEG 90 and saved inside the application cache folder under the name android_share_sheet_image_preview.jpg.
The current image will be, of course, always overwritten by the next one and cleared when the application cache is cleared.
2022-05-14 16:53:24 +02:00
Robin e6fffc0d5b Fix crash on missing title when sharing livestream 2021-10-08 21:42:01 +02:00
acti0 d9086300f3
Re-add sharing of the content name with the "Share" command (#6957)
The title of the content is re-added as the EXTRA_SUBJECT of the share intent.
2021-08-27 19:26:32 +02:00
TiA4f8R 218f25c171
Annotate params and methods with NonNull 2021-06-11 12:12:10 +02:00
TiA4f8R f02df6d80c
Fix an error and add a new method in the ShareUtils class
Fix the error due to the rebase on the dev branch of this branch
Add a shareText method in the ShareUtils class which has 3 parameters and calls
the original shareText method with an empty string for the
imagePreviewUrl param.
2021-06-11 12:12:09 +02:00
TiA4f8R 2702700d10
Don't use a chooser for other intents than opening a content in a browser or sharing a content to other apps
Use an ACTION_CHOOSER intent has a negative impact for user experience, because user cannot set as default an activity for an intent
2021-06-11 12:12:05 +02:00
TiA4f8R d6decc05d7
Move some classes to a new subpackage and adress requested changes
Rename URLHandler and KoreUtil classes to InternalUrlsHandler and KoreUtils.
Move InternalUrlsHandler, KoreUtils, TextLinkfier, ShareUtils classes to external_communication subpackage.
Remove unused param showPreviewText in shareText method of ShareUtils class.
Add initial work to be able to display an image preview of the content shared (not for downloads).
Use a better regular expression to parse timestamps in plain text descriptions.
2021-06-11 12:12:02 +02:00