/** * ********************************************** * * @return void 返回类型 * @throws @Title: init @Description: TODO(初始化数据) 设定文件 * @date 2014-11-19 *********************************************** */ @InjectInit public void init() { db = Ioc.getIoc().getDb("/sdcard/MTM/", Constants.APP_DATABASE); dataList = new ArrayList<HashMap<String, String>>(); initView(); mImageFetcher = new ImageDownloader(getActivity(), 300); mImageFetcher.setLoadingImage(R.drawable.default_load_image); eventBus.register(this, "onEventPostRoomList"); // 设置list列表间距 srla = new ConditionsRoomAdapter( activity, listview_roomlist, dataList, R.layout.reservation_screeningroom_item); listview_roomlist.setAdapter(srla); // 这里是设置里面的文字 可以不设置 默认有 PullToRefreshManager.getInstance().setRelease_label("松开后刷新"); PullToRefreshManager.getInstance() .setUpdateTime(org.apache.http.impl.cookie.DateUtils.formatDate(new Date(), "yyyy-MM-dd")); showDialog(); ajaxRoomList(1); ajaxPOST(); gallery_hotel.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { startActivity(new Intent(getActivity(), HotelViewPagerActivity.class)); } }); search_layout.setVisibility(View.GONE); }
/** * ********************************************** * * @param r 设定文件 * @return void 返回类型 * @throws @Title: result @Description: (推荐房间返回) * @date 2014-11-19 *********************************************** */ @InjectHttpOk(1) public void result(ResponseEntity r) { dismissDialog(); switch (r.getStatus()) { case FastHttp.result_ok: ArrayList<HashMap<String, String>> list = null; try { // if (ResultParse.reservationIsResultOK(r, activity)) { String json = Handler_Json.getValue("list", r.getContentAsString()).toString(); String s = Handler_Json.getValue("pageNo", r.getContentAsString()).toString(); pageNo = Integer.valueOf(s) + 1; if (!"".equals(json)) { // 判断查询数据是否为空 , list = Handler_Json.JsonToCollection(json); getList(list); } else { // 为空数据 初始化当前页数1 ,展示无数据图片 // pageNo = 1; // dataList.clear(); Toast.makeText(activity, "无数据", Toast.LENGTH_SHORT).show(); } Ioc.getIoc().getLogger().i(" 完成 刷新"); // } } catch (Exception e) { e.printStackTrace(); } break; case FastHttp.result_net_err: Toast.makeText(activity, "请求错误", Toast.LENGTH_SHORT).show(); break; } // 完成 加载更多 PullToRefreshManager.getInstance().onFooterRefreshComplete(); // 完成 刷新 PullToRefreshManager.getInstance().onHeaderRefreshComplete(); // 关闭顶部的下拉 PullToRefreshManager.getInstance().headerUnable(); // 打开顶部的下拉 PullToRefreshManager.getInstance().headerEnable(); // 关闭底部的加载 PullToRefreshManager.getInstance().footerUnable(); // 打开顶部的加载 PullToRefreshManager.getInstance().footerEnable(); }