@Override public void widgetClick(View v) { super.widgetClick(v); if (v.getId() == R.id.private_order_back) { this.finish(); } else { if (v.getId() == R.id.private_order_item1) { if (curBtn != 1) { clickBtn = 1; moveAnimation(curBtn - clickBtn); curBtn = 1; } } else if (v.getId() == R.id.private_order_item2) { if (curBtn != 2) { clickBtn = 2; moveAnimation(curBtn - clickBtn); curBtn = 2; } } else if (v.getId() == R.id.private_order_item3) { if (curBtn != 3) { clickBtn = 3; moveAnimation(curBtn - clickBtn); curBtn = 3; } } if (curBtn == 1) { foodBtn.setTextColor(this.getResources().getColor(R.color.ajk_selected)); textileBtn.setTextColor(this.getResources().getColor(R.color.ajk)); washBtn.setTextColor(this.getResources().getColor(R.color.ajk)); type = "food"; HttpMemberShoppeRequest request = new HttpMemberShoppeRequest(aty, mHandler, 1); request.getMemberShoppeInit(type, -1); request.start(); } else if (curBtn == 2) { foodBtn.setTextColor(this.getResources().getColor(R.color.ajk)); textileBtn.setTextColor(this.getResources().getColor(R.color.ajk_selected)); washBtn.setTextColor(this.getResources().getColor(R.color.ajk)); type = "textile"; HttpMemberShoppeRequest request = new HttpMemberShoppeRequest(aty, mHandler, 1); request.getMemberShoppeInit(type, -1); request.start(); } else if (curBtn == 3) { foodBtn.setTextColor(this.getResources().getColor(R.color.ajk)); textileBtn.setTextColor(this.getResources().getColor(R.color.ajk)); washBtn.setTextColor(this.getResources().getColor(R.color.ajk_selected)); type = "wash"; HttpMemberShoppeRequest request = new HttpMemberShoppeRequest(aty, mHandler, 1); request.getMemberShoppeInit(type, -1); request.start(); } } }
@Override public void initData() { super.initData(); ActivityManager.getInstace().addActivity(aty); adapter = new MemberShoppeListAdapter(list, aty); type = "food"; HttpMemberShoppeRequest request = new HttpMemberShoppeRequest(aty, mHandler, 1); request.getMemberShoppeInit(type, -1); request.start(); }
@Override public boolean onFling(MotionEvent e1, MotionEvent e2, float arg2, float arg3) { if ((e2.getX() - e1.getX()) > 120 && Math.abs(e2.getY() - e1.getY()) < 50) { if (curBtn > 1) { clickBtn--; moveAnimation(curBtn - clickBtn); curBtn--; if (curBtn == 1) { foodBtn.setTextColor(this.getResources().getColor(R.color.ajk_selected)); textileBtn.setTextColor(this.getResources().getColor(R.color.ajk)); washBtn.setTextColor(this.getResources().getColor(R.color.ajk)); type = "food"; HttpMemberShoppeRequest request = new HttpMemberShoppeRequest(aty, mHandler, 1); request.getMemberShoppeInit(type, -1); request.start(); } else if (curBtn == 2) { foodBtn.setTextColor(this.getResources().getColor(R.color.ajk)); textileBtn.setTextColor(this.getResources().getColor(R.color.ajk_selected)); washBtn.setTextColor(this.getResources().getColor(R.color.ajk)); type = "textile"; HttpMemberShoppeRequest request = new HttpMemberShoppeRequest(aty, mHandler, 1); request.getMemberShoppeInit(type, -1); request.start(); } else if (curBtn == 3) { foodBtn.setTextColor(this.getResources().getColor(R.color.ajk)); textileBtn.setTextColor(this.getResources().getColor(R.color.ajk)); washBtn.setTextColor(this.getResources().getColor(R.color.ajk_selected)); type = "wash"; HttpMemberShoppeRequest request = new HttpMemberShoppeRequest(aty, mHandler, 1); request.getMemberShoppeInit(type, -1); request.start(); } } } else if ((e2.getX() - e1.getX()) < -120 && Math.abs(e2.getY() - e1.getY()) < 50) { if (curBtn < 3) { clickBtn++; moveAnimation(curBtn - clickBtn); curBtn++; if (curBtn == 1) { foodBtn.setTextColor(this.getResources().getColor(R.color.ajk_selected)); textileBtn.setTextColor(this.getResources().getColor(R.color.ajk)); washBtn.setTextColor(this.getResources().getColor(R.color.ajk)); type = "food"; HttpMemberShoppeRequest request = new HttpMemberShoppeRequest(aty, mHandler, 1); request.getMemberShoppeInit(type, -1); request.start(); } else if (curBtn == 2) { foodBtn.setTextColor(this.getResources().getColor(R.color.ajk)); textileBtn.setTextColor(this.getResources().getColor(R.color.ajk_selected)); washBtn.setTextColor(this.getResources().getColor(R.color.ajk)); type = "textile"; HttpMemberShoppeRequest request = new HttpMemberShoppeRequest(aty, mHandler, 1); request.getMemberShoppeInit(type, -1); request.start(); } else if (curBtn == 3) { foodBtn.setTextColor(this.getResources().getColor(R.color.ajk)); textileBtn.setTextColor(this.getResources().getColor(R.color.ajk)); washBtn.setTextColor(this.getResources().getColor(R.color.ajk_selected)); type = "wash"; HttpMemberShoppeRequest request = new HttpMemberShoppeRequest(aty, mHandler, 1); request.getMemberShoppeInit(type, -1); request.start(); } } if ((e2.getX() - e1.getX()) > 50 && Math.abs(e2.getY() - e1.getY()) < 120) { if (menuWindow == null) { menuWindow = new PersonalPopupWindow(aty); // 显示窗口 menuWindow.showAtLocation( this.findViewById(R.id.private_order), Gravity.LEFT | Gravity.BOTTOM, 0, 0); menuWindow.setOnDismissListener( new OnDismissListener() { @Override public void onDismiss() { Method method = new Method(aty); method.backgroundAlpha(1f); menuWindow = null; } }); } } } return true; }