americosfacebook / googletv-issues

Automatically exported from code.google.com/p/googletv-issues
0 stars 0 forks source link

Google TV Units not respecting layout qualifiers #156

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When developing an Android Application that works on multiple devices, 
including the GTV, layout qualifiers are very important so you may target 
specific devices.

Google TV units are using /layout-sw360dp-land as the layout selected @ 320dpi 
@ 1080p, which is shared with phones and other devices.

Tested units include the Revue, Sony GS7, Vizio Co-Star, and HiSense Pulse.

Attempting to use qualifiers such as:
 /layout-television
 /layout-tvdpi
 /layout-xhdpi 

are ignored as well as many other variations of those including -land etc.

In addition, suggestions from your own Google TV Developer Advocates are not 
even valid (and will result in compiler error) - such as:

  /layout-tvdpi-notouch-land-large
  /layout-xhdpi-notouch-land-large
  /layout-television-notouch-land-large

as well as various combinations of the above 3.

Expected behavior:
 Google TV devices should check and use layout-television which I believe is what it is there for - specifically.

Workaround that we implemented:
if 
(getActivity().getPackageManager().hasSystemFeature("com.google.android.tv")) {
  // GTV specific layout implementation, doesn't help TV-sticks, etc...

} else {
  // use the auto-selected layout resource structure...

}

The problem with the above workaround is that it is tedious and needs to be 
added anywhere you have nested layouts.

Original issue reported on code.google.com by DustinBr...@gmail.com on 17 Mar 2013 at 4:14

GoogleCodeExporter commented 8 years ago
Project you may test on Google TV devices to see here: 
https://www.dropbox.com/s/d3gnc4k5bvkxnxc/GTVLayoutError.zip

Original comment by DustinBr...@gmail.com on 17 Mar 2013 at 4:27

GoogleCodeExporter commented 8 years ago
For multi device apk's that include Google TV the qualifier that works under 
most cases is layout-sw470dp-land - documentation to be updated. 

Original comment by kri...@google.com on 18 Mar 2013 at 2:45

GoogleCodeExporter commented 8 years ago
I suspect the main reason you are experiencing issues with the 
layout-television qualifier not being picked up as you'd expect is because GTV 
will actually be in landscape mode, which means -sw360p and -land override the 
-television specifier.

Give layout-land-television a go.

Original comment by mattga...@google.com on 18 Mar 2013 at 3:18

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hmmm, I seem to have spoken too soon.  It is still picking sw360dp-land FIRST 
over land-television.  It is second defaulting to land-television however if 
the layout isn't in sw360dp-land.  I will do some more research on the 
suggestion from Krispy and see how many devices it might share with as I don't 
want any overlap with phones, etc.  I may just go with the workaround as I know 
it works.

Original comment by DustinBr...@gmail.com on 19 Mar 2013 at 1:17

GoogleCodeExporter commented 8 years ago
Adding layout-sw-470dp-land will work, but if you don't want any mobile or 
tablet devices, you can just add layout-sw470dp-land-television and then it 
will opt for these styles.

NOTE: This is what happens in your sample if you switch over my suggestion 
layout-land-television to layout-sw360dp-land-television.

Try and think of each specifier having a certain importance and the more 
specific thing a device can match it, it will. In this case a smallest width of 
360dp is more important that it be a television device.

Original comment by mattga...@google.com on 19 Mar 2013 at 11:24

GoogleCodeExporter commented 8 years ago
p.s. More info here: 
http://developer.android.com/guide/topics/resources/providing-resources.html

Original comment by mattga...@google.com on 19 Mar 2013 at 11:28

GoogleCodeExporter commented 8 years ago
p.s. More info here: 
http://developer.android.com/guide/topics/resources/providing-resources.html

Original comment by mattga...@google.com on 19 Mar 2013 at 11:28

GoogleCodeExporter commented 8 years ago
Ok I tested layout-sw360dp-land-television on the GTV and layout-sw360dp-land 
on phones/tablets and it appears to be selecting the correct layout structure 
on both.

Thank you Matt & Krispy.  Please update your documentation to reflect this.

Original comment by DustinBr...@gmail.com on 19 Mar 2013 at 10:23