Bug 645725 - Don't require two taps to open non-fullscreen Android keyboards [r=mfinkle]

This commit is contained in:
Matt Brubeck 2011-06-02 09:32:12 -07:00
parent 18816085da
commit e6f5cf5a92

View File

@ -297,8 +297,8 @@ var BrowserUI = {
if (this._activePanel) if (this._activePanel)
this._activePanel.close(); this._activePanel.close();
// The readOnly state of the field enabled/disabled the VKB // If the keyboard will cover the full screen, we do not want to show it right away.
let isReadOnly = !(aPanel == AllPagesList && Util.isPortrait() && (willShowPanel || !this._edit.readOnly)); let isReadOnly = (aPanel != AllPagesList || this._isKeyboardFullscreen() || (!willShowPanel && this._edit.readOnly));
this._edit.readOnly = isReadOnly; this._edit.readOnly = isReadOnly;
if (isReadOnly) if (isReadOnly)
this._edit.blur(); this._edit.blur();
@ -355,6 +355,24 @@ var BrowserUI = {
this._dispatchPopupChanged(false); this._dispatchPopupChanged(false);
}, },
// Will the on-screen keyboard cover the whole screen when opened?
_isKeyboardFullscreen: function _isKeyboardFullscreen() {
#ifdef ANDROID
if (!Util.isPortrait()) {
switch (Services.prefs.getIntPref("widget.ime.android.landscape_fullscreen")) {
case 1:
return true;
case -1: {
let threshold = Services.prefs.getIntPref("widget.ime.android.fullscreen_threshold");
let dpi = Util.getWindowUtils(window).displayDPI;
return (window.innerHeight * 100 < threshold * dpi);
}
}
}
#endif
return false;
},
_dispatchPopupChanged: function _dispatchPopupChanged(aVisible) { _dispatchPopupChanged: function _dispatchPopupChanged(aVisible) {
let stack = document.getElementById("stack"); let stack = document.getElementById("stack");
let event = document.createEvent("UIEvents"); let event = document.createEvent("UIEvents");