summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout-land/launcher.xml4
-rw-r--r--res/layout-port/launcher.xml4
-rw-r--r--res/layout-sw720dp/launcher.xml4
-rw-r--r--res/layout/app_info_drop_target_bar.xml42
-rw-r--r--res/layout/search_drop_target_bar.xml12
-rw-r--r--src/com/android/launcher3/AppInfoDropTargetBar.java74
-rw-r--r--src/com/android/launcher3/DeviceProfile.java56
-rw-r--r--src/com/android/launcher3/Folder.java2
-rw-r--r--src/com/android/launcher3/InfoDropTarget.java3
-rw-r--r--src/com/android/launcher3/Launcher.java13
-rw-r--r--src/com/android/launcher3/Workspace.java7
-rw-r--r--src/com/android/launcher3/WorkspaceStateTransitionAnimation.java9
-rw-r--r--src/com/android/launcher3/dragndrop/DragLayer.java6
13 files changed, 195 insertions, 41 deletions
diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml
index f431fb132..951a30ec7 100644
--- a/res/layout-land/launcher.xml
+++ b/res/layout-land/launcher.xml
@@ -50,6 +50,10 @@
android:layout_gravity="right" />
<include
+ android:id="@+id/app_info_drop_target_bar"
+ layout="@layout/app_info_drop_target_bar" />
+
+ <include
android:id="@+id/search_drop_target_bar"
layout="@layout/search_drop_target_bar" />
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
index a7f851e76..4cb34e92e 100644
--- a/res/layout-port/launcher.xml
+++ b/res/layout-port/launcher.xml
@@ -64,6 +64,10 @@
android:layout_gravity="center_horizontal" />
<include
+ android:id="@+id/app_info_drop_target_bar"
+ layout="@layout/app_info_drop_target_bar" />
+
+ <include
android:id="@+id/search_drop_target_bar"
layout="@layout/search_drop_target_bar" />
diff --git a/res/layout-sw720dp/launcher.xml b/res/layout-sw720dp/launcher.xml
index 319a49315..3228999ce 100644
--- a/res/layout-sw720dp/launcher.xml
+++ b/res/layout-sw720dp/launcher.xml
@@ -50,6 +50,10 @@
android:layout_height="match_parent" />
<include
+ android:id="@+id/app_info_drop_target_bar"
+ layout="@layout/app_info_drop_target_bar" />
+
+ <include
android:id="@+id/search_drop_target_bar"
layout="@layout/search_drop_target_bar" />
diff --git a/res/layout/app_info_drop_target_bar.xml b/res/layout/app_info_drop_target_bar.xml
new file mode 100644
index 000000000..b8f30d0c8
--- /dev/null
+++ b/res/layout/app_info_drop_target_bar.xml
@@ -0,0 +1,42 @@
+<?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.
+-->
+<com.android.launcher3.AppInfoDropTargetBar xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:focusable="false" >
+
+ <!-- Drag specific targets container -->
+ <LinearLayout
+ android:id="@+id/drag_target_bar"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center|bottom" >
+
+ <FrameLayout
+ style="@style/DropTargetButtonContainer"
+ android:layout_weight="1" >
+
+ <!-- Info target -->
+
+ <com.android.launcher3.InfoDropTarget
+ android:id="@+id/info_target_text"
+ style="@style/DropTargetButton"
+ android:text="@string/info_target_label" />
+ </FrameLayout>
+ </LinearLayout>
+
+</com.android.launcher3.AppInfoDropTargetBar> \ No newline at end of file
diff --git a/res/layout/search_drop_target_bar.xml b/res/layout/search_drop_target_bar.xml
index 4737ee1bc..724eb943d 100644
--- a/res/layout/search_drop_target_bar.xml
+++ b/res/layout/search_drop_target_bar.xml
@@ -43,18 +43,6 @@
style="@style/DropTargetButtonContainer"
android:layout_weight="1" >
- <!-- Info target -->
-
- <com.android.launcher3.InfoDropTarget
- android:id="@+id/info_target_text"
- style="@style/DropTargetButton"
- android:text="@string/info_target_label" />
- </FrameLayout>
-
- <FrameLayout
- style="@style/DropTargetButtonContainer"
- android:layout_weight="1" >
-
<!-- Uninstall target -->
<com.android.launcher3.UninstallDropTarget
diff --git a/src/com/android/launcher3/AppInfoDropTargetBar.java b/src/com/android/launcher3/AppInfoDropTargetBar.java
new file mode 100644
index 000000000..31ff42a7f
--- /dev/null
+++ b/src/com/android/launcher3/AppInfoDropTargetBar.java
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+package com.android.launcher3;
+
+import android.content.Context;
+import android.util.AttributeSet;
+
+import com.android.launcher3.dragndrop.DragController;
+
+public class AppInfoDropTargetBar extends BaseDropTargetBar {
+ private ButtonDropTarget mAppInfoDropTarget;
+
+ public AppInfoDropTargetBar(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public AppInfoDropTargetBar(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+
+ // Get the individual components
+ mAppInfoDropTarget = (ButtonDropTarget) mDropTargetBar.findViewById(R.id.info_target_text);
+
+ mAppInfoDropTarget.setDropTargetBar(this);
+ }
+
+ @Override
+ public void setup(Launcher launcher, DragController dragController) {
+ dragController.addDragListener(this);
+
+ dragController.addDragListener(mAppInfoDropTarget);
+
+ dragController.addDropTarget(mAppInfoDropTarget);
+
+ mAppInfoDropTarget.setLauncher(launcher);
+ }
+
+ @Override
+ public void showDropTarget() {
+ animateDropTargetBarToAlpha(1f, DEFAULT_DRAG_FADE_DURATION);
+ }
+
+ @Override
+ public void hideDropTarget() {
+ animateDropTargetBarToAlpha(0f, DEFAULT_DRAG_FADE_DURATION);
+ }
+
+ private void animateDropTargetBarToAlpha(float alpha, int duration) {
+ animateViewAlpha(mDropTargetBarAnimator, mDropTargetBar, alpha,duration);
+ }
+
+ @Override
+ public void enableAccessibleDrag(boolean enable) {
+ mAppInfoDropTarget.enableAccessibleDrag(enable);
+ }
+}
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 6364d90c1..66cf2dfea 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -397,29 +397,15 @@ public class DeviceProfile {
// Layout the search bar space
View searchBar = launcher.getSearchDropTargetBar();
- lp = (FrameLayout.LayoutParams) searchBar.getLayoutParams();
- if (hasVerticalBarLayout) {
- // Vertical search bar space -- The search bar is fixed in the layout to be on the left
- // of the screen regardless of RTL
- lp.gravity = Gravity.LEFT;
- lp.width = searchBarSpaceHeightPx;
-
- LinearLayout targets = (LinearLayout) searchBar.findViewById(R.id.drag_target_bar);
- targets.setOrientation(LinearLayout.VERTICAL);
- FrameLayout.LayoutParams targetsLp = (FrameLayout.LayoutParams) targets.getLayoutParams();
- targetsLp.gravity = Gravity.TOP;
- targetsLp.height = LayoutParams.WRAP_CONTENT;
-
- } else {
- // Horizontal search bar space
- lp.gravity = Gravity.TOP;
- lp.height = searchBarSpaceHeightPx;
-
- LinearLayout targets = (LinearLayout) searchBar.findViewById(R.id.drag_target_bar);
- targets.getLayoutParams().width = searchBarSpaceWidthPx;
- }
+ lp = getDropTargetBarLayoutParams(hasVerticalBarLayout, searchBar, Gravity.TOP);
searchBar.setLayoutParams(lp);
+ // Layout the app info bar space
+ View appInfoBar = launcher.getAppInfoDropTargetBar();
+ lp = getDropTargetBarLayoutParams(hasVerticalBarLayout, appInfoBar, Gravity.BOTTOM);
+ lp.bottomMargin = hotseatBarHeightPx;
+ appInfoBar.setLayoutParams(lp);
+
// Layout the workspace
PagedView workspace = (PagedView) launcher.findViewById(R.id.workspace);
lp = (FrameLayout.LayoutParams) workspace.getLayoutParams();
@@ -478,7 +464,6 @@ public class DeviceProfile {
// Layout the Overview Mode
ViewGroup overviewMode = launcher.getOverviewPanel();
if (overviewMode != null) {
- int overviewButtonBarHeight = getOverviewModeButtonBarHeight();
lp = (FrameLayout.LayoutParams) overviewMode.getLayoutParams();
lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
@@ -487,7 +472,7 @@ public class DeviceProfile {
int maxWidth = totalItemWidth + (visibleChildCount-1) * overviewModeBarSpacerWidthPx;
lp.width = Math.min(availableWidthPx, maxWidth);
- lp.height = overviewButtonBarHeight;
+ lp.height = getOverviewModeButtonBarHeight();
overviewMode.setLayoutParams(lp);
if (lp.width > totalItemWidth && visibleChildCount > 1) {
@@ -516,6 +501,31 @@ public class DeviceProfile {
}
}
+ private FrameLayout.LayoutParams getDropTargetBarLayoutParams(boolean hasVerticalBarLayout,
+ View dropTargetBar, int verticalGravity) {
+ FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) dropTargetBar.getLayoutParams();
+ if (hasVerticalBarLayout) {
+ // Vertical drop target bar space -- The drop target bar is fixed in the layout to be on
+ // the left of the screen regardless of RTL
+ lp.gravity = Gravity.LEFT;
+ lp.width = searchBarSpaceHeightPx;
+
+ LinearLayout targets = (LinearLayout) dropTargetBar.findViewById(R.id.drag_target_bar);
+ targets.setOrientation(LinearLayout.VERTICAL);
+ FrameLayout.LayoutParams targetsLp = (FrameLayout.LayoutParams) targets.getLayoutParams();
+ targetsLp.gravity = verticalGravity;
+ targetsLp.height = LayoutParams.WRAP_CONTENT;
+ } else {
+ // Horizontal drop target bar space
+ lp.gravity = verticalGravity;
+ lp.height = searchBarSpaceHeightPx;
+
+ LinearLayout targets = (LinearLayout) dropTargetBar.findViewById(R.id.drag_target_bar);
+ targets.getLayoutParams().width = searchBarSpaceWidthPx;
+ }
+ return lp;
+ }
+
private int getCurrentWidth() {
return isLandscape
? Math.max(widthPx, heightPx)
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index e85fce6ef..ff21be218 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -906,7 +906,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
@Override
public boolean supportsAppInfoDropTarget() {
- return false;
+ return true;
}
@Override
diff --git a/src/com/android/launcher3/InfoDropTarget.java b/src/com/android/launcher3/InfoDropTarget.java
index b4a144526..f5b7c5640 100644
--- a/src/com/android/launcher3/InfoDropTarget.java
+++ b/src/com/android/launcher3/InfoDropTarget.java
@@ -59,7 +59,8 @@ public class InfoDropTarget extends ButtonDropTarget {
}
public static boolean supportsDrop(Context context, ItemInfo info) {
- return info instanceof AppInfo || info instanceof PendingAddItemInfo;
+ return info instanceof AppInfo || info instanceof ShortcutInfo
+ || info instanceof PendingAddItemInfo;
}
@Override
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 70a30c2ce..35d08baa4 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -247,6 +247,7 @@ public class Launcher extends Activity
private View mWidgetsButton;
private SearchDropTargetBar mSearchDropTargetBar;
+ private AppInfoDropTargetBar mAppInfoDropTargetBar;
// Main container view for the all apps screen.
@Thunk AllAppsContainerView mAppsView;
@@ -1366,9 +1367,12 @@ public class Launcher extends Activity
mWorkspace.setup(dragController);
dragController.addDragListener(mWorkspace);
- // Get the search/delete bar
+ // Get the search/delete/uninstall bar
mSearchDropTargetBar = (SearchDropTargetBar)
mDragLayer.findViewById(R.id.search_drop_target_bar);
+ // Get the app info bar
+ mAppInfoDropTargetBar = (AppInfoDropTargetBar)
+ mDragLayer.findViewById(R.id.app_info_drop_target_bar);
// Setup Apps and Widgets
mAppsView = (AllAppsContainerView) findViewById(R.id.apps_view);
@@ -1387,6 +1391,9 @@ public class Launcher extends Activity
mSearchDropTargetBar.setup(this, dragController);
mSearchDropTargetBar.setQsbSearchBar(getOrCreateQsbBar());
}
+ if (mAppInfoDropTargetBar != null) {
+ mAppInfoDropTargetBar.setup(this, dragController);
+ }
if (getResources().getBoolean(R.bool.debug_memory_enabled)) {
Log.v(TAG, "adding WeightWatcher");
@@ -1773,6 +1780,10 @@ public class Launcher extends Activity
return mSearchDropTargetBar;
}
+ public AppInfoDropTargetBar getAppInfoDropTargetBar() {
+ return mAppInfoDropTargetBar;
+ }
+
public LauncherAppWidgetHost getAppWidgetHost() {
return mAppWidgetHost;
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index c5d323b73..0fe37deb3 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -1589,6 +1589,7 @@ public class Workspace extends PagedView
setOnClickListener(mLauncher);
}
mLauncher.getSearchDropTargetBar().enableAccessibleDrag(enable);
+ mLauncher.getAppInfoDropTargetBar().enableAccessibleDrag(enable);
mLauncher.getHotseat().getLayout()
.enableAccessibleDrag(enable, CellLayout.WORKSPACE_ACCESSIBILITY_DRAG);
}
@@ -2013,6 +2014,10 @@ public class Workspace extends PagedView
return -workspaceOffsetTopEdge + overviewOffsetTopEdge;
}
+ int getSpringLoadedTranslationY() {
+ return getOverviewModeTranslationY();
+ }
+
/**
* Sets the current workspace {@link State}, returning an animation transitioning the workspace
* to that new state.
@@ -3825,7 +3830,7 @@ public class Workspace extends PagedView
@Override
public boolean supportsAppInfoDropTarget() {
- return false;
+ return true;
}
@Override
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index 011f4a2b1..d32ce7377 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -285,8 +285,13 @@ public class WorkspaceStateTransitionAnimation {
float finalHotseatAndPageIndicatorAlpha = (states.stateIsNormal || states.stateIsSpringLoaded) ?
1f : 0f;
float finalOverviewPanelAlpha = states.stateIsOverview ? 1f : 0f;
- float finalWorkspaceTranslationY = states.stateIsOverview || states.stateIsOverviewHidden ?
- mWorkspace.getOverviewModeTranslationY() : 0;
+
+ float finalWorkspaceTranslationY = 0;
+ if (states.stateIsOverview || states.stateIsOverviewHidden) {
+ finalWorkspaceTranslationY = mWorkspace.getOverviewModeTranslationY();
+ } else if (states.stateIsSpringLoaded) {
+ finalWorkspaceTranslationY = mWorkspace.getSpringLoadedTranslationY();
+ }
final int childCount = mWorkspace.getChildCount();
final int customPageCount = mWorkspace.numCustomPages();
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index 6b6bef42f..adcc12cb6 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -165,6 +165,11 @@ public class DragLayer extends InsettableFrameLayout {
if (mHitRect.contains((int) ev.getX(), (int) ev.getY())) {
return true;
}
+
+ getDescendantRectRelativeToSelf(mLauncher.getAppInfoDropTargetBar(), mHitRect);
+ if (mHitRect.contains((int) ev.getX(), (int) ev.getY())) {
+ return true;
+ }
return false;
}
@@ -324,6 +329,7 @@ public class DragLayer extends InsettableFrameLayout {
if (isInAccessibleDrag()) {
childrenForAccessibility.add(mLauncher.getSearchDropTargetBar());
+ childrenForAccessibility.add(mLauncher.getAppInfoDropTargetBar());
}
} else {
super.addChildrenForAccessibility(childrenForAccessibility);