Scribe-Android icon indicating copy to clipboard operation
Scribe-Android copied to clipboard

Add invalid state to keyboard commands and show localized `Not in Wikidata`

Open andrewtavis opened this issue 11 months ago • 9 comments

Terms

Description

This issue would add the invalid input functionality to Scribe-Android keyboards. In Scribe-iOS, when a user tries to execute a command on a word that's not a valid value in the given database, the localized version of the string Not in Wikidata is displayed to the user on the command bar.

  • Note that this issue is blocked by either #272 or #266

A screenshot of this in Scribe-iOS is seen below:

Simulator Screenshot - iPhone 16 Pro - 2024-12-15 at 19 26 25

The functionality is:

  • The user selects the Scribe key
  • The user selects a command like Plural that will be made in #272 or Translate in #266
  • The user enters a word that's not in the given nouns or translations tables like ANY_BUNCH_OF_RANDOM_LETTERS
  • The user hits the enter (return) key to execute the command
  • The command bar shows Not in Wikidata in the keyboard language
    • The current keyboard state is invalid
    • The Scribe key is returned to it's base state so that the command can be tried again
    • If the user starts typing again, then the command bar disappears and autocompletions are shown (i.e. keyboard state is idle)

[!NOTE] The invalid state messages can be found in the interface files in the language directories of app/src/main/java/be/scri/helpers.

Contribution

Happy to discuss this and review when a PR is open! 🚀

andrewtavis avatar Dec 15 '24 18:12 andrewtavis

@andrewtavis I would like to take this one. Also if possible, could you share the video of how it works in the iOS, that would make the things more clear 🙂

smalik2811 avatar Feb 05 '25 15:02 smalik2811

Thanks for your willingness to work on this, @smalik2811! Here's a video for how it works in iOS, as requested 😊

https://github.com/user-attachments/assets/ba9cbbfb-3bec-4384-a2f8-a8ce23190b44

Please let us know if there are further questions!

andrewtavis avatar Feb 05 '25 18:02 andrewtavis

Thankyou for the video. Also I would like to clarify what happens when the user clicks the Scribe key in the Invalid state? Does it switch back to the Idle mode?

smalik2811 avatar Feb 06 '25 05:02 smalik2811

In file state the Scribe key will result in the command options being shown :) So when the "Not in Wikidata" message is shown, then the user can press the Scribe key to see the commands and maybe retry the one that didn't work.

andrewtavis avatar Feb 06 '25 08:02 andrewtavis

Hello @andrewtavis, I have been working on the Invalid State and I have managed to get the current functionality by hiding the views from the command bar. However that's not enough I would also have to update the background drawable of the scribe key and restore it when the the keyboard exits the invalid state which makes the logic little complicated and does not follow SOLID principles.

I was wondering if we could create a seperate layout file for the Invalid state that would make the logic more clean and easy to maintain. What do you recommend?

Additionally, could you also share the colors that should be used for the info icon in the invalid state for both the light and dark mode.

https://github.com/user-attachments/assets/b1b3dba1-eb62-4c2a-9c99-b98998c40e59

smalik2811 avatar Feb 20 '25 04:02 smalik2811

Thanks for the great work here as always, @smalik2811!

I was wondering if we could create a seperate layout file for the Invalid state that would make the logic more clean and easy to maintain. What do you recommend?

I think a separate layout file for the invalid state would be great :) Feel free to go in that direction! 🚀

Additionally, could you also share the colors that should be used for the info icon in the invalid state for both the light and dark mode.

The color we use for this is the same as the placeholder text for the command bar - commandBarPlaceholderColor in iOS:

  • Light mode: #8A8A92
  • Dark mode: #777777

Let me know if there's anything else I can do to help!

andrewtavis avatar Feb 20 '25 16:02 andrewtavis

Hey @smalik2811 👋 Quick check in here to see if there's anything we can do to support on this issue :) Hope all's well with you! 😊

andrewtavis avatar Mar 08 '25 15:03 andrewtavis

Hi @andrewtavis ,

Thank you for checking in! I appreciate you reaching out. I've been engaged with some other tasks recently, and unfortunately, I won't be able to contribute to this particular issue at this time. Therefore, I'd like to remove myself from this issue.

I'm still very interested in contributing to the project in the future, and I'll keep an eye out for other opportunities.

Thanks again for your understanding.

smalik2811 avatar Mar 09 '25 08:03 smalik2811

Totally fine, @smalik2811! We hope to see you in the future :)

andrewtavis avatar Mar 09 '25 09:03 andrewtavis

Hi, @andrewtavis! Can I give it a try on this one? Seems like an interesting feature

linreal avatar May 14 '25 06:05 linreal

Assigned @linreal . Please do ask in case of any queries. Happy to help :)

angrezichatterbox avatar May 14 '25 07:05 angrezichatterbox

@andrewtavis @angrezichatterbox PR is ready, looking forward for your review

linreal avatar May 20 '25 07:05 linreal

Looking forward to the review, @linreal! 😊

andrewtavis avatar May 20 '25 07:05 andrewtavis

Closed by #401 🚀 Heading over to #274 to unblock it 😊😊

andrewtavis avatar May 21 '25 09:05 andrewtavis

hey @andrewtavis @linreal, I'm about to work on #274 but I can't seem to trigger the invalid state. Can you help showing me how to do so? Thank you.

catreedle avatar Jul 07 '25 10:07 catreedle

hey @andrewtavis @linreal, I'm about to work on #274 but I can't seem to trigger the invalid state. Can you help showing me how to do so? Thank you.

hey, @catreedle! Just hit scribe key, select "Plural" command, type random letters and press Enter key

linreal avatar Jul 07 '25 11:07 linreal

https://github.com/user-attachments/assets/c71a3443-b56d-4bbe-a3d9-6a2abc81cecb

hey @linreal . Thank you! I tried it on my emulator, but I can't trigger it. this is already merged to main, right?

catreedle avatar Jul 07 '25 11:07 catreedle

hey @linreal . Thank you! I tried it on my emulator, but I can't trigger it. this is already merged to main, right?

yes, it's in main and I can not reproduce behavior from your video on a real device :( seems it deserves a separate issue, @andrewtavis fyi

linreal avatar Jul 07 '25 12:07 linreal

Thanks for the discussion here! What emulator are you using, @catreedle? Maybe best to clear the Android Studio cash and reset it as much as possible to then see if the behavior improves?

andrewtavis avatar Jul 07 '25 15:07 andrewtavis

I am using Pixel API 35 @andrewtavis . Have tried rebuilding the app, but same behavior. been trying to set up using a physical device with no success. 😅 any suggestion on which emulator to use?

catreedle avatar Jul 08 '25 10:07 catreedle

Maybe we can open an issue for this then, @catreedle :) Could you do that and then we can investigate with the larger group?

andrewtavis avatar Jul 08 '25 10:07 andrewtavis

ok @andrewtavis, on it 😊

catreedle avatar Jul 08 '25 10:07 catreedle