| | |
| | | |
| | | import com.basic.security.base.BaseApplication; |
| | | import com.basic.security.base.BaseFragment; |
| | | import com.basic.security.manager.BaseSettingManager; |
| | | import com.basic.security.manager.LogManager; |
| | | import com.basic.security.manager.RecognizeManager; |
| | | import com.basic.security.model.ModelAdapter; |
| | | import com.basic.security.utils.Constants; |
| | | import com.basic.security.utils.FastDFSUtil; |
| | | import com.basic.security.utils.FileUtil; |
| | |
| | | public void run() { |
| | | LogManager.saveWeather("{\"now\":{\"cloud\":\"0\",\"cond_code\":\"100\",\"cond_txt\":\"晴\",\"fl\":\"-5\",\"hum\":\"27\",\"pcpn\":\"0.0\",\"pres\":\"1037\",\"tmp\":\"-1\",\"vis\":\"16\",\"wind_deg\":\"65\",\"wind_dir\":\"东北风\",\"wind_sc\":\"2\",\"wind_spd\":\"11\"},\"basic\":{\"admin_area\":\"北京\",\"cid\":\"CN101010300\",\"cnty\":\"中国\",\"lat\":\"39.92148972\",\"location\":\"朝阳\",\"lon\":\"116.48641205\",\"parent_city\":\"北京\",\"tz\":\"+8.00\"},\"status\":\"ok\",\"update\":{\"loc\":\"2019-11-25 09:12\",\"utc\":\"2019-11-25 01:12\"}}"); |
| | | String jsonStr = LogManager.findWeather(); |
| | | // System.out.println("HomeFragment.run jsonStr" + jsonStr); |
| | | // System1.out.println("HomeFragment.run jsonStr" + jsonStr); |
| | | if (!TextUtils.isEmpty(jsonStr)) { |
| | | Gson gson = new Gson(); |
| | | LogManager.saveWeather(jsonStr); |
| | | // System.out.println("HomeFragment.onSuccess " + jsonStr); |
| | | // System1.out.println("HomeFragment.onSuccess " + jsonStr); |
| | | WeatherData data = gson.fromJson(jsonStr, WeatherData.class); |
| | | Bitmap bitmap = null; |
| | | try { |
| | |
| | | mHandler.postDelayed(runnable, 12 * 60 * 60 * 1000); |
| | | return; |
| | | } |
| | | // System.out.println("HomeFragment.run 1 "); |
| | | // System1.out.println("HomeFragment.run 1 "); |
| | | HeWeather.getWeatherNow(mainActivity(), "CN101010300", Lang.CHINESE_SIMPLIFIED, Unit.METRIC, |
| | | new HeWeather.OnResultWeatherNowBeanListener() { |
| | | public void onError(Throwable e) { |
| | | System.out.println("HomeFragment.onError " + e.getMessage()); |
| | | System1.out.println("HomeFragment.onError " + e.getMessage()); |
| | | number += 1; |
| | | if (number < 5) { |
| | | // mHandler.postDelayed(runnable, 5000); |
| | |
| | | Gson gson = new Gson(); |
| | | String jsonStr = gson.toJson(dataObject.get(0)); |
| | | LogManager.saveWeather(jsonStr); |
| | | // System.out.println("HomeFragment.onSuccess " + jsonStr); |
| | | // System1.out.println("HomeFragment.onSuccess " + jsonStr); |
| | | //jsonStr {"now":{"cloud":"0","cond_code":"100","cond_txt":"晴","fl":"-5","hum":"27","pcpn":"0.0","pres":"1037","tmp":"-1","vis":"16","wind_deg":"65","wind_dir":"东北风","wind_sc":"2","wind_spd":"11"},"basic":{"admin_area":"北京","cid":"CN101010300","cnty":"中国","lat":"39.92148972","location":"朝阳","lon":"116.48641205","parent_city":"北京","tz":"+8.00"},"status":"ok","update":{"loc":"2019-11-25 09:12","utc":"2019-11-25 01:12"}} |
| | | WeatherData data = gson.fromJson(jsonStr, WeatherData.class); |
| | | Bitmap bitmap = null; |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | try { |
| | | // System.out.println("HomeFragment.SetWeatherData"); |
| | | // System1.out.println("HomeFragment.SetWeatherData"); |
| | | // mainActivity().secondaryDisplay.temp.setTextColor(Color.parseColor("#feb739")); |
| | | // mainActivity().secondaryDisplay.temp.setText(data.now.tmp + "°C"); |
| | | // mainActivity().secondaryDisplay.address.setText("地点:" + data.basic.admin_area + data.basic.location); |
| | |
| | | |
| | | @Click |
| | | void test3() { |
| | | List<ModelAdapter> list = BaseSettingManager.findBaseSettingList("select * from base_setting"); |
| | | for (int i = 1; i < list.size(); i++) { |
| | | BaseSettingManager.deleteBaseSetting(list.get(i)); |
| | | } |
| | | |
| | | } |
| | | |
| | | public void checkCardService() { |