Comments (11)
Very interesting!
I had to mark SubSamplingImageSource
as sealed because I wasn't certain about its API stability, especially if it receives multiplatform support. Will offering a SubSamplingImageSource.source(okio.Source)
solve your first step?
In the file CoilImageSource.kt the method ImageResult.toSubSamplingImageSource(...) would need to be adjusted to be able to map custom request data to custom SubSamplingImageSource.
Does this not work for your request data because its Result#diskCacheKey
is always null?
from telephoto.
Thanks for your fast reply and interest in my use case.
Will offering a SubSamplingImageSource.source(okio.Source) solve your first step?
I can provide a decrypting InputStream
, so okio.Source
should also work thanks to InputStream.source()
.
Does this not work for your request data because its Result#diskCacheKey is always null?
I debugged this and result.diskCacheKey
is null. Furthermore I would prefer not to create an unencrypted copy of the file (even in the app's internal storage).
from telephoto.
Furthermore I would prefer not to create an unencrypted copy of the file (even in the app's internal storage).
I'm curious what's the concern here? App directories are inaccessible to other apps.
I can't think of good ideas to make ZoomableAsyncImage
work with custom data types. Do you want to instead roll out your own ZoomableImageSource
? You could wrap ZoomableImageSource.coil()
or write a new one from scratch.
ZoomableImage(
image = ZoomableImageSource.encrypted(…),
)
from telephoto.
Hi Saket,
I'm curious what's the concern here? App directories are inaccessible to other apps.
I just want to keep the "attack surface" small. Android is very fragmented and at least until Android 12 you could utilize adb backup
to dump the app's internal storage without root. On the other hand, there should also be a performance impact when copying files (on cache miss).
Do you want to instead roll out your own ZoomableImageSource?
I started digging into ZoomableImageSource
and I think this will likely work for my use case. To test it we need to implement SubSamplingImageSource.source(okio.Source)
or SubSamplingImageSource.inputStream(InputStream)
first.
I'm quite busy the upcoming week but after that I could create a PR for the first step if you like.
from telephoto.
Sure, please go ahead!
from telephoto.
Alternatively, could you provide a custom disk cache to Coil that is backed by a fake in-memory file system?
from telephoto.
Hi,
forked your repo, added the methods to SubSamplingImageSource
and tried them with an encrypted file in my app, however getting an exception that the image format is not supported or cannot be decoded.
The only way I got it working is to provide a BitmapRegionDecoder
directly, however that does not make sense to me because I also initialize that with an InputStream
. It should be the same code, just split in two methods.
Will need to spend some more time looking into this. Due to a lack of time in the next days, it could take another week or two. But I'm on it, after that I will try ZoomableImageSource
and your latest idea with the fake cache.
from telephoto.
On a second thought, please disregard that. A fake disk cache won't help because BitmapRegionDecoder
will expect the file to exist on the real disk system.
I went ahead and implemented SubSamplingImageSource.rawSource(). Wanna try it out on 0.5.0-SNAPSHOT
?
from telephoto.
I went ahead and implemented SubSamplingImageSource.rawSource(). Wanna try it out on 0.5.0-SNAPSHOT?
Many thanks! I gave it a try and it's working fine. Will test the approach with ZoomableImageSource
in den next days.
from telephoto.
So basically copied the ZoomableImageSource.coil()
implementation, removed everything I do not need and adjusted the work()
and toSubSamplingImageSource()
methods and it's working fine. Some methods are duplicated, but these are just a few smaller ones.
From my side, the issue would be resolved with the new method. Thanks again!
Maybe one final question, depending on the answer this would be worth a new issue then. Coil offers SubcomposeAsyncImage
where I like to use loading
, error
and success
for overlays. Would you consider such a feature?
from telephoto.
Glad to hear!
Coil offers SubcomposeAsyncImage where I like to use loading, error and success for overlays. Would you consider such a feature?
Yes please, let's move this to a new discussion so that it's searchable by others.
from telephoto.
Related Issues (20)
- Unable to capture bitmap from ZoomableAsyncImage composable HOT 9
- Better zoom gestures HOT 13
- Please provide a way to change zoom and offset programatically HOT 9
- Coil returned a null cache snapshot HOT 4
- Telephoto internal NPE HOT 7
- Incorrect fling velocity on zoom gesture end with Compose 1.7.0-alpha02 HOT 1
- Zoomable modifier looses state after ZoomableState gets disposed and recreated HOT 12
- Allow disabling "Double tap to zoom" & "Pinch to zoom" separately HOT 2
- Content padding HOT 2
- Keyboard support HOT 2
- IllegalStateException: maximumVelocity should be a positive value HOT 16
- IllegalStateException: Coil returned a null cache snapshot HOT 5
- Gif Not Working HOT 5
- Individual Zoom for Canvas Rectangles using rememberZoomState. HOT 2
- Add mouse wheel zoom support HOT 5
- Different double tap/zoom functionality HOT 1
- Need SubsamplingScaleImageView.visibleFileRect(Rect fRect) analog HOT 4
- Fatal Exception: java.io.FileNotFoundException: No content provider: url HOT 4
- Lower minSDK to 21 HOT 6
- NullPointerException in RealZoomableState HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from telephoto.