From d8905fa1682207a57e0852e2e62bedf21253cc7b Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Thu, 15 Aug 2013 09:49:45 -0700 Subject: [PATCH] Bug 904122: Dismiss keyboard on search suggestion scroll. r=lucasr --- mobile/android/base/home/BrowserSearch.java | 25 +++++++++++++++++++ .../base/resources/layout/browser_search.xml | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/mobile/android/base/home/BrowserSearch.java b/mobile/android/base/home/BrowserSearch.java index 39d88dd3aa11..e23c66036c24 100644 --- a/mobile/android/base/home/BrowserSearch.java +++ b/mobile/android/base/home/BrowserSearch.java @@ -35,8 +35,10 @@ 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; @@ -850,4 +852,27 @@ public class BrowserSearch extends HomeFragment } } } + + /** + * 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; + } + } } diff --git a/mobile/android/base/resources/layout/browser_search.xml b/mobile/android/base/resources/layout/browser_search.xml index 2a177a64509c..a685d76a948c 100644 --- a/mobile/android/base/resources/layout/browser_search.xml +++ b/mobile/android/base/resources/layout/browser_search.xml @@ -13,7 +13,7 @@ android:layout_height="wrap_content" android:layout="@layout/home_suggestion_prompt" /> -