@Override public void onSuccess(ArrayList<SearchFilterAttributeModel> data, Response response) { if (!mSearchFilterParser.isSuccess()) { closeLoadingLayer(true); UiUtils.makeToast( this, TextUtils.isEmpty(mSearchFilterParser.getErrMsg()) ? Config.NORMAL_ERROR : mSearchFilterParser.getErrMsg()); return; } IPageCache cache = new IPageCache(); cache.set(getCacheKey(), mSearchFilterParser.getString(), 3600 * 24); requestFinish(data); }
private void initData() { IPageCache cache = new IPageCache(); String data = cache.get(getCacheKey()); if (data != null) { ArrayList<SearchFilterAttributeModel> models; try { models = mSearchFilterParser.parse(data); } catch (Exception ex) { Log.e(LOG_TAG, ex); models = null; } if (models != null) { requestFinish(models); return; } } showLoadingLayer(); String option = mSearchModel.getOption(); mSearchModel.setOption(null); String strUrl = SearchHelper.getSearchUrlParamter(mSearchModel); strUrl += "&dtype=attr"; Ajax ajax = ServiceConfig.getAjax(Config.URL_SEARCH_NEW, strUrl); if (null == ajax) return; mSearchModel.setOption(option); ajax.setParser(mSearchFilterParser); ajax.setOnSuccessListener(this); ajax.setOnErrorListener( new OnErrorListener() { @Override public void onError(Ajax ajax, Response response) { FilterActivity.this.onError(ajax, response); } }); ajax.send(); addAjax(ajax); }