Skip to content
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

Resized images #1599

Closed
wants to merge 9 commits into from
Closed

Resized images #1599

wants to merge 9 commits into from

Conversation

tobiasKaminsky
Copy link
Contributor

@tobiasKaminsky tobiasKaminsky commented Apr 9, 2016

--------- edited by @davivel

BLOCKED by owncloud/core#16250

--------- edited by @jabarros
TASKs:

  • Changes after CR @jabarros
  • [QA] Create 'resizedImages' branch in QA Repo @jesmrec
  • [QA] Merge 'resizedImages' branch in QA Repo
  • [QA] Create test plan @jesmrec
  • [QA] Validate test plan @jesmrec [WIP]

bugs and improvements:


This PR is now against master.

As this PR introduces a rather complex feature I will summarize it here.

  • Clicking on an image loads a reduced version to the cache.
  • The width and height is determinated by the screen.
  • the benefit is a very small, but yet usable preview of the image.
  • it can be used to send via whatsapp, or as a file to another app (like k9) with the correct filename.
  • resized images are not treated as downloaded files. If the user wants to have the real file, he has to long-click and select download.
  • clicking on an image shows first a square thumbnail (if available) until the resized image is loaded

ToDo

  • Zooming a resized image with at least 2x (which can get blurry)
    • show snackbar "automatically download full image on zoom: yes"
    • Clicking "yes" after second time will offer option "always" to prevent showing the question.
    • time out the snackbar the second time by just waiting will show "never download full image" -> "yes".
    • after both show second snackbar without action "default behaviour can be changed in settings"
  • In setting: new entry "click on image downloads ..."
    • full image to storage
    • resized image to cache

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @davivel, @jabarros and @purigarcia to be potential reviewers

@tobiasKaminsky tobiasKaminsky mentioned this pull request Apr 9, 2016
@tobiasKaminsky
Copy link
Contributor Author

Snackbar is only allowing one action.
So I have adapted the behaviour.
@jancborchardt @AndyScherzinger @davivel

@tobiasKaminsky
Copy link
Contributor Author

@jancborchardt @AndyScherzinger
After thinking about it I think a snackbar (or similar) with two options would be better, or?

@jancborchardt
Copy link
Member

I thought we said zooming should always download the image? Without showing any snackbar or something like that?

@tobiasKaminsky
Copy link
Contributor Author

No, please read the other PR.
There me and other said that this against the expectation to save bandwidth and storage. So this should stay optional.
And with the snackbar approach every user can decide on its own how the default behaviour should be.

@AndyScherzinger
Copy link
Contributor

@tobiasKaminsky your approach works for me since you are right, the snackbar is defined with 0-1 action. For more than 1 action we would need to use dialogs or something else.

@davivel
Copy link
Contributor

davivel commented May 11, 2016

Having a look now, just read the comments in the thread.

First ideas:

  • zoom behaviour should be in a separate PR to limit the scope of testing.
  • about sending preview image to other apps instead of the full size image without the user being aware of it: will this behaviour fit the expectations of most of the users?

Going on with the review.

@@ -114,7 +114,7 @@
android:name=".providers.FileContentProvider"
android:authorities="@string/authority"
android:enabled="true"
android:exported="false"
android:exported="true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea :/
A quick test shows no problems if I revert this.

@tobiasKaminsky
Copy link
Contributor Author

zoom behaviour should be in a separate PR to limit the scope of testing.

This is a good idea.

about sending preview image to other apps instead of the full size image without the user being aware of it: will this behaviour fit the expectations of most of the users?

If the image is not downloaded I assume that users know that the resized version is used.
The user has to explicit download a file to use this.
But maybe we can show this to the user by using "send resized image".
And use "send original size" when downloaded.

