Don't set input type if it's the same as old one

It breaks Gboard word correction if you change cursor in screen
This commit is contained in:
Benau 2019-05-28 00:53:53 +08:00
parent 1d5e80c131
commit 2744a24951

View File

@ -182,27 +182,40 @@ public class STKEditText extends EditText
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
public void configType(final int type) public void configType(final int type)
{ {
int it = InputType.TYPE_CLASS_TEXT;
// Check text_box_widget.hpp for definition // Check text_box_widget.hpp for definition
switch (type) switch (type)
{ {
case 0: case 0:
setInputType(InputType.TYPE_CLASS_TEXT); {
it = InputType.TYPE_CLASS_TEXT;
break; break;
}
case 1: case 1:
setInputType(InputType.TYPE_CLASS_TEXT | {
InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); it = InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
break; break;
}
case 2: case 2:
setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); {
it = InputType.TYPE_TEXT_VARIATION_PASSWORD;
break; break;
}
case 3: case 3:
setInputType(InputType.TYPE_CLASS_NUMBER); {
it = InputType.TYPE_CLASS_NUMBER;
break; break;
}
case 4: case 4:
setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); {
it = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
break; break;
}
default: default:
break; break;
} }
if (it != getInputType())
setInputType(it);
} }
} }