am 04d181dd: (-s ours) am b879135b: (-s ours) am 9d8285fa: Import revised translations. DO NOT MERGE
* commit '04d181ddd0a29acfffc19094711afce5fac3a18d':
Import revised translations. DO NOT MERGE
diff --git a/proguard.flags b/proguard.flags
index 19c8fd5..94dd260 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -20,7 +20,7 @@
public void setHoverAlpha(float);
}
--keep class com.android.launcher2.CellLayout$LayoutParams {
+-keep class com.android.launcher2.DragLayer$LayoutParams {
public void setWidth(int);
public int getWidth();
public void setHeight(int);
diff --git a/res/layout-xlarge-port/all_apps_tabbed.xml b/res/layout-xlarge-port/all_apps_tabbed.xml
deleted file mode 100644
index c357d2e..0000000
--- a/res/layout-xlarge-port/all_apps_tabbed.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.android.launcher2.AllAppsTabbed
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher">
- <com.android.launcher2.AllAppsBackground
- android:id="@+id/all_apps_background"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <RelativeLayout
- android:layout_width="700dp"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:background="@drawable/tab_unselected_holo">
- <TabWidget
- android:id="@android:id/tabs"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:tabStripEnabled="false" />
- <FrameLayout
- android:id="@+id/market_info_frame"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true">
- <com.android.launcher2.ApplicationInfoDropTarget
- android:id="@+id/all_apps_info_target"
- android:drawableRight="@drawable/ic_home_info_holo_dark"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:visibility="invisible"/>
- <TextView
- android:id="@+id/market_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:gravity="center"
- android:paddingRight="22dp"
- android:text="@string/market"
- android:textColor="@color/workspace_all_apps_and_delete_zone_text_color"
- android:textSize="18sp"
- android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color"
- android:shadowDx="0.0"
- android:shadowDy="0.0"
- android:shadowRadius="2.0" />
- </FrameLayout>
- <com.android.launcher2.DeleteZone
- android:id="@+id/all_apps_delete_zone"
- android:drawablePadding="@dimen/delete_zone_drawable_padding"
- android:drawableLeft="@drawable/delete_zone_selector"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_toLeftOf="@id/market_info_frame"
- android:layout_centerVertical="true"
- android:visibility="invisible"
- android:paddingRight="22dp"
- launcher:direction="horizontal"
-
- android:gravity="center"
- android:textColor="@color/workspace_all_apps_and_delete_zone_text_color"
- android:textSize="18sp"
- android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color"
- android:shadowDx="0.0"
- android:shadowDy="0.0"
- android:shadowRadius="2.0" />
- </RelativeLayout>
- <FrameLayout
- android:id="@android:id/tabcontent"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <com.android.launcher2.AllAppsPagedView
- android:id="@+id/all_apps_paged_view"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- launcher:cellCountX="5"
- launcher:cellCountY="7"
- launcher:pageLayoutWidthGap="36dp"
- launcher:pageLayoutHeightGap="36dp"
- launcher:pageLayoutPaddingTop="25dp"
- launcher:pageLayoutPaddingBottom="10dp"
- launcher:pageLayoutPaddingLeft="20dp"
- launcher:pageLayoutPaddingRight="20dp">
- </com.android.launcher2.AllAppsPagedView>
- </FrameLayout>
- </LinearLayout>
-</com.android.launcher2.AllAppsTabbed>
diff --git a/res/layout-xlarge-land/all_apps_tabbed.xml b/res/layout-xlarge/all_apps_tabbed.xml
similarity index 85%
rename from res/layout-xlarge-land/all_apps_tabbed.xml
rename to res/layout-xlarge/all_apps_tabbed.xml
index 9244213..2710b32 100644
--- a/res/layout-xlarge-land/all_apps_tabbed.xml
+++ b/res/layout-xlarge/all_apps_tabbed.xml
@@ -25,7 +25,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
- android:layout_width="952dp"
+ android:layout_width="@dimen/all_apps_tabbed_width"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@drawable/tab_unselected_holo">
@@ -91,14 +91,14 @@
android:id="@+id/all_apps_paged_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- launcher:cellCountX="7"
- launcher:cellCountY="5"
- launcher:pageLayoutWidthGap="36dp"
- launcher:pageLayoutHeightGap="6dp"
- launcher:pageLayoutPaddingTop="20dp"
- launcher:pageLayoutPaddingBottom="15dp"
- launcher:pageLayoutPaddingLeft="40dp"
- launcher:pageLayoutPaddingRight="40dp">
+ launcher:cellCountX="@integer/all_apps_view_cellCountX"
+ launcher:cellCountY="@integer/all_apps_view_cellCountY"
+ launcher:pageLayoutWidthGap="@dimen/all_apps_view_pageLayoutWidthGap"
+ launcher:pageLayoutHeightGap="@dimen/all_apps_view_pageLayoutHeightGap"
+ launcher:pageLayoutPaddingTop="@dimen/all_apps_view_pageLayoutPaddingTop"
+ launcher:pageLayoutPaddingBottom="@dimen/all_apps_view_pageLayoutPaddingBottom"
+ launcher:pageLayoutPaddingLeft="@dimen/all_apps_view_pageLayoutPaddingLeft"
+ launcher:pageLayoutPaddingRight="@dimen/all_apps_view_pageLayoutPaddingRight">
</com.android.launcher2.AllAppsPagedView>
</FrameLayout>
</LinearLayout>
diff --git a/res/values-xlarge-land/dimens.xml b/res/values-xlarge-land/dimens.xml
index b3d40d5..27db522 100644
--- a/res/values-xlarge-land/dimens.xml
+++ b/res/values-xlarge-land/dimens.xml
@@ -29,4 +29,14 @@
<dimen name="customization_drawer_content_height">420dp</dimen>
<dimen name="customization_drawer_content_min_width">952dp</dimen>
<dimen name="customization_drawer_tab_widget_width">952dp</dimen>
+
+ <dimen name="all_apps_tabbed_width">952dp</dimen>
+ <integer name="all_apps_view_cellCountX">7</integer>
+ <integer name="all_apps_view_cellCountY">5</integer>
+ <dimen name="all_apps_view_pageLayoutWidthGap">36dp</dimen>
+ <dimen name="all_apps_view_pageLayoutHeightGap">6dp</dimen>
+ <dimen name="all_apps_view_pageLayoutPaddingTop">20dp</dimen>
+ <dimen name="all_apps_view_pageLayoutPaddingBottom">14dp</dimen>
+ <dimen name="all_apps_view_pageLayoutPaddingLeft">40dp</dimen>
+ <dimen name="all_apps_view_pageLayoutPaddingRight">40dp</dimen>
</resources>
\ No newline at end of file
diff --git a/res/values-xlarge-port/dimens.xml b/res/values-xlarge-port/dimens.xml
index 8a4c78b..72f6d8a 100644
--- a/res/values-xlarge-port/dimens.xml
+++ b/res/values-xlarge-port/dimens.xml
@@ -29,4 +29,14 @@
<dimen name="customization_drawer_content_height">420dp</dimen>
<dimen name="customization_drawer_content_min_width">640dp</dimen>
<dimen name="customization_drawer_tab_widget_width">700dp</dimen>
+
+ <dimen name="all_apps_tabbed_width">700dp</dimen>
+ <integer name="all_apps_view_cellCountX">5</integer>
+ <integer name="all_apps_view_cellCountY">7</integer>
+ <dimen name="all_apps_view_pageLayoutWidthGap">36dp</dimen>
+ <dimen name="all_apps_view_pageLayoutHeightGap">36dp</dimen>
+ <dimen name="all_apps_view_pageLayoutPaddingTop">25dp</dimen>
+ <dimen name="all_apps_view_pageLayoutPaddingBottom">10dp</dimen>
+ <dimen name="all_apps_view_pageLayoutPaddingLeft">20dp</dimen>
+ <dimen name="all_apps_view_pageLayoutPaddingRight">20dp</dimen>
</resources>
\ No newline at end of file
diff --git a/src/com/android/launcher2/AppWidgetResizeFrame.java b/src/com/android/launcher2/AppWidgetResizeFrame.java
index 2b2662f..d975ed9 100644
--- a/src/com/android/launcher2/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher2/AppWidgetResizeFrame.java
@@ -18,6 +18,8 @@
private ItemInfo mItemInfo;
private LauncherAppWidgetHostView mWidgetView;
private CellLayout mCellLayout;
+ private DragLayer mDragLayer;
+ private Workspace mWorkspace;
private ImageView mLeftHandle;
private ImageView mRightHandle;
private ImageView mTopHandle;
@@ -57,7 +59,7 @@
public static final int BOTTOM = 3;
public AppWidgetResizeFrame(Context context, ItemInfo itemInfo,
- LauncherAppWidgetHostView widgetView, CellLayout cellLayout) {
+ LauncherAppWidgetHostView widgetView, CellLayout cellLayout, DragLayer dragLayer) {
super(context);
mContext = context;
@@ -65,6 +67,8 @@
mCellLayout = cellLayout;
mWidgetView = widgetView;
mResizeMode = widgetView.getAppWidgetInfo().resizeMode;
+ mDragLayer = dragLayer;
+ mWorkspace = (Workspace) dragLayer.findViewById(R.id.workspace);
final AppWidgetProviderInfo info = widgetView.getAppWidgetInfo();
int[] result = mCellLayout.rectToCell(info.minWidth, info.minHeight, null);
@@ -150,7 +154,7 @@
mDeltaX = Math.max(-mBaselineX, deltaX);
mDeltaX = Math.min(mBaselineWidth - 2 * mTouchTargetWidth, mDeltaX);
} else if (mRightBorderActive) {
- mDeltaX = Math.min(mCellLayout.getWidth() - (mBaselineX + mBaselineWidth), deltaX);
+ mDeltaX = Math.min(mDragLayer.getWidth() - (mBaselineX + mBaselineWidth), deltaX);
mDeltaX = Math.max(-mBaselineWidth + 2 * mTouchTargetWidth, mDeltaX);
}
@@ -158,7 +162,7 @@
mDeltaY = Math.max(-mBaselineY, deltaY);
mDeltaY = Math.min(mBaselineHeight - 2 * mTouchTargetWidth, mDeltaY);
} else if (mBottomBorderActive) {
- mDeltaY = Math.min(mCellLayout.getHeight() - (mBaselineY + mBaselineHeight), deltaY);
+ mDeltaY = Math.min(mDragLayer.getHeight() - (mBaselineY + mBaselineHeight), deltaY);
mDeltaY = Math.max(-mBaselineHeight + 2 * mTouchTargetWidth, mDeltaY);
}
}
@@ -168,7 +172,8 @@
*/
public void visualizeResizeForDelta(int deltaX, int deltaY) {
updateDeltas(deltaX, deltaY);
- CellLayout.LayoutParams lp = (CellLayout.LayoutParams) getLayoutParams();
+ DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
+
if (mLeftBorderActive) {
lp.x = mBaselineX + mDeltaX;
lp.width = mBaselineWidth - mDeltaX;
@@ -261,6 +266,7 @@
// Update the cells occupied by this widget
mCellLayout.markCellsAsOccupiedForView(mWidgetView);
+ mWidgetView.requestLayout();
}
/**
@@ -284,20 +290,22 @@
}
public void snapToWidget(boolean animate) {
- final CellLayout.LayoutParams lp = (CellLayout.LayoutParams) getLayoutParams();
+ final DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
+ int xOffset = mCellLayout.getLeft() - mWorkspace.getScrollX();
+ int yOffset = mCellLayout.getTop() - mWorkspace.getScrollY();
int newWidth = mWidgetView.getWidth() + 2 * mBackgroundPadding;
int newHeight = mWidgetView.getHeight() + 2 * mBackgroundPadding;
- int newX = mWidgetView.getLeft() - mBackgroundPadding;
- int newY = mWidgetView.getTop() - mBackgroundPadding;
+ int newX = mWidgetView.getLeft() - mBackgroundPadding + xOffset;
+ int newY = mWidgetView.getTop() - mBackgroundPadding + yOffset;
// We need to make sure the frame stays within the bounds of the CellLayout
if (newY < 0) {
newHeight -= -newY;
newY = 0;
}
- if (newY + newHeight > mCellLayout.getHeight()) {
- newHeight -= newY + newHeight - mCellLayout.getHeight();
+ if (newY + newHeight > mDragLayer.getHeight()) {
+ newHeight -= newY + newHeight - mDragLayer.getHeight();
}
if (!animate) {
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 1111c53..825878a 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -1587,38 +1587,6 @@
}
}
- public void setWidth(int width) {
- this.width = width;
- }
-
- public int getWidth() {
- return width;
- }
-
- public void setHeight(int height) {
- this.height = height;
- }
-
- public int getHeight() {
- return height;
- }
-
- public void setX(int x) {
- this.x = x;
- }
-
- public int getX() {
- return x;
- }
-
- public void setY(int y) {
- this.y = y;
- }
-
- public int getY() {
- return y;
- }
-
public String toString() {
return "(" + this.cellX + ", " + this.cellY + ")";
}
diff --git a/src/com/android/launcher2/CellLayoutChildren.java b/src/com/android/launcher2/CellLayoutChildren.java
index 04996f3..11b2f9e 100644
--- a/src/com/android/launcher2/CellLayoutChildren.java
+++ b/src/com/android/launcher2/CellLayoutChildren.java
@@ -43,12 +43,6 @@
private int mWidthGap;
private int mHeightGap;
- // Variables relating to resizing widgets
- private final ArrayList<AppWidgetResizeFrame> mResizeFrames =
- new ArrayList<AppWidgetResizeFrame>();
- private AppWidgetResizeFrame mCurrentResizeFrame;
- private int mXDown, mYDown;
-
public CellLayoutChildren(Context context) {
super(context);
mWallpaperManager = WallpaperManager.getInstance(context);
@@ -176,95 +170,4 @@
protected void setChildrenDrawnWithCacheEnabled(boolean enabled) {
super.setChildrenDrawnWithCacheEnabled(enabled);
}
-
- public void clearAllResizeFrames() {
- for (AppWidgetResizeFrame frame: mResizeFrames) {
- removeView(frame);
- }
- mResizeFrames.clear();
- }
-
- public boolean hasResizeFrames() {
- return mResizeFrames.size() > 0;
- }
-
- public boolean isWidgetBeingResized() {
- return mCurrentResizeFrame != null;
- }
-
- private boolean handleTouchDown(MotionEvent ev) {
- Rect hitRect = new Rect();
-
- int x = (int) ev.getX();
- int y = (int) ev.getY();
-
- for (AppWidgetResizeFrame child: mResizeFrames) {
- child.getHitRect(hitRect);
- if (hitRect.contains(x, y)) {
- if (child.beginResizeIfPointInRegion(x - child.getLeft(), y - child.getTop())) {
- mCurrentResizeFrame = child;
- mXDown = x;
- mYDown = y;
- requestDisallowInterceptTouchEvent(true);
- return true;
- }
- }
- }
- return false;
- }
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (ev.getAction() == MotionEvent.ACTION_DOWN) {
- if (handleTouchDown(ev)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- boolean handled = false;
- int action = ev.getAction();
-
- int x = (int) ev.getX();
- int y = (int) ev.getY();
-
- if (ev.getAction() == MotionEvent.ACTION_DOWN) {
- if (ev.getAction() == MotionEvent.ACTION_DOWN) {
- if (handleTouchDown(ev)) {
- return true;
- }
- }
- }
-
- if (mCurrentResizeFrame != null) {
- handled = true;
- switch (action) {
- case MotionEvent.ACTION_MOVE:
- mCurrentResizeFrame.visualizeResizeForDelta(x - mXDown, y - mYDown);
- break;
- case MotionEvent.ACTION_CANCEL:
- case MotionEvent.ACTION_UP:
- mCurrentResizeFrame.commitResizeForDelta(x - mXDown, y - mYDown);
- mCurrentResizeFrame = null;
- }
- }
- return handled;
- }
-
- public void addResizeFrame(ItemInfo itemInfo, LauncherAppWidgetHostView widget,
- CellLayout cellLayout) {
- AppWidgetResizeFrame resizeFrame = new AppWidgetResizeFrame(getContext(),
- itemInfo, widget, cellLayout);
-
- CellLayout.LayoutParams lp = new CellLayout.LayoutParams(-1, -1, -1, -1);
- lp.isLockedToGrid = false;
-
- addView(resizeFrame, lp);
- mResizeFrames.add(resizeFrame);
-
- resizeFrame.snapToWidget(false);
- }
}
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index 5c61b0b..332f6e4 100644
--- a/src/com/android/launcher2/CustomizePagedView.java
+++ b/src/com/android/launcher2/CustomizePagedView.java
@@ -1128,8 +1128,10 @@
}
// Set a min page width for PagedView layout if we have more than a single page
- if (enforceMinimumPagedWidths) {
- setMinimumWidthOverride((childCount > 1) ? mMinPageWidth : 0);
+ if (enforceMinimumPagedWidths && childCount > 1) {
+ setMinimumWidthOverride(mMinPageWidth);
+ } else {
+ resetMinimumWidthOverride();
}
// Bound the current page index
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java
index eb53945..c2b710e 100644
--- a/src/com/android/launcher2/DragLayer.java
+++ b/src/com/android/launcher2/DragLayer.java
@@ -16,10 +16,11 @@
package com.android.launcher2;
-import com.android.launcher.R;
+import java.util.ArrayList;
import android.content.Context;
import android.graphics.Bitmap;
+import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -27,6 +28,8 @@
import android.widget.FrameLayout;
import android.widget.ImageView;
+import com.android.launcher.R;
+
/**
* A ViewGroup that coordinates dragging across its descendants
*/
@@ -34,6 +37,12 @@
private DragController mDragController;
private int[] mTmpXY = new int[2];
+ // Variables relating to resizing widgets
+ private final ArrayList<AppWidgetResizeFrame> mResizeFrames =
+ new ArrayList<AppWidgetResizeFrame>();
+ private AppWidgetResizeFrame mCurrentResizeFrame;
+ private int mXDown, mYDown;
+
/**
* Used to create a new DragLayer from XML.
*
@@ -56,31 +65,66 @@
return mDragController.dispatchKeyEvent(event) || super.dispatchKeyEvent(event);
}
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- // If the current CellLayoutChildren has a resize frame, we need to detect if any touch
- // event has occurred which doesn't result in resizing a widget. In this case, we
- // dismiss any visible resize frames.
- final Workspace w = (Workspace) findViewById(R.id.workspace);
- if (w != null) {
- final CellLayout currentPage = (CellLayout) w.getChildAt(w.getCurrentPage());
- final CellLayoutChildren childrenLayout = currentPage.getChildrenLayout();
+ private boolean handleTouchDown(MotionEvent ev) {
+ Rect hitRect = new Rect();
+ int x = (int) ev.getX();
+ int y = (int) ev.getY();
- if (childrenLayout.hasResizeFrames() && !childrenLayout.isWidgetBeingResized()) {
- post(new Runnable() {
- public void run() {
- if (!childrenLayout.isWidgetBeingResized()) {
- childrenLayout.clearAllResizeFrames();
- }
- }
- });
+ for (AppWidgetResizeFrame child: mResizeFrames) {
+ child.getHitRect(hitRect);
+ if (hitRect.contains(x, y)) {
+ if (child.beginResizeIfPointInRegion(x - child.getLeft(), y - child.getTop())) {
+ mCurrentResizeFrame = child;
+ mXDown = x;
+ mYDown = y;
+ requestDisallowInterceptTouchEvent(true);
+ return true;
+ }
}
}
+ return false;
+ }
+
+ @Override
+ public boolean onInterceptTouchEvent(MotionEvent ev) {
+ if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+ if (handleTouchDown(ev)) {
+ return true;
+ }
+ }
+ clearAllResizeFrames();
return mDragController.onInterceptTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
+ boolean handled = false;
+ int action = ev.getAction();
+
+ int x = (int) ev.getX();
+ int y = (int) ev.getY();
+
+ if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+ if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+ if (handleTouchDown(ev)) {
+ return true;
+ }
+ }
+ }
+
+ if (mCurrentResizeFrame != null) {
+ handled = true;
+ switch (action) {
+ case MotionEvent.ACTION_MOVE:
+ mCurrentResizeFrame.visualizeResizeForDelta(x - mXDown, y - mYDown);
+ break;
+ case MotionEvent.ACTION_CANCEL:
+ case MotionEvent.ACTION_UP:
+ mCurrentResizeFrame.commitResizeForDelta(x - mXDown, y - mYDown);
+ mCurrentResizeFrame = null;
+ }
+ }
+ if (handled) return true;
return mDragController.onTouchEvent(ev);
}
@@ -103,4 +147,94 @@
v.getLocationOnScreen(mTmpXY);
return createDragView(mDragController.getViewBitmap(v), mTmpXY[0], mTmpXY[1]);
}
+
+ public static class LayoutParams extends FrameLayout.LayoutParams {
+ public int x, y;
+ public boolean customPosition = false;
+
+ /**
+ * {@inheritDoc}
+ */
+ public LayoutParams(int width, int height) {
+ super(width, height);
+ }
+
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public void setHeight(int height) {
+ this.height = height;
+ }
+
+ public int getHeight() {
+ return height;
+ }
+
+ public void setX(int x) {
+ this.x = x;
+ }
+
+ public int getX() {
+ return x;
+ }
+
+ public void setY(int y) {
+ this.y = y;
+ }
+
+ public int getY() {
+ return y;
+ }
+ }
+
+ protected void onLayout(boolean changed, int l, int t, int r, int b) {
+ super.onLayout(changed, l, t, r, b);
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ View child = getChildAt(i);
+ final FrameLayout.LayoutParams flp = (FrameLayout.LayoutParams) child.getLayoutParams();
+ if (flp instanceof LayoutParams) {
+ final LayoutParams lp = (LayoutParams) flp;
+ if (lp.customPosition) {
+ child.layout(lp.x, lp.y, lp.x + lp.width, lp.y + lp.height);
+ }
+ }
+ }
+ }
+
+ public void clearAllResizeFrames() {
+ if (mResizeFrames.size() > 0) {
+ for (AppWidgetResizeFrame frame: mResizeFrames) {
+ removeView(frame);
+ }
+ mResizeFrames.clear();
+ }
+ }
+
+ public boolean hasResizeFrames() {
+ return mResizeFrames.size() > 0;
+ }
+
+ public boolean isWidgetBeingResized() {
+ return mCurrentResizeFrame != null;
+ }
+
+ public void addResizeFrame(ItemInfo itemInfo, LauncherAppWidgetHostView widget,
+ CellLayout cellLayout) {
+ AppWidgetResizeFrame resizeFrame = new AppWidgetResizeFrame(getContext(),
+ itemInfo, widget, cellLayout, this);
+
+ LayoutParams lp = new LayoutParams(-1, -1);
+ lp.customPosition = true;
+
+ addView(resizeFrame, lp);
+ mResizeFrames.add(resizeFrame);
+
+ resizeFrame.snapToWidget(false);
+ }
}
diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java
index dd83c78..bbc3409 100644
--- a/src/com/android/launcher2/FolderIcon.java
+++ b/src/com/android/launcher2/FolderIcon.java
@@ -43,7 +43,10 @@
}
public boolean isDropEnabled() {
- return !((Workspace)getParent().getParent()).isSmall();
+ final ViewGroup cellLayoutChildren = (ViewGroup) getParent();
+ final ViewGroup cellLayout = (ViewGroup) cellLayoutChildren.getParent();
+ final Workspace workspace = (Workspace) cellLayout.getParent();
+ return !workspace.isSmall();
}
static FolderIcon fromXml(int resId, Launcher launcher, ViewGroup group,
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index e7ecb99..1da08cd 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -1177,6 +1177,9 @@
protected void setMinimumWidthOverride(int minimumWidth) {
mMinimumWidth = minimumWidth;
}
+ protected void resetMinimumWidthOverride() {
+ mMinimumWidth = 0;
+ }
protected int getChildWidth(int index) {
return Math.max(mMinimumWidth, getChildAt(index).getMeasuredWidth());
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index e7865d2..b5c1074 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -1800,8 +1800,8 @@
}
public void exitWidgetResizeMode() {
- final CellLayout currentLayout = (CellLayout) getChildAt(getCurrentPage());
- currentLayout.getChildrenLayout().clearAllResizeFrames();
+ DragLayer dragLayer = (DragLayer) mLauncher.findViewById(R.id.drag_layer);
+ dragLayer.clearAllResizeFrames();
}
void unshrink(boolean animated) {
@@ -2353,7 +2353,6 @@
mTargetCell[0], mTargetCell[1], mDragInfo.spanX, mDragInfo.spanY));
if (cell instanceof LauncherAppWidgetHostView) {
- final CellLayoutChildren children = dropTargetLayout.getChildrenLayout();
final CellLayout cellLayout = dropTargetLayout;
// We post this call so that the widget has a chance to be placed
// in its final location
@@ -2363,7 +2362,9 @@
if (pinfo.resizeMode != AppWidgetProviderInfo.RESIZE_NONE) {
post(new Runnable() {
public void run() {
- children.addResizeFrame(info, hostView,
+ DragLayer dragLayer = (DragLayer)
+ mLauncher.findViewById(R.id.drag_layer);
+ dragLayer.addResizeFrame(info, hostView,
cellLayout);
}
});