Skip to content

Commit

Permalink
An option to disable wallpaper scrolling.
Browse files Browse the repository at this point in the history
Change trash can icon in launcher.
  • Loading branch information
ruqq authored and echo17 committed May 9, 2011
1 parent 8f7cb74 commit 9f8d05e
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 8 deletions.
Binary file modified res/drawable-hdpi/trashcan.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/drawable-hdpi/trashcan_hover.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions res/values/strings.xml
Expand Up @@ -160,8 +160,8 @@
<string name="pref_summary_hide_labels">Check to hide desktop icon labels</string>
<string name="pref_title_hide_labels">Hide labels</string>
<string name="pref_summary_launcher_fullscreen">Hide notification bar on homescreen</string>
<string name="pref_title_launcher_fullscreen">Full screen launcher</string>


<string name="pref_title_launcher_fullscreen">Full screen mode</string>
<string name="pref_title_wallpaper_scrolling">Wallpaper scrolling</string>
<string name="pref_summary_wallpaper_scrolling">Enable/disable wallpaper scroll</string>

</resources>
5 changes: 5 additions & 0 deletions res/xml/preferences.xml
Expand Up @@ -9,6 +9,11 @@
android:summary="@string/pref_summary_launcher_fullscreen"
android:defaultValue="false" />

<CheckBoxPreference android:key="pref_key_launcher_wallpaper_scrolling"
android:title="@string/pref_title_wallpaper_scrolling"
android:summary="@string/pref_summary_wallpaper_scrolling"
android:defaultValue="true" />

</PreferenceCategory>

<PreferenceCategory
Expand Down
3 changes: 3 additions & 0 deletions src/com/android/launcher2/Launcher.java
Expand Up @@ -599,6 +599,9 @@ protected void onResume() {
} else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

Workspace.WALLPAPER_SCROLLING = mPrefs.getBoolean(LauncherPreferenceActivity.LAUNCHER_WALLPAPER_SCROLLING, true);

if (mRestoring || mOnResumeNeedsLoad) {
mWorkspaceLoading = true;
mModel.startLoader(this, true);
Expand Down
1 change: 1 addition & 0 deletions src/com/android/launcher2/LauncherPreferenceActivity.java
Expand Up @@ -41,6 +41,7 @@ public class LauncherPreferenceActivity extends PreferenceActivity{
public static final String LAUNCHER_HIDE_LABELS = "pref_key_launcher_hide_labels";
public static final String LAUNCHER_SHOW_SHORTCUTS_LABEL = "pref_key_launcher_show_shortcuts_label";
public static final String LAUNCHER_FULLSCREEN = "pref_key_launcher_fullscreen";
public static final String LAUNCHER_WALLPAPER_SCROLLING = "pref_key_launcher_wallpaper_scrolling";

//private static final String APPS2D_PREF = "pref_key_2d_setting";

Expand Down
10 changes: 5 additions & 5 deletions src/com/android/launcher2/Workspace.java
Expand Up @@ -72,6 +72,8 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag

private boolean mFirstLayout = true;

static public boolean WALLPAPER_SCROLLING = true;

private int mCurrentScreen;
private int mNextScreen = INVALID_SCREEN;
private CustomScroller mScroller;
Expand Down Expand Up @@ -427,11 +429,9 @@ private void updateWallpaperOffset() {
}

private void updateWallpaperOffset(int scrollRange) {
IBinder token = getWindowToken();
if (token != null) {
mWallpaperManager.setWallpaperOffsetSteps(1.0f / (getChildCount() - 1), 0 );
mWallpaperManager.setWallpaperOffsets(getWindowToken(),
Math.max(0.f, Math.min(mScrollX/(float)scrollRange, 1.f)), 0);
if (Workspace.WALLPAPER_SCROLLING == true) {
mWallpaperManager.setWallpaperOffsetSteps(1.0f / (getChildCount() - 1), 0 );
mWallpaperManager.setWallpaperOffsets(getWindowToken(), getScrollX() / (float) scrollRange, 0);
}
}

Expand Down

0 comments on commit 9f8d05e

Please sign in to comment.