Merge "Updating alignment of search input" into ub-launcher3-calgary
diff --git a/build.gradle b/build.gradle
index f98021c..ffe4455 100644
--- a/build.gradle
+++ b/build.gradle
@@ -12,8 +12,8 @@
 apply plugin: 'com.google.protobuf'
 
 android {
-    compileSdkVersion 'android-N'
-    buildToolsVersion '24.0.0-rc3'
+    compileSdkVersion 25
+    buildToolsVersion '24.0.0'
 
     defaultConfig {
         applicationId "com.android.launcher3"
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index f71aaef..dd54495 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -3177,9 +3177,6 @@
         return (d.dragInfo instanceof LauncherAppWidgetInfo ||
                 d.dragInfo instanceof PendingAddWidgetInfo);
     }
-    private boolean isExternalDragWidget(DragObject d) {
-        return d.dragSource != this && isDragWidget(d);
-    }
 
     public void onDragOver(DragObject d) {
         // Skip drag over events while we are dragging over side pages
@@ -3201,7 +3198,7 @@
         final View child = (mDragInfo == null) ? null : mDragInfo.cell;
         // Identify whether we have dragged over a side page
         if (workspaceInModalState()) {
-            if (mLauncher.getHotseat() != null && !isExternalDragWidget(d)) {
+            if (mLauncher.getHotseat() != null && !isDragWidget(d)) {
                 if (isPointInSelfOverHotseat(d.x, d.y)) {
                     layout = mLauncher.getHotseat().getLayout();
                 }
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index ae9d836..30cd607 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -32,7 +32,6 @@
 import android.view.View;
 import android.view.ViewConfiguration;
 import android.view.ViewGroup;
-import android.view.inputmethod.InputMethodManager;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 
@@ -338,12 +337,8 @@
         final OnClickListener searchFocusListener = new OnClickListener() {
             @Override
             public void onClick(View view) {
-                if (!mSearchInput.isFocused()) {
-                    mSearchInput.requestFocus();
-                    final InputMethodManager imm =
-                            (InputMethodManager)getContext().getSystemService(
-                                    Context.INPUT_METHOD_SERVICE);
-                    imm.showSoftInput(mSearchInput, 0);
+                if (!mSearchBarController.isSearchFieldFocused()) {
+                    mSearchBarController.focusSearchField();
                 }
             }
         };
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 0babc1a..b42b762 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -65,6 +65,8 @@
     private float mShiftCurrent;    // [0, mShiftRange]
     private float mShiftRange;      // changes depending on the orientation
 
+    private static final float DEFAULT_SHIFT_RANGE = 10;
+
 
     private static final float RECATCH_REJECTION_FRACTION = .0875f;
 
@@ -81,6 +83,7 @@
         mLauncher = launcher;
         mDetector = new VerticalPullDetector(launcher);
         mDetector.setListener(this);
+        mShiftCurrent = mShiftRange = DEFAULT_SHIFT_RANGE;
         mBezelSwipeUpHeight = launcher.getResources().getDimensionPixelSize(
                 R.dimen.all_apps_bezel_swipe_height);
     }
@@ -436,14 +439,12 @@
     @Override
     public void onLayoutChange(View v, int left, int top, int right, int bottom,
             int oldLeft, int oldTop, int oldRight, int oldBottom) {
+        float prevShiftRatio = mShiftCurrent / mShiftRange;
         if (!mLauncher.getDeviceProfile().isVerticalBarLayout()) {
             mShiftRange = top;
         } else {
             mShiftRange = bottom;
         }
-        if (!mLauncher.isAllAppsVisible()) {
-            setProgress(mShiftRange);
-        }
-        mHotseat.removeOnLayoutChangeListener(this);
+        setProgress(mShiftRange * prevShiftRatio);
     }
 }