public class MyApplication extends Application{

    private static MyApplication mcontext;
    public static DaoMaster daoMaster;
    public static DaoSession daoSession;
    public static LocationClient mLocationClient;


    private static final String cityUrl = "https://free-api.heweather.com/";
    private static final String heweatherKey = "93d476b872724a9681a642dce28c6523";

    public static final String shareFilename1 ="nightMode";
    public static final String shareFilename2 ="nightMode2";
    public static final String logFilename = "log";
    public static final String notificationname = "notification";
    public static final String widgetname = "widget";
    public static final String cachename = "cache";
//    public static RefWatcher mRefWatcher;
    public static boolean isNewDay = false;
    public static final boolean ENCRYPTED = false;

    public static DaoSession getDaoSession() {
        if (daoMaster == null) {
            DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(getAppContext(), ENCRYPTED ?
                    "weather-db-encrypted" : "weather-db");
            Database db = ENCRYPTED ? helper.getEncryptedWritableDb("super-secret") : helper.getWritableDb();
            daoMaster = new DaoMaster(db);
            daoSession = new DaoMaster(db).newSession();
        }
        return daoMaster.newSession();
    }



    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        TimeMonitorManager.getInstance().resetTimeMonitor(TimeMonitorConfig.TIME_MONITOR_ID_APPLICATION_START);
    }

    @Override
    public void onCreate() {
        super.onCreate();
        mcontext = this;
        new Thread(new Runnable() {
            @Override
            public void run() {
                NetService.getInstance().init(cityUrl);
                Logger.addLogAdapter(new AndroidLogAdapter());
            }
        }).start();

//        Stetho.initializeWithDefaults(this);
//        mRefWatcher = LeakCanary.install(mcontext);
        TimeMonitorManager.getInstance().getTimeMonitor(TimeMonitorConfig
                .TIME_MONITOR_ID_APPLICATION_START).recordingTimeTag("ApplicationCreated");

//        DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(getAppContext(),
//                "weather-db", null);
//        daoMaster = new DaoMaster(helper.getWritableDatabase());


//        CrashHandler crashHandler = CrashHandler.getInstance();
//        crashHandler.init(this);
//        crashHandler.sendPreviousReportsToServer();
    }

    public static Context getAppContext() {
        return mcontext;
    }

    public static String getCityUrl() {
        return cityUrl;
    }

    public static String getHeweatherKey() {
        return heweatherKey;
    }


    public static boolean nightMode(){
        SharedPreferences share = mcontext.getSharedPreferences(shareFilename1, MODE_PRIVATE);
        boolean ischecked=share.getBoolean("ischecked",false);
        return ischecked;
    }

    public static boolean nightMode2(){
        SharedPreferences share = mcontext.getSharedPreferences(shareFilename2, MODE_PRIVATE);
        boolean ischecked = share.getBoolean("ischecked",false);
        return ischecked;
    }


    public static boolean log(){
        SharedPreferences share = mcontext.getSharedPreferences(logFilename, MODE_PRIVATE);
        boolean ischecked = share.getBoolean("ischecked",true);
        return ischecked;
    }


    public static boolean notification(){
        SharedPreferences share = mcontext.getSharedPreferences(notificationname, MODE_PRIVATE);
        boolean ischecked = share.getBoolean("ischecked",true);
        return ischecked;
    }

    public static boolean widget(){
        SharedPreferences share = mcontext.getSharedPreferences(widgetname, MODE_PRIVATE);
        boolean ischecked = share.getBoolean("ischecked",true);
        return ischecked;
    }

    public static boolean cache(){
        SharedPreferences share = mcontext.getSharedPreferences(cachename, MODE_PRIVATE);
        boolean ischecked = share.getBoolean("ischecked",true);
        return ischecked;
    }

    public static LocationClient getmLocationClient() {
        if (mLocationClient == null) {
            mLocationClient = new LocationClient(mcontext);

        }
        return mLocationClient;
    }

    public static boolean isNewDay() {
        return isNewDay;
    }
} public class BaseFragment extends Fragment {

    private WindowManager mWindowManager = null;
    private View mNightView = null;
    private WindowManager.LayoutParams mNightViewParam;



    public BaseFragment() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        TextView textView = new TextView(getActivity());
        textView.setText("你好");
        return textView;
    }

    protected void initNightView(int layoutID)
    {
        mNightViewParam = new WindowManager.LayoutParams(
                WindowManager.LayoutParams.TYPE_APPLICATION,
                WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
                PixelFormat.TRANSPARENT);

        mWindowManager = (WindowManager) getActivity().getSystemService(Context.WINDOW_SERVICE);
        mNightView=LayoutInflater.from(getActivity()).inflate(layoutID,null);
        mWindowManager.addView(mNightView, mNightViewParam);
    }

    protected void removeNightView(){
        if(mNightView!=null) {
            mWindowManager.removeViewImmediate(mNightView);
            mNightView = null;
        }
    }
} public class WeekWeather implements Serializable {

    private int lowTemp;
    private int highTemp;

    private String Date;
    private String cond;

    public int getLowTemp() {
        return lowTemp;
    }

    public void setLowTemp(int lowTemp) {
        this.lowTemp = lowTemp;
    }

    public int getHighTemp() {
        return highTemp;
    }

    public void setHighTemp(int highTemp) {
        this.highTemp = highTemp;
    }

    public String getDate() {
        return Date;
    }

    public void setDate(String date) {
        Date = date;
    }

    public String getCond() {
        return cond;
    }

    public void setCond(String cond) {
        this.cond = cond;
    }
} public interface CityDataSource {

    /******************************************************************************************
     * 对CityDao进行的操作
     *******************************************************************************************/
    void addCities(UrlCity city);

    void addCity(CityEntity city);

    boolean isExistInCity();

    void getCityFromProvince(String provinceName, GetCityCallBack callBack);

    void getAllCity(GetCityCallBack callBack);

    void getCities(String name, GetCityCallBack callBack);

    boolean isExistInCity(String name);

    List<CityEntity> getAllCities();

    List<CityEntity> getCities(String name);


    /******************************************************************************************
     * 对ProvinceDao进行的操作
     *******************************************************************************************/

    List<ProvinceEntity> getProvinces(String name);

    void getAllProvince(GetProvinceCallBack callBack);

    void addProvince();

    void addProvince(ProvinceEntity province);

    boolean isExistInProvince();

    void getProvince(String name, GetProvinceCallBack callBack);

    List<ProvinceEntity> getAllProvince();


    /******************************************************************************************
     *  对LoveCityDao进行的操作
     *******************************************************************************************/


    List<LoveCityEntity> getAllLoveCities();

    void getLoveCity(String cityName, GetLoveCityCallBack callBack);

    void getLoveCity(int order, GetLoveCityCallBack callBack);

    LoveCityEntity getLoveCity(int order);

    void getLoveCity(GetLoveCityCallBack callBack);

    void addLoveCity(LoveCityEntity loveCity);

    boolean isExistInLoveCity(String cityName);

    void updateCityOrder(String cityName, int order);

    void updateLocaitonCityOrder(String cityName,int order);

    void deleteCity(String cityName);

    interface GetLoveCityCallBack {
        void onSuccess(List<LoveCityEntity> loveCities);

        void onFailure(String failureMessage);

    }

    interface GetProvinceCallBack {
        void onSuccess(List<ProvinceEntity> provinces);

        void onFailure(String failureMessage);
    }


    interface GetCityCallBack {
        void onSuccess(List<CityEntity> cities);

        void onFailure(String failureMessage);
    }


} @Entity
public class LoveCityEntity {

