diff options
author | Dianne Hackborn <hackbod@google.com> | 2009-08-10 23:05:49 -0700 |
---|---|---|
committer | Cary Clark <cary@android.com> | 2009-08-11 10:03:16 -0400 |
commit | c8a0a75e1c61d1ab24bd46a8243041c107e738ac (patch) | |
tree | 2fb0685253fe71e77f91e0ca7259c83a2b91cae8 /core/java | |
parent | 2ce89adde442fac551413362ea442caa088c25e4 (diff) | |
download | frameworks_base-c8a0a75e1c61d1ab24bd46a8243041c107e738ac.zip frameworks_base-c8a0a75e1c61d1ab24bd46a8243041c107e738ac.tar.gz frameworks_base-c8a0a75e1c61d1ab24bd46a8243041c107e738ac.tar.bz2 |
Implement support for scrolling a wallpaper.
This currently only works for a wallpaper that is larger than the
screen. Set the scroll position with the new wallpaper API. Right
now only does jump scrolls.
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/app/WallpaperManager.java | 23 | ||||
-rw-r--r-- | core/java/android/view/IWindowManager.aidl | 1 | ||||
-rw-r--r-- | core/java/android/view/IWindowSession.aidl | 6 |
3 files changed, 29 insertions, 1 deletions
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java index 9019b54..78b6cf1 100644 --- a/core/java/android/app/WallpaperManager.java +++ b/core/java/android/app/WallpaperManager.java @@ -28,6 +28,7 @@ import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ServiceManager; +import android.view.ViewRoot; import java.io.FileOutputStream; import java.io.IOException; @@ -312,6 +313,28 @@ public class WallpaperManager { } /** + * Set the position of the current wallpaper within any larger space, when + * that wallpaper is visible behind the given window. The X and Y offsets + * are floating point numbers ranging from 0 to 1, representing where the + * wallpaper should be positioned within the screen space. These only + * make sense when the wallpaper is larger than the screen. + * + * @param windowToken The window who these offsets should be associated + * with, as returned by {@link android.view.View#getWindowVisibility() + * View.getWindowToken()}. + * @param xOffset The offset olong the X dimension, from 0 to 1. + * @param yOffset The offset along the Y dimension, from 0 to 1. + */ + public void setWallpaperOffsets(IBinder windowToken, float xOffset, float yOffset) { + try { + ViewRoot.getWindowSession(mContext.getMainLooper()).setWallpaperPosition( + windowToken, xOffset, yOffset); + } catch (RemoteException e) { + // Ignore. + } + } + + /** * Remove any currently set wallpaper, reverting to the system's default * wallpaper. On success, the intent {@link Intent#ACTION_WALLPAPER_CHANGED} * is broadcast. diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index 5607d4b..3e6cdc2 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -90,7 +90,6 @@ interface IWindowManager void exitKeyguardSecurely(IOnKeyguardExitResult callback); boolean inKeyguardRestrictedInputMode(); - // These can only be called with the SET_ANIMATON_SCALE permission. float getAnimationScale(int which); float[] getAnimationScales(); diff --git a/core/java/android/view/IWindowSession.aidl b/core/java/android/view/IWindowSession.aidl index 1156856..4d662d2 100644 --- a/core/java/android/view/IWindowSession.aidl +++ b/core/java/android/view/IWindowSession.aidl @@ -108,4 +108,10 @@ interface IWindowSession { boolean getInTouchMode(); boolean performHapticFeedback(IWindow window, int effectId, boolean always); + + /** + * For windows with the wallpaper behind them, and the wallpaper is + * larger than the screen, set the offset within the screen. + */ + void setWallpaperPosition(IBinder windowToken, float x, float y); } |