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

Enhancements: SVGImageView - Define an asset attribute and cache drawables. #23

Open
GoogleCodeExporter opened this issue Jul 24, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. My app uses a number of svg images, some of them in several places. All of 
them are use an asset.

What is the expected output? What do you see instead?

The app takes a performance hit. SVG images load slowly.

What version of the product are you using? On what operating system?

Version 1.2 (hg clone).


Please provide any additional information below.

My suggestion is that an "asset" attribute is defined to go along with the 
standard "svg" attribute. "asset" should be set to override "svg". When 
specified the SVGImageView should bypass the Resource and InternalURI logic and 
load the image straight from the asset. Gains a little speed and makes the use 
of the View in the layout more logical.

As far as caching is concerned, I have implemented a solution using a "cache" 
(boolean) attribute and an internal HashMap which caches the Drawable with the 
"svg" or "asset" attribute value as the key.

The first time a particular asset (resource or URI) is used with "cache" set to 
true the drawable is created and stored in the HashMap. The next time an 
SVGImageView accesses the same "asset" (again with "cache" set to true) we 
simply pull the stored drawable.

This introduces a significant speed boost. Find the modified SVGImageView.java 
file attached.

Original issue reported on code.google.com by a...@spoton.com on 6 Nov 2013 at 5:30

Attachments:

@GoogleCodeExporter
Copy link
Author

Original comment by paul.leb...@gmail.com on 7 Nov 2013 at 4:53

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Original comment by paul.leb...@gmail.com on 7 Nov 2013 at 4:53

  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant