Merge "Smooth fade to search activity when hard search key is pressed."
diff --git a/res/layout-large/market_button.xml b/res/layout-large/market_button.xml
new file mode 100644
index 0000000..ad5f6da
--- /dev/null
+++ b/res/layout-large/market_button.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+<TextView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
+ style="@style/MarketButton"
+ android:onClick="onClickAppMarketButton"
+ android:gravity="center"
+ android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
+ android:paddingRight="@dimen/toolbar_button_horizontal_padding"
+ android:drawablePadding="10dp"
+ android:text="@string/market"
+ android:contentDescription="@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"
+ android:background="@drawable/tab_widget_indicator_selector"
+ android:focusable="true"
+ android:clickable="true" />
diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml
index 788d4c3..05e7fc1 100644
--- a/res/layout/apps_customize_pane.xml
+++ b/res/layout/apps_customize_pane.xml
@@ -35,27 +35,12 @@
android:layout_gravity="left"
android:background="@drawable/tab_unselected_holo"
android:tabStripEnabled="false" />
- <TextView
- style="@style/MarketButton"
+ <include
android:id="@+id/market_button"
- android:onClick="onClickAppMarketButton"
+ layout="@layout/market_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:layout_gravity="right"
- android:gravity="center"
- android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
- android:paddingRight="@dimen/toolbar_button_horizontal_padding"
- android:text="@string/market"
- android:contentDescription="@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"
- android:background="@drawable/tab_widget_indicator_selector"
- android:focusable="true"
- android:clickable="true" />
+ android:layout_gravity="right" />
</FrameLayout>
<FrameLayout
android:id="@android:id/tabcontent"
diff --git a/res/layout/market_button.xml b/res/layout/market_button.xml
new file mode 100644
index 0000000..2d840d7
--- /dev/null
+++ b/res/layout/market_button.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+<TextView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
+ style="@style/MarketButton"
+ android:onClick="onClickAppMarketButton"
+ android:gravity="center"
+ android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
+ android:paddingRight="@dimen/toolbar_button_horizontal_padding"
+ android:contentDescription="@string/market"
+ android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color"
+ android:shadowDx="0.0"
+ android:shadowDy="0.0"
+ android:shadowRadius="2.0"
+ android:background="@drawable/tab_widget_indicator_selector"
+ android:focusable="true"
+ android:clickable="true" />
diff --git a/res/values-large-port/dimens.xml b/res/values-large-port/dimens.xml
index e0651b2..4e1cf8f 100644
--- a/res/values-large-port/dimens.xml
+++ b/res/values-large-port/dimens.xml
@@ -18,10 +18,6 @@
<!-- AppsCustomize -->
<dimen name="apps_customize_cell_width">96dp</dimen>
<dimen name="apps_customize_cell_height">96dp</dimen>
- <!-- The amount of space to account for the next/prev pages when
- calculating the number of columns to fit a page.
- In portrait/large we use apps_customize_cell_width / 8. -->
- <dimen name="apps_customize_peek_width">12dp</dimen>
<dimen name="workspace_page_spacing">64dp</dimen>
<!-- Workspace -->
@@ -40,6 +36,6 @@
<dimen name="apps_customize_pageLayoutHeightGap">36dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingTop">25dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingBottom">10dp</dimen>
- <dimen name="apps_customize_pageLayoutPaddingLeft">20dp</dimen>
- <dimen name="apps_customize_pageLayoutPaddingRight">20dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingLeft">10dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingRight">10dp</dimen>
</resources>
\ No newline at end of file
diff --git a/res/values-large/dimens.xml b/res/values-large/dimens.xml
index 234fcdb..3fe53b5 100644
--- a/res/values-large/dimens.xml
+++ b/res/values-large/dimens.xml
@@ -33,10 +33,6 @@
<dimen name="apps_customize_tab_bar_height">56dp</dimen>
<dimen name="apps_customize_cell_width">96dp</dimen>
<dimen name="apps_customize_cell_height">96dp</dimen>
- <!-- The amount of space to account for the next/prev pages when
- calculating the number of columns to fit a page.
- In landscape/large we use apps_customize_cell_width / 4. -->
- <dimen name="apps_customize_peek_width">48dp</dimen>
<dimen name="apps_customize_widget_cell_width_gap">36dp</dimen>
<dimen name="apps_customize_widget_cell_height_gap">36dp</dimen>
diff --git a/res/values-xlarge-port/dimens.xml b/res/values-xlarge-port/dimens.xml
index 4f53280..0850e8c 100644
--- a/res/values-xlarge-port/dimens.xml
+++ b/res/values-xlarge-port/dimens.xml
@@ -15,11 +15,6 @@
-->
<resources>
- <!-- The amount of space to account for the next/prev pages when
- calculating the number of columns to fit a page.
- In portrait/xlarge we use apps_customize_cell_width / 4. -->
- <dimen name="apps_customize_peek_width">48dp</dimen>
-
<!-- We can also afford to have a slightly wider portrait layout in
xlarge -->
<dimen name="apps_customize_pageLayoutWidthGap">36dp</dimen>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 641f8ea..3934237 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -41,7 +41,6 @@
<!-- The width can be 72dp because we don't have L/R padding -->
<dimen name="apps_customize_cell_width">72dp</dimen>
<dimen name="apps_customize_cell_height">80dp</dimen>
- <dimen name="apps_customize_peek_width">0dp</dimen>
<dimen name="apps_customize_max_gap">18dp</dimen>
<dimen name="apps_customize_widget_cell_width_gap">10dp</dimen>
<dimen name="apps_customize_widget_cell_height_gap">10dp</dimen>
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 893e91d..16dad1b 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -245,9 +245,8 @@
}
@Override
- protected void onWallpaperTap(MotionEvent ev) {
- int action = ev.getAction();
- if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_DOWN) {
+ protected void onUnhandledTap(MotionEvent ev) {
+ if (LauncherApplication.isScreenLarge()) {
// Dismiss AppsCustomize if we tap
mLauncher.showWorkspace(true);
}
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 25001b1..8f067fa 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -45,6 +45,9 @@
private ViewGroup mTabsContainer;
private AppsCustomizePagedView mAppsCustomizePane;
+ private boolean mInTransition;
+ private boolean mResetAfterTransition;
+
public AppsCustomizeTabHost(Context context, AttributeSet attrs) {
super(context, attrs);
mLayoutInflater = LayoutInflater.from(context);
@@ -223,9 +226,20 @@
return super.getDescendantFocusability();
}
+ void reset() {
+ if (mInTransition) {
+ // Defer to after the transition to reset
+ mResetAfterTransition = true;
+ } else {
+ // Reset immediately
+ mAppsCustomizePane.reset();
+ }
+ }
+
/* LauncherTransitionable overrides */
@Override
public void onLauncherTransitionStart(Animator animation, boolean toWorkspace) {
+ mInTransition = true;
// isHardwareAccelerated() checks if we're attached to a window and if that
// window is HW accelerated-- we were sometimes not attached to a window
// and buildLayer was throwing an IllegalStateException
@@ -240,10 +254,15 @@
if (!toWorkspace && !LauncherApplication.isScreenLarge()) {
mAppsCustomizePane.showScrollingIndicator(false);
}
+ if (mResetAfterTransition) {
+ mAppsCustomizePane.reset();
+ mResetAfterTransition = false;
+ }
}
@Override
public void onLauncherTransitionEnd(Animator animation, boolean toWorkspace) {
+ mInTransition = false;
if (animation != null) {
setLayerType(LAYER_TYPE_NONE, null);
}
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index d9d0487..a17e2d6 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -81,6 +81,7 @@
int[] mTempLocation = new int[2];
boolean[][] mOccupied;
+ private boolean mLastDownOnOccupiedCell = false;
private OnTouchListener mInterceptTouchListener;
@@ -752,6 +753,8 @@
}
}
+ mLastDownOnOccupiedCell = found;
+
if (!found) {
final int cellXY[] = mTmpXY;
pointToCellExact(x, y, cellXY);
@@ -1877,4 +1880,8 @@
+ ", x=" + cellX + ", y=" + cellY + "]";
}
}
+
+ public boolean lastDownOnOccupiedCell() {
+ return mLastDownOnOccupiedCell;
+ }
}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 421db74..f8e3e1c 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -915,10 +915,11 @@
mDragLayer.clearAllResizeFrames();
updateRunning();
- // Reset AllApps to it's initial state only if we are not in the middle of
+ // Reset AllApps to its initial state only if we are not in the middle of
// processing a multi-step drop
- if (mAppsCustomizeContent != null && mPendingAddInfo.container == ItemInfo.NO_ID) {
- mAppsCustomizeContent.reset();
+ if (mAppsCustomizeTabHost != null && mPendingAddInfo.container == ItemInfo.NO_ID) {
+ mAppsCustomizeTabHost.reset();
+ showWorkspace(false);
}
} else if (Intent.ACTION_USER_PRESENT.equals(action)) {
mUserPresent = true;
@@ -1091,8 +1092,8 @@
}
// Reset AllApps to its initial state
- if (mAppsCustomizeContent != null) {
- mAppsCustomizeContent.reset();
+ if (mAppsCustomizeTabHost != null) {
+ mAppsCustomizeTabHost.reset();
}
}
}
@@ -2465,11 +2466,6 @@
sAppMarketIcon = updateTextButtonWithIconFromExternalActivity(
R.id.market_button, activityName, R.drawable.ic_launcher_market_holo);
marketButton.setVisibility(View.VISIBLE);
-
- // Remove the shop icon text in the Phone UI
- if (!LauncherApplication.isScreenLarge()) {
- ((TextView) marketButton).setText("");
- }
} else {
// We should hide and disable the view so that we don't try and restore the visibility
// of it when we swap between drag & normal states from IconDropTarget subclasses.
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index d228fef..d2d734c 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -1138,7 +1138,7 @@
snapToDestination();
}
} else {
- onWallpaperTap(ev);
+ onUnhandledTap(ev);
}
mTouchState = TOUCH_STATE_REST;
mActivePointerId = INVALID_POINTER;
@@ -1222,12 +1222,9 @@
mVelocityTracker.clear();
}
}
- if (mTouchState == TOUCH_STATE_REST) {
- onWallpaperTap(ev);
- }
}
- protected void onWallpaperTap(MotionEvent ev) {}
+ protected void onUnhandledTap(MotionEvent ev) {}
@Override
public void requestChildFocus(View child, View focused) {
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index bec00ec..63cf9e8 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -46,7 +46,6 @@
private int mWidthGap;
private int mHeightGap;
private int mMaxGap;
- private float mPeekWidth;
protected PagedViewCellLayoutChildren mChildren;
private PagedViewCellLayoutChildren mHolographicChildren;
private boolean mAllowHardwareLayerCreation = false;
@@ -71,7 +70,6 @@
resources.getDimensionPixelSize(R.dimen.apps_customize_cell_width);
mOriginalCellHeight = mCellHeight =
resources.getDimensionPixelSize(R.dimen.apps_customize_cell_height);
- mPeekWidth = resources.getDimensionPixelSize(R.dimen.apps_customize_peek_width);
mCellCountX = LauncherModel.getCellCountX();
mCellCountY = LauncherModel.getCellCountY();
mOriginalHeightGap = mOriginalHeightGap = mWidthGap = mHeightGap = -1;
@@ -366,7 +364,7 @@
// The space for a page assuming that we want to show half of a column of the previous and
// next pages is the width - left padding (current & next page) - right padding (previous &
// current page) - half cell width (for previous and next pages)
- int availWidth = (int) (width - (2 * mPaddingLeft + 2 * mPaddingRight) - (2 * mPeekWidth));
+ int availWidth = (int) (width - (2 * mPaddingLeft + 2 * mPaddingRight));
// We know that we have to fit N cells with N-1 width gaps, so we just juggle to solve for N
int n = Math.max(1, (availWidth + mWidthGap) / (mCellWidth + mWidthGap));
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index a45d2b8..9856f7e 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -598,11 +598,20 @@
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+ switch (ev.getAction() & MotionEvent.ACTION_MASK) {
+ case MotionEvent.ACTION_DOWN:
mXDown = ev.getX();
mYDown = ev.getY();
+ break;
+ case MotionEvent.ACTION_POINTER_UP:
+ case MotionEvent.ACTION_UP:
+ if (mTouchState == TOUCH_STATE_REST) {
+ final CellLayout currentPage = (CellLayout) getChildAt(mCurrentPage);
+ if (!currentPage.lastDownOnOccupiedCell()) {
+ onWallpaperTap(ev);
+ }
+ }
}
-
return super.onInterceptTouchEvent(ev);
}
@@ -1291,7 +1300,6 @@
}
}
- @Override
protected void onWallpaperTap(MotionEvent ev) {
final int[] position = mTempCell;
getLocationOnScreen(position);