EmmanuelPil / Android-java-code-utilities-widgets-for-Processing-for-Android

Android code for Processing for Android
16 stars 9 forks source link

Request: Multiline edit #2

Open uheinema opened 4 years ago

uheinema commented 4 years ago

As a Dialog or (better!) as a (transparent) overlay of your sketch display.

Great stuff!

Lots of tnx

Your brother in APDE.

EmmanuelPil commented 4 years ago

Ok, I thought I had posted something like that already. I´ll have to finish my current project first though. Since Google+ shut down on April 2nd, 2019, the then-existing forum ended. Wouldn't you like to open a new forum at Google forums like this one? Just for specific APDE related stuff? I didn't do it myself already because I don't know how much time I still have. BTW You can find me on P4A forum here.

uheinema commented 4 years ago

Thanks for pointing me there! Isn't the Processing forum the right place for this? Though I don't like the UI there very much. Keep it up!

EmmanuelPil commented 4 years ago

I've added the Edit Text box. You can combine other views like buttons, textViews etc. Just add them to the the layout, like "fl.addView(myButton);" The order in which you set them is important because they "float" above each other. All of them must have an unique id number to be called in the sketch within a runnable. If it is working for you, please comment on which android mode.

uheinema commented 4 years ago

Well, not too bad. Last line is buggy?? And superflous. Height way too small, increased:

Screenshot_20200605_235332_com calsignlabs apde sketchpreview Likes to be vertical centered, no scollbar... But a place to start, context menu works, input ok. Maybe it will become a reasonable "Notepad" with some effort.

So I thought, noting the View.OnKeyListener:

Ok, forget the display, maybe I can finally capture soft input this way - eg. Ä, when typed on screen.

But alas, the same as with all other methods i tried (overloading onkey..., dispatcher, what else...), different soft keyboards.. All with the same result: There simply is no event/call ... happening. All work with hardware (Blietooth) keyboards and on Ascii chars. No clue...and I'm not alone. From https://stackoverflow.com/questions/5419766/how-to-capture-soft-keyboard-input-in-a-view/7386854

Turns out that I did in fact need to subclass TextView and the use addTextChangedListener() to add my own implementation of TextWatcher in order to listen to soft key events. I couldn't find a way to do this with a plain old View.

uheinema commented 4 years ago

And so speaks Android Developers:

Key presses in software keyboards will generally NOT trigger this listener, although some may elect to do so in some situations. Do not rely on this to catch software key presses.

Of course afaik nowhere is explained HOW to catch software keypresses...

uheinema commented 4 years ago

So after some tinkering, this

https://github.com/uheinema/BoxDrop-Example/blob/master/Editfield/multiline.pde

is almost all I need.

Tnx, Best regards

PS: If you like fancy buttons, I do them in a GLSL fragment shader...but that's another story.

uheinema commented 4 years ago

Hi again.

After some tinkering, it doesnt look too bad:

See

https://github.com/uheinema/BoxDrop-Example/blob/master/README.md