Monday, August 24, 2015

The End of Summer

  I'm sad to say that the summer is goes to the end... yes, everyone knows that (or don't you?). But this means also that my internship in moVirt project is goes to the end too. And I'm really sad, that I can't continue working with this project. I'd love to list it as my full time job, but now I have to find something new and I'm eager to learn new technologies to work with.
  I'm happy that I chose moVirt among Outreachy projects. For the first time I thought that I can pretend only for some PHP project, maybe with JavaScript, because it was the most familiar for me at that moment. But I thought it could be the most boring thing, and I saw moVirt - Android project on Java. I also had Java experience but never in context of Android development. In fact I also had never touch real android phone or tablet. As later my mentor will say in sarcasm that this is good prerequisites for android development :) But I decided that I could learn Android development in one day.
Pic. 1. I know Android.

  Well, it was not really a one day, I've spent a half of week to read 101 basis and I've been learning new concepts of Android development in depth constantly through the whole internship. And this is the best part, when you can learn while work, and moVirt is complex project which doesn't ends on android, it also includes some technologies that I also learned, for example client-server pattern. REST API, database querying, etc. Also I have installed Linux for the first time, and now I'm not hating git :)

  Actually I may continue contributing to moVirt project after internship, because it's open-source project, and I have some plans, but it would be possible only as a volunteer. And thanks to Outreachy I think I have much more chance to find a new job that I want because of all that experience I gained during this summer.

Thursday, August 6, 2015

Google Play release!

  Since the previous 0.2beta release only one week passed by and suddenly we now have 1.0 version which is released on Google Play Store!

  This week was quite intensive even our mentor now actively contributes, not just code reviewing. My main feature for 1.0 version was to add support for Migrate VM action. This task includes new concepts of moVirt that I've still been not familiar with - which one is REST API.

  REST is used to perform communication between server and clients (oVirt and moVirt in this case). Briefly, you can post data or actions from client to add or perform them on server; or acquire for entities, stored on the server. At that point moVirt already had some actions like: start, stop, reboot VM, etc. My task was simply to extend current interface with one new action. But migration was a bit more complex, because it has options inside Action entity where you can set the destination host to migrate VM, or leave it empty to migrate to default host. After spending some time learning about REST and JSON, I've made new class that extends empty Action with destination host option, and it looks simply like this:
@JsonIgnoreProperties(ignoreUnknown = true)
public class ActionMigrate extends Action {

    public Host host;

    public ActionMigrate(String hostId) {
        host = new Host(); = hostId;
   After REST part has been made we need UI to run it. Important part is to show user the list of available hosts to choose. And because I'm not experienced user of Android, I've been thinking in concept that such choices made through dialogue windows. And I've started to read guides about dialogues in Android. I found that AlertDialogue may perfectly fit the requirements, because it supports lists with items to choose which are loaded from database. And after I finally made clean and reliably class to show this dialogue, we found that list doesn't support scrolling so only first 4 items shows! I haven't seen any warning in SDK documentations and guides that this dialogue shows only first 4 items. What a shame...
  There was several ways to fix this, but I decided to transform from dialogue to activity, and set layout from scratch, and as a result it now looks even better.
Pic. 1. Migrate VM activity.