Status Update
Comments
si...@google.com <si...@google.com>
si...@google.com <si...@google.com>
si...@google.com <si...@google.com> #3
Thanks for the report!
si...@google.com <si...@google.com> #4
The release notes documentation has been edited to clarify this change in behavior for line height.
To support non-standard text sizes, we encourage users to follow the Material design system and use a different style = LocalTextStyle.current.copy(lineHeight = TextUnit.Unspecified)
, or create a custom Typography
entirely.
si...@google.com <si...@google.com> #5
si...@google.com <si...@google.com> #6
In my case, I have multiple font sizes in the same Text
(using SpanStyle
in AnnotatedString
). There are legitimate reasons for this. For example, when combining Chinese and English (phonetic) together (for language-learning purposes).
ap...@google.com <ap...@google.com> #7
Branch: androidx-master-dev
commit c2e5559d05db4329d7e0d3e92e53508194bf5d8d
Author: Siyamed Sinir <siyamed@google.com>
Date: Tue Jun 09 09:37:23 2020
Use TextFieldValue in all TextFields
Test: ./gradlew ui:ui-material:test
Test: ./gradlew ui:ui-material:cAT
Test: ./gradlew ui:ui-foundation:test
Test: ./gradlew ui:ui-foundation:cAT
Test: ./gradlew ui:ui-text:test
Test: ./gradlew ui:ui-text:cAT
Test: ./gradlew ui:ui-text-core:test
Test: ./gradlew ui:ui-text-core:cAT
Test: ./gradlew ui:ui-core:test
Test: ./gradlew ui:ui-core:cAT
Test: Manual test in the Demo app.
RelNote: "androidx.ui.foundation.TextFieldValue and
androidx.ui.input.EditorValue is deprecated. TextField,
FilledTextField and CoreTextField composables that uses
that type is also deprecated. Please use
androidx.ui.input.TextFieldValue instead"
Bug: 155211005
Change-Id: I4066d1f4d2e3e3514753aa3495680292dc55f89d
M compose/compose-runtime/samples/src/main/java/androidx/compose/samples/ModelSamples.kt
M ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/input/EditProcessorBenchmark.kt
M ui/integration-tests/demos/src/main/java/androidx/ui/demos/DemoApp.kt
M ui/integration-tests/demos/src/main/java/androidx/ui/demos/DemoFilter.kt
M ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/PopupDemo.kt
M ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/autofill/ExplicitAutofillTypesDemo.kt
M ui/ui-core/src/androidTest/java/androidx/ui/input/RecordingInputConnectionTest.kt
M ui/ui-core/src/main/java/androidx/ui/input/InputState.kt
M ui/ui-core/src/main/java/androidx/ui/input/RecordingInputConnection.kt
M ui/ui-core/src/main/java/androidx/ui/input/TextInputServiceAndroid.kt
M ui/ui-core/src/test/java/androidx/ui/input/RecordingInputConnectionUpdateTextFieldValueTest.kt
M ui/ui-core/src/test/java/androidx/ui/input/TextInputServiceAndroidTest.kt
M ui/ui-desktop/src/jvmMain/kotlin/androidx/ui/desktop/DesktopPlatformInput.kt
M ui/ui-foundation/api/0.1.0-dev14.txt
M ui/ui-foundation/api/current.txt
M ui/ui-foundation/api/public_plus_experimental_0.1.0-dev14.txt
M ui/ui-foundation/api/public_plus_experimental_current.txt
M ui/ui-foundation/api/restricted_0.1.0-dev14.txt
M ui/ui-foundation/api/restricted_current.txt
M ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/TextFieldSample.kt
M ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/SoftwareKeyboardTest.kt
M ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/TextFieldFocusTest.kt
M ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/TextFieldOnValueChangeTextFieldValueTest.kt
M ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/TextFieldTest.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/TextField.kt
M ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/TextLayoutDirectionModifierTest.kt
M ui/ui-material/api/0.1.0-dev14.txt
M ui/ui-material/api/current.txt
M ui/ui-material/api/public_plus_experimental_0.1.0-dev14.txt
M ui/ui-material/api/public_plus_experimental_current.txt
M ui/ui-material/api/restricted_0.1.0-dev14.txt
M ui/ui-material/api/restricted_current.txt
M ui/ui-material/samples/src/main/java/androidx/ui/material/samples/TextFieldSamples.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/FilledTextFieldTest.kt
M ui/ui-material/src/main/java/androidx/ui/material/TextField.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/TextActionsTest.kt
M ui/ui-test/src/main/java/androidx/ui/test/TextInputServiceForTests.kt
M ui/ui-text-core/api/0.1.0-dev14.txt
M ui/ui-text-core/api/current.txt
M ui/ui-text-core/api/public_plus_experimental_0.1.0-dev14.txt
M ui/ui-text-core/api/public_plus_experimental_current.txt
M ui/ui-text-core/api/restricted_0.1.0-dev14.txt
M ui/ui-text-core/api/restricted_current.txt
M ui/ui-text-core/build.gradle
M ui/ui-text-core/src/commonMain/kotlin/androidx/ui/input/EditProcessor.kt
D ui/ui-text-core/src/commonMain/kotlin/androidx/ui/input/EditorValue.kt
A ui/ui-text-core/src/commonMain/kotlin/androidx/ui/input/TextFieldValue.kt
M ui/ui-text-core/src/commonMain/kotlin/androidx/ui/input/TextInputService.kt
M ui/ui-text-core/src/test/java/androidx/ui/input/EditProcessorTest.kt
M ui/ui-text-core/src/test/java/androidx/ui/text/TextInputServiceTest.kt
M ui/ui-text/api/0.1.0-dev14.txt
M ui/ui-text/api/current.txt
M ui/ui-text/api/public_plus_experimental_0.1.0-dev14.txt
M ui/ui-text/api/public_plus_experimental_current.txt
M ui/ui-text/api/restricted_0.1.0-dev14.txt
M ui/ui-text/api/restricted_current.txt
M ui/ui-text/integration-tests/ui-text-compose-demos/src/main/java/androidx/ui/text/demos/ComposeInputField.kt
M ui/ui-text/integration-tests/ui-text-compose-demos/src/main/java/androidx/ui/text/demos/ComposeInputFieldFocusTransition.kt
M ui/ui-text/integration-tests/ui-text-compose-demos/src/main/java/androidx/ui/text/demos/ComposeInputFieldTrickyUseCase.kt
M ui/ui-text/integration-tests/ui-text-compose-demos/src/main/java/androidx/ui/text/demos/ComposeVariousInputField.kt
M ui/ui-text/integration-tests/ui-text-compose-demos/src/main/java/androidx/ui/text/demos/TailFollowingTextField.kt
M ui/ui-text/integration-tests/ui-text-compose-demos/src/main/java/androidx/ui/text/demos/TextFieldWIthScroller.kt
M ui/ui-text/src/androidTest/java/androidx/ui/text/TextFieldDelegateIntegrationTest.kt
M ui/ui-text/src/main/java/androidx/ui/text/CoreTextField.kt
M ui/ui-text/src/main/java/androidx/ui/text/TextFieldDelegate.kt
M ui/ui-text/src/test/java/androidx/ui/text/TextFieldDelegateTest.kt
si...@google.com <si...@google.com> #8
FYI: this caused far too many work. I regret pushing the change in.
Description
CoreTextField(EditorValue, (EditorValue) -> Unit) (in ui.text)
TextField(EditorValue, (EditorValue) -> Unit) (in ui.foundation)
TextField(TextFieldValue, (TextFieldValue) -> Unit) (in ui.foundation)
FilledTextField(TextFieldValue, (TextFieldValue) -> Unit) (in ui.material)
FilledTextField(String, (String) -> Unit) (in ui.material)
EditorValue is the most powerful API, where every aspect of the text field is controllable, but also more cumbersome to use.
TextFieldValue is middle-weight, with only string value and selection controllable, but still a bit cumbersome to use
String is the least powerful API, but also the most convenient and powerful enough to satisfy the overwhelming majority of use cases.
My suggestion is to refactor these overloads to have each one fit into one of two overloads:
1. EditorValue-based (cumbersome, powerful)
2. String-based (convenient, useful)
The string-based variants would have an `onSelectionChanged: (Selection) -> Unit` parameter, but would not allow for a selection to be *controlled* (hence the past tense on the parameter name).
It seems to me like the need to control or listen to the selection state are both somewhat rare, but the need to control it is even more so. On the other hand, the need to control the text value is virtually 100% of the time. As a result, adding the overhead of the selection controllability in the common case feels wrong, since the times you might want to do that, the more powerful EditorValue API might be something you need to reach for anyway.
As a result, my proposal is to have the following APIs:
in ui.text:
fun CoreTextField(value: EditorValue, onValueChange: (EditorValue) -> Unit) (unchanged)
in ui.foundation:
fun TextField(EditorValue, (EditorValue) -> Unit) (unchanged)
fun TextField(value: String, onValueChange: (String) -> Unit, onSelectionChanged: (Selection) -> Unit)
in ui.material:
fun FilledTextField(EditorValue, (EditorValue) -> Unit)
fun FilledTextField(value: String, onValueChange: (String) -> Unit, onSelectionChanged: (Selection) -> Unit)