diff options
author | Andy Doan <andy.doan@linaro.org> | 2011-12-05 23:44:06 -0600 |
---|---|---|
committer | Andy Doan <andy.doan@linaro.org> | 2011-12-06 15:14:28 -0600 |
commit | b683e03999c7bf74e570d236bdae9385dc3bf9c8 (patch) | |
tree | 580dfb76b0c9d1d42dff0793fbe062db77ee1892 | |
parent | 2221ba6851706e6c8a8bd09bc1d3f5c63652cf42 (diff) | |
download | LinaroWallpaper-b683e03999c7bf74e570d236bdae9385dc3bf9c8.tar.gz |
setup code for location "Center"
-rw-r--r-- | src/org/linaro/wallpaper/LogoWallpaper.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/org/linaro/wallpaper/LogoWallpaper.java b/src/org/linaro/wallpaper/LogoWallpaper.java index e36766e..97664b2 100644 --- a/src/org/linaro/wallpaper/LogoWallpaper.java +++ b/src/org/linaro/wallpaper/LogoWallpaper.java @@ -118,21 +118,16 @@ public class LogoWallpaper extends WallpaperService { p[i] = new Point(boxX + (i*boxW), boxY); } - private void initAnimation(int width, int height) { - float density = getResources().getDisplayMetrics().density; - + private void initAnimationCenter(int width, int height, float density, + Drawable d, int boxSpacing) { mLogoX = (width/2.0f) - (mLogo.getWidth()/2.0f); mLogoY = (height/2.0f) - (mLogo.getHeight()/2.0f); - mBox = new MovingDrawable[5]; - int boxX = Math.round(mLogoX + (BOX_XOFFSET*density)); int boxY = Math.round(mLogoY + (BOX_YOFFSET*density)); - Drawable d = getResources().getDrawable(R.drawable.box); - int w = d.getIntrinsicWidth() + Math.round(3*density); Point p[] = new Point[mBox.length]; - getEndingPoints(boxX, boxY, w, p); + getEndingPoints(boxX, boxY, boxSpacing, p); //box 1 from the top,left Point start = new Point(0, 0); @@ -153,8 +148,19 @@ public class LogoWallpaper extends WallpaperService { //box 5 from the top,left start = new Point(width, 0); mBox[4] = new MovingDrawable(d, start, p[4], NUM_FRAMES); + } + private void initAnimation(int width, int height) { + float density = getResources().getDisplayMetrics().density; + + mBox = new MovingDrawable[5]; mNumFrameDelays = NUM_FRAMES / mBox.length; + + Drawable d = getResources().getDrawable(R.drawable.box); + int w = d.getIntrinsicWidth() + Math.round(3*density); + + if("Center".equals(mLocation)) + initAnimationCenter(width, height, density, d, w); } @Override |