Monthly Archives: November 2016

Update ‘Hier of Daar?’ – Using Custom View Group

As described in my last post, I’m working on an Android app that uses open data. For those interested in Android development, I’d like to share how I tackled a layout challenge I had. If fixed it in the latest update of the app ‘Hier of Daar?’  v1.10. Get it at Google Play.

The layout challenge

Screenshot_1479680411

This screen is built out of multiple layers, where the white icons are on top of the blue-purple swirl. In order to place these icons on the correct spot and with the correct size, this was not really do-able with normal layout options in Android.

First solution; For one device only

To save time I side stepped the problem by only making it look ok for the Nexus 7 (2013). This allowed me to create a video of the app showing the jury how the app works. It’s somewhat acceptable, since the app is a proof of concept.

The big disadvantage being that hardly anyone can try out the app and give feedback without being distracted by how ugly it looks on their device..

Second solution: Custom View Groups

A View Group is a way to group different views. In other words; a layout. For instance, you can make use of LinearLayout or RelativeLayout. A custom View Group does the same thing; it tells the layout where to place the views and how to deal with resizing, etc.

While the custom view groups ( and compound views) still have many secrets for me, it was clear that I could create one that would solve my problem. So after reading some documentation and watching some videos I gave it a go.

Now I have one Swirl class that extends the ViewGroup and only has real code in the onLayout method. Here I place all the views and tell them what their position and size should be by providing a coordinate for their left, top, right, bottom. All values are relative to the size of the total view group.  What’s neat is that once you have the custom view group it will show in Android Studio as it would in the app.

AndroidStudio

The screenshot at the beginning of the post was of the Nexus 7, this next screenshot is of an emulator with a 480 x 800 px resolution and an older version of Android.

Screenshot_1479681603

Up next

There is much that could be improved, for instance a back button would be nice, or making users aware that these white icons can be clicked, etc. But within the existing design, this solution worked and I’m happy with the improvement.

It would be nice to look more into custom views and see what could be improved based on that. Also, while I was researching I came across a video that explained how you can make a custom view that allows users to doodle. That could be nice to incorporate in my Idea Growr app.

 

Proof of concept for Hacking For Sustainability competition

I’m working on a project with Laura for Hacking for Sustainability.:
http://www.hackingforsustainability.nl

I’m doing development, she does design, we’re both responsible for concept.
You can find the proof of concept app here:
https://play.google.com/store/apps/details?id=com.juliushuijnk.tools.hierofdaar

Because of this project, and a different project that resulted in 0 year old who’s living with us, all other projects are on pause for now.

What the project is about

The game tries to let kids explore open data in a way that makes sense to them. No maps, coordinates, tables or graphs. Instead it’s based on pictures of specific iconic locations, supported by audio and a simple question: “Here or there?”

With this app we like to show how open data can be used to create simple fun games, where teachers and parents can expand on the game content by simply adding pictures and audio and selecting a postal code.

The app comes with a single data set, but can be easily expanded on with many more in future versions. We see this as a potential international platform where lot’s of games and experiences can be played, customized and shared.

For now, it is a bit rough around the edges and very much a work in progress.  We made it specifically for the Nexus 7 (2013) in landscape.

Why

We see that there is a huge amount of open data, and it’s not really finding it’s way to a lot of people in experiences they care about. So we want to bridge that gap by proving this platform.

As small and simple as possible

(Video is slightly old compared to state of app)

Obviously the app is for from the platform we have in mind. It’s a good example of starting with something as small and simple as possible. One data set, one super simple game, one way to play, etc.  The point is to make it easy for people to imagine that such a platform can exist and trigger ideas how this best should be done.

At the same time, we have something concrete we we can receive feedback on and improve, while learning. Also it fits nicely with my personal goals.

From a tech perspective

It’s a simple Android app. I wanted to use simple csv files for the data sets, that then load into the database. It made take a deeper look at different ORM’s.

How to lay out the views

At the moment I’m doing the layout with the new constraint-layout.

It doesn’t feel ready to be included in the stable release of Android Studio. Also it’s hardly documented. For instance try to figure out how to put a rules in the horizontal center of the layout. I’ll write the spoiler, because it doesn’t really say:

The design Laura made was not so conventional, so it made me look into custom view groups. For now I’m not using those, but it’s clear that this is right path forward if the proof of concept needs to look good on more than one device.

Later more..