Bug 904122: Dismiss keyboard on search suggestion scroll. r=lucasr
☠☠ backed out by 4c0e25e39bed ☠ ☠
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 15 Aug 2013 09:49:45 -0700
changeset 143540 9760c819e9934d5083d90ba83d1733590d1a4e37
parent 143539 a7454660ca732db8744db69c6cf95943e3c38025
child 143541 4c0e25e39bede6eccd1f314c23a01ca26cac09ad
push id25130
push userlrocha@mozilla.com
push dateWed, 21 Aug 2013 09:41:27 +0000
treeherdermozilla-central@b2486721572e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr
bugs904122
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 904122: Dismiss keyboard on search suggestion scroll. r=lucasr
mobile/android/base/home/BrowserSearch.java
mobile/android/base/resources/layout/browser_search.xml
--- a/mobile/android/base/home/BrowserSearch.java
+++ b/mobile/android/base/home/BrowserSearch.java
@@ -30,18 +30,20 @@ import android.database.Cursor;
 import android.graphics.Bitmap;
 import android.net.Uri;
 import android.os.Bundle;
 import android.support.v4.app.LoaderManager;
 import android.support.v4.app.LoaderManager.LoaderCallbacks;
 import android.support.v4.content.AsyncTaskLoader;
 import android.support.v4.content.Loader;
 import android.text.TextUtils;
+import android.util.AttributeSet;
 import android.util.Log;
 import android.view.LayoutInflater;
+import android.view.MotionEvent;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.ViewGroup;
 import android.view.ViewStub;
 import android.view.WindowManager.LayoutParams;
 import android.view.animation.AccelerateInterpolator;
 import android.view.animation.Animation;
 import android.view.animation.TranslateAnimation;
@@ -845,9 +847,32 @@ public class BrowserSearch extends HomeF
 
         private void deselectRow() {
             if (mSelectedEngineRow != null) {
                 mSelectedEngineRow.onDeselected();
                 mSelectedEngineRow = null;
             }
         }
     }
+
+    /**
+     * HomeSearchListView is a list view for displaying search engine results on the awesome screen.
+     */
+    public static class HomeSearchListView extends HomeListView {
+        public HomeSearchListView(Context context, AttributeSet attrs) {
+            this(context, attrs, R.attr.homeListViewStyle);
+        }
+
+        public HomeSearchListView(Context context, AttributeSet attrs, int defStyle) {
+            super(context, attrs, defStyle);
+        }
+
+        @Override
+        public boolean onInterceptTouchEvent(MotionEvent event) {
+            if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
+                // Dismiss the soft keyboard.
+                requestFocus();
+            }
+
+            return false;
+        }
+    }
 }
--- a/mobile/android/base/resources/layout/browser_search.xml
+++ b/mobile/android/base/resources/layout/browser_search.xml
@@ -8,15 +8,15 @@
               android:layout_width="match_parent"
               android:layout_height="match_parent">
 
     <ViewStub android:id="@+id/suggestions_opt_in_prompt"
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:layout="@layout/home_suggestion_prompt" />
 
-    <org.mozilla.gecko.home.HomeListView
+    <org.mozilla.gecko.home.HomeSearchListView
             android:id="@+id/home_list_view"
             android:layout_width="match_parent"
             android:layout_height="0dp"
             android:layout_weight="1" />
 
 </LinearLayout>