Android Open Source - homeless-nyc services Manager






From Project

Back to project page homeless-nyc.

License

The source code is released under:

GNU General Public License

If you think the Android project homeless-nyc 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 io.rasmi.homelessnyc;
/*w ww  .ja v a 2  s .co  m*/
import java.util.ArrayList;

import android.content.Context;
import android.util.Log;

public class servicesManager {
  private static final String TAG = "servicesManager";
  private static servicesManager ServicesManager;
  private Context mAppContext;
  private JSONParser parser;
  
  private ArrayList<service> resources;
  private ArrayList<service> community;
  
  private servicesManager(Context appContext) {
    mAppContext = appContext;
    parser = new JSONParser(mAppContext);
    try {
      resources = parser.loadServices("resources");
      community = parser.loadServices("community");
    } catch (Exception e) {
      resources = new ArrayList<service>();
      community = new ArrayList<service>();
      Log.e(TAG, "Error loading services from JSON file.");
    }
  }
  
  public static servicesManager get(Context context) {
    if (ServicesManager == null) {
      ServicesManager = new servicesManager(context.getApplicationContext());
    }
    
    return ServicesManager;
  }
  
  public ArrayList<service> getServices(String type) {
    if ("resources".equals(type)) return resources;
    else if ("community".equals(type)) return community;
    else return null;
  }
  
  /*
  public service getService(String id) {
    for (service s : services) {
      if (s.id.equals(id))
        return s;
    }
    return null;
  }
  */
}




Java Source Code List

io.rasmi.homelessnyc.JSONParser.java
io.rasmi.homelessnyc.MainActivity.java
io.rasmi.homelessnyc.MapActivity.java
io.rasmi.homelessnyc.facilitiesManager.java
io.rasmi.homelessnyc.facilityInfo.java
io.rasmi.homelessnyc.facility.java
io.rasmi.homelessnyc.faq.java
io.rasmi.homelessnyc.reportActivity.java
io.rasmi.homelessnyc.serviceInfo.java
io.rasmi.homelessnyc.serviceList.java
io.rasmi.homelessnyc.service.java
io.rasmi.homelessnyc.servicesManager.java
io.rasmi.homelessnyc.webAction.java