-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image preview in Android share sheet (Android 10+ only) #8143
Conversation
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create two PRs: one for adding image previews and one for refactoring ShareUtils
, please.
* | ||
* @param context the context to use | ||
* @param intent the intent to open | ||
* @param isShareIntent set the title "Open with" to the chooser if true, else not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param isShareIntent set the title "Open with" to the chooser if true, else not | |
* @param isShareIntent set the title "Open with" to the chooser if false, else do not set any title |
734825a
to
0455093
Compare
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.
0455093
to
761c0ff
Compare
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a small commit doing some little improvements. I tested many possible configurations on my Android 10 phone and it works as expected. Thank you for the research @TiA4f8R :-)
What is it?
Description of the changes in your PR
This PR adds the image preview of contents shared in the Android share sheet, for Android 10+ devices. Note that it may be not shown, depending of the customizations made by your OEM on your Android device.
Images included in the share sheet will be only the ones in the memory image cache used by Picasso (the image library loader), in order to not have to handle network exceptions when sharing contents. If it is not loaded or no image preview is available, no image will be shown in the share sheet (like the current behavior).
The image of the content, before sharing, is compressed in JPEG 90 and saved inside the application cache folder under the name
android_share_sheet_image_preview.jpg
. The current image shared will be, of course, always overwritten by the next one and deleted when the application cache is cleared.Before/After Screenshots/Screen Record
Fixes the following issue(s)
Fixes the TODO (that I added) in
ShareUtils
:NewPipe/app/src/main/java/org/schabi/newpipe/util/external_communication/ShareUtils.java
Lines 255 to 261 in 629b685
APK testing
The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.
Due diligence