// Path: app/src/main/java/com/yoga/oneweather/MyApplication.java
// public class MyApplication extends Application {
// 
//     private static Context context;
//     private static Gson mGson = new Gson();
// 
// 
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         context = getApplicationContext();
//         LitePal.initialize(context);
//         DBManager.getInstance().copyCitysToDB();
// 
// 
// 
//     }
// 
//     public static Gson getGson() {
//         return mGson;
//     }
// 
//     public static Context getContext() {
//         return context;
//     }
// }
// 
// Path: app/src/main/java/com/yoga/oneweather/model/entity/city/City.java
// public class City {
//     public String cityName;
//     @SerializedName("county")
//     public List<County> counties;
// }
// 
// Path: app/src/main/java/com/yoga/oneweather/model/entity/city/County.java
// public class County {
// 
//     public String countyName;
//     public String countyNo;
//     public String countyPY;
// }
// 
// Path: app/src/main/java/com/yoga/oneweather/model/entity/city/Province.java
// public class Province {
//     public String provinceName;
//     @SerializedName("city")
//     public List<City> cities;
// 
// 
// }
// 
// Path: app/src/main/java/com/yoga/oneweather/model/entity/weather/Weather.java
// public class Weather {
//     public String status;
//     public AQI aqi;
//     public Basic basic;
//     @SerializedName("daily_forecast")
//     public List<Forecast> forecastList;
//     public Now now;
//     public Suggestion suggestion;
// }


import com.google.gson.reflect.TypeToken;
import com.yoga.oneweather.MyApplication;
import com.yoga.oneweather.model.entity.city.City;
import com.yoga.oneweather.model.entity.city.County;
import com.yoga.oneweather.model.entity.city.Province;
import com.yoga.oneweather.model.entity.weather.Weather;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
package com.yoga.oneweather.util;




/**
 * Created by wyg on 2017/7/29.
 */

public class JSONHandleUtil {
    public static Weather handleWeatherResponse(String response){
        try {
            JSONObject jsonObject  = new JSONObject(response);
            JSONArray jsonArray = jsonObject.getJSONArray("HeWeather5");
            String weatherString = jsonArray.getJSONObject(0).toString();
            return MyApplication.getGson().fromJson(weatherString,Weather.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }


// Path: app/src/main/java/com/yoga/oneweather/MyApplication.java
// public class MyApplication extends Application {
// 
//     private static Context context;
//     private static Gson mGson = new Gson();
// 
// 
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         context = getApplicationContext();
//         LitePal.initialize(context);
//         DBManager.getInstance().copyCitysToDB();
// 
// 
// 
//     }
// 
//     public static Gson getGson() {
//         return mGson;
//     }
// 
//     public static Context getContext() {
//         return context;
//     }
// }
// 
// Path: app/src/main/java/com/yoga/oneweather/model/entity/city/City.java
// public class City {
//     public String cityName;
//     @SerializedName("county")
//     public List<County> counties;
// }
// 
// Path: app/src/main/java/com/yoga/oneweather/model/entity/city/County.java
// public class County {
// 
//     public String countyName;
//     public String countyNo;
//     public String countyPY;
// }
// 
// Path: app/src/main/java/com/yoga/oneweather/model/entity/city/Province.java
// public class Province {
//     public String provinceName;
//     @SerializedName("city")
//     public List<City> cities;
// 
// 
// }
// 
// Path: app/src/main/java/com/yoga/oneweather/model/entity/weather/Weather.java
// public class Weather {
//     public String status;
//     public AQI aqi;
//     public Basic basic;
//     @SerializedName("daily_forecast")
//     public List<Forecast> forecastList;
//     public Now now;
//     public Suggestion suggestion;
// }


// Path: app/src/main/java/com/yoga/oneweather/util/JSONHandleUtil.java
import com.google.gson.reflect.TypeToken;
import com.yoga.oneweather.MyApplication;
import com.yoga.oneweather.model.entity.city.City;
import com.yoga.oneweather.model.entity.city.County;
import com.yoga.oneweather.model.entity.city.Province;
import com.yoga.oneweather.model.entity.weather.Weather;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;

package com.yoga.oneweather.util;




/**
 * Created by wyg on 2017/7/29.
 */

public class JSONHandleUtil {
    public static Weather handleWeatherResponse(String response){
        try {
            JSONObject jsonObject  = new JSONObject(response);
            JSONArray jsonArray = jsonObject.getJSONArray("HeWeather5");
            String weatherString = jsonArray.getJSONObject(0).toString();
            return MyApplication.getGson().fromJson(weatherString,Weather.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }


    public static List<County> handleCitiesJSONData(String allCities){