Fixing issue where the cling is offset. (Bug 7633074)

- Also fixing issue where the workspace cling was showing on top of AllApps when you entered it for the first time.

Change-Id: I7d59ad153de192bc1d69537af1b4af632465138b
This commit is contained in:
Winson Chung 2012-11-29 14:29:38 -08:00
parent 1ef2123ccd
commit 7819abd2d1
6 changed files with 57 additions and 42 deletions

View File

@ -86,6 +86,21 @@
android:id="@+id/qsb_bar" android:id="@+id/qsb_bar"
layout="@layout/qsb_bar" /> layout="@layout/qsb_bar" />
<!-- The Workspace cling must appear under the AppsCustomizePagedView below to ensure
that it is still visible during the transition to AllApps and doesn't overlay on
top of that view. -->
<include layout="@layout/workspace_cling"
android:id="@+id/workspace_cling"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<include layout="@layout/folder_cling"
android:id="@+id/folder_cling"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<com.android.launcher2.DrawableStateProxyView <com.android.launcher2.DrawableStateProxyView
android:id="@+id/voice_button_proxy" android:id="@+id/voice_button_proxy"
android:layout_width="@dimen/qsb_bar_height" android:layout_width="@dimen/qsb_bar_height"
@ -102,17 +117,5 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:visibility="invisible" /> android:visibility="invisible" />
<include layout="@layout/workspace_cling"
android:id="@+id/workspace_cling"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<include layout="@layout/folder_cling"
android:id="@+id/folder_cling"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
</com.android.launcher2.DragLayer> </com.android.launcher2.DragLayer>
</FrameLayout> </FrameLayout>

View File

@ -85,6 +85,21 @@
android:id="@+id/qsb_bar" android:id="@+id/qsb_bar"
layout="@layout/qsb_bar" /> layout="@layout/qsb_bar" />
<!-- The Workspace cling must appear under the AppsCustomizePagedView below to ensure
that it is still visible during the transition to AllApps and doesn't overlay on
top of that view. -->
<include layout="@layout/workspace_cling"
android:id="@+id/workspace_cling"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<include layout="@layout/folder_cling"
android:id="@+id/folder_cling"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<com.android.launcher2.DrawableStateProxyView <com.android.launcher2.DrawableStateProxyView
android:id="@+id/voice_button_proxy" android:id="@+id/voice_button_proxy"
android:layout_width="80dp" android:layout_width="80dp"
@ -100,17 +115,5 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:visibility="invisible" /> android:visibility="invisible" />
<include layout="@layout/workspace_cling"
android:id="@+id/workspace_cling"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<include layout="@layout/folder_cling"
android:id="@+id/folder_cling"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
</com.android.launcher2.DragLayer> </com.android.launcher2.DragLayer>
</FrameLayout> </FrameLayout>

View File

@ -85,6 +85,21 @@
android:id="@+id/qsb_bar" android:id="@+id/qsb_bar"
layout="@layout/qsb_bar" /> layout="@layout/qsb_bar" />
<!-- The Workspace cling must appear under the AppsCustomizePagedView below to ensure
that it is still visible during the transition to AllApps and doesn't overlay on
top of that view. -->
<include layout="@layout/workspace_cling"
android:id="@+id/workspace_cling"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<include layout="@layout/folder_cling"
android:id="@+id/folder_cling"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<com.android.launcher2.DrawableStateProxyView <com.android.launcher2.DrawableStateProxyView
android:id="@+id/voice_button_proxy" android:id="@+id/voice_button_proxy"
android:layout_width="80dp" android:layout_width="80dp"
@ -101,17 +116,5 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:visibility="invisible" /> android:visibility="invisible" />
<include layout="@layout/workspace_cling"
android:id="@+id/workspace_cling"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<include layout="@layout/folder_cling"
android:id="@+id/folder_cling"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
</com.android.launcher2.DragLayer> </com.android.launcher2.DragLayer>
</FrameLayout> </FrameLayout>

View File

@ -499,9 +499,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
int[] pos = mWidgetSpacingLayout.estimateCellPosition(mClingFocusedX, mClingFocusedY); int[] pos = mWidgetSpacingLayout.estimateCellPosition(mClingFocusedX, mClingFocusedY);
mLauncher.getDragLayer().getLocationInDragLayer(this, offset); mLauncher.getDragLayer().getLocationInDragLayer(this, offset);
// PagedViews are centered horizontally but top aligned // PagedViews are centered horizontally but top aligned
// Note we have to shift the items up now that Launcher sits under the status bar
pos[0] += (getMeasuredWidth() - mWidgetSpacingLayout.getMeasuredWidth()) / 2 + pos[0] += (getMeasuredWidth() - mWidgetSpacingLayout.getMeasuredWidth()) / 2 +
offset[0]; offset[0];
pos[1] += offset[1]; pos[1] += offset[1] - mLauncher.getDragLayer().getPaddingTop();
mLauncher.showFirstRunAllAppsCling(pos); mLauncher.showFirstRunAllAppsCling(pos);
} }
} }

View File

@ -418,11 +418,9 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
} }
if (!toWorkspace) { if (!toWorkspace) {
// Going from Workspace -> All Apps // Dismiss the workspace cling
setVisibilityOfSiblingsWithLowerZOrder(INVISIBLE);
// Dismiss the workspace cling and show the all apps cling (if not already shown)
l.dismissWorkspaceCling(null); l.dismissWorkspaceCling(null);
// Show the all apps cling (if not already shown)
mAppsCustomizePane.showAllAppsCling(); mAppsCustomizePane.showAllAppsCling();
// Make sure adjacent pages are loaded (we wait until after the transition to // Make sure adjacent pages are loaded (we wait until after the transition to
// prevent slowing down the animation) // prevent slowing down the animation)
@ -431,6 +429,11 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
if (!LauncherApplication.isScreenLarge()) { if (!LauncherApplication.isScreenLarge()) {
mAppsCustomizePane.hideScrollingIndicator(false); mAppsCustomizePane.hideScrollingIndicator(false);
} }
// Going from Workspace -> All Apps
// NOTE: We should do this at the end since we check visibility state in some of the
// cling initialization/dismiss code above.
setVisibilityOfSiblingsWithLowerZOrder(INVISIBLE);
} }
} }

View File

@ -3739,7 +3739,9 @@ public final class Launcher extends Activity
} }
private void dismissCling(final Cling cling, final String flag, int duration) { private void dismissCling(final Cling cling, final String flag, int duration) {
if (cling != null && cling.getVisibility() == View.VISIBLE) { // To catch cases where siblings of top-level views are made invisible, just check whether
// the cling is directly set to GONE before dismissing it.
if (cling != null && cling.getVisibility() != View.GONE) {
ObjectAnimator anim = LauncherAnimUtils.ofFloat(cling, "alpha", 0f); ObjectAnimator anim = LauncherAnimUtils.ofFloat(cling, "alpha", 0f);
anim.setDuration(duration); anim.setDuration(duration);
anim.addListener(new AnimatorListenerAdapter() { anim.addListener(new AnimatorListenerAdapter() {