Example usage for android.util JsonWriter name

List of usage examples for android.util JsonWriter name

Introduction

In this page you can find the example usage for android.util JsonWriter name.

Prototype

public JsonWriter name(String name) throws IOException 

Source Link

Document

Encodes the property name.

Usage

From source file:com.fuzz.android.limelight.util.JSONTool.java

/**
 * @param writer//w w w. j  a  v a 2 s.co m
 * @param book the Book object to be written in JSON
 * @throws IOException
 */
public static void writeBook(JsonWriter writer, Book book) throws IOException {
    writer.beginObject();
    writer.name("title").value(book.getTitle());
    writer.name("font").value(book.getFontName());
    writer.name("package").value(book.getPackage());
    if (book.getChapters() != null) {
        writer.name("chapters");
        writeChapterArray(writer, book.getChapters());
    } else {
        writer.name("chapters").nullValue();
    }
    writer.endObject();
}

From source file:com.fuzz.android.limelight.util.JSONTool.java

/**
 * @param writer//from  ww  w. ja v a2 s  . c om
 * @param act the act object to be written into JSON
 * @throws IOException
 */
public static void writeAct(JsonWriter writer, Act act) throws IOException {
    writer.beginObject();
    writer.name("id").value(act.getAnchorViewID());
    writer.name("message").value(act.getMessage());
    writer.name("message_res_id").value(act.getMessageResID());
    writer.name("graphic_res_id").value(act.getGraphicResID());
    writer.name("is_action_bar_item").value(act.isInActionBar());
    writer.name("x_offset").value(act.getWidthRatio());
    writer.name("y_offset").value(act.getHeightRatio());
    writer.name("text_color").value(act.getTextColor());
    writer.name("text_background_color").value(act.getTextBackgroundColor());
    writer.name("text_size").value(act.getTextSize());
    writer.name("text_background_transparent").value(act.hasTransparentBackground());
    writer.name("animation").value(act.getAnimation());
    writer.name("activity_name").value(act.getActivityName());
    writer.endObject();
}

From source file:com.fuzz.android.limelight.util.JSONTool.java

/**
 * @param writer//from www  .ja v  a2 s.c  o m
 * @param chapter the BaseChapter object to be written in JSON
 * @throws IOException
 */
public static void writeChapter(JsonWriter writer, BaseChapter chapter) throws IOException {
    writer.beginObject();
    writer.name("type").value("chapter");
    writer.name("duration").value(chapter.getTime());
    writer.name("has_act_view").value(chapter.hasActView());
    writer.name("act");
    writeAct(writer, chapter.getAct());
    writer.endObject();
}

From source file:com.fuzz.android.limelight.util.JSONTool.java

/**
 * @param writer// ww w  .j av a2s.  c o m
 * @param transition the ChapterTransition object to be written in JSON
 * @throws IOException
 */
public static void writeTransition(JsonWriter writer, ChapterTransition transition) throws IOException {
    writer.beginObject();
    writer.name("type").value("transition");
    writer.name("time").value(transition.getTime());
    writer.name("item_position").value(transition.getItemPosition());
    writer.name("child_id").value(transition.getChildID());
    writer.name("id").value(transition.getAnchorViewID());
    writer.name("message").value(transition.getMessage());
    writer.name("message_res_id").value(transition.getMessageResID());
    writer.name("graphic_res_id").value(transition.getGraphicResID());
    writer.name("is_action_bar_item").value(transition.isInActionBar());
    writer.name("x_offset").value(transition.getWidthRatio());
    writer.name("y_offset").value(transition.getHeightRatio());
    writer.name("text_color").value(transition.getTextColor());
    writer.name("text_background_color").value(transition.getTextBackgroundColor());
    writer.name("text_size").value(transition.getTextSize());
    writer.name("text_background_transparent").value(transition.hasTransparentBackground());
    writer.name("animation").value(transition.getAnimation());
    writer.endObject();
}

From source file:at.ac.tuwien.caa.docscan.logic.DataLog.java

private void writeGPS(JsonWriter writer, GPS gps) throws IOException {

    writer.beginObject();//from  w  w w.  j ava 2 s .  com
    writer.name(GPS_LONGITUDE_NAME).value(gps.getLongitude());
    writer.name(GPS_LATITUDE_NAME).value(gps.getLatitude());
    writer.endObject();

}

From source file:at.ac.tuwien.caa.docscan.logic.DataLog.java

private void writeShotLog(JsonWriter writer, ShotLog shotLog) throws IOException {

    writer.beginObject();//  w w  w .  j a  v a  2 s  .c  o  m

    //        file naem:
    String fileName = shotLog.getFileName();
    writer.name(FILE_NAME).value(fileName);

    //        time stamp:
    String date = date2String(shotLog.getDate());
    writer.name(DATE_NAME).value(date);

    //        location:
    if (shotLog.getGPS() != null) {
        writer.name(GPS_NAME);
        writeGPS(writer, shotLog.getGPS());
    } else
        writer.name(GPS_NAME).nullValue();

    //        series mode:
    writer.name(SERIES_MODE_NAME).value(shotLog.isSeriesMode());

    writer.endObject();

}

From source file:ngo.music.soundcloudplayer.controller.SongController.java

private void writePlayedSongs(Song playingSong, ArrayList<Song> queue, JsonWriter jsonWriter, long currentTIme)
        throws IOException {
    // TODO Auto-generated method stub

    jsonWriter.beginArray();// ww  w .j a va  2 s  . c om
    for (Song song : queue) {
        jsonWriter.beginObject();
        jsonWriter.name(song.getId());
        if (playingSong.getId().equals(song.getId())) {
            jsonWriter.value(currentTIme);
        } else {
            jsonWriter.value(0);
        }
        jsonWriter.endObject();

    }
    jsonWriter.endArray();
}