-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add API and launcher for NonEditableBasicTextField #2395
Conversation
import androidx.compose.ui.text.input.VisualTransformation | ||
|
||
/** | ||
* This is a wrapper for [BasicTextField] that when clicked launches the keyboard. It cannot be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to improve these, but maybe wait until API is settled
5835a3c
to
fee27a5
Compare
|
||
override fun parseResult(resultCode: Int, intent: Intent?): Result { | ||
return if (resultCode == RESULT_OK) { | ||
val resultText = intent?.extras?.getString("result_text") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This I need to fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it works, it's just that it's overridden by the BasicTextField
implementation. Maybe using that wasn't such a good idea 🤔
fee27a5
to
71ae7e0
Compare
71ae7e0
to
2bd4ce7
Compare
}, | ||
value = value, | ||
onValueChange = {}, | ||
enabled = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This made it work since its suppressing the BasicTextField
, but it feels quite hacky, maybe not the solution we want to go for I guess 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was not working before disabling the component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before doing this, I think the BasicTextField was interfering (just my assumption). The text was not able to update correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
I will do another round of review tomorrow, just leaving these comments for now.
Could you please add a video showing the usage of the component to the PR description? A sequence of screenshots is also fine.
onTextChanged(it.text) | ||
} | ||
} | ||
val keyboardIntent = Intent("com.google.android.wearable.action.LAUNCH_KEYBOARD") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This intent is for gboard, which doesn't come pre-installed in every watch (e.g. samsung watches).
This component would need to check if the intent exists, if it doesn't, we would need to think on a good behavior, e.g. call RemoteInputIntentHelper.startActivityForResult or let the user of the component provide the fallback behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I didn't know, maybe providing some callback would be good? No strong opinions on how best to handle this from my side. Is this maybe a UX question perhaps? :)
}, | ||
value = value, | ||
onValueChange = {}, | ||
enabled = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was not working before disabling the component?
Thank you for checking this out and giving valuable feedback 🙏 Currently very in draft stage. I can provide a video on how it's working now. From what I understood in the issue we want to have a wrapper on |
I think maybe I'll close this for now until we get a bit more input from the UX. Not quite sure how this component should work to provide most value to the users |
Thanks for the patience, Odin. I will ping you here once I get more information. |
WHAT
Adding NonEditableBasicTextField composable to open the keyboard on click.
Currently a draft as I need to get it to work. Opening a draft PR here so I can get some feedback on the solution :)
WHY
Ref. #1563
HOW
Checklist 📋