diff options
author | nebkat <nebkat@teamhacksung.org> | 2012-12-24 05:39:43 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.cyanogenmod.com> | 2012-12-24 05:39:43 -0800 |
commit | dcc1ded62375e961c9efd958b18fbc1690bbf748 (patch) | |
tree | 4755da7e6931724de7811d730877be5db2c493b1 | |
parent | 7032cc3759a8b3a6145bca5fcb31135e54d665a8 (diff) | |
parent | c6f8c8c92e73efb0aa675a89ca4eded9ebd77615 (diff) | |
download | packages_apps_trebuchet-dcc1ded62375e961c9efd958b18fbc1690bbf748.zip packages_apps_trebuchet-dcc1ded62375e961c9efd958b18fbc1690bbf748.tar.gz packages_apps_trebuchet-dcc1ded62375e961c9efd958b18fbc1690bbf748.tar.bz2 |
Merge "Hotseat: Multiple Pages" into cm-10.1
-rw-r--r-- | res/layout-land/hotseat.xml | 18 | ||||
-rw-r--r-- | res/layout-land/hotseat_page.xml | 33 | ||||
-rw-r--r-- | res/layout-port/hotseat.xml | 18 | ||||
-rw-r--r-- | res/layout-port/hotseat_page.xml | 33 | ||||
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | res/xml/default_workspace.xml | 8 | ||||
-rw-r--r-- | res/xml/preferences_dock.xml | 8 | ||||
-rw-r--r-- | res/xml/update_workspace.xml | 30 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Hotseat.java | 63 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Launcher.java | 4 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/LauncherModel.java | 23 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/PagedView.java | 5 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Workspace.java | 45 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java | 3 |
14 files changed, 206 insertions, 87 deletions
diff --git a/res/layout-land/hotseat.xml b/res/layout-land/hotseat.xml index 2b13347..4fd3e28 100644 --- a/res/layout-land/hotseat.xml +++ b/res/layout-land/hotseat.xml @@ -17,20 +17,4 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:launcher="http://schemas.android.com/apk/res/com.cyanogenmod.trebuchet" launcher:cellCountX="1" - launcher:cellCountY="@integer/hotseat_cell_count"> - <com.cyanogenmod.trebuchet.CellLayout - android:id="@+id/layout" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:paddingTop="@dimen/button_bar_width_left_padding" - android:paddingBottom="@dimen/button_bar_width_right_padding" - android:paddingLeft="@dimen/button_bar_height_top_padding" - android:paddingRight="@dimen/button_bar_height_bottom_padding" - - launcher:cellWidth="@dimen/hotseat_cell_width" - launcher:cellHeight="@dimen/hotseat_cell_height" - launcher:widthGap="@dimen/hotseat_width_gap" - launcher:heightGap="@dimen/hotseat_height_gap" - launcher:maxGap="@dimen/workspace_max_gap" /> -</com.cyanogenmod.trebuchet.Hotseat> + launcher:cellCountY="@integer/hotseat_cell_count" /> diff --git a/res/layout-land/hotseat_page.xml b/res/layout-land/hotseat_page.xml new file mode 100644 index 0000000..5371a09 --- /dev/null +++ b/res/layout-land/hotseat_page.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2008 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<com.cyanogenmod.trebuchet.CellLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:launcher="http://schemas.android.com/apk/res/com.cyanogenmod.trebuchet" + + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:paddingTop="@dimen/button_bar_width_left_padding" + android:paddingBottom="@dimen/button_bar_width_right_padding" + android:paddingLeft="@dimen/button_bar_height_top_padding" + android:paddingRight="@dimen/button_bar_height_bottom_padding" + + launcher:cellWidth="@dimen/hotseat_cell_width" + launcher:cellHeight="@dimen/hotseat_cell_height" + launcher:widthGap="@dimen/hotseat_width_gap" + launcher:heightGap="@dimen/hotseat_height_gap" + launcher:maxGap="@dimen/workspace_max_gap" /> diff --git a/res/layout-port/hotseat.xml b/res/layout-port/hotseat.xml index 0420469..3abd133 100644 --- a/res/layout-port/hotseat.xml +++ b/res/layout-port/hotseat.xml @@ -17,20 +17,4 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:launcher="http://schemas.android.com/apk/res/com.cyanogenmod.trebuchet" launcher:cellCountX="@integer/hotseat_cell_count" - launcher:cellCountY="1"> - <com.cyanogenmod.trebuchet.CellLayout - android:id="@+id/layout" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="center" - android:paddingTop="@dimen/button_bar_height_top_padding" - android:paddingBottom="@dimen/button_bar_height_bottom_padding" - android:paddingLeft="@dimen/button_bar_width_left_padding" - android:paddingRight="@dimen/button_bar_width_right_padding" - - launcher:cellWidth="@dimen/hotseat_cell_width" - launcher:cellHeight="@dimen/hotseat_cell_height" - launcher:widthGap="@dimen/hotseat_width_gap" - launcher:heightGap="@dimen/hotseat_height_gap" - launcher:maxGap="@dimen/workspace_max_gap" /> -</com.cyanogenmod.trebuchet.Hotseat> + launcher:cellCountY="1" /> diff --git a/res/layout-port/hotseat_page.xml b/res/layout-port/hotseat_page.xml new file mode 100644 index 0000000..9c1e87c --- /dev/null +++ b/res/layout-port/hotseat_page.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2008 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<com.cyanogenmod.trebuchet.CellLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:launcher="http://schemas.android.com/apk/res/com.cyanogenmod.trebuchet" + + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_gravity="center" + android:paddingTop="@dimen/button_bar_height_top_padding" + android:paddingBottom="@dimen/button_bar_height_bottom_padding" + android:paddingLeft="@dimen/button_bar_width_left_padding" + android:paddingRight="@dimen/button_bar_width_right_padding" + + launcher:cellWidth="@dimen/hotseat_cell_width" + launcher:cellHeight="@dimen/hotseat_cell_height" + launcher:widthGap="@dimen/hotseat_width_gap" + launcher:heightGap="@dimen/hotseat_height_gap" + launcher:maxGap="@dimen/workspace_max_gap" /> diff --git a/res/values/strings.xml b/res/values/strings.xml index d23b861..87047d2 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -382,6 +382,8 @@ s --> <!-- Dock --> <string name="preferences_interface_dock_title">Dock</string> + <string name="preferences_interface_dock_pages_title">Pages</string> + <string name="preferences_interface_dock_pages_summary">Number of pages in the dock</string> <string name="preferences_interface_dock_divider_title">Show dock divider</string> <string name="preferences_interface_dock_divider_summary">Show divider between homescreen and dock</string> diff --git a/res/xml/default_workspace.xml b/res/xml/default_workspace.xml index 2feb09f..7975e65 100644 --- a/res/xml/default_workspace.xml +++ b/res/xml/default_workspace.xml @@ -71,12 +71,12 @@ launcher:packageName="com.android.contacts" launcher:className="com.android.contacts.activities.PeopleActivity" launcher:container="-101" - launcher:screen="1" + launcher:screen="0" launcher:x="1" launcher:y="0" /> <shortcut launcher:container="-101" - launcher:screen="2" + launcher:screen="0" launcher:x="2" launcher:y="0" launcher:icon="@drawable/ic_allapps" @@ -86,14 +86,14 @@ launcher:packageName="com.android.mms" launcher:className="com.android.mms.ui.ConversationList" launcher:container="-101" - launcher:screen="3" + launcher:screen="0" launcher:x="3" launcher:y="0" /> <favorite launcher:packageName="com.android.browser" launcher:className="com.android.browser.BrowserActivity" launcher:container="-101" - launcher:screen="4" + launcher:screen="0" launcher:x="4" launcher:y="0" /> </favorites> diff --git a/res/xml/preferences_dock.xml b/res/xml/preferences_dock.xml index 10fabe2..08a2c19 100644 --- a/res/xml/preferences_dock.xml +++ b/res/xml/preferences_dock.xml @@ -18,8 +18,14 @@ xmlns:launcher="http://schemas.android.com/apk/res/com.cyanogenmod.trebuchet" android:key="ui_dock" android:title="@string/preferences_interface_dock_title"> + <com.cyanogenmod.trebuchet.preference.NumberPickerPreference android:key="ui_dock_pages" + android:title="@string/preferences_interface_dock_pages_title" + android:summary="@string/preferences_interface_dock_pages_summary" + android:defaultValue="1" + launcher:max="3" + launcher:min="1" /> <CheckBoxPreference android:key="ui_dock_divider" android:title="@string/preferences_interface_dock_divider_title" android:summary="@string/preferences_interface_dock_divider_summary" android:defaultValue="true" /> -</PreferenceScreen>
\ No newline at end of file +</PreferenceScreen> diff --git a/res/xml/update_workspace.xml b/res/xml/update_workspace.xml index 768d3ba..320d765 100644 --- a/res/xml/update_workspace.xml +++ b/res/xml/update_workspace.xml @@ -17,12 +17,40 @@ <favorites xmlns:launcher="http://schemas.android.com/apk/res/com.cyanogenmod.trebuchet"> <!-- Update the db with new hotseat all apps button. --> <!-- Hotseat (We use the screen as the position of the item in the hotseat) --> + <favorite + launcher:packageName="com.android.contacts" + launcher:className="com.android.contacts.activities.DialtactsActivity" + launcher:container="-101" + launcher:screen="0" + launcher:x="0" + launcher:y="0" /> + <favorite + launcher:packageName="com.android.contacts" + launcher:className="com.android.contacts.activities.PeopleActivity" + launcher:container="-101" + launcher:screen="0" + launcher:x="1" + launcher:y="0" /> <shortcut launcher:container="-101" - launcher:screen="2" + launcher:screen="0" launcher:x="2" launcher:y="0" launcher:icon="@drawable/ic_allapps" launcher:title="@string/all_apps_button_label" launcher:uri="#Intent;action=com.cyanogenmod.trebuchet.LAUNCHER_ACTION;category=android.intent.category.HOME;launchFlags=0x10200000;component=com.cyanogenmod.trebuchet/com.cyanogenmod.trebuchet.Launcher;S.android.intent.extra.TEXT=AllApps;end" /> + <favorite + launcher:packageName="com.android.mms" + launcher:className="com.android.mms.ui.ConversationList" + launcher:container="-101" + launcher:screen="0" + launcher:x="3" + launcher:y="0" /> + <favorite + launcher:packageName="com.android.browser" + launcher:className="com.android.browser.BrowserActivity" + launcher:container="-101" + launcher:screen="0" + launcher:x="4" + launcher:y="0" /> </favorites> diff --git a/src/com/cyanogenmod/trebuchet/Hotseat.java b/src/com/cyanogenmod/trebuchet/Hotseat.java index cc287bd..23435d3 100644 --- a/src/com/cyanogenmod/trebuchet/Hotseat.java +++ b/src/com/cyanogenmod/trebuchet/Hotseat.java @@ -24,11 +24,10 @@ import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; -import android.widget.FrameLayout; -import com.cyanogenmod.trebuchet.R; +import com.cyanogenmod.trebuchet.preference.PreferencesProvider; -public class Hotseat extends FrameLayout { +public class Hotseat extends PagedView { private Launcher mLauncher; private CellLayout mContent; @@ -53,6 +52,17 @@ public class Hotseat extends FrameLayout { public Hotseat(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); + mFadeInAdjacentScreens = false; + mHandleScrollIndicator = true; + + int hotseatPages = PreferencesProvider.Interface.Dock.getNumberPages(); + + LayoutInflater inflater = + (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + for (int i = 0; i < hotseatPages; i++) { + inflater.inflate(R.layout.hotseat_page, this); + } + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Hotseat, defStyle, 0); Resources r = context.getResources(); @@ -63,6 +73,9 @@ public class Hotseat extends FrameLayout { r.getBoolean(R.bool.hotseat_transpose_layout_with_orientation); mIsLandscape = context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; + + // No data needed + setDataIsReady(); } public void setup(Launcher launcher) { @@ -71,7 +84,16 @@ public class Hotseat extends FrameLayout { } CellLayout getLayout() { - return mContent; + return (CellLayout) getPageAt(mCurrentPage); + } + + public boolean hasPage(View view) { + for (int i = 0; i < getChildCount(); i++) { + if (view == getChildAt(i)) { + return true; + } + } + return false; } private boolean hasVerticalHotseat() { @@ -80,14 +102,14 @@ public class Hotseat extends FrameLayout { /* Get the orientation invariant order of the item in the hotseat for persistence. */ int getOrderInHotseat(int x, int y) { - return hasVerticalHotseat() ? (mContent.getCountY() - y - 1) : x; + return hasVerticalHotseat() ? (mCellCountY - y - 1) : x; } /* Get the orientation specific coordinates given an invariant order in the hotseat. */ int getCellXFromOrder(int rank) { return hasVerticalHotseat() ? 0 : rank; } int getCellYFromOrder(int rank) { - return hasVerticalHotseat() ? (mContent.getCountY() - (rank + 1)) : 0; + return hasVerticalHotseat() ? (mCellCountY - (rank + 1)) : 0; } @Override @@ -95,14 +117,33 @@ public class Hotseat extends FrameLayout { super.onFinishInflate(); if (mCellCountX < 0) mCellCountX = DEFAULT_CELL_COUNT_X; if (mCellCountY < 0) mCellCountY = DEFAULT_CELL_COUNT_Y; - mContent = (CellLayout) findViewById(R.id.layout); - mContent.setGridSize(mCellCountX, mCellCountY); - mContent.setIsHotseat(true); - + for (int i = 0; i < getChildCount(); i++) { + CellLayout cl = (CellLayout) getPageAt(i); + cl.setGridSize(mCellCountX, mCellCountY); + cl.setIsHotseat(true); + } resetLayout(); } void resetLayout() { - mContent.removeAllViewsInLayout(); + for (int i = 0; i < getChildCount(); i++) { + CellLayout cl = (CellLayout) getPageAt(i); + cl.removeAllViewsInLayout(); + } + } + + @Override + public void syncPages() { + } + + @Override + public void syncPageItems(int page, boolean immediate) { + } + + @Override + protected void loadAssociatedPages(int page) { + } + @Override + protected void loadAssociatedPages(int page, boolean immediateAndOnly) { } } diff --git a/src/com/cyanogenmod/trebuchet/Launcher.java b/src/com/cyanogenmod/trebuchet/Launcher.java index 14274f3..e8efcc6 100644 --- a/src/com/cyanogenmod/trebuchet/Launcher.java +++ b/src/com/cyanogenmod/trebuchet/Launcher.java @@ -2549,7 +2549,7 @@ public final class Launcher extends Activity boolean isHotseatLayout(View layout) { return mHotseat != null && layout != null && - (layout instanceof CellLayout) && (layout == mHotseat.getLayout()); + (layout instanceof CellLayout) && mHotseat.hasPage(layout); } Hotseat getHotseat() { return mHotseat; @@ -2564,7 +2564,7 @@ public final class Launcher extends Activity CellLayout getCellLayout(long container, int screen) { if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) { if (mHotseat != null) { - return mHotseat.getLayout(); + return (CellLayout) mHotseat.getPageAt(screen); } else { return null; } diff --git a/src/com/cyanogenmod/trebuchet/LauncherModel.java b/src/com/cyanogenmod/trebuchet/LauncherModel.java index abdb484..36a8043 100644 --- a/src/com/cyanogenmod/trebuchet/LauncherModel.java +++ b/src/com/cyanogenmod/trebuchet/LauncherModel.java @@ -385,14 +385,7 @@ public class LauncherModel extends BroadcastReceiver { item.cellX = cellX; item.cellY = cellY; - // We store hotseat items in canonical form which is this orientation invariant position - // in the hotseat - if (context instanceof Launcher && screen < 0 && - container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) { - item.screen = ((Launcher) context).getHotseat().getOrderInHotseat(cellX, cellY); - } else { - item.screen = screen; - } + item.screen = screen; final ContentValues values = new ContentValues(); values.put(LauncherSettings.Favorites.CONTAINER, item.container); @@ -559,14 +552,8 @@ public class LauncherModel extends BroadcastReceiver { item.container = container; item.cellX = cellX; item.cellY = cellY; - // We store hotseat items in canonical form which is this orientation invariant position - // in the hotseat - if (context instanceof Launcher && screen < 0 && - container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) { - item.screen = ((Launcher) context).getHotseat().getOrderInHotseat(cellX, cellY); - } else { - item.screen = screen; - } + + item.screen = screen; final ContentValues values = new ContentValues(); final ContentResolver cr = context.getContentResolver(); @@ -1175,13 +1162,13 @@ public class LauncherModel extends BroadcastReceiver { if (item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) { // We use the last index to refer to the hotseat and the screen as the rank, so // test and update the occupied state accordingly - if (occupied[Launcher.MAX_SCREEN_COUNT][item.screen][0] != null) { + if (occupied[Launcher.MAX_SCREEN_COUNT][item.cellX][0] != null) { Log.e(TAG, "Error loading shortcut into hotseat " + item + " into position (" + item.screen + ":" + item.cellX + "," + item.cellY + ") occupied by " + occupied[Launcher.MAX_SCREEN_COUNT][item.screen][0]); return false; } else { - occupied[Launcher.MAX_SCREEN_COUNT][item.screen][0] = item; + occupied[Launcher.MAX_SCREEN_COUNT][item.cellX][0] = item; return true; } } else if (item.container != LauncherSettings.Favorites.CONTAINER_DESKTOP) { diff --git a/src/com/cyanogenmod/trebuchet/PagedView.java b/src/com/cyanogenmod/trebuchet/PagedView.java index b1fee54..a2b353f 100644 --- a/src/com/cyanogenmod/trebuchet/PagedView.java +++ b/src/com/cyanogenmod/trebuchet/PagedView.java @@ -195,6 +195,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc private boolean mHasScrollIndicator = true; private boolean mShouldShowScrollIndicator = false; private boolean mShouldShowScrollIndicatorImmediately = false; + protected boolean mHandleScrollIndicator = false; protected static final int sScrollIndicatorFadeInDuration = 150; protected static final int sScrollIndicatorFadeOutDuration = 650; protected static final int sScrollIndicatorFadeOutShortDuration = 150; @@ -2017,6 +2018,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc mShouldShowScrollIndicatorImmediately = true; if (getChildCount() <= 1) return; if (!isScrollingIndicatorEnabled()) return; + if (mHandleScrollIndicator) return; mShouldShowScrollIndicator = false; getScrollingIndicator(); @@ -2048,6 +2050,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc protected void hideScrollingIndicator(boolean immediately, int duration) { if (getChildCount() <= 1) return; if (!isScrollingIndicatorEnabled()) return; + if (mHandleScrollIndicator) return; getScrollingIndicator(); if (mScrollIndicator != null) { @@ -2105,6 +2108,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc private void updateScrollingIndicator() { if (getChildCount() <= 1) return; if (!isScrollingIndicatorEnabled()) return; + if (mHandleScrollIndicator) return; getScrollingIndicator(); if (mScrollIndicator != null) { @@ -2118,6 +2122,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc private void updateScrollingIndicatorPosition() { if (!isScrollingIndicatorEnabled()) return; if (mScrollIndicator == null) return; + if (mHandleScrollIndicator) return; int numPages = getChildCount(); int pageSize = !mVertical ? getMeasuredWidth() : getMeasuredHeight(); int lastChildIndex = Math.max(0, getChildCount() - 1); diff --git a/src/com/cyanogenmod/trebuchet/Workspace.java b/src/com/cyanogenmod/trebuchet/Workspace.java index 08b0e7a..05567e2 100644 --- a/src/com/cyanogenmod/trebuchet/Workspace.java +++ b/src/com/cyanogenmod/trebuchet/Workspace.java @@ -663,7 +663,11 @@ public class Workspace extends SmoothPagedView final CellLayout layout; if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) { - layout = mLauncher.getHotseat().getLayout(); + if (screen < 0 || screen >= mLauncher.getHotseat().getChildCount()) { + layout = (CellLayout) mLauncher.getHotseat().getLayout(); + } else { + layout = (CellLayout) mLauncher.getHotseat().getPageAt(screen); + } child.setOnKeyListener(null); // Hide titles in the hotseat @@ -673,14 +677,10 @@ public class Workspace extends SmoothPagedView ((BubbleTextView) child).setTextVisible(false); } - if (screen < 0) { - screen = mLauncher.getHotseat().getOrderInHotseat(x, y); - } else { - // Note: We do this to ensure that the hotseat is always laid out in the orientation - // of the hotseat in order regardless of which orientation they were added - x = mLauncher.getHotseat().getCellXFromOrder(screen); - y = mLauncher.getHotseat().getCellYFromOrder(screen); - } + // Note: We do this to ensure that the hotseat is always laid out in the orientation + // of the hotseat in order regardless of which orientation they were added + x = mLauncher.getHotseat().getCellXFromOrder(x); + y = mLauncher.getHotseat().getCellYFromOrder(y); } else { if (!mHideIconLabels) { // Show titles if not in the hotseat @@ -2750,7 +2750,10 @@ public class Workspace extends SmoothPagedView if (v == null || hasntMoved || !mCreateUserFolderOnDrop) return false; mCreateUserFolderOnDrop = false; - final int screen = (targetCell == null) ? mDragInfo.screen : indexOfChild(target); + final int screen = (targetCell == null) ? mDragInfo.screen : + (mLauncher.isHotseatLayout(target) ? + mLauncher.getHotseat().indexOfChild(target) : + indexOfChild(target)); boolean aboveShortcut = (v.getTag() instanceof ShortcutInfo); boolean willBecomeShortcut = (newView.getTag() instanceof ShortcutInfo); @@ -2844,7 +2847,9 @@ public class Workspace extends SmoothPagedView LauncherSettings.Favorites.CONTAINER_HOTSEAT : LauncherSettings.Favorites.CONTAINER_DESKTOP; int screen = (mTargetCell[0] < 0) ? - mDragInfo.screen : indexOfChild(dropTargetLayout); + mDragInfo.screen : (hasMovedIntoHotseat ? + mLauncher.getHotseat().indexOfChild(dropTargetLayout) : + indexOfChild(dropTargetLayout)); int spanX = mDragInfo != null ? mDragInfo.spanX : 1; int spanY = mDragInfo != null ? mDragInfo.spanY : 1; // First we find the cell nearest to point at which the item is @@ -3672,7 +3677,9 @@ public class Workspace extends SmoothPagedView final long container = mLauncher.isHotseatLayout(cellLayout) ? LauncherSettings.Favorites.CONTAINER_HOTSEAT : LauncherSettings.Favorites.CONTAINER_DESKTOP; - final int screen = indexOfChild(cellLayout); + final int screen = mLauncher.isHotseatLayout(cellLayout) ? + mLauncher.getHotseat().indexOfChild(cellLayout) : + indexOfChild(cellLayout); if (!mLauncher.isHotseatLayout(cellLayout) && screen != mCurrentPage && mState != State.SPRING_LOADED) { snapToPage(screen); @@ -4225,8 +4232,11 @@ public class Workspace extends SmoothPagedView for (int screen = 0; screen < screenCount; screen++) { layouts.add(((CellLayout) getChildAt(screen))); } - if (mLauncher.getHotseat() != null) { - layouts.add(mLauncher.getHotseat().getLayout()); + Hotseat hotseat = mLauncher.getHotseat(); + if (hotseat != null) { + for (int screen = 0; screen < hotseat.getChildCount(); screen++) { + layouts.add((CellLayout) hotseat.getPageAt(screen)); + } } return layouts; } @@ -4243,8 +4253,11 @@ public class Workspace extends SmoothPagedView for (int screen = 0; screen < screenCount; screen++) { childrenLayouts.add(((CellLayout) getChildAt(screen)).getShortcutsAndWidgets()); } - if (mLauncher.getHotseat() != null) { - childrenLayouts.add(mLauncher.getHotseat().getLayout().getShortcutsAndWidgets()); + Hotseat hotseat = mLauncher.getHotseat(); + if (hotseat != null) { + for (int screen = 0; screen < hotseat.getChildCount(); screen++) { + childrenLayouts.add(((CellLayout) hotseat.getPageAt(screen)).getShortcutsAndWidgets()); + } } return childrenLayouts; } diff --git a/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java b/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java index 623a297..d5901f8 100644 --- a/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java +++ b/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java @@ -179,6 +179,9 @@ public final class PreferencesProvider { } public static class Dock { + public static int getNumberPages() { + return getInt("ui_dock_pages", 1); + } public static boolean getShowDivider() { return getBoolean("ui_dock_divider", true); } |