@Override public void doPayment(Activity activity, Map<String, String> map, ResultCallback cb) throws Exception { if (activity != null) { PayTask alipay = new PayTask(activity); String param = createAlipayUrl(map); LogUtil.d(TAG, "alipay param=" + param); String alipayResult = alipay.pay(param); LogUtil.d(TAG, "alipay result=" + alipayResult); PayResult result = AliConfig.parseAlipayResult(alipayResult); cb.onPaymentFeedback(result); } else { PayResult result = new PayResult(); result.resultCode = PaymentResultCode.Result.Failed; result.errorCode = PaymentResultCode.ErrorCode.ParamErr; cb.onPaymentFeedback(result); } }
/** 弹出生日选择框 void */ private void showBirthdayDialog() { if (mBirthdayDialog == null) { mBirthdayDialog = CommonDialogFactory.getDialog(this, R.style.Theme_Ptui_Dialog_Wheel); mBirthdayDialog.setTitle(getString(R.string.putao_personal_data_birthday)); mBirthdayDialog.setNegativeButton( R.string.putao_cancel, new OnClickListener() { @Override public void onClick(View view) { mBirthdayDialog.dismiss(); } }); mBirthdayDialog.setPositiveButton( R.string.putao_confirm, new OnClickListener() { @Override public void onClick(View view) { mBirthdayDialog.dismiss(); mChangeFlag = true; int year = mYearWheelView.getCurrentItem() + mCurrentYear - 100; int month = mMonthWheelView.getCurrentItem() + 1; int day = mDayWheelView.getCurrentItem() + 1; StringBuilder sb = new StringBuilder(); sb.append(year).append("-").append(month).append("-").append(day); mBirthdaySTR = sb.toString(); mBirthdayTextView.setText(mBirthdaySTR); } }); LinearLayout wheelContainer = (LinearLayout) mBirthdayDialog.getContainerLayout(); // 年,年月的滚动控件不用设置滚动事件监听 Calendar calendar = Calendar.getInstance(); mCurrentYear = calendar.get(Calendar.YEAR); mYearWheelView = (WheelView) wheelContainer.findViewById(R.id.wheel_left); mYearWheelView.setVisibleItems(3); mYearAdapter = new WheelNumericAdapter( this, mCurrentYear - 100, mCurrentYear, getString(R.string.putao_personal_data_year)); mYearWheelView.setViewAdapter(mYearAdapter); // 月 mMonthWheelView = (WheelView) wheelContainer.findViewById(R.id.wheel_center); mMonthWheelView.setVisibleItems(3); mMonthAdapter = new WheelNumericAdapter(this, 1, 12, getString(R.string.putao_personal_data_month)); mMonthWheelView.setViewAdapter(mMonthAdapter); // 日 mDayWheelView = (WheelView) wheelContainer.findViewById(R.id.wheel_right); mDayWheelView.setVisibleItems(3); OnWheelChangedListener listener = new OnWheelChangedListener() { @Override public void onChanged(WheelView wheel, int oldValue, int newValue) { // 只要是年月发生变化,就要去检查日是否也联动发生变化 updateDays(mYearWheelView, mMonthWheelView, mDayWheelView); } }; mYearWheelView.addChangingListener(listener); mMonthWheelView.addChangingListener(listener); updateDays(mYearWheelView, mMonthWheelView, mDayWheelView); } // mBirthdaySTR是否为空 if (!TextUtils.isEmpty(mBirthdaySTR)) { try { String[] date = mBirthdaySTR.split("-"); String year = ""; String month = ""; String day = ""; if (date.length > 0) { year = date[0]; } // 将year转为为year index if (!TextUtils.isEmpty(year)) { int yearIndex = Integer.parseInt(year) - (mCurrentYear - 100); mYearWheelView.setCurrentItem(yearIndex); } if (date.length > 1) { month = date[1]; } // 将month转化为month index if (!TextUtils.isEmpty(month)) { int monthIndex = Integer.parseInt(month) - 1; mMonthWheelView.setCurrentItem(monthIndex); } if (date.length > 2) { day = date[2]; } // 将day转化为day index if (!TextUtils.isEmpty(day)) { int dayIndex = Integer.parseInt(day) - 1; mDayWheelView.setCurrentItem(dayIndex); } } catch (Exception e) { LogUtil.w("YellowpagePersonalInfoActivity", "catch Exception throw by choosePicture", e); } } else { mYearWheelView.setCurrentItem(73); } mBirthdayDialog.show(); }