| | |
| | | import android.os.Handler; |
| | | import android.os.Message; |
| | | import android.text.InputType; |
| | | import android.view.KeyEvent; |
| | | import android.view.MotionEvent; |
| | | import android.view.View; |
| | | import android.view.WindowManager; |
| | | import android.view.inputmethod.InputMethodManager; |
| | | import android.widget.CompoundButton; |
| | | import android.widget.EditText; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.ImageView; |
| | |
| | | |
| | | import com.alibaba.baichuan.trade.biz.login.AlibcLogin; |
| | | import com.alibaba.baichuan.trade.biz.login.AlibcLoginCallback; |
| | | import com.androidquery.AQuery; |
| | | import com.bumptech.glide.Glide; |
| | | import com.tejia.lijin.app.ShoppingApplication; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.wpc.library.RetainViewFragment; |
| | | import com.wpc.library.util.common.StringUtils; |
| | | import com.tejia.lijin.app.BasicTextHttpResponseHandler; |
| | |
| | | /** |
| | | * 订单找回 fragment |
| | | */ |
| | | public class FragmentOrderAppeal extends RetainViewFragment implements View.OnClickListener { |
| | | public class FragmentOrderAppeal extends RetainViewFragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener { |
| | | private TextView tv_refer_appeal, tv_order_appeal_doubt; |
| | | private EditText et_orderId; |
| | | private TextView tv_notice_content, iv_order_coursetxt; |
| | | private LinearLayout ll_notice; |
| | | private ImageView iv_close; |
| | | private ScrollView sv_content; |
| | | private TextView tv_order_appeal_aout;//自动找回 |
| | | private ImageView iv_order_course;//图片教程 |
| | | |
| | | private int clickState = 0; |
| | | private Bundle mBundle;//传递过来的值 |
| | | private String TYPE = "orderFind";//默认淘宝 |
| | | private AQuery mAQuery; |
| | | |
| | | @Override |
| | | public int getContentResource() { |
| | |
| | | |
| | | @Override |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | mAQuery = new AQuery(contentView); |
| | | tv_refer_appeal = contentView.findViewById(R.id.tv_refer_appeal); |
| | | tv_order_appeal_doubt = contentView.findViewById(R.id.tv_order_appeal_doubt); |
| | | et_orderId = contentView.findViewById(R.id.et_order_id); |
| | |
| | | tv_notice_content = contentView.findViewById(R.id.tv_notice_content); |
| | | ll_notice = contentView.findViewById(R.id.ll_notice); |
| | | iv_close = contentView.findViewById(R.id.iv_close); |
| | | sv_content = contentView.findViewById(R.id.sv_content); |
| | | iv_order_coursetxt = contentView.findViewById(R.id.iv_order_coursetxt); |
| | | iv_order_course = contentView.findViewById(R.id.iv_order_course); |
| | | mAQuery.id(R.id.cb_tb).getCheckBox().setOnCheckedChangeListener(this); |
| | | mAQuery.id(R.id.cb_jd).getCheckBox().setOnCheckedChangeListener(this); |
| | | mAQuery.id(R.id.cb_pdd).getCheckBox().setOnCheckedChangeListener(this); |
| | | mAQuery.id(R.id.cb_vip).getCheckBox().setOnCheckedChangeListener(this); |
| | | mAQuery.id(R.id.cb_suning).getCheckBox().setOnCheckedChangeListener(this); |
| | | mAQuery.id(R.id.cb_elme).getCheckBox().setOnCheckedChangeListener(this); |
| | | |
| | | |
| | | et_orderId.setCursorVisible(true); |
| | | et_orderId.setOnClickListener(this); |
| | | et_orderId.setOnEditorActionListener(new TextView.OnEditorActionListener() { |
| | | @Override |
| | | public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { |
| | | tv_refer_appeal.performClick(); |
| | | return true; |
| | | } |
| | | }); |
| | | tv_refer_appeal.setOnClickListener(this); |
| | | tv_order_appeal_doubt.setOnClickListener(this); |
| | | tv_order_appeal_aout.setOnClickListener(this); |
| | |
| | | //如果上面的代码没有弹出软键盘 可以使用下面另一种方式 |
| | | //InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); |
| | | // imm.showSoftInput(editText, 0); |
| | | sv_content.fullScroll(ScrollView.FOCUS_DOWN); |
| | | } |
| | | |
| | | private int showCount = 0; |
| | |
| | | return; |
| | | } |
| | | |
| | | ShoppingApi.setOrderAppeal(getContext(), et_orderId.getText().toString(), uid, mBundle.getInt("id") + "", new BasicTextHttpResponseHandler() { |
| | | Integer type = getCheckSourceType(); |
| | | if (type == null) { |
| | | Toast.makeText(getContext(), "请选择订单渠道", Toast.LENGTH_SHORT).show(); |
| | | return; |
| | | } |
| | | |
| | | |
| | | ShoppingApi.setOrderAppeal(getContext(), et_orderId.getText().toString(), uid, type + "", new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | |
| | | if (pd != null && pd.isShowing()) |
| | | pd.dismiss(); |
| | | } |
| | | |
| | | int[] sourceIds = new int[]{R.id.cb_tb, R.id.cb_jd, R.id.cb_pdd, R.id.cb_vip, R.id.cb_suning, R.id.cb_elme}; |
| | | |
| | | @Override |
| | | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
| | | if (isChecked) { |
| | | for (int id : sourceIds) { |
| | | if (id != buttonView.getId()) { |
| | | mAQuery.id(id).checked(false); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private Integer getCheckSourceType() { |
| | | |
| | | int selectId = -1; |
| | | for (int id : sourceIds) { |
| | | if (mAQuery.id(id).isChecked()) { |
| | | selectId = id; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | switch (selectId) { |
| | | case R.id.cb_tb: |
| | | return Constant.GOODS_TYPE_TB; |
| | | case R.id.cb_jd: |
| | | return Constant.GOODS_TYPE_JD; |
| | | case R.id.cb_pdd: |
| | | return Constant.GOODS_TYPE_PDD; |
| | | case R.id.cb_vip: |
| | | return Constant.GOODS_TYPE_VIP; |
| | | case R.id.cb_suning: |
| | | return Constant.GOODS_TYPE_SUNING; |
| | | case R.id.cb_elme: |
| | | return Constant.GOODS_TYPE_TB; |
| | | } |
| | | return null; |
| | | |
| | | } |
| | | |
| | | |
| | | } |