Android Open Source - AndroidForiOS Prediction






From Project

Back to project page AndroidForiOS.

License

The source code is released under:

MIT License

If you think the Android project AndroidForiOS 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.androidforios.app.data.model;
//ww  w.  j a  va  2 s.co m
import android.os.Parcel;
import android.os.Parcelable;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.Date;

/**
 * Created by stephen.barnes on 3/21/14.
 */
public class Prediction implements Parcelable{

    public String stopId;
    public String stopName;
    public Integer stopSeconds;

    public Prediction() {}

    public Prediction(JSONObject jsonData) {
        this.importDataFromJSON(jsonData);
    }

    public void importDataFromJSON(JSONObject jsonData) {
        try {
            this.stopId = jsonData.getString("StopID");
            this.stopName = jsonData.getString("Stop");
            this.stopSeconds = jsonData.getInt("Seconds");
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public static Creator<Prediction> CREATOR = new Creator<Prediction>() {
        @Override
        public Prediction[] newArray(int size) {
            return new Prediction[size];
        }

        @Override
        public Prediction createFromParcel(Parcel source) {
            Prediction prediction = new Prediction();
            prediction.stopId = source.readString();
            prediction.stopName = source.readString();
            prediction.stopSeconds = source.readInt();
            return prediction;
        }
    };

    @Override
    public int describeContents() {
        return super.hashCode();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(stopId);
        dest.writeString(stopName);
        dest.writeInt(stopSeconds);
    }
}




Java Source Code List

com.example.androidforios.app.activities.MainActivity.java
com.example.androidforios.app.activities.TripDetailActivity.java
com.example.androidforios.app.activities.TripListActivity.java
com.example.androidforios.app.adapters.LineTypeArrayAdapter.java
com.example.androidforios.app.adapters.PredictionArrayAdapter.java
com.example.androidforios.app.adapters.TripArrayAdapter.java
com.example.androidforios.app.data.managers.DataManager.java
com.example.androidforios.app.data.model.Prediction.java
com.example.androidforios.app.data.model.TripList.java
com.example.androidforios.app.data.model.Trip.java
com.example.androidforios.app.fragments.SubwayListFragment.java
com.example.androidforios.app.fragments.TripDetailFragment.java
com.example.androidforios.app.fragments.TripListFragment.java
com.example.androidforios.app.views.TripDetailsView.java