    @Id(autoincrement = true)
    private Long id;
    private String cityName;
    private int order;

    @Generated(hash = 1968781902)
    public LoveCityEntity(Long id, String cityName, int order) {
        this.id = id;
        this.cityName = cityName;
        this.order = order;
    }

    @Generated(hash = 2010273138)
    public LoveCityEntity() {
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCityName() {
        return this.cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    public int getOrder() {
        return this.order;
    }

    public void setOrder(int order) {
        this.order = order;
    }


} @SuppressLint("SimpleDateFormat")
public class DateUtil {

    /**
     *
     * @param newDate 新的时间
     * @param oldDate 旧的时间
     * @return 新旧时间差
     * @throws ParseException
     */
    public static long getDifferenceofDate(Date newDate,Date oldDate) {
        @SuppressLint("SimpleDateFormat")
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        try {
            Date tempNew = df.parse(df.format(newDate));
            Date tempOld = df.parse(df.format(oldDate));
            return tempNew.getTime() - tempOld.getTime();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return -1;
    }


    /**
     * 输入一个日期，返回该日期以及接下来6天的星期数。
     * @param date 一个日期
     * @return 返回星期数
     */
    public static String[] getNextWeek(Date date) {
        String[] weeks = {"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
        String[] myWeek = new String[7];
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        int weekIndex = cal.get(Calendar.DAY_OF_WEEK) - 1;
        if (weekIndex < 0) {
            weekIndex = 0;
        }
        for(int i = 0 ;i < 7;i++) {
            if (i == 0) {
                myWeek[i] = new SimpleDateFormat("MM/dd").format(date);
            }else{
                myWeek[i] = weeks[(weekIndex + i) % 7];

            }
        }
        return myWeek;
    }

    /**
     *
     * @param fDate 旧的时间
     * @param oDate 新的时间
     * @return
     */

    public static int daysOfTwo(Date fDate, Date oDate) {
        Calendar aCalendar = Calendar.getInstance();
        aCalendar.setTime(fDate);
        int day1 = aCalendar.get(Calendar.DAY_OF_YEAR);
        aCalendar.setTime(oDate);
        int day2 = aCalendar.get(Calendar.DAY_OF_YEAR);
        return day2 - day1;

    }


} public class DisplayUtil {
    /**
     * 将px值转换为dip或dp值，保证尺寸大小不变
     *
     * @param pxValue
     *            （DisplayMetrics类中属性density）
     * @return
     */
    public static int px2dip(Context context, float pxValue) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (pxValue / scale + 0.5f);
    }

    /**
     * 将dip或dp值转换为px值，保证尺寸大小不变
     *
     * @param dipValue
     *            （DisplayMetrics类中属性density）
     * @return
     */
    public static int dip2px(Context context, float dipValue) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (dipValue * scale + 0.5f);
    }

    /**
     * 将px值转换为sp值，保证文字大小不变
     *
     * @param pxValue
     *            （DisplayMetrics类中属性scaledDensity）
     * @return
     */
    public static int px2sp(Context context, float pxValue) {
        final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
        return (int) (pxValue / fontScale + 0.5f);
    }

    /**
     * 将sp值转换为px值，保证文字大小不变
     *
     * @param spValue
     *            （DisplayMetrics类中属性scaledDensity）
     * @return
     */
    public static int sp2px(Context context, float spValue) {
        final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
        return (int) (spValue * fontScale + 0.5f);
    }

    /**
     * 获取控件的高度或者宽度  isHeight=true则为测量该控件的高度，isHeight=false则为测量该控件的宽度
     * @param view
     * @param isHeight
     * @return
     */
    public static int getViewHeight(View view, boolean isHeight){
        int result;
        if(view==null)return 0;
        if(isHeight){
            int h = View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);
            view.measure(h,0);
            result =view.getMeasuredHeight();
        }else{
            int w = View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);
            view.measure(0,w);
            result =view.getMeasuredWidth();
        }
        return result;
    }
} public class ImageUtils {


    public static final int BRIEF = 1;
    public static final int DETAIL = 2;
    public static final int FUTURE = 3;
    private static WeatherRepository mWeatherRepository = WeatherRepository.getInstance();


    public static void drawImage(Context context, int flag) {
        HWeather weather = getData();
        int width = ScreenUtil.getScreenW(context);
        int height = DisplayUtil.dip2px(context, 150);
        int padding = DisplayUtil.dip2px(context, 20);
        Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        Paint paint = new Paint();
        paint.setColor(Color.WHITE);//设置画笔颜色
        paint.setStrokeWidth(20.0f);// 设置画笔粗细
        paint.setAntiAlias(true);
        paint.setStyle(Paint.Style.FILL);
        String familyName = "宋体";
        Typeface font = Typeface.create(familyName, Typeface.BOLD);
        paint.setTypeface(font);
        paint.setTextSize(DisplayUtil.sp2px(context, 25));//设置文字大小
        paint.setTextAlign(Paint.Align.CENTER);

        Paint textPaint = new Paint();
        textPaint.setColor(Color.WHITE);//设置画笔颜色
        textPaint.setStrokeWidth(20.0f);// 设置画笔粗细
        textPaint.setAntiAlias(true);
        textPaint.setStyle(Paint.Style.FILL);
        textPaint.setTypeface(font);
        textPaint.setTextSize(DisplayUtil.sp2px(context, 15));//设置文字大小
        textPaint.setTextAlign(Paint.Align.CENTER);

        Paint verticalLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        verticalLinePaint.setStyle(Paint.Style.STROKE);
        verticalLinePaint.setColor(ContextCompat.getColor(context, R.color.lightgray));
        verticalLinePaint.setAntiAlias(true);
        verticalLinePaint.setStrokeWidth(5);
        verticalLinePaint.setStrokeCap(Paint.Cap.ROUND);
        PathEffect effect = new DashPathEffect(new float[]{1, 2, 4, 8}, 1);
        verticalLinePaint.setPathEffect(effect);
        verticalLinePaint.setStrokeJoin(Paint.Join.ROUND);

        Date sqlDate = mWeatherRepository.getWeatherEntity(mWeatherRepository.getShowCity()).getUpdateTime();
        @SuppressLint("SimpleDateFormat")
        String updateTime = new SimpleDateFormat("MM-dd HH:mm").format(sqlDate);
        String city = WeatherJsonConverter.getWeather(weather).getBasic().getCity();
        String tmp = WeatherJsonConverter.getWeather(weather).getNow().getTmp() + "°";
        String cond = WeatherJsonConverter.getWeather(weather).getNow().getCond().getTxt();

        String tmpRange = WeatherJsonConverter.getWeather(weather).getDaily_forecast().get(0).getTmp().getMin() + "°" + "/" +
                WeatherJsonConverter.getWeather(weather).getDaily_forecast().get(0).getTmp().getMax() + "°";
        String hum = "湿度：" + WeatherJsonConverter.getWeather(weather).getNow().getHum() + "%";
        String speed = "风速：" + WeatherJsonConverter.getWeather(weather).getNow().getWind().getSpd() + "km/h";
        String uv = "紫外线：" + WeatherJsonConverter.getWeather(weather).getSuggestion().getUv().getBrf();
        String[] weeks = new String[7];
        try {
            weeks = DateUtil.
                    getNextWeek(new SimpleDateFormat("yyyy-MM-dd").
                            parse(WeatherJsonConverter.getWeather(weather).getDaily_forecast().get(0).getDate()));
        } catch (ParseException e) {
            e.printStackTrace();
        }

        String[] weekTmp = new String[7];
        String[] highTmp = new String[7];
        String[] lowTmp = new String[7];

        File imgFile[] = new File[3];

        switch (flag) {
            case BRIEF:

                canvas.save();
                canvas.drawColor(ContextCompat.getColor(context, R.color.dodgerblue));
                canvas.drawText(city,
                        width - 6 * padding,
                        height - padding,
                        paint);

                canvas.drawText(updateTime,
                        width - 6 * padding,
                        3 * padding,
                        paint);

                canvas.drawText(tmp,
                        3 * padding,
                        height - padding,
                        paint);

                canvas.drawText(cond,
                        3 * padding,
                        3 * padding,
                        paint);

                imgFile[0] = new File(context.getExternalFilesDir(null),
                        "IMG-BRIEF"  + ".png");//创建一个文件
                try {
                    OutputStream os = new FileOutputStream(imgFile[0]);//创建输出流
                    bitmap.compress(Bitmap.CompressFormat.PNG, 100, os);//通过输出流将图片保存

                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
                canvas.restore();
            case DETAIL:

                canvas.save();
                canvas.drawColor(ContextCompat.getColor(context, R.color.orange));
                canvas.drawText(tmp,
                        3 * padding,
                        2 * padding,
                        paint);

                canvas.drawText(city,
                        width - 6 * padding,
                        2 * padding,
                        paint);

                canvas.drawText(cond,
                        3 * padding,
                        6 * padding,
                        paint);

                canvas.drawText(tmpRange,
                        3 * padding,
                        4 * padding,
                        paint);

                canvas.drawText(hum,
                        width - 6 * padding,
                        4 * padding,
                        textPaint);

                canvas.drawText(speed,
                        width - 6 * padding,
                        5 * padding,
                        textPaint);

                canvas.drawText(uv,
                        width - 6 * padding,
                        6 * padding,
                        textPaint);

                imgFile[1] = new File(context.getExternalFilesDir(null),
                        "IMG-DETAIL" + ".png");//创建一个文件
                try {
                    OutputStream os = new FileOutputStream(imgFile[1]);//创建输出流
                    bitmap.compress(Bitmap.CompressFormat.PNG, 100, os);//通过输出流将图片保存
                  } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
                canvas.restore();
            case FUTURE:

                canvas.save();
                canvas.drawColor(ContextCompat.getColor(context, R.color.white));
                for (int i = 0; i < WeatherJsonConverter.getWeather(weather).getDaily_forecast().size(); i++) {
                    weekTmp[i] = WeatherJsonConverter.getWeather(weather).getDaily_forecast().get(i).getCond().getTxt_d();
                    if (weekTmp[i].contains("/")) {
                        weekTmp[i] = weekTmp[i].split("/")[1];
                    }
                    highTmp[i] = "高" + WeatherJsonConverter.getWeather(weather).getDaily_forecast().get(i).getTmp().getMax() + "°";
                    lowTmp[i] = "低" + WeatherJsonConverter.getWeather(weather).getDaily_forecast().get(i).getTmp().getMin() + "°";
                }
                textPaint.setColor(Color.BLACK);
                for (int i = 1; i < 7; i++) {
                    canvas.save();
                    canvas.translate(width * i / 7, 0);
                    canvas.drawLine(0, 0, 0, height, verticalLinePaint);
                    canvas.restore();
                }

                for (int i = 0; i < 7; i++) {
                    canvas.save();
                    canvas.translate(width * i / 7, 0);
                    canvas.drawText(weeks[i],
                            width / 14,
                            2 * padding,
                            textPaint);
                    canvas.drawText(weekTmp[i],
                            width / 14,
                            4 * padding,
                            textPaint);
                    canvas.drawText(highTmp[i],
                            width / 14,
                            6 * padding,
                            textPaint);
                    canvas.drawText(lowTmp[i],
                            width / 14,
                            7 * padding,
                            textPaint);
                    canvas.restore();
                }
                imgFile[2] = new File(context.getExternalFilesDir(null),
                        "IMG-FUTURE"  + ".png");//创建一个文件
                try {
                    OutputStream os = new FileOutputStream(imgFile[2]);//创建输出流
                    bitmap.compress(Bitmap.CompressFormat.PNG, 100, os);//通过输出流将图片保存
                    bitmap.recycle();

                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }

                canvas.restore();

        }
    }


    private static HWeather getData() {

        return mWeatherRepository.getLocalWeather(mWeatherRepository.getShowCity());

    }
} public class LogUtils {
    public static final int VERBOSE = 1;

    public static final int DEBUG = 2;

    public static final int INFO = 3;

    public static final int WARN = 4;

    public static final int ERROR = 5;

    public static final int NOTHING = 6;

    public static final int LEVEL = NOTHING;

    public static void v(String tag, String msg) {
        if (LEVEL <= VERBOSE) {
            Log.v(tag, msg);
        }
    }

    public static void d(String tag, String msg) {
        if (LEVEL <= DEBUG) {
            Log.d(tag, msg);
        }
    }

    public static void i(String tag, String msg) {
        if (LEVEL <= INFO) {
            Log.i(tag, msg);
        }
    }

    public static void w(String tag, String msg) {
        if (LEVEL <= WARN) {
            Log.w(tag, msg);
        }
    }

    public static void e(String tag, String msg) {
        if (LEVEL <= ERROR) {
            Log.e(tag, msg);
        }
    }


} public class PopupWindowAdapter extends BaseAdapter{

    private List<HoursWeather> hoursWeathers;
    private LayoutInflater mInflater = null;


    public PopupWindowAdapter(List<HoursWeather> hoursWeathers, Context context) {
        this.hoursWeathers = hoursWeathers;
        mInflater = LayoutInflater.from(context);
    }
    @Override
    public int getCount() {
        return hoursWeathers.size();
    }

    @Override
    public Object getItem(int position) {
        return hoursWeathers.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @SuppressLint("SimpleDateFormat")
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = new ViewHolder();
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.item_popup_listview, parent,false);
            holder.tmp = (TextView)convertView.findViewById(R.id.tmp);
            holder.wind_class = (TextView)convertView.findViewById(R.id.wind_class);
            holder.wind_speed = (TextView)convertView.findViewById(R.id.wind_speed);
            holder.wind_deg = (TextView)convertView.findViewById(R.id.wind_deg);
            holder.wind_dir = (TextView)convertView.findViewById(R.id.wind_dir);
            holder.hum = (TextView) convertView.findViewById(R.id.hum);
            holder.pop = (TextView)convertView.findViewById(R.id.pop);
            holder.update = (TextView) convertView.findViewById(R.id.update_time_hours);

            convertView.setTag(holder);
        }else{
            holder = (ViewHolder) convertView.getTag();
        }
        holder.tmp.setText(hoursWeathers.get(position).getTmp());
        holder.wind_class.setText("风力等级：" + hoursWeathers.get(position).getWind_class());
        holder.wind_deg.setText("风力角度：" + hoursWeathers.get(position).getWind_deg() + "°");
        holder.wind_dir.setText("风向：" + hoursWeathers.get(position).getWind_dir());
        holder.wind_speed.setText("风速：" + hoursWeathers.get(position).getWind_speed() + "km/h");
        holder.pop.setText("降水概率：" + hoursWeathers.get(position).getPop());
        holder.hum.setText("湿度：" + hoursWeathers.get(position).getHum());
        holder.update.setText("预计今天" + hoursWeathers.get(position).getUpdate().split(" ")[1] + "天气情况");

        return convertView;
    }

    class ViewHolder{
         TextView tmp;
         TextView wind_class;
         TextView pop;
         TextView update;
         TextView hum;
         TextView wind_speed;
         TextView wind_deg;
         TextView wind_dir;


    }
} public class HoursWeather implements Serializable{

    private String tmp;
    private String pop;
    private String wind_class;
    private String wind_dir;
    private String wind_deg;
    private String wind_speed;
    private String hum;
    private String update;


    public String getTmp() {
        return tmp;
    }

    public void setTmp(String tmp) {
        this.tmp = tmp;
    }


    public String getPop() {
        return pop;
    }

    public void setPop(String pop) {
        this.pop = pop;
    }


    public String getUpdate() {
        return update;
    }

    public void setUpdate(String update) {
        this.update = update;
    }

    public String getWind_class() {
        return wind_class;
    }

    public void setWind_class(String wind_class) {
        this.wind_class = wind_class;
    }

    public String getWind_dir() {
        return wind_dir;
    }

    public void setWind_dir(String wind_dir) {
        this.wind_dir = wind_dir;
    }

    public String getWind_deg() {
        return wind_deg;
    }

    public void setWind_deg(String wind_deg) {
        this.wind_deg = wind_deg;
    }

    public String getWind_speed() {
        return wind_speed;
    }

    public void setWind_speed(String wind_speed) {
        this.wind_speed = wind_speed;
    }

    public String getHum() {
        return hum;
    }

    public void setHum(String hum) {
        this.hum = hum;
    }
} public class WeekWeatherView extends View {

    private Paint baseLinePaint;
    private Paint verticalLinePaint;
    private Paint highPointPaint;
    private Paint lowPointPaint;
    private Paint highLinePaint;
    private Paint lowLinePaint;
    private Paint textPaint;
    private Paint lowTempPaint;
    private Paint highTempPaint;
    private Path mPath;
    private Path dPath;
    private List<Integer> lists = new ArrayList<>();
    private List<WeekWeather> weekWeathers = new ArrayList<>();
    private float[] lowTempX = new float[7];
    private float[] lowTempY = new float[7];
    private float[] highTempX = new float[7];
    private float[] highTempY = new float[7];
    private String[] weeks = new String[7];
    private int viewHeight, viewWidth;
    private int padding = 20;
    private int tempPadding = 15;
    private int textPadding = 20;

    public WeekWeatherView(Context context) {
        super(context);
        init(context);
    }

    public WeekWeatherView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public WeekWeatherView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
    }

    private void init(Context context) {
        baseLinePaint = new Paint();
        baseLinePaint.setColor(ContextCompat.getColor(context, R.color.maincolor));
        baseLinePaint.setAntiAlias(true);
        baseLinePaint.setStyle(Paint.Style.FILL);
        baseLinePaint.setStrokeWidth(10);

        verticalLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        verticalLinePaint.setStyle(Paint.Style.STROKE);
        verticalLinePaint.setColor(ContextCompat.getColor(context, R.color.lightgray));
        verticalLinePaint.setAntiAlias(true);
        verticalLinePaint.setStrokeWidth(5);
        verticalLinePaint.setStrokeCap(Paint.Cap.ROUND);
        PathEffect effect = new DashPathEffect(new float[]{1, 2, 4, 8}, 1);
        verticalLinePaint.setPathEffect(effect);
        verticalLinePaint.setStrokeJoin(Paint.Join.ROUND);

        highPointPaint = new Paint();
        highPointPaint.setColor(ContextCompat.getColor(context, R.color.red));
        highPointPaint.setAntiAlias(true);
        highPointPaint.setStyle(Paint.Style.STROKE);
        highPointPaint.setStrokeWidth(5);

        lowPointPaint = new Paint();
        lowPointPaint.setColor(ContextCompat.getColor(context, R.color.maincolor));
        lowPointPaint.setAntiAlias(true);
        lowPointPaint.setStyle(Paint.Style.STROKE);
        lowPointPaint.setStrokeWidth(5);

        highLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        highLinePaint.setColor(ContextCompat.getColor(context, R.color.red));
        highLinePaint.setAntiAlias(true);
        highLinePaint.setStrokeWidth(5);
        highLinePaint.setStrokeCap(Paint.Cap.ROUND);
        highLinePaint.setStrokeJoin(Paint.Join.ROUND);
        highLinePaint.setStyle(Paint.Style.STROKE);

        lowLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        lowLinePaint.setColor(ContextCompat.getColor(context, R.color.cadetblue));
        lowLinePaint.setAntiAlias(true);
        lowLinePaint.setStrokeWidth(5);
        lowLinePaint.setStrokeCap(Paint.Cap.ROUND);
        lowLinePaint.setStrokeJoin(Paint.Join.ROUND);
        lowLinePaint.setStyle(Paint.Style.STROKE);

        mPath = new Path();
        dPath = new Path();

        textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        textPaint.setColor(ContextCompat.getColor(context, R.color.black));
        String familyName = "宋体";
        Typeface font = Typeface.create(familyName, Typeface.BOLD);
        textPaint.setTypeface(font);
        textPaint.setTextAlign(Paint.Align.CENTER);

        lowTempPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        lowTempPaint.setColor(ContextCompat.getColor(context, R.color.cadetblue));
        lowTempPaint.setTypeface(font);
        lowTempPaint.setTextAlign(Paint.Align.CENTER);

        highTempPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        highTempPaint.setColor(ContextCompat.getColor(context, R.color.red));
        highTempPaint.setTypeface(font);
        highTempPaint.setTextAlign(Paint.Align.CENTER);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int result;
        //通过MeasureSpec.getMode与getSize方法获取宽和高的测量方式与测量大小
        int widthMode = MeasureSpec.getMode(widthMeasureSpec);
        int widthSize = MeasureSpec.getSize(widthMeasureSpec);
        int heightMode = MeasureSpec.getMode(heightMeasureSpec);
        int heightSize = MeasureSpec.getSize(heightMeasureSpec);
        //保存最后的测量值，优化代码的话可以不用这个变量的。
        int width = 0, height = 0;
        //对测量模式进行判断，如果是EXACTLY的话则最后的测量值就是系统帮我们测量的结果。
        if (widthMode == MeasureSpec.EXACTLY) {
            width = widthSize;
        } else {
            //如果是UNSPECIFIED 则使用我们的默认值作为最后的测量值
            result = 300;
            //如果是AT_MOST 则就要用系统测量结果与我们默认结果取最小值来决定最后的测量结果
            if (widthMode == MeasureSpec.AT_MOST) {
                width = Math.min(result, widthSize);
            }
        }
        //高度和宽度的过程是一致的。
        if (heightMode == MeasureSpec.EXACTLY) {
            height = heightSize;
        } else {
            result = 300;
            if (heightMode == MeasureSpec.AT_MOST) {
                height = Math.min(result, heightSize);
            }
        }
        //把我们最后的宽和高设置进去
        viewHeight = height;
        viewWidth = width;
        setMeasuredDimension(width, height);
    }


    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        int translateLength = (viewWidth - 2 * padding) / 7;
        textPaint.setTextSize(translateLength / 4);
        lowTempPaint.setTextSize(translateLength / 4);
        highTempPaint.setTextSize(translateLength / 4);

        //画水平基准线
        canvas.drawLine(padding,
                viewHeight - padding,
                viewWidth - padding,
                viewHeight - padding,
                baseLinePaint);

        //画竖直基准线
        for (int i = 1; i < 7; i++) {
            canvas.save();
            canvas.translate(translateLength * i, 0);
            dPath.moveTo(padding,
                    viewHeight - padding - 10);
            dPath.lineTo(padding,
                    padding);
            canvas.drawPath(dPath, verticalLinePaint);
            canvas.restore();
        }
        if (weeks[0] == null) return;
        //画日期
        for (int i = 0; i < weeks.length; i++) {
            canvas.save();
            canvas.translate(translateLength * i, 0);
            canvas.drawText(weeks[i], padding + translateLength / 2, 4 * textPadding, textPaint);
            canvas.drawText(weekWeathers.get(i).getCond(), padding + translateLength / 2, 6 * textPadding,textPaint);
            canvas.restore();
        }


        int lowestTemp = IntegerUtils.getSmallestNum(lists);

        for (int i = 0; i < weekWeathers.size(); i++) {
            int lowDiff = weekWeathers.get(i).getLowTemp() - lowestTemp;
            int diff = weekWeathers.get(i).getHighTemp() - weekWeathers.get(i).getLowTemp();
            lowTempX[i] = padding + translateLength / 2 + translateLength * i;
            lowTempY[i] = viewHeight - (15 + lowDiff) * tempPadding;
            canvas.drawCircle(lowTempX[i],
                    lowTempY[i],
                    8,
                    lowPointPaint);
            canvas.drawText(weekWeathers.get(i).getLowTemp() + "℃",
                    lowTempX[i],
                    lowTempY[i] + 2 * textPadding,
                    lowTempPaint);

            highTempX[i] = (padding + translateLength / 2 + translateLength * i);
            highTempY[i] = viewHeight - (15 + lowDiff) * tempPadding - tempPadding * diff;
            canvas.drawCircle(highTempX[i],
                    highTempY[i],
                    8,
                    highPointPaint);
            canvas.drawText(weekWeathers.get(i).getHighTemp() + "℃",
                    highTempX[i],
                    highTempY[i] - textPadding,
                    highTempPaint);
        }
        for (int i = 0; i < 6; i++) {
            mPath.reset();
            mPath.moveTo(lowTempX[i] + 8, lowTempY[i]);
            mPath.lineTo(lowTempX[i + 1] - 8, lowTempY[i + 1]);
            canvas.drawPath(mPath, lowLinePaint);
            mPath.rewind();
            mPath.moveTo(highTempX[i] + 8, highTempY[i]);
            mPath.lineTo(highTempX[i + 1] - 8, highTempY[i + 1]);
            canvas.drawPath(mPath, highLinePaint);
        }
    }


