Problem
When TextField.focus() is called twice, the soft keyboard displays even though the window has been created using
windowSoftInputMode:Ti.UI.Android.SOFT_INPUT_STATE_ALWAYS_HIDDEN
.
The first
TextField.focus()
call focuses the TextField correctly, and the keyboard does not appear (this is expected behavior).
When TextField.focus() is called again, while the TextField has focus, the keyboard incorrectly appears.
There is a regression in the 1.9.0.v20120111233134 SDK. The problem did not occur with 1.8.0.1 or earlier.
Test Case
drop the following app.js code into a new project
build with SDK 1.8.0.1
click the button once...the edit gets focus & no keyboard shows.
click the button again...the edit is still focused & still no keyboard.
rebuild with SDK 1.9.0.v20120111233134
click the button once...the edit gets focus & no keyboard shows.
click the button again...the edit is still focused *but now the keyboard pops up.* This is the problem.
var win1 = Ti.UI.createWindow({
backgroundColor:'#fff',
windowSoftInputMode:Ti.UI.Android.SOFT_INPUT_STATE_ALWAYS_HIDDEN,
exitOnClose:true,
navBarHidden:true
});
var label1 = Ti.UI.createLabel({
color:'#999',
text:'I am Window 1',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto',
top:100
});
win1.add(label1);
var edit1=Ti.UI.createTextField({
width:100,
top:130
});
win1.add(edit1);
var btn1 = Ti.UI.createButton({
title:'Focus Edit',
width:'auto',
left:10,
top:175
});
function DoBtn1Click()
{
edit1.focus();
}
btn1.addEventListener('click',DoBtn1Click);
win1.add(btn1);
win1.open();
attached failcase code.
Good ticket, Shawn. Thanks! Escalating.
Functional tested with 1.9.0.169f35e and AVD 2.2. Going to mark CAN'T REPRODUCE. Note, however, that the described behavior doesn't quite match up with the expected behavior according to the Android documentation; see [SOFT_INPUT_STATE_ALWAYS_HIDDEN](http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#SOFT_INPUT_STATE_ALWAYS_HIDDEN) in their docs. It sounds like when the text field is focused the soft keyboard should always display from this description, but I could be wrong.
Can't reproduce 1.9.0.169f35e.
Verified fixed in SDK 1.8.1. Stephen, the "expected behavior" that I listed seems to me to agree with the description in the link you provided: "_always hide any soft input area when this window receives focus_". Translated to this specific case: always hide the soft keyboard when this TextField receives focus. Anyway, it seems to have been fixed between 01/11/2012 and the release of 1.8.1.
Closing ticket as I am unable to reproduce this issue with the following environment; Pixel (7.1) MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.0.3 GA Appc NPM 4.2.8 Appc CLI 6.1.0 Ti CLI 5.0.11 Alloy 1.9.5 Arrow 1.10.1 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80