Did anyone experimented with button shapes?

95 views
Skip to first unread message

Tomislav Tomšić

unread,
Sep 5, 2016, 8:09:12 PM9/5/16
to App Inventor Open Source Development
It occurred to me that having triangles, rhombuses, hexagons and arcs thrown in, and on them, and so on, might be appealing. I am experimenting along those lines, and I would be interested to hear other people experience and/or ideas on the subject.

In the attachment of this message one  will find a current code of ButtonBase.java I am currently using to try out various ideas.

Please note, code is raw, I do not recommend of implementing it as it is on your local instance, it is better to use some instance dedicated to developing.

Also, one should assume that code is connected with App Inventor platform as it is explained in documentation, meaning, read and implemented everything as it is written in how to change/add properties (etc) to visible components, which includes, but it is not limited to OdeMessages, MockButtonBase and so on.

Problems that I am having currently is that, frankly, beside using basic call-out to Android API, desired shapes are not drawn :(. It all settles to default rectangular shape. Clearly, I am missing something out.

If someone has an idea what are the mistakes I am making, I would be grateful to hear it.

Respectfully,
Tomislav Tomsic

ButtonBase.java

Jos Flores

unread,
Sep 6, 2016, 6:28:04 AM9/6/16
to app-inventor-open-source-dev
Hi there,

two questions:
1) Does the code work in a normal SDK app? Can you see the desired
shapes outside of App Inventor?

2) How are you testing this? If you are compiling this within App
Inventor, how do you trigger the shapes? If you haven't 'connected' it
to the designer, that is. Also, are you trying to see this in the
Companion? If so, are you using your own Companion? the one created
within the compilation process. Otherwise the stock Companion will not
have your code in it, and you won't be able to use it. Does that make
sense?

cheers,
José
> --
> You received this message because you are subscribed to the Google Groups
> "App Inventor Open Source Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to app-inventor-open-so...@googlegroups.com.
> To post to this group, send email to
> app-inventor-o...@googlegroups.com.
> Visit this group at
> https://groups.google.com/group/app-inventor-open-source-dev.
> For more options, visit https://groups.google.com/d/optout.

Tomislav Tomšić

unread,
Sep 7, 2016, 10:52:19 AM9/7/16
to App Inventor Open Source Development

Jose, I apologize I was not able to respond more promptly.

1) Yes that was omission on my part, now I realize. In my defense, I am a little hesitant to use usual Android development process (Android studio or Eclipse), after working with App Inventor. I guess, once you go visual...

In any case good call, I should correct that, and I'll post results here. I mean, mine simplistic assumption that Android's coordinate system is the same as the one used in Mathematics and elsewhere, with the one difference of preference, i.e. Android starts from fourth quadrant, while elsewhere is preferred first one, is most likely incorect.

2) As for developing/testing, I do, what I assume is the usual way. I dedicate git fork to certain problem, an then I develop/test etc. Since I am usually doing several things at once, I have no problem with waiting for compilation and so fort.

I apologize if I was unclear, of course that I connected everything with the rest of the App Inventor SDK, and then I made several iterations of test applications.
My warning was for those who might be interested in the subject, and assumed that all they need to do, is to copy/paste provided raw code on their local copy
of ButtonBase, and everything would work.

I do not tend to use my own companion when I am experimenting what idea, or approach, makes sense. After I establish that than I do some testings with the custom companion. It simply seems inconsiderate to me to offer a code that is not properly checked and tested in all possible, that I know of, use cases.

Yes, everything you wrote is as understandable and straightforward as I could hope it would be. On the other hand, I apologize if my writing here doesn't deserve the same epithet. As one can easily guess from my name, I am not a native English speaker, and thanks to Central European literary traditions, my sentences tend to be unnecessary lengthy, thus appearing convoluted, at times even incongruent, instead of being clear and understandable.

I guess, greatest transgressor in that regard, that I can think of, would be Miroslav Krleza, to convey a proper meaning often he would use up to five languages in his works. There is an old aphorism here in Croatia, that he was the only man in history able to write a readable 500-pages long book, using only seven or eight sentences, but I digress.

When I use for example, drawable.setShape(new ArcShape(some_angle,some_sweepingAngle)); in setShape method of ButtonBase class, or any other similar call to underlying Android platform, like having more rounded button corners, or even asymmetrically rounded, everything is fine, and result is precisely as desired.

However, if I use a case statement for calling a method where I am playing with Path and/or PathShape objects, I end up with a default-looking button, so I thought maybe someone else here already faced similar problems, and solved them, and would be willing to share those insights.

Greetings,
Tomislav Tomsic

Jos Flores

unread,
Sep 7, 2016, 12:58:56 PM9/7/16
to app-inventor-open-source-dev
Hi there, no worries at all; I am not a native English speaker either,
as many others in this community.

I understand that it is hard to go back to Android Studio after using
AI, but If you are doing component development, it is a lot easier to
use the SDK to figure out what you want to build, and then translate
that into a component. It's also a lot faster, as you could use
debugging points to figure out why that case statement is misbehaving.
But that's obviously up to you; whatever works best for you.

cheers,
José

Jeff Mezzanotte

unread,
Sep 22, 2016, 7:26:57 AM9/22/16
to App Inventor Open Source Development

I built a fully functional LCARS layout via canvas and non colored ball collisions rather than buttons and button clicks.

Jeff Mezzanotte

unread,
Sep 22, 2016, 7:33:37 AM9/22/16
to App Inventor Open Source Development
Also see my Thunkable tutorial for oddly shaped UI here 
https://drive.google.com/open?id=0B0aJ_7pXV1-EMVpTNnFrY1l3WW8

On Monday, September 5, 2016 at 8:09:12 PM UTC-4, Tomislav Tomšić wrote:

Tomislav Tomšić

unread,
Jan 19, 2017, 12:15:50 PM1/19/17
to app-inventor-o...@googlegroups.com
Jeff, thank you very much for sharing your tutorial, quite informative and useful, and I am not using those words lightly. Also, thank you very much for getting my attention to Thunkable platform.

Incidentally, I apologize for my late response, workload being what it is... :)

--
You received this message because you are subscribed to a topic in the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/app-inventor-open-source-dev/TOi6FvP145Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-open-source-dev@googlegroups.com.



--
Tomislav Tomsic
Reply all
Reply to author
Forward
0 new messages