thaliproject / postcardapp

A sample app to demonstrate how to build Thali applications
MIT License
22 stars 5 forks source link

Getting the ability to submit the postcard using the keyboard #72

Closed yaronyg closed 8 years ago

yaronyg commented 8 years ago

Right now you have to type with the keyboard but when you want to submit the postcard you have to hit a check mark in the upper right hand corner. No native app works this way because they add a key to the keyboard and so the experience is really quite jarring for people used to native apps.

What happens when I run the postcard app as a Cordova plugin on UWP? If there is no onscreen keyboard (such as desktop) then what will occur?

deadlyfingers commented 8 years ago

Look at Cordova plugin to add a done button. When editing mutli-line text the return key is for a new line and it would be nicer UX to have a keyboard 'Done' button to save changes to postcard.

deadlyfingers commented 8 years ago

This is handled by the 'inputAccessoryView' for iOS: http://stackoverflow.com/questions/12188137/how-to-add-a-done-button-to-ios-keyboard-webview-phonegap-cordova What I didn't notice is that Cordova has included this "Done" button in the inputAccessoryView for iOS already.

For Android the 'done' button could be added using android:imeOptions="actionDone" although this may not work with multiline editor. http://stackoverflow.com/questions/2986387/multi-line-edittext-with-done-action-button

Alternatively the other option is to replace the multi-line editing 'textarea' with a single line input field to have the 'done' button back on Android soft keyboard. However in Postcard now I can also attach a photo so I might not want the return key to 'save' the postcard as I might want to capture a photo as well.

But if we can put a custom input view above soft keyboard with a 'Save' button it might be worth looking into creating a new Cordova plugin to target Android, iOS and Windows.

deadlyfingers commented 8 years ago

@yaronyg should we spin this out as a separate Cordova plugin in Thali project? Once that's done we can add the plugin into Postcard app.

yaronyg commented 8 years ago

I think we want to still have a carriage return key and per your comment on the call we want to have a 'save' button versus a 'done' button.

The link for iOS seems to argue that we can either add a button on the top of the keyboard or rename an existing key and that this can be done via config. Not sure if that is worth its own plugin.

The second link seems to argue that we can either have return or done but not both and I'm pretty sure we want return (although it's not the end of the world if we can't have it). So is your plan to get rid of return and replace it with done? What happened to send?

I also checked for Cordova plugins that handled keyboards and I can't say that I found anything particularly interesting. So what is the plan, to write native code?

deadlyfingers commented 8 years ago

Will give it a think over. So the standard keyboard plugin only gives 'next', 'prev' and 'done' options for iOS - https://github.com/apache/cordova-plugins/tree/master/keyboard Ideally I would like to add a 'Save' button to have it dismiss the keyboard and trigger a save. As for the config option for iOS this may refer to creating custom keyboards for apps rather than customising the inputAccessoryView? Android will require further investigation.

yaronyg commented 8 years ago

Maybe for now we just stick in a save area instead of the check mark? It took me a bit to recognize that the checkmark meant save. It wasn't intuitive for me.

deadlyfingers commented 8 years ago

Yes 'Save' text at top right is quite common (with iOS at least) and a faster fix for now.