@@ -281,18 +329,25 @@ private Bitmap doOCFileInBackground() {
try {
String uri = mClient.getBaseUri() + "" +
"/index.php/apps/files/api/v1/thumbnail/" +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, set a constant for this

@jabarros
Copy link
Contributor

@tobiasKaminsky In a short term, QA team is going to validate this functionality. Could you take a look to the CR changes and do a rebase on master?

@jesmrec
Copy link
Collaborator

jesmrec commented Jun 29, 2016

The images in format .tiff are not previewed, because they are not supported (thumbnail is not shown). If you tap on a tiff image, a spinner appears forever on a black background. That can be confusing for the user, so that he/she does not know if there is a problem or not. If this image format (and another ones) are not supported, it would be better to show an alert or similar indicating that the image .tiff (or whatever) can not be previewed.

cc @tobiasKaminsky @owncloud/android-developers

@jesmrec
Copy link
Collaborator

jesmrec commented Jun 29, 2016

if you tap on a "landscape" image, is not correctly resized.

This is the downloaded image:

screen shot 2016-06-29 at 17 49 24

The previewed (not dowloaded) in portrait:

screen shot 2016-06-29 at 17 48 41

The previewed (nor downloaded) in landscape:

screen shot 2016-06-29 at 17 58 01

In this case, this is a "landscape" image (longer than widther), so the preview should fit with the device landscape orientation. The device in portrait orientation should show something like the first attached file.

cc @tobiasKaminsky @owncloud/android-developers

@jabarros
Copy link
Contributor

@owncloud/android-developers

due to high number of conflits detected during the rebase from master, I pushed the rebase with the fixes into a new one (resizedImages_fix_rebase) in order to avoid break this PR if some conflicts were not fixed okay.

So, if anyone will work here, please, better move to new resizedImages_fix_rebase branch.

@davivel
Copy link
Contributor

davivel commented Jul 5, 2016

Will resume where @jabarros left it, in the branch resizedImages_fix_rebase, fixing the second bug.

@davivel davivel self-assigned this Jul 5, 2016
@@ -129,9 +129,9 @@
android:name=".providers.FileContentProvider"
android:authorities="@string/authority"
android:enabled="true"
android:exported="true"
android:exported="false"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-note: this was set to true with addition of Document Provider.

@davivel
Copy link
Contributor

davivel commented Jul 5, 2016

Rebase double checked and pushed here; no need to go to other branch.

@davivel
Copy link
Contributor

davivel commented Jul 5, 2016

The images in format .tiff are not previewed, because they are not supported (thumbnail is not shown). If you tap on a tiff image, a spinner appears forever on a black background. That can be confusing for the user, so that he/she does not know if there is a problem or not. If this image format (and another ones) are not supported, it would be better to show an alert or similar indicating that the image .tiff (or whatever) can not be previewed.

Even more: if a resized preview can't be got, I'd say the file should be downloaded instead.

@davivel
Copy link
Contributor

davivel commented Jul 5, 2016

In this case, this is a "landscape" image (longer than widther), so the preview should fit with the device landscape orientation. The device in portrait orientation should show something like the first attached file.

Previews should use the same rules to adapt the size of the image to the screen that those used to render the full image. In your sample the preview is resulting in a clip of the image, but it should be a rescaled version.


if (mShowResizedImage){
Bitmap resizedImage = ThumbnailsCacheManager.getBitmapFromDiskCache(
String.valueOf("r" + getFile().getRemoteId()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefix "r" in the identifier to request a resized preview, and prefix "t" in the identifier to request a thumbnail? Is not too tricky? Seems that ThumbnailsCacheManager needs different methods for both cases.

@davivel
Copy link
Contributor

davivel commented Jul 5, 2016

Previews should use the same rules to adapt the size of the image to the screen that those used to render the full image. In your sample the preview is resulting in a clip of the image, but it should be a rescaled version.

And in the very end, the problem is what @tobiasKaminsky already stated in the very beginning:

Remaining problem:
owncloud/core#16250

IMHO, this is blocking. 'Til that issue is not addressed, this shouldn't be merged.

@zgmnkv
Copy link

zgmnkv commented Aug 11, 2017

Hi guys, any update on this one?
Downloading all the images that I viewed consumes a lot of memory on my device.

@jesmrec
Copy link
Collaborator

jesmrec commented Aug 23, 2017

not for the moment... you know, we are opened to contributions!!! :)

@jesmrec
Copy link
Collaborator

jesmrec commented Aug 28, 2019

Will check with next core generation.

@hannesa2 hannesa2 deleted the resizedImages branch July 12, 2021 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants