[TIMOB-13689] Android: SOFT_INPUT_ADJUST_RESIZE causes keyboard to show on start, and TextField doesn't lose focus
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-05-10T17:21:30.000+0000 |
Affected Version/s | Release 3.0.2, Release 3.1.0 |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Sameeh Harfoush |
Assignee | Sunila |
Created | 2013-04-20T13:18:01.000+0000 |
Updated | 2017-03-29T17:17:13.000+0000 |
Description
*Actual behavior*
Using window.windowSoftInputMode = Ti.UI.Android.SOFT_INPUT_ADJUST_RESIZE; the keyboard automatically shows when the application starts.
Also, the input text always keep its focus i.e. the cursor keeps blinking and the TextField is always blue even if the blur() method is called.
*Expected behavior*
The keyboard should not show automatically when using SOFT_INPUT_ADJUST_RESIZE.
The TextField should lose focus when calling the blur() method, and should probably lose focus when tapping the window, too.
*Test case*
Ti.Android.currentActivity.setRequestedOrientation(Ti.Android.SCREEN_ORIENTATION_PORTRAIT);
var win = Ti.UI.createWindow({
title : 'Lab',
backgroundColor : 'white',
fullscreen : false,
navBarHidden : true,
exitOnClose : true,
orientationModes : [Titanium.UI.PORTRAIT]
});
win.windowSoftInputMode = Ti.UI.Android.SOFT_INPUT_ADJUST_RESIZE;
var text = Ti.UI.createTextField({
width : Ti.UI.FILL,
hintText : 'Search Lebanon',
top : 0
});
win.add(text);
var blurBtn = Ti.UI.createButton({
title : 'Blur',
top : 70
});
blurBtn.addEventListener('click', function(e) {
text.blur();
});
win.add(blurBtn);
win.open();
Tested and confirmed with Samsung Galaxy S2 Android 2.3.6 on 3.0.2 GA and 3.1 GA. This is not a regression between 3.0.2 and 3.1 - it's exactly the same behavior. It continues blinking even when blur() is called with both SDKs. If have simplified the test case to isolate the issue. @Sameeh - It would be a bonus if you could try the simplified test case and let me know if it still covers all the issues you described, and to also clarify that there is no regression. Edit: The regression might only occur on your specific device... Moving to TiMob.
Since textField is the only focusable control, it gets focus and keyboard is shown. If you don't want the keyboard to be shown when the activity is starting, set win.windowSoftInputMode = Ti.UI.Android.SOFT_INPUT_STATE_HIDDEN|Ti.UI.Android.SOFT_INPUT_ADJUST_RESIZE; Since there is no other focusable control, calling blur will set the focus again on the textfield
Closing ticket as invalid.