diff options
author | Leon Hong <leonhong@google.com> | 2011-10-24 17:26:18 -0700 |
---|---|---|
committer | Leon Hong <leonhong@google.com> | 2011-10-25 10:59:53 -0700 |
commit | a5a0fb88861b6ada41bad777f42421cbebd193fd (patch) | |
tree | 7bab53b2c1367fed4f54aea5835fd3f4776b6e5d /src/com/android/galaxy4/Galaxy4Wallpaper.java | |
parent | 536e9c842b63ad618936b758076edf18f9726d98 (diff) | |
download | android_packages_wallpapers_Galaxy4-a5a0fb88861b6ada41bad777f42421cbebd193fd.tar.gz android_packages_wallpapers_Galaxy4-a5a0fb88861b6ada41bad777f42421cbebd193fd.tar.bz2 android_packages_wallpapers_Galaxy4-a5a0fb88861b6ada41bad777f42421cbebd193fd.zip |
Orientation change fix
- fixed reposition when orientation changes
- updated assets
- removed baked-in stars in bg image
- added static stars mesh
Change-Id: I6b47a994a235ec3034cab0c20d836db46c2873c7
Diffstat (limited to 'src/com/android/galaxy4/Galaxy4Wallpaper.java')
-rw-r--r-- | src/com/android/galaxy4/Galaxy4Wallpaper.java | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/com/android/galaxy4/Galaxy4Wallpaper.java b/src/com/android/galaxy4/Galaxy4Wallpaper.java index 1192e1c..d952df8 100644 --- a/src/com/android/galaxy4/Galaxy4Wallpaper.java +++ b/src/com/android/galaxy4/Galaxy4Wallpaper.java @@ -22,9 +22,12 @@ import android.os.Handler; import android.os.Message; import android.renderscript.RenderScript; import android.renderscript.RenderScriptGL; +import android.util.DisplayMetrics; import android.service.wallpaper.WallpaperService; import android.view.Surface; import android.view.SurfaceHolder; +import android.view.WindowManager; +import android.app.Service; public class Galaxy4Wallpaper extends WallpaperService { @@ -36,6 +39,7 @@ public class Galaxy4Wallpaper extends WallpaperService { private class RenderScriptEngine extends Engine { private RenderScriptGL mRenderScript = null; private GalaxyRS mWallpaperRS = null; + private int mDensityDPI; @Override public void onCreate(SurfaceHolder surfaceHolder) { @@ -43,6 +47,11 @@ public class Galaxy4Wallpaper extends WallpaperService { setTouchEventsEnabled(true); surfaceHolder.setSizeFromLayout(); surfaceHolder.setFormat(PixelFormat.RGBA_8888); + + DisplayMetrics metrics = new DisplayMetrics(); + ((WindowManager) getApplication().getSystemService(Service.WINDOW_SERVICE)) + .getDefaultDisplay().getMetrics(metrics); + mDensityDPI = metrics.densityDpi; } @Override @@ -80,7 +89,8 @@ public class Galaxy4Wallpaper extends WallpaperService { } @Override - public void onSurfaceChanged(SurfaceHolder surfaceHolder, int format, int width, int height) { + public void onSurfaceChanged(SurfaceHolder surfaceHolder, + int format, int width, int height) { super.onSurfaceChanged(surfaceHolder, format, width, height); if (mRenderScript != null) { @@ -89,11 +99,12 @@ public class Galaxy4Wallpaper extends WallpaperService { if (mWallpaperRS == null) { mWallpaperRS = new GalaxyRS(); - mWallpaperRS.init(mRenderScript, getResources(), width, height); + mWallpaperRS.init(mDensityDPI, mRenderScript, getResources(), width, height); mWallpaperRS.start(); + } else { + mWallpaperRS.resize(width, height); } - // mWallpaperRS.resize(width, height); } @Override @@ -116,11 +127,5 @@ public class Galaxy4Wallpaper extends WallpaperService { } } } - - @Override - public void onOffsetsChanged(float xOffset, float yOffset, float xOffsetStep, - float yOffsetStep, int xPixelOffset, int yPixelOffset) { - // mWallpaperRS.setOffset(xOffset, yOffset, xPixelOffset, yPixelOffset); - } } -} +}
\ No newline at end of file |