scribe-org / Scribe-Android

Android app with keyboards for language learners
GNU General Public License v3.0
41 stars 40 forks source link

Play Icon When in a Command Mode #251

Open Linfye opened 1 day ago

Linfye commented 1 day ago

Contributor checklist


Description

This PR changes enter icon to play button when in a command mode.

Related issue

github-actions[bot] commented 1 day ago

Thank you for the pull request!

The Scribe team will do our best to address your contribution as soon as we can. The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :)

If you're not already a member of our public Matrix community, please consider joining! We'd suggest using Element as your Matrix client, and definitely join the General and Android rooms once you're in. Also consider joining our bi-weekly Saturday dev syncs. It'd be great to have you!

Maintainer checklist

Linfye commented 1 day ago

The creation process of the keyboard is implemented by a helper, and I haven't found a suitable way to pass the isCommandMode parameter. After modifying the isCommandMode value in SimpleKeyboardIME and recreating the keyboard, it seems that the parameter is reset, and I don't know how to solve this. Could you help me with this? Thanks! :) @andrewtavis

andrewtavis commented 1 day ago

CC also @angrezichatterbox as I'm at work atm :) I'll take a look tonight or over the weekend, @Linfye! Thank you!

angrezichatterbox commented 1 day ago

I am not sure we have any easy ways of passing the command boolean. However, I have another way in which we could do it. One method is to set a custom state within the keyboard. So for eg if we use the EditorInfo.IME_ACTION_UNSPECIFIED is the condition for setting the icon of the enter key to the Play Icon. Now there is the setEnterKeyColor function use it to set the mEnterKeyType as that specific type. Now create a function to set the enter key icon using this logic in MyKeyboard.kt and call this function after setting the mEnterKey type. You can use any custom type to do it.

I am happy to explain in more detail :)

Linfye commented 21 hours ago

I am not sure we have any easy ways of passing the command boolean. However, I have another way in which we could do it. One method is to set a custom state within the keyboard. So for eg if we use the EditorInfo.IME_ACTION_UNSPECIFIED is the condition for setting the icon of the enter key to the Play Icon. Now there is the setEnterKeyColor function use it to set the mEnterKeyType as that specific type. Now create a function to set the enter key icon using this logic in MyKeyboard.kt and call this function after setting the mEnterKey type. You can use any custom type to do it.

I had considered this method initially, but I thought that modifying the built-in state might not be a common practice in Android development (I'm not quite sure about this). Since you suggested it, I can give it a try. Thank you! :)

angrezichatterbox commented 20 hours ago

I am not sure we have any easy ways of passing the command boolean. However, I have another way in which we could do it. One method is to set a custom state within the keyboard. So for eg if we use the EditorInfo.IME_ACTION_UNSPECIFIED is the condition for setting the icon of the enter key to the Play Icon. Now there is the setEnterKeyColor function use it to set the mEnterKeyType as that specific type. Now create a function to set the enter key icon using this logic in MyKeyboard.kt and call this function after setting the mEnterKey type. You can use any custom type to do it.

I had considered this method initially, but I thought that modifying the built-in state might not be a common practice in Android development (I'm not quite sure about this). Since you suggested it, I can give it a try. Thank you! :)

You could also set a companion object as a new type and set the key type as that from the setEnterKeyColor function.