Commit a8f99ff0 authored by Nate Fischer's avatar Nate Fischer Committed by Commit Bot

[AW][Dev-UI] fix IME issues with search bar

This addresses a few issues I noticed with the IME (AKA "soft keyboard")
with the new search bar:

 * Switches to "adjustPan" mode, which overlays the IME on top of our
   layout rather than resizing our layout to sit above the IME (avoids
   an issue where the bottom nav bar sits above the keyboard)
 * Hide the IME when the user clicks the "done" button
 * Hide the IME when the user taps away from the EditText

Bug: 1052345
Test: Manual - verify IME works as expected
Change-Id: I1275299ffa562a48bd2f99586c8c10974b376927
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2340931Reviewed-by: default avatarChangwan Ryu <changwan@chromium.org>
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795646}
parent 97a5eb32
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-feature android:name="android.software.leanback" android:required="false"/> <uses-feature android:name="android.software.leanback" android:required="false"/>
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/> <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
<application # DIFF-ANCHOR: db395d2d <application # DIFF-ANCHOR: d9433e23
android:extractNativeLibs="True" android:extractNativeLibs="True"
android:icon="@$PACKAGE:drawable/icon_webview" android:icon="@$PACKAGE:drawable/icon_webview"
android:label="Android System WebView" android:label="Android System WebView"
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
android:exported="false" android:exported="false"
android:name="com.google.android.gms.common.api.GoogleApiActivity" android:name="com.google.android.gms.common.api.GoogleApiActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"/> android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
<activity # DIFF-ANCHOR: 46008f92 <activity # DIFF-ANCHOR: c5a36874
android:icon="@drawable/icon_webview" android:icon="@drawable/icon_webview"
android:label="WebView DevTools" android:label="WebView DevTools"
android:launchMode="singleTask" android:launchMode="singleTask"
...@@ -31,12 +31,13 @@ ...@@ -31,12 +31,13 @@
android:process=":webview_apk" android:process=":webview_apk"
android:taskAffinity="$PACKAGE.org.chromium.android_webview.devui" android:taskAffinity="$PACKAGE.org.chromium.android_webview.devui"
android:theme="@style/Theme.DevUi.DayNight" android:theme="@style/Theme.DevUi.DayNight"
android:visibleToInstantApps="true"> android:visibleToInstantApps="true"
android:windowSoftInputMode="adjustPan">
<intent-filter> # DIFF-ANCHOR: 76367aac <intent-filter> # DIFF-ANCHOR: 76367aac
<action android:name="$PACKAGE.SHOW_DEV_UI"/> <action android:name="$PACKAGE.SHOW_DEV_UI"/>
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
</intent-filter> # DIFF-ANCHOR: 76367aac </intent-filter> # DIFF-ANCHOR: 76367aac
</activity> # DIFF-ANCHOR: 46008f92 </activity> # DIFF-ANCHOR: c5a36874
<activity # DIFF-ANCHOR: a003fb0a <activity # DIFF-ANCHOR: a003fb0a
android:label="@string/license_activity_title" android:label="@string/license_activity_title"
android:name="org.chromium.android_webview.nonembedded.LicenseActivity" android:name="org.chromium.android_webview.nonembedded.LicenseActivity"
...@@ -415,5 +416,5 @@ ...@@ -415,5 +416,5 @@
android:process=":sandboxed_process9" android:process=":sandboxed_process9"
android:visibleToInstantApps="true" android:visibleToInstantApps="true"
tools:ignore="ExportedService"/> tools:ignore="ExportedService"/>
</application> # DIFF-ANCHOR: db395d2d </application> # DIFF-ANCHOR: d9433e23
</manifest> </manifest>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-feature android:name="android.software.leanback" android:required="false"/> <uses-feature android:name="android.software.leanback" android:required="false"/>
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/> <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
<application # DIFF-ANCHOR: 6f393552 <application # DIFF-ANCHOR: 9f4fb3d2
android:extractNativeLibs="False" android:extractNativeLibs="False"
android:icon="@$PACKAGE:drawable/icon_webview" android:icon="@$PACKAGE:drawable/icon_webview"
android:label="Android System WebView" android:label="Android System WebView"
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
android:exported="false" android:exported="false"
android:name="com.google.android.gms.common.api.GoogleApiActivity" android:name="com.google.android.gms.common.api.GoogleApiActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"/> android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
<activity # DIFF-ANCHOR: 46008f92 <activity # DIFF-ANCHOR: c5a36874
android:icon="@drawable/icon_webview" android:icon="@drawable/icon_webview"
android:label="WebView DevTools" android:label="WebView DevTools"
android:launchMode="singleTask" android:launchMode="singleTask"
...@@ -31,12 +31,13 @@ ...@@ -31,12 +31,13 @@
android:process=":webview_apk" android:process=":webview_apk"
android:taskAffinity="$PACKAGE.org.chromium.android_webview.devui" android:taskAffinity="$PACKAGE.org.chromium.android_webview.devui"
android:theme="@style/Theme.DevUi.DayNight" android:theme="@style/Theme.DevUi.DayNight"
android:visibleToInstantApps="true"> android:visibleToInstantApps="true"
android:windowSoftInputMode="adjustPan">
<intent-filter> # DIFF-ANCHOR: 76367aac <intent-filter> # DIFF-ANCHOR: 76367aac
<action android:name="$PACKAGE.SHOW_DEV_UI"/> <action android:name="$PACKAGE.SHOW_DEV_UI"/>
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
</intent-filter> # DIFF-ANCHOR: 76367aac </intent-filter> # DIFF-ANCHOR: 76367aac
</activity> # DIFF-ANCHOR: 46008f92 </activity> # DIFF-ANCHOR: c5a36874
<activity # DIFF-ANCHOR: a003fb0a <activity # DIFF-ANCHOR: a003fb0a
android:label="@string/license_activity_title" android:label="@string/license_activity_title"
android:name="org.chromium.android_webview.nonembedded.LicenseActivity" android:name="org.chromium.android_webview.nonembedded.LicenseActivity"
...@@ -416,5 +417,5 @@ ...@@ -416,5 +417,5 @@
android:visibleToInstantApps="true" android:visibleToInstantApps="true"
tools:ignore="ExportedService"/> tools:ignore="ExportedService"/>
<uses-static-library android:certDigest="32a2fc74d731105859e5a85df16d95f102d85b22099b8064c5d8915c61dad1e0" android:name="org.chromium.trichromelibrary" android:version="$VERSION_NUMBER"/> <uses-static-library android:certDigest="32a2fc74d731105859e5a85df16d95f102d85b22099b8064c5d8915c61dad1e0" android:name="org.chromium.trichromelibrary" android:version="$VERSION_NUMBER"/>
</application> # DIFF-ANCHOR: 6f393552 </application> # DIFF-ANCHOR: 9f4fb3d2
</manifest> </manifest>
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
android_webview/test/shell/AndroidManifest.xml as well. --> android_webview/test/shell/AndroidManifest.xml as well. -->
<!--suppress HardcodedText --> <!--suppress HardcodedText -->
<activity android:name="org.chromium.android_webview.devui.MainActivity" <activity android:name="org.chromium.android_webview.devui.MainActivity"
android:windowSoftInputMode="adjustPan"
android:visibleToInstantApps="true" android:visibleToInstantApps="true"
android:label="WebView DevTools" android:label="WebView DevTools"
android:icon="@drawable/icon_webview" android:icon="@drawable/icon_webview"
......
...@@ -22,12 +22,14 @@ ...@@ -22,12 +22,14 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:textIsSelectable="true"
android:textAppearance="?android:attr/textAppearanceLarge"/> android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView <TextView
android:id="@+id/flags_description" android:id="@+id/flags_description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textAppearance="?android:attr/textAppearanceMedium"/> android:textAppearance="?android:attr/textAppearanceMedium"/>
</LinearLayout> </LinearLayout>
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
android:singleLine="true" android:singleLine="true"
android:drawablePadding="4dp" android:drawablePadding="4dp"
android:drawableStart="@drawable/ic_search" android:drawableStart="@drawable/ic_search"
android:imeOptions="actionDone|actionSearch"
android:textAppearance="?android:attr/textAppearanceMedium"/> android:textAppearance="?android:attr/textAppearanceMedium"/>
<!--suppress HardcodedText --> <!--suppress HardcodedText -->
......
...@@ -19,6 +19,7 @@ import android.view.LayoutInflater; ...@@ -19,6 +19,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewParent; import android.view.ViewParent;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
...@@ -120,6 +121,16 @@ public class FlagsFragment extends DevUiBaseFragment { ...@@ -120,6 +121,16 @@ public class FlagsFragment extends DevUiBaseFragment {
@Override @Override
public void afterTextChanged(Editable e) {} public void afterTextChanged(Editable e) {}
}); });
searchBar.setOnFocusChangeListener((View v, boolean hasFocus) -> {
if (!hasFocus) hideKeyboard(mContext, v);
});
}
private static void hideKeyboard(Context context, View view) {
InputMethodManager inputMethodManager =
(InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
} }
/** /**
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
<permission android:name="$PACKAGE.permission.C2D_MESSAGE" android:protectionLevel="signature"/> <permission android:name="$PACKAGE.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
<permission android:name="$PACKAGE.TOS_ACKED" android:protectionLevel="signatureOrSystem"/> <permission android:name="$PACKAGE.TOS_ACKED" android:protectionLevel="signatureOrSystem"/>
<permission android:label="Debug web pages" android:name="$PACKAGE.permission.DEBUG" android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS" android:protectionLevel="signature"/> <permission android:label="Debug web pages" android:name="$PACKAGE.permission.DEBUG" android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS" android:protectionLevel="signature"/>
<application # DIFF-ANCHOR: 8b4c7922 <application # DIFF-ANCHOR: c9a6872
android:allowBackup="false" android:allowBackup="false"
android:extractNativeLibs="false" android:extractNativeLibs="false"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
...@@ -537,7 +537,7 @@ ...@@ -537,7 +537,7 @@
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
</intent-filter> # DIFF-ANCHOR: b3c76e56 </intent-filter> # DIFF-ANCHOR: b3c76e56
</activity> # DIFF-ANCHOR: ecad59fd </activity> # DIFF-ANCHOR: ecad59fd
<activity # DIFF-ANCHOR: 5fe1d7ec <activity # DIFF-ANCHOR: 1d9e26ca
android:icon="@drawable/icon_webview" android:icon="@drawable/icon_webview"
android:label="WebView DevTools" android:label="WebView DevTools"
android:launchMode="singleTask" android:launchMode="singleTask"
...@@ -545,12 +545,13 @@ ...@@ -545,12 +545,13 @@
android:process=":webview_apk" android:process=":webview_apk"
android:taskAffinity="$PACKAGE.org.chromium.android_webview.devui" android:taskAffinity="$PACKAGE.org.chromium.android_webview.devui"
android:theme="@style/Theme.DevUi.DayNight" android:theme="@style/Theme.DevUi.DayNight"
android:visibleToInstantApps="true"> android:visibleToInstantApps="true"
android:windowSoftInputMode="adjustPan">
<intent-filter> # DIFF-ANCHOR: 36c368a2 <intent-filter> # DIFF-ANCHOR: 36c368a2
<action android:name="com.android.webview.SHOW_DEV_UI"/> <action android:name="com.android.webview.SHOW_DEV_UI"/>
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
</intent-filter> # DIFF-ANCHOR: 36c368a2 </intent-filter> # DIFF-ANCHOR: 36c368a2
</activity> # DIFF-ANCHOR: 5fe1d7ec </activity> # DIFF-ANCHOR: 1d9e26ca
<activity # DIFF-ANCHOR: a003fb0a <activity # DIFF-ANCHOR: a003fb0a
android:label="@string/license_activity_title" android:label="@string/license_activity_title"
android:name="org.chromium.android_webview.nonembedded.LicenseActivity" android:name="org.chromium.android_webview.nonembedded.LicenseActivity"
...@@ -1460,5 +1461,5 @@ ...@@ -1460,5 +1461,5 @@
android:exported="true" android:exported="true"
android:name="org.chromium.chrome.browser.prerender.ChromePrerenderService" android:name="org.chromium.chrome.browser.prerender.ChromePrerenderService"
tools:ignore="ExportedService"/> tools:ignore="ExportedService"/>
</application> # DIFF-ANCHOR: 8b4c7922 </application> # DIFF-ANCHOR: c9a6872
</manifest> </manifest>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment