wallpaper dimensions

129 views
Skip to first unread message

muni anda

unread,
Dec 29, 2009, 5:20:05 PM12/29/09
to android...@googlegroups.com
Hi,

I have a development platform with a 800x480 landscape panel. For the
wallpaper, launcher (using eclair) is setting the wallpaper dimensions
to 960x800 instead of 1600x480.

Following code is the suspect (from
http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git;a=blob;f=src/com/android/launcher/Launcher.java;hb=HEAD)

private void setWallpaperDimension() {
WallpaperManager wpm = (WallpaperManager)getSystemService(WALLPAPER_SERVICE);

Display display = getWindowManager().getDefaultDisplay();
boolean isPortrait = display.getWidth() < display.getHeight();
final int width = isPortrait ? display.getWidth() : display.getHeight();
final int height = isPortrait ? display.getHeight() : display.getWidth();
wpm.suggestDesiredDimensions(width * WALLPAPER_SCREENS_SPAN, height);
}

Should the fix be to change the above code to get the
portrait/landscape information from android:screenOrientation?

Even after I fixed above, when I attempt to change the wallpaper with
the bitmap of 1600x480 com.android.camera.cropImage is launched and
the resulting wallpaper is the cropped and zoomed version of my
original bitmap. Cropping/Zooming seems to kick-in no matter what the
dimensions of my bitmap is. I was wondering under what conditions the
cropping will kicks-in.

I am tyring to understand the logic here by digging through the code.
But, if someone can provide a quick answer or pointer to look for that
would be great.

Thanks
-Muni

muni anda

unread,
Dec 29, 2009, 7:06:05 PM12/29/09
to android...@googlegroups.com
It turns out that cropping is just a feature. User can change the
bounding rectangle to what ever size that want. Sorry, It was not
intuitive for me. Ouch!
So, the only issue is the implementation of setWallpaperDimension()
API. Any comment on that?

Dianne Hackborn

unread,
Dec 31, 2009, 12:58:10 AM12/31/09
to android...@googlegroups.com
The purpose of this code is to avoid making the wallpaper larger along the larger dimension, to avoid the keep the size to something reasonable.  If you want different behavior for your device, then you could certainly change this logic, but what is there now is working as intended.

On Tue, Dec 29, 2009 at 2:20 PM, muni anda <muni...@gmail.com> wrote:



--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

muni anda

unread,
Dec 31, 2009, 6:17:20 AM12/31/09
to android...@googlegroups.com
Thanks for the reply. Comment in-line

On Wed, Dec 30, 2009 at 9:58 PM, Dianne Hackborn <hac...@android.com> wrote:
> The purpose of this code is to avoid making the wallpaper larger along the
> larger dimension, to avoid the keep the size to something reasonable.

I was under the impression that size needs to be double of the x-axis
times y-axis not matter what the orientation is. That is because the
Android virtual desktop spans 2 horizontal screens. If that is right,
the logic used appears to only works for some panels which has width <
height in the portrait orientation.

If the idea is to just minimize the size and use scaling to fit the
panel's virtual desktop in any orientation, then any width/height/size
will do.

Dianne Hackborn

unread,
Jan 1, 2010, 7:46:17 PM1/1/10
to android...@googlegroups.com
On Thu, Dec 31, 2009 at 3:17 AM, muni anda <muni...@gmail.com> wrote:
I was under the impression that size needs to be double of the x-axis
times y-axis not matter what the orientation is. That is because the
Android virtual desktop spans 2 horizontal screens. If that is right,
the logic used appears to only works for some panels which has width <
height in the portrait orientation.

The size doesn't "need" to be anything, except at least the same size as the maximum dimension of the screen (to be big enough to cover both landscape and portrait layouts).  Other than that, any extra size just impacts how much parallax there is during scrolling.

If the idea is to just minimize the size and use scaling to fit the
panel's virtual desktop in any orientation, then any width/height/size
will do.

No, it is to pick a size that will generally be larger than the shown screen, by some amount, so there is parallax during the scrolling, without being excessive.

Reply all
Reply to author
Forward
0 new messages