Search in sources :

Example 11 with ServerSentBus

use of cl.smartcities.isci.transportinspector.model.gson.ServerSentBus in project androidApp by InspectorIncognito.

the class BusSelectionDialog method setBusMap.

/**
 * Creates a hashMap using a list of buses. This hashMap needed for the adapter.
 */
private void setBusMap(ArrayList<ServerSentBus> busList) {
    this.busMap = new HashMap<>();
    for (ServerSentBus bus : busList) {
        String service = bus.getService();
        // If the map does not contain the service
        if (!this.busMap.containsKey(service)) {
            ArrayList<ServerSentBus> sameServiceBusList = new ArrayList<>();
            sameServiceBusList.add(bus);
            this.busMap.put(service, sameServiceBusList);
        } else {
            ArrayList<ServerSentBus> sameServiceBusList = this.busMap.get(service);
            sameServiceBusList.add(bus);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) ServerSentBus(cl.smartcities.isci.transportinspector.model.gson.ServerSentBus)

Aggregations

ServerSentBus (cl.smartcities.isci.transportinspector.model.gson.ServerSentBus)11 Feature (com.mapbox.services.commons.geojson.Feature)4 ArrayList (java.util.ArrayList)4 View (android.view.View)3 TextView (android.widget.TextView)3 ImageView (android.widget.ImageView)2 BusMarker (cl.smartcities.isci.transportinspector.map.model.bus.BusMarker)2 AlertDialog (android.app.AlertDialog)1 Bitmap (android.graphics.Bitmap)1 Typeface (android.graphics.Typeface)1 Drawable (android.graphics.drawable.Drawable)1 Bundle (android.os.Bundle)1 NonNull (android.support.annotation.NonNull)1 AppCompatImageView (android.support.v7.widget.AppCompatImageView)1 LayoutInflater (android.view.LayoutInflater)1 InputMethodManager (android.view.inputmethod.InputMethodManager)1 Button (android.widget.Button)1 EditText (android.widget.EditText)1 LinearLayout (android.widget.LinearLayout)1 ListView (android.widget.ListView)1