Fixed
Status Update
Comments
ta...@mercury.com <ta...@mercury.com> #2
It looks like the built-in keyboard requires TYPE_NUMBER_FLAG_DECIMAL
to be set on EditorInfo
, but I'm not finding a way to do this via TextField
and TextInputService
.
cl...@google.com <cl...@google.com>
si...@google.com <si...@google.com> #3
WE should add decimal as a type to KeyboardType.
ha...@google.com <ha...@google.com>
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit 3e769f5cda5a05c4e658ad14e59313a8307dbe3c
Author: Halil Ozercan <halilibo@google.com>
Date: Tue Mar 22 16:48:24 2022
Add Decimal as a new KeyboardType
Most keyboards show a decimal separator when keyboard type is set as Number. However, it is possible that a keyboard expects `TYPE_NUMBER_FLAG_DECIMAL` flag in inputType to actually show a key for decimal separator.
This change adds a new KeyboardType called Decimal that explicitly sets the required flag. Number and Decimal would essentially behave the same for most keyboards and OEMs.
Fix: b/209835363
Test: EditorInfoTest
Relnote: "Added KeyboardType.Decimal as an alternative to Keyboard.Number for specifically including decimal separator in IME."
Change-Id: Iec4c84be81e72f8eaf136f2df23f9d12567cc3dc
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/EditorInfoTest.kt
M compose/ui/ui-text/api/restricted_current.txt
M compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/ImeOptions.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/KeyboardSingleLineDemo.kt
M compose/ui/ui-text/api/public_plus_experimental_current.txt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/TextInputServiceAndroid.android.kt
M compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/KeyboardType.kt
M compose/ui/ui-text/api/current.txt
https://android-review.googlesource.com/2036485
Branch: androidx-main
commit 3e769f5cda5a05c4e658ad14e59313a8307dbe3c
Author: Halil Ozercan <halilibo@google.com>
Date: Tue Mar 22 16:48:24 2022
Add Decimal as a new KeyboardType
Most keyboards show a decimal separator when keyboard type is set as Number. However, it is possible that a keyboard expects `TYPE_NUMBER_FLAG_DECIMAL` flag in inputType to actually show a key for decimal separator.
This change adds a new KeyboardType called Decimal that explicitly sets the required flag. Number and Decimal would essentially behave the same for most keyboards and OEMs.
Fix:
Test: EditorInfoTest
Relnote: "Added KeyboardType.Decimal as an alternative to Keyboard.Number for specifically including decimal separator in IME."
Change-Id: Iec4c84be81e72f8eaf136f2df23f9d12567cc3dc
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/EditorInfoTest.kt
M compose/ui/ui-text/api/restricted_current.txt
M compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/ImeOptions.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/KeyboardSingleLineDemo.kt
M compose/ui/ui-text/api/public_plus_experimental_current.txt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/TextInputServiceAndroid.android.kt
M compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/KeyboardType.kt
M compose/ui/ui-text/api/current.txt
ha...@google.com <ha...@google.com> #5
I finally had a chance to test this on an LG G6 with Android 8.0. LG keyboard seems to really look for an explicit Decimal flag to show decimal separator on the keyboard. Please see attached screenshot for how new Decimal KeyboardType fixes this issue.
Description
On an LG G8 with Android 9, the standard keyboard does not show a decimal separator button (e.g. '.' in most locales) when used with a
TextField
set up withKeyboardType.Number
. This makes it impossible to input fractional values without using a differentKeyboardType
such asKeyboardType.Text
.Jetpack Compose release version: 1.1.0-beta03
Android Studio Build: #AI-211.7628.21.2111.7863044
Kotlin version: 1.5.31