Comments (3)
I'm not quite sure I see what's difficult here. You can extend ImageRequest and override getPriority to set a request. You can also extend ImageLoader and override makeImageRequest to return your custom ImageRequest which overrides getPriority. None of this should require too much duplicated/custom code.
What APIs are you proposing to add?
from volley.
I was thinking on extending:
public ImageContainer get(String requestUrl, ImageListener imageListener, int maxWidth, int maxHeight, ScaleType scaleType)
to
public ImageContainer get(String requestUrl, ImageListener imageListener, int maxWidth, int maxHeight, ScaleType scaleType, Priority priority) {
And then add appropriate convenience methods with smaller number of parameters in the same time supporting API backward compatibility, passing Priority.LOW when priority not passed.
from volley.
I think that approach might run into issues with makeImageRequest(), which is protected and thus can't have its signature changed. Open to ideas on how to resolve that, but I'm not seeing a simple one at a glance. It's not as simple as adding an overloaded copy like you propose for get(), because get() needs to know which version of makeImageRequest to call, and it can't know whether there's an overridden version of makeImageRequest. But you presumably need some way to propagate the priority down to it.
Also, for what it's worth, I think the semantics are a bit hard to define when it comes to the request batching that ImageLoader does. If a request is in the queue for an image at one priority, and a new one comes in with a higher priority, what should happen? We don't really have a way to promote the priority of an in-flight request. That makes me a bit hesitant to explicitly add this as an API, because you might call get with a high priority and not realize that it would have no impact if a low priority request is already in flight.
I don't know how an app might decide to prioritize requests, but it still seems to me like subclassing ImageLoader would be the way to go here if you accept the above caveat and still want custom priorities, maybe because you can guarantee in your application that there's a unique URL -> priority mapping. But in that case, it should be possible to just override makeImageRequest and apply that mapping on the given requestUrl and return an ImageRequest with the given priority.
from volley.
Related Issues (20)
- The JsonObjectRequest and JsonArrayRequest don't support 204: No Content HOT 5
- Unexpected response code 511 for HOT 1
- Support digest authentication HOT 2
- Type com.android.volley.Cache$Entry is defined multiple times HOT 1
- Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: com.google.android.youtube.player.YouTubeApiServiceUtil HOT 1
- Volley unable to parse dateStr HOT 1
- setPriority() for Request HOT 1
- E/Volley: [18667] NetworkUtility.shouldRetryException: Unexpected response code 403 HOT 1
- -
- Com.android.volley.2015.05.28.jar HOT 1
- Support Proxy functionality HOT 1
- Volley: [5311] NetworkUtility.logSlowRequests: HTTP response for request=<[ ] HOT 3
- NetworkUtility.logSlowRequests: HTTP response for request=<[ ] https://www.google.com/ 0xd61ac103 NORMAL 1> [lifetime=6472], [size=159525], [rc=200], [retryCount=1]
- Fix nullability issues in Kotlin sample code HOT 4
- Pagination HOT 1
- Getting E/Volley: [19618] NetworkDispatcher.processRequest: Unhandled exception HOT 4
- pls rply me what can i do for this HOT 1
- Potential debug logging even when DEBUG is False HOT 6
- ConcurrentModificationException on cancel HOT 1
- App Crashed on Android version 4.3 java.lang.NoClassDefFoundError: com.android.volley.toolbox.Volley HOT 1
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 volley.