Android Open Source - o365api-android-get-events-app Event Item






From Project

Back to project page o365api-android-get-events-app.

License

The source code is released under:

MIT License

If you think the Android project o365api-android-get-events-app listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.mattleib.myinboxapplication;
// w  w  w  . j a va 2 s  .com
import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.Date;

/**
 * Created by mattleib on 1/26/2015.
 */
public class EventItem implements Serializable, Item {

    public DataTypes.ItemType isItemType() {
        return DataTypes.ItemType.event;
    }

    protected String Subject;
    protected String BodyPreview;
    protected String Start;
    protected String End;
    protected String Type;
    protected Organizer Organizer;
    protected Location Location;
    protected Boolean IsAllDay;
    protected Boolean IsCancelled;
    protected String Importance;
    protected String ShowAs;

    public String getSubject() {
        return Subject;
    }

    public void setSubject(String subject) {
        Subject = subject;
    }

    public String getBodyPreview() {
        return BodyPreview;
    }

    public void setBodyPreview(String bodyPreview) {
        BodyPreview = bodyPreview;
    }

    public String getStart() {
        return Start;
    }

    public void setStart(String start) {
        Start = start;
    }

    public String getEnd() {
        return End;
    }

    public void setEnd(String end) {
        End = end;
    }

    public String getType() {
        return Type;
    }

    public void setType(String type) {
        Type = type;
    }

    public Organizer getOrganizer() {
        return Organizer;
    }

    public void setOrganizer(Organizer organizer) {
        Organizer = organizer;
    }

    public Location getLocation() {
        return Location;
    }

    public void setLocation(Location location) {
        Location = location;
    }

    public Boolean getIsAllDay() {
        return IsAllDay;
    }

    public void setIsAllDay(Boolean isAllDay) {
        IsAllDay = isAllDay;
    }

    public Boolean getIsCancelled() {
        return IsCancelled;
    }

    public void setIsCancelled(Boolean isCancelled) {
        IsCancelled = isCancelled;
    }

    public String getImportance() {
        return Importance;
    }

    public void setImportance(String importance) {
        Importance = importance;
    }

    public String getShowAs() {
        return ShowAs;
    }

    public void setShowAs(String showAs) {
        ShowAs = showAs;
    }

    public EventItem(String subject, String bodyPreview, String start, String end, String type, com.example.mattleib.myinboxapplication.Organizer organizer, com.example.mattleib.myinboxapplication.Location location, Boolean isAllDay, Boolean isCancelled, String importance, String showAs) {
        Subject = subject;
        BodyPreview = bodyPreview;
        Start = start;
        End = end;
        Type = type;
        Organizer = organizer;
        Location = location;
        IsAllDay = isAllDay;
        IsCancelled = isCancelled;
        Importance = importance;
        ShowAs = showAs;
    }

     public EventItem(JSONObject event) throws JSONException {
        Subject = Helpers.TryGetJSONValue(event, "Subject");
        BodyPreview = Helpers.TryGetJSONValue(event, "BodyPreview");
        Start = Helpers.TryGetJSONValue(event, "Start");
        End = Helpers.TryGetJSONValue(event, "End");
        Type = Helpers.TryGetJSONValue(event, "Type");
        IsAllDay = Helpers.TryGetJSONValue(event, "IsAllDay") == "true" ? true : false;
        IsCancelled = Helpers.TryGetJSONValue(event, "IsCancelled") == "true" ? true : false;
        Importance = Helpers.TryGetJSONValue(event, "Importance");
        ShowAs = Helpers.TryGetJSONValue(event, "ShowAs");

        JSONObject objLocation = Helpers.TryGetJSONObject(event, "Location");
        if(objLocation == null){
            Location = null;
        } else {
            Location = new Location(Helpers.TryGetJSONValue(objLocation, "DisplayName"));
        }

        JSONObject objOrganizer = Helpers.TryGetJSONObject(event, "Organizer");
        if(objOrganizer == null){
            Organizer = null;
        } else {
            JSONObject objEmailAddress = Helpers.TryGetJSONObject(objOrganizer, "EmailAddress");
            EmailAddress email = new EmailAddress(
                    Helpers.TryGetJSONValue(objEmailAddress, "Address"),
                    Helpers.TryGetJSONValue(objEmailAddress, "Name")
            );
            Organizer = new Organizer(email);
        }
    }
}




Java Source Code List

com.example.mattleib.myinboxapplication.AppConfig.java
com.example.mattleib.myinboxapplication.AppHelper.java
com.example.mattleib.myinboxapplication.ApplicationTest.java
com.example.mattleib.myinboxapplication.Constants.java
com.example.mattleib.myinboxapplication.DataTypes.java
com.example.mattleib.myinboxapplication.EmailAddress.java
com.example.mattleib.myinboxapplication.EmptyItem.java
com.example.mattleib.myinboxapplication.EventItem.java
com.example.mattleib.myinboxapplication.EventItemsFragment.java
com.example.mattleib.myinboxapplication.Helpers.java
com.example.mattleib.myinboxapplication.InMemoryCacheStore.java
com.example.mattleib.myinboxapplication.Item.java
com.example.mattleib.myinboxapplication.LocalDateTimeConverter.java
com.example.mattleib.myinboxapplication.Location.java
com.example.mattleib.myinboxapplication.MainActivity.java
com.example.mattleib.myinboxapplication.Organizer.java
com.example.mattleib.myinboxapplication.PreferenceSetting.java
com.example.mattleib.myinboxapplication.PreferenceSettings.java
com.example.mattleib.myinboxapplication.SectionItem.java
com.example.mattleib.myinboxapplication.SettingsActivity.java
com.example.mattleib.myinboxapplication.SettingsFragment.java
com.example.mattleib.myinboxapplication.SimpleAlertDialog.java