honoru88 / google-glass-api

Automatically exported from code.google.com/p/google-glass-api
0 stars 0 forks source link

Support web images in Card bulider #299

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Attempt to use findById to access the background image for a Card.
2.
3.

What is the expected output?
The id for the background image can be found.

What do you see instead?
None of the Card layout is exposed.

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

Please provide any additional information below.
Volley provides a NetworkImageView which is ideal for loading images and 
handling caching. It's currently not possible to leverage this feature because 
the layout of a Card is unavailable.

Some discussion on Stack Overflow: 
http://stackoverflow.com/questions/20498614/delayed-loading-of-images-on-cards

Original issue reported on code.google.com by paulyoun...@gmail.com on 13 Dec 2013 at 8:16

GoogleCodeExporter commented 9 years ago
Hello,

Thanks for the feature request! Could you explain why you can't simply 
regenerate the view using the Card builder class once the image is available?

It might be easier than having to look through the different views and layouts 
provided by the Card class.

Best,
Alain

Original comment by ala...@google.com on 13 Dec 2013 at 4:34

GoogleCodeExporter commented 9 years ago
Hi Alain

I have a CardScrollView containing cards that I'm trying to load remote images 
into (similar to the Stack Overflow question).

It appears that currently I can't use Volley's NetworkImageView which means 
that I also need to manage my own cache. I've tried using ImageRequest but 
haven't been able to figure out how to refresh cards once the request completes.

If you could elaborate on how to "regenerate the view using the Card builder 
class" I'll look into that.

Original comment by paulyoun...@gmail.com on 13 Dec 2013 at 6:38

GoogleCodeExporter commented 9 years ago
Simply create a new Card instance, set the various data you need and call 
Card.toView() again to get a newly generated View that you can use in your 
layout.

Original comment by ala...@google.com on 13 Dec 2013 at 6:53

GoogleCodeExporter commented 9 years ago
So I think you're saying that I should replace the relevant item in my 
List<Card> and everything should just work?

Original comment by paulyoun...@gmail.com on 13 Dec 2013 at 6:57

GoogleCodeExporter commented 9 years ago
If we're not going to allow an easy way to do network loading via the Card 
class, it would be good to have a sample project with a card layout or a put a 
good example card layout that we can modify so we can do interesting things (as 
well as do view recycling), while still sticking to the glass UI as much as 
possible.

Original comment by mike...@mikeyin.org on 18 Dec 2013 at 10:25

GoogleCodeExporter commented 9 years ago
This is an issue for me too. To effectively manage the process of downloading 
and replacing a number of photos in cards, I figure you need to write lots of 
custom code:

- Observer code (like the Camera sample) & callbacks to make sure the image is 
on the filesystem
- File caching logic to manage images that have already been downloaded
- Object tracking & view recycling logic as images come in asynchronously over 
the wire
- AsyncTask+ThreadPoolExecutor, or IntentService+ResultReceiver for download 
management without affecting the UI thread, performance spikes & triggering 
garbage collection.

Code samples/sample project would be greatly appreciated!

Original comment by jldavid....@gmail.com on 5 Jan 2014 at 10:26

GoogleCodeExporter commented 9 years ago

Original comment by ala...@google.com on 6 Jan 2014 at 5:31

GoogleCodeExporter commented 9 years ago
This is vey much needed indeed!

Original comment by milosbos...@gmail.com on 23 Jan 2014 at 4:01