Disclaimer: this is a strange issue that only happens in a Kindle Fire (so far).
Technologies Involved: Android SDK, Eclipse, LibGDX.
I have a relatively simple app running with LibGDX. The way LibGDX works is by having an OpenGL thread that will call Create() (once) and then Render() as many times as possible (so you can do your render…).
So when you initialize the Device, your "Create()" method is called and then when the OpenGL surface is initialized (all this happens automagically), your Render() starts getting called.
If the OpenGL context is lost, destroyed, etc. your Resize(width,height) method is called by LibGDX.
So far. So good.
Now I came across a strange issue with a Kindle Fire where things looked a few pixels off or "cut". The Kindle Fire has a "softbar" at the bottom of the screen (20 pixels) that you can't hide or skip, which is "kind of ok" because the device doesn't have physical buttons. You're expected to touch this soft bar and get a bigger bar to go back, go home, etc. According to Amazon, this bar cannot be removed. (is not 100% clear but nobody has found a way -that is not breaking the Amazon rules). The only App I've seen that removes that is the Amazon Video Players for videos streamed from Amazon's Cloud only. So as you can see, there doesn't seem to be a way to "permanently" hide that bar.
So if the bar is there, your real screen state is not the hardware resolution 1024x600 (landscape) but 1024x580. So I added some logging to my methods to see what was going on, and was surprised with this… (remember the create(), render() and resize() methods):
12-23 15:17:04.119: I/myapp(19921): SCREEN HEIGHT AT CREATE(): 600
[snip other unrelated log stuff]
12-23 15:17:04.673: I/myapp(19921): SCREEN HEIGHT AT RENDER() LOOP: 600
[snip other unrelated log stuff]
12-23 15:17:04.705: I/myapp(19921): MyApp - Resize() Called.
12-23 15:17:04.705: I/myapp(19921): SCREEN HEIGHT AT RENDER() LOOP: 580
So the screen has been "resized" by the Kindle Fire, "at some point".
Has anyone come across something like this?
This is a screenshot (notice the black bar on top, that's not added by me!). Forgive me for blurring the image but this is a client's project and I can't "disclose" anything.
The fun part begins when sometimes, the bar won't be there and the app will look like the next (again, sry for the blur). Notice how the top bar is not there…</p>
Upon a closer examination of both shots, you can tell that the bottom (which should be the same), is not. The kindle is doing strange things.
Any ideas?
The assets were originally packed as 1024x600 but we have changed that (580 now) and will assume that the viewport is now 1024x580 but I was wondering if anyone found a better way to deal with this nonsense? :)
note: we do have android:theme="@android:style/Theme.NoTitleBar.Fullscreen" in the manifest. Doesn't do anything.
Thanks in advance.