Bug 924480 - Part 1: Make search_container focusable before browser_toolbar. r=bnicholson, a=lsblakk
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 17 Oct 2013 13:32:57 -0700
changeset 166356 18c9ab1860edad41ae2e907257165e0069204938
parent 166355 e2b3761232a02b0a588f17e283021dd9994c1a03
child 166357 c13c00bbc3f6b8b17467b06c684f9de485ed8cdf
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson, lsblakk
bugs924480
milestone27.0a2
Bug 924480 - Part 1: Make search_container focusable before browser_toolbar. r=bnicholson, a=lsblakk
mobile/android/base/BrowserToolbar.java
mobile/android/base/resources/layout/gecko_app.xml
--- a/mobile/android/base/BrowserToolbar.java
+++ b/mobile/android/base/BrowserToolbar.java
@@ -405,16 +405,17 @@ public class BrowserToolbar extends Geck
                         if (mCommitListener != null) {
                             mCommitListener.onCommit();
                         }
                         return true;
                     }
                 }
 
                 if (keyCode == KeyEvent.KEYCODE_BACK) {
+                    // Drop the virtual keyboard.
                     clearFocus();
                     return true;
                 }
 
                 return false;
             }
         });
 
--- a/mobile/android/base/resources/layout/gecko_app.xml
+++ b/mobile/android/base/resources/layout/gecko_app.xml
@@ -50,30 +50,35 @@
 
         <RelativeLayout android:id="@+id/camera_layout"
                         android:layout_height="wrap_content"
                         android:layout_width="wrap_content"
                         android:layout_alignParentRight="true"
                         android:layout_alignParentBottom="true">
         </RelativeLayout>
 
-        <org.mozilla.gecko.BrowserToolbar android:id="@+id/browser_toolbar"
+        <FrameLayout android:id="@+id/search_container"
+                     android:layout_width="fill_parent"
+                     android:layout_height="fill_parent"
+                     android:layout_below="@+id/browser_toolbar"
+                     android:background="@android:color/white"
+                     android:visibility="invisible"/>
+
+        <!-- When focus is cleared from from BrowserToolbar's EditText to
+             lower the virtual keyboard, focus will be returned to the root
+             view. To make sure the EditText is not the first focusable view in
+             the root view, BrowserToolbar should be specified as low in the
+             view hierarchy as possible. -->
+        <org.mozilla.gecko.BrowserToolbar android:id="@id/browser_toolbar"
                 style="@style/BrowserToolbar"
                 android:layout_width="fill_parent"
                 android:layout_height="@dimen/browser_toolbar_height"
                 android:clickable="true"
                 android:focusable="true"/>
 
-        <FrameLayout android:id="@+id/search_container"
-                     android:layout_width="fill_parent"
-                     android:layout_height="fill_parent"
-                     android:layout_below="@id/browser_toolbar"
-                     android:background="@android:color/white"
-                     android:visibility="invisible"/>
-
     </view>
 
     <LinearLayout android:id="@+id/toast"
                   style="@style/Toast">
 
         <TextView android:id="@+id/toast_message"
                   style="@style/ToastMessage" />