google / horologist

Horologist is a group of libraries that aim to supplement Wear OS developers with features that are commonly required by developers but not yet available.
https://google.github.io/horologist/
Apache License 2.0
576 stars 95 forks source link

TextField for Wearable #512

Closed Fra078 closed 2 years ago

Fra078 commented 2 years ago

Text fields are not recommended by Google on wearable devices, but sometime apps needs to use them (an example is Log-in in standalone apps) but all the ways on Wear Compose to call keyboard are uncomfortable to use and are rich of issues. Can you implement a simplified and functional way for text input?

yschimke commented 2 years ago

What are you imagining? Say a text field, with visible border to invite a touch. then launching out to the text entry activities and updating in place?

Similar API to https://developer.android.com/jetpack/compose/text ?

Fra078 commented 2 years ago

What are you imagining? Say a text field, with visible border to invite a touch. then launching out to the text entry activities and updating in place?

Similar API to https://developer.android.com/jetpack/compose/text ?

I was thinking to a Button which opens the keyboard

yschimke commented 2 years ago

I've got some examples for voice and keyboard input in a personal app.

https://github.com/yschimke/rememberwear/blob/ecb6bce9f785c4c55c098d7ee1def81de4440ae5/wear/src/main/kotlin/com/google/wear/soyted/ui/input/VoicePrompt.kt

Used https://github.com/yschimke/rememberwear/blob/ecb6bce9f785c4c55c098d7ee1def81de4440ae5/wear/src/main/kotlin/com/google/wear/soyted/ui/inbox/InboxScreen.kt#L80 and https://github.com/yschimke/rememberwear/blob/ecb6bce9f785c4c55c098d7ee1def81de4440ae5/wear/src/main/kotlin/com/google/wear/soyted/ui/home/HomeScreen.kt#L48

But I'm not certain we gain a huge amount with this and tied to a specific Button.

What would you expect the API to be like? How would you handle the successful and cancelled results?

yschimke commented 2 years ago

Are you expecting an actual keyboard implemented in Horologist? I was thinking we would just call out to Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH) or RemoteInputIntentHelper.createActionRemoteInputIntent() but maybe I misunderstood?

Fra078 commented 2 years ago

I know that you can use remote intent helper but using it you can't set a type of allowed content (like only put numbers) or text type(like password)

yschimke commented 2 years ago

I don't think a keyboard implementation in library form in Horologist would be appropriate. There is an established mechanism of Remote Intents, that could be adapted to support alternative keyboard apps. Maybe that would be more appropriate, a way for apps to use the best available installed keyboard app?

Going to close this as we won't be a keyboard app in Horologist.