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:
@JsonRootName("action")
@JsonIgnoreProperties(ignoreUnknown = true)
public class ActionMigrate extends Action {

    public Host host;

    public ActionMigrate(String hostId) {
        host = new Host();
        host.id = 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.

2 comments:

  1. Cool! So you are programming natively on android right? Any plans porting it to other OSes in the future?

    ReplyDelete
  2. Yes, it's currently android only. But there is a chance porting to iOS if more people will request.

    ReplyDelete