summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNebojsa Cvetkovic <nebkat@gmail.com>2013-12-17 21:16:36 +0000
committerDanesh M <daneshm90@gmail.com>2014-01-24 16:25:19 -0800
commit5094b6c61ef0a3dc87a6ca8a03cdab932a53bbe5 (patch)
tree1b5760f3145ddc1509f9204b11ddae3b535e2fc4
parent7fc14e45774e3094ef3afdf391a13ad54df62a3e (diff)
downloadandroid_packages_apps_Trebuchet-5094b6c61ef0a3dc87a6ca8a03cdab932a53bbe5.tar.gz
android_packages_apps_Trebuchet-5094b6c61ef0a3dc87a6ca8a03cdab932a53bbe5.tar.bz2
android_packages_apps_Trebuchet-5094b6c61ef0a3dc87a6ca8a03cdab932a53bbe5.zip
Workspace: Scroll wallpaper
Change-Id: I6946df98ada04a3d1fb1da705154888d5cd6973d
-rw-r--r--res/values/cm_strings.xml6
-rw-r--r--res/values/preferences_defaults.xml3
-rw-r--r--res/xml/preferences_homescreen.xml12
-rw-r--r--src/com/android/launcher3/Workspace.java24
-rw-r--r--src/com/android/launcher3/settings/SettingsProvider.java3
5 files changed, 35 insertions, 13 deletions
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 05cb477dd..d880bfb4b 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -31,8 +31,10 @@
<string name="preferences_interface_homescreen_search_title">Search bar</string>
<string name="preferences_interface_homescreen_search_summary">Show persistent search bar at top of screen</string>
<string name="preferences_interface_homescreen_scrolling_category">Scrolling</string>
- <string name="preferences_interface_homescreen_scrolling_show_outlines_title">Show outlines</string>
- <string name="preferences_interface_homescreen_scrolling_show_outlines_summary">Show outlines when scrolling homescreens</string>
+ <string name="preferences_interface_homescreen_scrolling_wallpaper_scroll_title">Scroll wallpaper</string>
+ <string name="preferences_interface_homescreen_scrolling_wallpaper_scroll_summary">Pan wallpaper while scrolling homescreens</string>
+ <string name="preferences_interface_homescreen_scrolling_page_outlines_title">Page outlines</string>
+ <string name="preferences_interface_homescreen_scrolling_page_outlines_summary">Show page outlines while scrolling homescreens</string>
<!-- Drawer -->
<string name="preferences_interface_drawer_title">Drawer</string>
diff --git a/res/values/preferences_defaults.xml b/res/values/preferences_defaults.xml
index 0fb4ed863..ae2ee8037 100644
--- a/res/values/preferences_defaults.xml
+++ b/res/values/preferences_defaults.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="preferences_interface_homescreen_search_default">true</bool>
- <bool name="preferences_interface_homescreen_scrolling_show_outlines_default">@bool/config_workspaceDefaultShowOutlines</bool>
+ <bool name="preferences_interface_homescreen_scrolling_wallpaper_scroll_default">true</bool>
+ <bool name="preferences_interface_homescreen_scrolling_page_outlines_default">@bool/config_workspaceDefaultShowOutlines</bool>
<bool name="preferences_interface_general_large_icons_default">@bool/config_largeIcons</bool>
</resources> \ No newline at end of file
diff --git a/res/xml/preferences_homescreen.xml b/res/xml/preferences_homescreen.xml
index 7b56f56af..41ad848a3 100644
--- a/res/xml/preferences_homescreen.xml
+++ b/res/xml/preferences_homescreen.xml
@@ -23,9 +23,13 @@
android:summary="@string/preferences_interface_homescreen_search_summary"
android:defaultValue="@bool/preferences_interface_homescreen_search_default" />
<PreferenceCategory android:title="@string/preferences_interface_homescreen_scrolling_category">
- <CheckBoxPreference android:key="ui_homescreen_scrolling_show_outlines"
- android:title="@string/preferences_interface_homescreen_scrolling_show_outlines_title"
- android:summary="@string/preferences_interface_homescreen_scrolling_show_outlines_summary"
- android:defaultValue="@bool/config_workspaceDefaultShowOutlines" />
+ <CheckBoxPreference android:key="ui_homescreen_scrolling_wallpaper_scroll"
+ android:title="@string/preferences_interface_homescreen_scrolling_wallpaper_scroll_title"
+ android:summary="@string/preferences_interface_homescreen_scrolling_wallpaper_scroll_summary"
+ android:defaultValue="@bool/preferences_interface_homescreen_scrolling_wallpaper_scroll_default" />
+ <CheckBoxPreference android:key="ui_homescreen_scrolling_page_outlines"
+ android:title="@string/preferences_interface_homescreen_scrolling_page_outlines_title"
+ android:summary="@string/preferences_interface_homescreen_scrolling_page_outlines_summary"
+ android:defaultValue="@bool/preferences_interface_homescreen_scrolling_page_outlines_default" />
</PreferenceCategory>
</PreferenceScreen>
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 12117f451..9c5a4cd46 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -209,6 +209,7 @@ public class Workspace extends SmoothPagedView
private boolean mWorkspaceFadeInAdjacentScreens;
WallpaperOffsetInterpolator mWallpaperOffset;
+ private boolean mScrollWallpaper;
private Runnable mDelayedResizeRunnable;
private Runnable mDelayedSnapToPageRunnable;
private Point mDisplaySize = new Point();
@@ -310,8 +311,11 @@ public class Workspace extends SmoothPagedView
mShowSearchBar = SettingsProvider.getBoolean(context, SettingsProvider.SETTINGS_UI_HOMESCREEN_SEARCH,
R.bool.preferences_interface_homescreen_search_default);
mShowOutlines = SettingsProvider.getBoolean(context,
- SettingsProvider.SETTINGS_UI_HOMESCREEN_SCROLLING_SHOW_OUTLINES,
- R.bool.preferences_interface_homescreen_scrolling_show_outlines_default);
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_SCROLLING_PAGE_OUTLINES,
+ R.bool.preferences_interface_homescreen_scrolling_page_outlines_default);
+ mScrollWallpaper = SettingsProvider.getBoolean(context,
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_SCROLLING_WALLPAPER_SCROLL,
+ R.bool.preferences_interface_homescreen_scrolling_wallpaper_scroll_default);
mLauncher = (Launcher) context;
final Resources res = getResources();
@@ -441,7 +445,7 @@ public class Workspace extends SmoothPagedView
// In this case, we will skip drawing background protection
}
- mWallpaperOffset = new WallpaperOffsetInterpolator();
+ if (mScrollWallpaper) mWallpaperOffset = new WallpaperOffsetInterpolator();
Display display = mLauncher.getWindowManager().getDefaultDisplay();
display.getSize(mDisplaySize);
@@ -1313,7 +1317,7 @@ public class Workspace extends SmoothPagedView
@Override
public void computeScroll() {
super.computeScroll();
- mWallpaperOffset.syncWithScroll();
+ if (mScrollWallpaper) mWallpaperOffset.syncWithScroll();
if (isInOverviewMode() && !isReordering(true)) {
updateDefaultScreenButton();
@@ -1600,7 +1604,7 @@ public class Workspace extends SmoothPagedView
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- if (mFirstLayout && mCurrentPage >= 0 && mCurrentPage < getChildCount()) {
+ if (mFirstLayout && mCurrentPage >= 0 && mCurrentPage < getChildCount() && mScrollWallpaper) {
mWallpaperOffset.syncWithScroll();
mWallpaperOffset.jumpToFinal();
}
@@ -1608,6 +1612,16 @@ public class Workspace extends SmoothPagedView
}
@Override
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+ super.onSizeChanged(w, h, oldw, oldh);
+
+ // Center wallpaper if scrolling disabled
+ if (!mScrollWallpaper && mWindowToken != null) {
+ mWallpaperManager.setWallpaperOffsets(mWindowToken, 0f, 0.5f);
+ }
+ }
+
+ @Override
protected void onDraw(Canvas canvas) {
// Draw the background gradient if necessary
if (mBackground != null && mBackgroundAlpha > 0.0f && mDrawBackground) {
diff --git a/src/com/android/launcher3/settings/SettingsProvider.java b/src/com/android/launcher3/settings/SettingsProvider.java
index abe46b1ee..3d4f5d229 100644
--- a/src/com/android/launcher3/settings/SettingsProvider.java
+++ b/src/com/android/launcher3/settings/SettingsProvider.java
@@ -26,7 +26,8 @@ public final class SettingsProvider {
public static final String SETTINGS_UI_HOMESCREEN_DEFAULT_SCREEN_ID = "ui_homescreen_default_screen_id";
public static final String SETTINGS_UI_HOMESCREEN_SEARCH = "ui_homescreen_search";
- public static final String SETTINGS_UI_HOMESCREEN_SCROLLING_SHOW_OUTLINES = "ui_homescreen_scrolling_show_outlines";
+ public static final String SETTINGS_UI_HOMESCREEN_SCROLLING_WALLPAPER_SCROLL = "ui_homescreen_scrolling_wallpaper_scroll";
+ public static final String SETTINGS_UI_HOMESCREEN_SCROLLING_PAGE_OUTLINES = "ui_homescreen_scrolling_page_outlines";
public static final String SETTINGS_UI_GENERAL_LARGE_ICONS = "ui_general_large_icons";
public static SharedPreferences get(Context context) {