| | |
| | | |
| | | import com.basic.security.BuildConfig; |
| | | import com.basic.security.R; |
| | | import com.basic.security.base.BaseApplication; |
| | | import com.basic.security.base.BaseFragment; |
| | | import com.basic.security.manager.impl.cblite.BaseManager; |
| | | import com.basic.security.manager.RecognizeManager; |
| | | import com.basic.security.manager.impl.cblite.BaseSettingManager; |
| | | import com.basic.security.utils.Constants; |
| | | import com.basic.security.utils.WeatherData; |
| | | import com.basic.security.utils.FastDFSUtil; |
| | | import com.basic.security.utils.FileUtil; |
| | | import com.basic.security.utils.SystemUtils; |
| | | import com.basic.security.utils.ToastUtil; |
| | | import com.basic.security.utils.WeatherData; |
| | | import com.basic.security.widget.ConfirmDialog; |
| | | import com.couchbase.lite.Expression; |
| | | import com.basic.security.model.ModelAdapter; |
| | | import com.google.gson.Gson; |
| | | |
| | | import org.androidannotations.annotations.AfterViews; |
| | | import org.androidannotations.annotations.Background; |
| | | import org.androidannotations.annotations.Click; |
| | | import org.androidannotations.annotations.EFragment; |
| | | import org.androidannotations.annotations.UiThread; |
| | |
| | | |
| | | @ViewById |
| | | ImageView weather_icon; |
| | | |
| | | @ViewById |
| | | Button test1, test2, test3; |
| | | Handler mHandler = new Handler(); |
| | | private boolean isFirst = true; |
| | | |
| | | private int number = 0; |
| | | Runnable runnable = new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | HeWeather.getWeatherNow(mainActivity(), "CN101010300", Lang.CHINESE_SIMPLIFIED, Unit.METRIC, |
| | | new HeWeather.OnResultWeatherNowBeanListener() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | // ToastUtil.show(e.getMessage()); |
| | | Log.e("getWeatherNow", e.getMessage() + number); |
| | | number += 1; |
| | | if (number < 5) { |
| | | // System.out.println("HomeFragment.onError 1"); |
| | | // mHandler.postDelayed(runnable, 60 * 60 * 5000); |
| | | } else { |
| | | System.out.println("HomeFragment.onError 2"); |
| | | mHandler.postDelayed(runnable, 6*60 * 60 * 1000); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onSuccess(List dataObject) { |
| | | System.out.println("HomeFragment.onSuccess 3"); |
| | | Gson gson = new Gson(); |
| | | // Log.e("successWeather", gson.toJson(dataObject.get(0))); |
| | | WeatherData data = gson.fromJson(gson.toJson(dataObject.get(0)), WeatherData.class); |
| | | SetWeatherData(data); |
| | | mHandler.postDelayed(runnable, 6*60 * 60 * 1000); |
| | | } |
| | | }); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | }; |
| | | |
| | | @Override |
| | | public void show() { |
| | |
| | | |
| | | } |
| | | // 解决如果菜单栏显示,长时间不操作返回首页,菜单栏显示的问题 |
| | | Fragment fragment_menu = ((MenuFragment) mainActivity().fragment_menu); |
| | | Fragment fragment_menu = mainActivity().fragment_menu; |
| | | if (fragment_menu.isVisible()) { |
| | | FragmentManager fm = getFragmentManager(); |
| | | fm.beginTransaction() |
| | |
| | | }); |
| | | weather_image_view.setClipToOutline(true); |
| | | mHandler.postDelayed(runnable, 5000); |
| | | temp.setVisibility(View.GONE); |
| | | } |
| | | |
| | | |
| | | Handler mHandler = new Handler(); |
| | | |
| | | Runnable runnable = new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | HeWeather.getWeatherNow(mainActivity(), "CN101010300", Lang.CHINESE_SIMPLIFIED, Unit.METRIC, |
| | | new HeWeather.OnResultWeatherNowBeanListener() { |
| | | @Override |
| | | public void onError(Throwable e) { |
| | | // ToastUtil.show(e.getMessage()); |
| | | Log.e("getWeatherNow", e.getMessage() + number); |
| | | number += 1; |
| | | if (number < 5) { |
| | | mHandler.postDelayed(runnable, 5000); |
| | | } else { |
| | | mHandler.postDelayed(runnable, 10 * 60 * 1000); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onSuccess(List dataObject) { |
| | | Gson gson = new Gson(); |
| | | // Log.e("successWeather", gson.toJson(dataObject.get(0))); |
| | | WeatherData data = gson.fromJson(gson.toJson(dataObject.get(0)), WeatherData.class); |
| | | SetWeatherData(data); |
| | | mHandler.postDelayed(runnable, 10 * 60 * 1000); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | }; |
| | | |
| | | @UiThread |
| | | public void SetWeatherData(WeatherData data) { |
| | |
| | | } |
| | | } |
| | | |
| | | @ViewById |
| | | Button test1, test2, test3; |
| | | |
| | | // @Click |
| | | // void test1() { |
| | | // TestSubscribe.getTestDoGet(new VisitRecordTO(), new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() { |
| | |
| | | // })); |
| | | // } |
| | | |
| | | @Background |
| | | public void check() { |
| | | BaseApplication.getApplication().executorService.execute(() -> { |
| | | FastDFSUtil.testUpload("/dsf/dsf/cdfgg", "jpg"); |
| | | }); |
| | | } |
| | | |
| | | @Click |
| | |
| | | |
| | | @Click |
| | | void test3() { |
| | | Expression expression = Expression.property("table").equalTo(Expression.string("base_setting")); |
| | | // Expression expression = Expression.property("table").equalTo(Expression.string("user")); |
| | | List<ModelAdapter> list = BaseSettingManager.findBaseSettingList(expression); |
| | | |
| | | for (int i = 1; i < list.size(); i++) { |
| | | BaseSettingManager.deleteBaseSetting(list.get(i)); |
| | | } |
| | | // Expression expression = Expression.property("table").equalTo(Expression.string("base_setting")); |
| | | //// Expression expression = Expression.property("table").equalTo(Expression.string("user")); |
| | | // List<ModelAdapter> list = BaseSettingManager.findBaseSettingList(expression); |
| | | // |
| | | // for (int i = 1; i < list.size(); i++) { |
| | | // BaseSettingManager.deleteBaseSetting(list.get(i)); |
| | | // } |
| | | |
| | | } |
| | | |