0

I've been Googling all over and haven't found any XML versions of the Mirror API templates. I know that the Mirror API allows you to see the HTML and CSS associated with these cards, but since I have to use the GDK in my application and can't use the Mirror API at all I cannot use these templates. I feel as though this is something that should be provided in the GDK but currently isn't. Are there XML versions of these templates released by Google or someone else available for use?

cereallarceny
  • 4,913
  • 4
  • 39
  • 74

1 Answers1

2

The CardBuilder class in the GDK provides many of the same layouts in the Mirror API Playground without the need to manipulate XML directly. Try to use those whenever possible to ensure a consistent Glass user experience.

If those don't meet your needs, you can also find copy-and-pastable stub layouts in our developer guides, which already have the proper margins laid out for you.

Tony Allevato
  • 6,429
  • 1
  • 29
  • 34
  • Well yes, they're close... but I'd like to have versions that are the exact same as the Mirror API. Why weren't those ever created directly? – cereallarceny Oct 20 '14 at 18:00
  • Can you provide more details about what you need? – Tony Allevato Oct 20 '14 at 18:01
  • Well I'm basing all of my designs on the Mirror API but I need to have those done over the GDK (since I can't rely on making POST requests all the time due to circumstances that our customers demand... security and Internet availability). I would really like it if I could have the designs in the Mirror API available using `CardBuilder` rather than just the default 6 layouts that come with it. – cereallarceny Oct 20 '14 at 18:04
  • Many of the designs in the Mirror API are provided by `CardBuilder`: text, image-in-left-column, author layout, caption layout, and others. In addition, you can use Android's spanned string capabilities to construct a `CharSequence` objects that have text styling/colors applied to mimic what you could do in HTML through Mirror. What *specifically* do you need that isn't satisfied by those features? – Tony Allevato Oct 20 '14 at 18:07
  • My apologies for not being terribly well-versed on Android/Glass development, I'm just starting out. What I'm looking for are designs similar to the "List", "Image List", "Transit", and "Event" cards in the Mirror API Playground. Some of those I could use via `CardBuilder`, but I would like more flexibility than inserting raw text like in the "image-in-left-column" GDK layout. To give an example, how could I reproduce the "Transit" card using the `CardBuilder` class in the GDK? – cereallarceny Oct 20 '14 at 18:13
  • The "event" layout is just a text layout that has colored text inserted into it; you can use Android `Spanned` for this. For the others, such as "transit", I've edited my answer to point to a couple of stub layouts that you can copy-and-paste from our docs as a starting point. – Tony Allevato Oct 20 '14 at 18:24
  • I've seen the XML layouts you link to, but there are no widgets available in those examples. Will there be any documentation in the future about how to implement a custom XML layout in a Glass App? – cereallarceny Oct 20 '14 at 18:31
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/63360/discussion-between-cereallarceny-and-tony-allevato). – cereallarceny Oct 20 '14 at 18:33