//    @SuppressLint("SimpleDateFormat")
//    private void getData() throws Exception {
//        weekWeathers.clear();
//        if(weather == null) return;
//        for (int i = 0; i < WeatherJsonConverter.getWeather(weather).getDaily_forecast().size(); i++) {
//            WeekWeather weekWeather = new WeekWeather();
//            String weatherCond = WeatherJsonConverter.getWeather(weather).getDaily_forecast().get(i).getCond().getTxt_d();
//            weekWeather.setLowTemp(Integer.parseInt(WeatherJsonConverter.getWeather(weather).getDaily_forecast().get(i).getTmp().getMin()));
//            lists.add(Integer.parseInt(WeatherJsonConverter.getWeather(weather).getDaily_forecast().get(i).getTmp().getMin()));
//            weekWeather.setHighTemp(Integer.parseInt(WeatherJsonConverter.getWeather(weather).getDaily_forecast().get(i).getTmp().getMax()));
//            weekWeather.setDate(WeatherJsonConverter.getWeather(weather).getDaily_forecast().get(i).getDate());
//            if (weatherCond.contains("/")) {
//                weekWeather.setCond(weatherCond.split("/")[1]);
//            }else{
//                weekWeather.setCond(weatherCond);
//            }
//            weekWeathers.add(weekWeather);
//        }
//        weeks = DateUtil.
//                getNextWeek(new SimpleDateFormat("yyyy-MM-dd").
//                        parse(WeatherJsonConverter.getWeather(weather).getDaily_forecast().get(0).getDate()));
//
//    }

    public void setData(List<WeekWeather> weathers,String[] weeks,List<Integer> lists){

        this.weekWeathers = weathers;
        this.weeks = weeks;
        this.lists = lists;
    }

    public void notifyDateChanged(){
        postInvalidate();
        Debug.stopMethodTracing();
    }

} public class HWeather implements Parcelable,Serializable {


    private List<Weather> HeWeather5;

    public List<Weather> getHeWeather5() {
        return HeWeather5;
    }

    public void setHeWeather5(List<Weather> HeWeather5) {
        this.HeWeather5 = HeWeather5;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeList(this.HeWeather5);
    }

    public HWeather() {
    }

    protected HWeather(Parcel in) {
        this.HeWeather5 = new ArrayList<Weather>();
        in.readList(this.HeWeather5, Weather.class.getClassLoader());
    }

    public static final Creator<HWeather> CREATOR = new Creator<HWeather>() {
        @Override
        public HWeather createFromParcel(Parcel source) {
            return new HWeather(source);
        }

        @Override
        public HWeather[] newArray(int size) {
            return new HWeather[size];
        }
    };
} public class MessageEvent {

    private int message;

    public MessageEvent(int message) {
        this.message = message;
    }

    public int getMessage() {
        return message;
    }

    public void setMessage(int message) {
        this.message = message;
    }
} public class ScreenUtil {
    /**
     * 获取屏幕宽高，sdk17后不建议采用
     *
     * @param context
     */
    private static int[] getScreenHW(Context context) {
        WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        Display display = manager.getDefaultDisplay();
        int width = display.getWidth();
        int height = display.getHeight();
        int[] HW = new int[] { width, height };
        return HW;
    }

    /**
     * 获取屏幕宽高，建议采用
     *
     * @param context
     */
    public static int[] getScreenHW2(Context context) {
        WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        DisplayMetrics dm = new DisplayMetrics();
        manager.getDefaultDisplay().getMetrics(dm);
        int width = dm.widthPixels;
        int height = dm.heightPixels;
        int[] HW = new int[] { width, height };
        return HW;
    }

    /**
     * 获取屏幕的宽度
     *
     * @param context
     * @return
     */
    public static int getScreenW(Context context) {
        return getScreenHW2(context)[0];
    }

    /**
     * 获取屏幕的高度
     *
     * @param context
     * @return
     */
    public static int getScreenH(Context context) {
        return getScreenHW2(context)[1];
    }
} public class WeatherIcon {

    public static int getWeatherImage(String weatherCode) {
        Calendar cal = Calendar.getInstance();
        int hour = cal.get(Calendar.HOUR_OF_DAY);
        int code = Integer.parseInt(weatherCode);
        if (hour > 18 || hour < 6) {
            if (code == 100) {
                return R.mipmap.sunny_night;
            }else if(code == 101){
                return R.mipmap.cloudy4_night;
            } else if (code == 102) {
                return R.mipmap.cloudy1_night;
            }else if (code == 103) {
                return R.mipmap.cloudy3_night;
            }else if(code == 104){
                return R.mipmap.sunny_night;
            } else if (code >= 200 && code < 300) {
                return R.mipmap.fog_night;
            }else if (code == 300){
                return R.mipmap.light_rain;
            }else if (code > 300 && code < 400) {
                if(code == 301 || code == 303 || code == 306 || code == 307 || code >= 310){
                    return R.mipmap.shower3;
                }else{
                    return R.mipmap.shower1_night;
                }
            } else if (code == 400 || code == 407) {
                return R.mipmap.snow1_night;
            }else if(code == 401){
                return R.mipmap.snow2_night;
            }else if (code == 402) {
                return R.mipmap.snow3_night;
            }else if (code == 403) {
                return R.mipmap.snow4;
            } else if (code == 404 || code == 405 || code == 406) {
                return R.mipmap.sleet;
            } else if (code >= 500 && code <= 600) {
                return R.mipmap.mist_night;
            }
        }else{
            if (code == 100) {
                return R.mipmap.sunny;
            }else if(code == 101){
                return R.mipmap.cloudy4;
            } else if (code == 102) {
                return R.mipmap.cloudy1;
            }else if (code == 103) {
                return R.mipmap.cloudy3;
            }else if(code == 104){
                return R.mipmap.sunny;
            } else if (code >= 200 && code < 300) {
                return R.mipmap.fog;
            }else if (code == 300){
                return R.mipmap.light_rain;
            }else if (code > 300 && code < 400) {
                if(code == 301 || code == 303 || code == 306 || code == 307 || code >= 310){
                    return R.mipmap.shower3;
                }else{
                    return R.mipmap.shower1;
                }
            } else if (code == 400 || code == 407) {
                return R.mipmap.snow1;
            }else if(code == 401){
                return R.mipmap.snow2;
            }else if (code == 402) {
                return R.mipmap.snow3;
            }else if (code == 403) {
                return R.mipmap.snow4;
            } else if (code == 404 || code == 405 || code == 406) {
                return R.mipmap.sleet;
            } else if (code >= 500 && code <= 600) {
                return R.mipmap.mist;
            }
        }
        return R.mipmap.sunny;
    }
} public class WeatherJsonConverter {

    public static Weather getWeather(HWeather hWeather){
        return hWeather.getHeWeather5().get(0);
    }
} public static final int UPDATE_SHOW_CITY = 0x402; public static final int UPDATE_WEATHER = 0X401; public static int getViewHeight(View view, boolean isHeight){
    int result;
    if(view==null)return 0;
    if(isHeight){
        int h = View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);
        view.measure(h,0);
        result =view.getMeasuredHeight();
    }else{
        int w = View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED);
        view.measure(0,w);
        result =view.getMeasuredWidth();
    }
    return result;
} public static final int BRIEF = 1; public class Knife {

    static final long UPDATE_TIME = 60 * 60 * 1000;
    static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale
            .getDefault());

    public static <T> T checkNotNull(T ref) {
        if (ref == null) {
            throw new NullPointerException();
        }else{
            return ref;
        }
    }

    public static boolean isListEmpty(List<?> list) {
        if (list == null) {
            return true;
        }
        if (list.size() == 0) {
            return true;
        }

        return false;
    }

    public static Date convertDate(Date date){
        try {
            return simpleDateFormat.parse(simpleDateFormat.format(date));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }

    public static Date convertDate(String date){
        try {
            return simpleDateFormat.parse(date);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        return null;
    }

    public static boolean isNeedUpdate(Date oldTime,Date newTime){
        long oT = oldTime.getTime();
        long nT = newTime.getTime();

        if (nT - oT >= UPDATE_TIME) {
            return true;
        }else{
            return false;
        }
    }


    public static <T>  T convertObject(byte[] bytes, Class<T> clz) {
        try {
            ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
            Object object = new ObjectInputStream(bais).readObject();
            T t = clz.cast(object);
            return t;
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }


}
import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.os.Debug;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AlertDialog;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import com.orhanobut.logger.Logger;
import com.weather.byhieg.easyweather.MyApplication;
import com.weather.byhieg.easyweather.base.BaseFragment;
import com.weather.byhieg.easyweather.data.bean.WeekWeather;
import com.weather.byhieg.easyweather.data.source.CityDataSource;
import com.weather.byhieg.easyweather.data.source.local.entity.LoveCityEntity;
import com.weather.byhieg.easyweather.tools.DateUtil;
import com.weather.byhieg.easyweather.tools.DisplayUtil;
import com.weather.byhieg.easyweather.tools.ImageUtils;
import com.weather.byhieg.easyweather.tools.LogUtils;
import com.weather.byhieg.easyweather.home.adapter.PopupWindowAdapter;
import com.weather.byhieg.easyweather.data.bean.HoursWeather;
import com.weather.byhieg.easyweather.R;
import com.weather.byhieg.easyweather.customview.WeekWeatherView;
import com.weather.byhieg.easyweather.data.bean.HWeather;
import com.weather.byhieg.easyweather.tools.MessageEvent;
import com.weather.byhieg.easyweather.tools.ScreenUtil;
import com.weather.byhieg.easyweather.tools.WeatherIcon;
import com.weather.byhieg.easyweather.tools.WeatherJsonConverter;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import static com.weather.byhieg.easyweather.tools.Constants.UPDATE_SHOW_CITY;
import static com.weather.byhieg.easyweather.tools.Constants.UPDATE_WEATHER;
import static com.weather.byhieg.easyweather.tools.DisplayUtil.getViewHeight;
import static com.weather.byhieg.easyweather.tools.ImageUtils.BRIEF;
import static com.weather.byhieg.easyweather.tools.Knife.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import butterknife.BindView;
import butterknife.ButterKnife;
package com.weather.byhieg.easyweather.home;








/**
 * A simple {@link Fragment} subclass.
 */
public class HomeFragment extends BaseFragment implements HomeContract.View, SwipeRefreshLayout
        .OnRefreshListener {


//    @BindView(R.id.arrow)
//    public ImageView arrow;
    @BindView(R.id.arrow_detail)
    public ImageView arrowDetail;
    @BindView(R.id.expand_view)
    public LinearLayout expandView;
    @BindView(R.id.detail)
    public LinearLayout detail;
    @BindView(R.id.date)
    public TextView date;
    @BindView(R.id.temp)
    public TextView temp;
    @BindView(R.id.tempImage)
    public ImageView tempImage;
    @BindView(R.id.tempHigh)
    public TextView tempHigh;
    @BindView(R.id.tempLow)
    public TextView tempLow;
    @BindView(R.id.cloth)
    public TextView cloth;
    @BindView(R.id.pm)
    public TextView pm;
    @BindView(R.id.hum)
    public TextView hum;
    @BindView(R.id.wind)
    public TextView wind;
    @BindView(R.id.wind_dir)
    public TextView windDir;
    @BindView(R.id.to_detail)
    public TextView toDetail;
    @BindView(R.id.qlty)
    public TextView qlty;
    @BindView(R.id.vis)
    public TextView vis;
    @BindView(R.id.pres)
    public TextView pres;
    @BindView(R.id.uv)
    public TextView uv;
    @BindView(R.id.sunrise)
    public TextView sunrise;
    @BindView(R.id.sunset)
    public TextView sunset;
    @BindView(R.id.condition)
    public TextView condition;
    @BindView(R.id.scrollView)
    public ScrollView scrollView;
    @BindView(R.id.refresh)
    public ImageView refresh;
    @BindView(R.id.swipe_refresh)
    public SwipeRefreshLayout mSwipeLayout;
    @BindView(R.id.updateTime)
    public TextView updateTime;
    @BindView(R.id.cloth_brf)
    public TextView clothBrf;
    @BindView(R.id.cloth_txt)
    public TextView clothTxt;
    @BindView(R.id.sport_brf)
    public TextView sportBrf;
    @BindView(R.id.sport_txt)
    public TextView sportTxt;
    @BindView(R.id.action_bar)
    public LinearLayout action_bar;
    @BindView(R.id.cold_brf)
    public TextView codeBrf;
    @BindView(R.id.cold_txt)
    public TextView coldTxt;
    @BindView(R.id.week_Weather_view)
    public WeekWeatherView weekWeatherView;