public void cancelOrder(boolean withoutNotice) { if (withoutNotice == false) { UiUtils.showDialog( mActivity, R.string.caption_hint, R.string.message_order_cancel, R.string.btn_yes, R.string.btn_no, new AppDialog.OnClickListener() { @Override public void onDialogClick(int nButtonId) { if (nButtonId == AppDialog.BUTTON_POSITIVE) { cancelOrder(true); } } }); return; } ToolUtil.sendTrack( mActivity.getClass().getName(), mActivity.getString(R.string.tag_OrderDetailActivity), OrderDetailActivity.class.getName(), mActivity.getString(R.string.tag_OrderDetailActivity), "03012"); final String orderCharId = mOrderModel.getOrderCharId(); OnSuccessListener<JSONObject> success = new OnSuccessListener<JSONObject>() { @Override public void onSuccess(JSONObject v, Response response) { mActivity.closeProgressLayer(); if (v.optInt("errno", -1) == 0) { mActivity.setIsOperate(true); mActivity.initOrderDetailView(); // Report for canceling order. StatisticsEngine.trackEvent(mActivity, "cancel_order", "orderId=" + orderCharId); AppStorage.setData(AppStorage.SCOPE_DEFAULT, AppStorage.KEY_MINE_RELOAD, "1", false); } else { String data = v.optString("data", ""); data = data.equals("") ? Config.NORMAL_ERROR : data; UiUtils.makeToast(mActivity, data); } } }; mActivity.showProgressLayer("正在取消订单, 请稍候..."); mOrderControl.orderCancel(orderCharId, false, success, mActivity); }
@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); }
@SuppressWarnings("unchecked") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_filter); Intent intent = getIntent(); if (intent.getSerializableExtra(REQUEST_SEARCH_MODEL) == null) { UiUtils.makeToast(this, R.string.params_empty, true); finish(); return; } mSearchModel = (SearchModel) intent.getSerializableExtra(REQUEST_SEARCH_MODEL); if (null != intent.getSerializableExtra(REQUEST_SEARCH_CATEGORY_MODEL)) { mSearchCategoryModels = (ArrayList<SearchCategoryModel>) intent.getSerializableExtra(REQUEST_SEARCH_CATEGORY_MODEL); } total_num = intent.getIntExtra(FilterCategoryActivity.TOTAL_COUNT, -1); mExpandableListView = (ExpandableListView) findViewById(R.id.filter_expandablelistview); mButtonConfirm = (Button) findViewById(R.id.filter_button_confirm); mButtonClear = (Button) findViewById(R.id.filter_button_clear); String strTitle = (null == mSearchModel.getCategoryName() || mSearchModel.getCategoryName().equals("")) ? "筛选" : mSearchModel.getCategoryName(); loadNavBar(R.id.filter_navigation_bar, strTitle); mButtonConfirm.setOnClickListener(this); mButtonClear.setOnClickListener(this); mSearchFilterParser = new SearchFilterParser(); mExpandableListView.setOnChildClickListener( new OnChildClickListener() { @Override public boolean onChildClick( ExpandableListView parent, View view, int groupPosition, int childPosition, long id) { SearchFilterOptionModel mSearchFilterOptionModel = (SearchFilterOptionModel) mFilterAdapter.getChild(groupPosition, childPosition); CheckBox box = (CheckBox) view.findViewById(R.id.filteroption_checkbox); boolean checked = box.isChecked(); box.setChecked(!checked); mSearchFilterOptionModel.setSelect(!checked); mFilterAdapter.notifyDataSetChanged(); return false; } }); mExpandableListView.setOnGroupExpandListener( new OnGroupExpandListener() { @Override public void onGroupExpand(int currentGroupId) { for (int nId = 0; nId < mFilterAdapter.getGroupCount(); nId++) { if (nId != currentGroupId) { mExpandableListView.collapseGroup(nId); } } } }); mHeaderView = LayoutInflater.from(this).inflate(R.layout.adapter_filter_attr_header, null); selectedViewContainer = (RelativeLayout) mHeaderView.findViewById(R.id.filter_select_class); mHasGoodView = (ImageView) mHeaderView.findViewById(R.id.filter_sale_status); selectedCategoryView = (TextView) mHeaderView.findViewById(R.id.filter_category_selected); initData(); }