Friday, July 15, 2011

[android-developers] Re: How can I find how many home screens?

Thanks Mark and Diane for the help.

My task is to properly place my living wallpaper background (I use the
current "dead" wallpaper) behind the system's placement of icons and
widgets. My users should be able to do "Settings" on different
(right, center, left) home screens.

Here's the three assumptions that, so far, work for me:
1. Upon exit from preview mode the system will always show the panel
of icons and widgets last showing before preview mode.
In WallpaperService.onCreate() I get wallpaper width from
WallpaperManager.getDrawable() and getBitmap() and getWidth(),
and
2. device screen width in pixels = wallpaper width / 2;
However many homescreens there are,
3. offset to center panel of wallpaper = the negative of (device
screen width / 2);

Therefore, during preview mode I show this center panel. Upon exit
from preview mode I get my first onOffsetsChanged() callback and can
calculate the real number of home screens and manage my background
accordingly.

Perhaps in the future some live wallpaper applications would be better
served if the system exposed additional information it obviously has:
(a) during onCreate(), some direct way to get device screen size and
number of home screens,
(b) upon entry to preview mode, some way to get which home screen was
last showing
(c) upon exit from preview mode, some way to set which home screen (of
icons and widgets) will show next.
And, by the way, some documentation about the usefulness of
onOffsetsChanged()-s with xSteps of 0.0 and -1.0.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment