|
|
@@ -1,35 +1,39 @@
|
|
|
package com.webrain.dailypay.ui.activity.identity;
|
|
|
|
|
|
-import android.content.Context;
|
|
|
+import android.Manifest;
|
|
|
import android.content.Intent;
|
|
|
-import android.graphics.Color;
|
|
|
import android.os.Bundle;
|
|
|
+import android.os.StrictMode;
|
|
|
+import android.support.annotation.Nullable;
|
|
|
import android.support.v7.widget.CardView;
|
|
|
-import android.view.MotionEvent;
|
|
|
import android.view.View;
|
|
|
import android.widget.Button;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.FrameLayout;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
+import android.widget.RadioButton;
|
|
|
+import android.widget.RadioGroup;
|
|
|
import android.widget.RelativeLayout;
|
|
|
import android.widget.ScrollView;
|
|
|
+import android.widget.TextView;
|
|
|
|
|
|
-import com.bigkoo.pickerview.adapter.NumericWheelAdapter;
|
|
|
-import com.contrarywind.listener.OnItemSelectedListener;
|
|
|
-import com.contrarywind.view.WheelView;
|
|
|
+import com.webrain.baselibrary.IntentConstant;
|
|
|
+import com.webrain.baselibrary.imageloader.ImageLoaderUtil;
|
|
|
+import com.webrain.baselibrary.utils.PermissionsUtils;
|
|
|
import com.webrain.baselibrary.utils.PxUtils;
|
|
|
import com.webrain.dailypay.R;
|
|
|
+import com.webrain.dailypay.ui.activity.image.PickImageActivity;
|
|
|
import com.webrain.dailypay.ui.base.BaseActivity;
|
|
|
-import com.webrain.dailypay.ui.base.BaseViewHolder;
|
|
|
import com.webrain.dailypay.ui.mvp.contacts.IdentityCompanyContacts;
|
|
|
import com.webrain.dailypay.ui.mvp.presenter.IdentityCompanyPresenter;
|
|
|
-
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
+import com.webrain.dailypay.ui.viewholder.TimePickViewHolder;
|
|
|
+import com.webrain.dailypay.ui.widget.ShrinkAnimationLayout;
|
|
|
+import com.webrain.dailypay.utils.PhotoUtils;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
import butterknife.OnClick;
|
|
|
+import io.reactivex.functions.Consumer;
|
|
|
|
|
|
/**
|
|
|
* 企业用户身份认证
|
|
|
@@ -49,17 +53,31 @@ public class IdentityCompanyActivity extends BaseActivity<IdentityCompanyPresent
|
|
|
@BindView(R.id.rl_head)
|
|
|
RelativeLayout rlHead;
|
|
|
@BindView(R.id.te_company_name)
|
|
|
- EditText teCompanyName;
|
|
|
- @BindView(R.id.et_expiration_time)
|
|
|
- EditText etExpirationTime;
|
|
|
+ EditText etCompanyName;
|
|
|
+ @BindView(R.id.tv_expiration_time)
|
|
|
+ TextView tvExpirationTime;
|
|
|
@BindView(R.id.sv)
|
|
|
ScrollView sv;
|
|
|
- @BindView(R.id.ll_time_pick)
|
|
|
- LinearLayout llTimePick;
|
|
|
-
|
|
|
+ @BindView(R.id.sal_time_pick)
|
|
|
+ ShrinkAnimationLayout salTimePick;
|
|
|
+ @BindView(R.id.rb_long_valid)
|
|
|
+ RadioButton rbLongValid;
|
|
|
+ @BindView(R.id.rb_no_long_valid)
|
|
|
+ RadioButton rbNoLongValid;
|
|
|
+ @BindView(R.id.rg_valid)
|
|
|
+ RadioGroup rgValid;
|
|
|
+ @BindView(R.id.rb_yes)
|
|
|
+ RadioButton rbYes;
|
|
|
+ @BindView(R.id.rb_no)
|
|
|
+ RadioButton rbNo;
|
|
|
+ @BindView(R.id.rg_humen)
|
|
|
+ RadioGroup rgHumen;
|
|
|
+ @BindView(R.id.ll_time_over)
|
|
|
+ LinearLayout llTimeOver;
|
|
|
|
|
|
TimePickViewHolder timePickViewHolder;
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public int getLayoutId() {
|
|
|
return R.layout.activity_identity_company;
|
|
|
@@ -75,6 +93,11 @@ public class IdentityCompanyActivity extends BaseActivity<IdentityCompanyPresent
|
|
|
super.onCreate(savedInstanceState);
|
|
|
setBackColor(R.color.white);
|
|
|
initView();
|
|
|
+
|
|
|
+ // android 7.0系统解决拍照的问题
|
|
|
+ StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
|
|
|
+ StrictMode.setVmPolicy(builder.build());
|
|
|
+ builder.detectFileUriExposure();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -82,9 +105,27 @@ public class IdentityCompanyActivity extends BaseActivity<IdentityCompanyPresent
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- @OnClick(R.id.btn_submit)
|
|
|
+ @OnClick({R.id.btn_submit, R.id.iv_front, R.id.iv_reverse, R.id.tv_expiration_time})
|
|
|
public void onClick(View view) {
|
|
|
- startActivity(new Intent(mContext, IdentityResultActivity.class));
|
|
|
+ switch (view.getId()) {
|
|
|
+ case R.id.iv_front:
|
|
|
+ mvpPresenter.getImageType(0);
|
|
|
+ break;
|
|
|
+ case R.id.iv_reverse:
|
|
|
+ mvpPresenter.getImageType(1);
|
|
|
+ break;
|
|
|
+ case R.id.btn_submit:
|
|
|
+ mvpPresenter.realAuthentication(etCompanyName.getText().toString(), tvExpirationTime.getText().toString(), rgValid.getCheckedRadioButtonId() == R.id.rb_long_valid ? 1 : 0, rgHumen.getCheckedRadioButtonId() == R.id.rb_yes ? 1 : 0);
|
|
|
+ break;
|
|
|
+ case R.id.tv_expiration_time:
|
|
|
+ if (timePickViewHolder == null) {
|
|
|
+ timePickViewHolder = new TimePickViewHolder(mContext, sv, onDateChangeListener);
|
|
|
+ salTimePick.addView(timePickViewHolder.getView());
|
|
|
+ }
|
|
|
+ salTimePick.toggleExpand();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void initView() {
|
|
|
@@ -96,370 +137,93 @@ public class IdentityCompanyActivity extends BaseActivity<IdentityCompanyPresent
|
|
|
cvTitleLayoutParams.width = PxUtils.getDeviceWidth() + PxUtils.dip2px(54);
|
|
|
cvTitle.setLayoutParams(cvTitleLayoutParams);
|
|
|
|
|
|
- timePickViewHolder = new TimePickViewHolder(mContext);
|
|
|
- llTimePick.addView(timePickViewHolder.getView());
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- class TimePickViewHolder extends BaseViewHolder {
|
|
|
- private final int DEFAULT_START_YEAR = 1900;
|
|
|
- private final int DEFAULT_END_YEAR = 2100;
|
|
|
- private final int DEFAULT_START_MONTH = 1;
|
|
|
- private final int DEFAULT_END_MONTH = 12;
|
|
|
- private final int DEFAULT_START_DAY = 1;
|
|
|
- private final int DEFAULT_END_DAY = 31;
|
|
|
+ rgValid.setOnCheckedChangeListener(onCheckedChangeListener);
|
|
|
|
|
|
+ salTimePick.initExpand(false);
|
|
|
|
|
|
- private int startYear = DEFAULT_START_YEAR;
|
|
|
- private int endYear = DEFAULT_END_YEAR;
|
|
|
- private int startMonth = DEFAULT_START_MONTH;
|
|
|
- private int endMonth = DEFAULT_END_MONTH;
|
|
|
- private int startDay = DEFAULT_START_DAY;
|
|
|
- private int endDay = DEFAULT_END_DAY; //表示31天的
|
|
|
- private int currentYear;
|
|
|
|
|
|
- @BindView(R.id.wv_year)
|
|
|
- WheelView wvYear;
|
|
|
- @BindView(R.id.wv_month)
|
|
|
- WheelView wvMonth;
|
|
|
- @BindView(R.id.wv_day)
|
|
|
- WheelView wvDay;
|
|
|
-
|
|
|
- public TimePickViewHolder(Context mContext) {
|
|
|
- super(mContext);
|
|
|
- init();
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
+ RadioGroup.OnCheckedChangeListener onCheckedChangeListener = new RadioGroup.OnCheckedChangeListener() {
|
|
|
@Override
|
|
|
- public int bindViewLayoutId() {
|
|
|
- return R.layout.view_time_picker;
|
|
|
- }
|
|
|
-
|
|
|
- private void init() {
|
|
|
- wvYear.setTextSize(14);
|
|
|
- wvYear.setTextColorCenter(Color.WHITE);
|
|
|
- wvYear.setTextColorOut(mContext.getResources().getColor(R.color.time_picker_out));
|
|
|
- wvYear.setDividerColor(Color.TRANSPARENT);
|
|
|
- wvYear.setOnTouchListener(onTouchListener);
|
|
|
-
|
|
|
- wvMonth.setTextSize(14);
|
|
|
- wvMonth.setTextColorCenter(Color.WHITE);
|
|
|
- wvMonth.setTextColorOut(mContext.getResources().getColor(R.color.time_picker_out));
|
|
|
- wvMonth.setDividerColor(Color.TRANSPARENT);
|
|
|
- wvMonth.setOnTouchListener(onTouchListener);
|
|
|
-
|
|
|
- wvDay.setTextSize(14);
|
|
|
- wvDay.setTextColorCenter(Color.WHITE);
|
|
|
- wvDay.setTextColorOut(mContext.getResources().getColor(R.color.time_picker_out));
|
|
|
- wvDay.setDividerColor(Color.TRANSPARENT);
|
|
|
- wvDay.setOnTouchListener(onTouchListener);
|
|
|
-
|
|
|
- setSolar(2019, 5, 29);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 拦截ScrollView滚动冲突
|
|
|
- */
|
|
|
- View.OnTouchListener onTouchListener = new View.OnTouchListener() {
|
|
|
- @Override
|
|
|
- public boolean onTouch(View v, MotionEvent event) {
|
|
|
- if (event.getAction() == MotionEvent.ACTION_UP) {
|
|
|
- sv.requestDisallowInterceptTouchEvent(false);
|
|
|
- } else {
|
|
|
- sv.requestDisallowInterceptTouchEvent(true);
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- /**
|
|
|
- * 设置公历
|
|
|
- *
|
|
|
- * @param year
|
|
|
- * @param month
|
|
|
- * @param day
|
|
|
- */
|
|
|
- private void setSolar(int year, final int month, int day) {
|
|
|
- // 添加大小月月份并将其转换为list,方便之后的判断
|
|
|
- String[] months_big = {"1", "3", "5", "7", "8", "10", "12"};
|
|
|
- String[] months_little = {"4", "6", "9", "11"};
|
|
|
-
|
|
|
- final List<String> list_big = Arrays.asList(months_big);
|
|
|
- final List<String> list_little = Arrays.asList(months_little);
|
|
|
-
|
|
|
- wvYear.setAdapter(new NumericWheelAdapter(startYear, endYear));// 设置"年"的显示数据
|
|
|
-
|
|
|
- wvYear.setCurrentItem(year - startYear);// 初始化时显示的数据
|
|
|
- // 月
|
|
|
- if (startYear == endYear) {//开始年等于终止年
|
|
|
- wvMonth.setAdapter(new NumericWheelAdapter(startMonth, endMonth));
|
|
|
- wvMonth.setCurrentItem(month + 1 - startMonth);
|
|
|
- } else if (year == startYear) {
|
|
|
- //起始日期的月份控制
|
|
|
- wvMonth.setAdapter(new NumericWheelAdapter(startMonth, 12));
|
|
|
- wvMonth.setCurrentItem(month + 1 - startMonth);
|
|
|
- } else if (year == endYear) {
|
|
|
- //终止日期的月份控制
|
|
|
- wvMonth.setAdapter(new NumericWheelAdapter(1, endMonth));
|
|
|
- wvMonth.setCurrentItem(month);
|
|
|
+ public void onCheckedChanged(RadioGroup group, int checkedId) {
|
|
|
+ if (checkedId == R.id.rb_long_valid) {
|
|
|
+ llTimeOver.setVisibility(View.GONE);
|
|
|
} else {
|
|
|
- wvMonth.setAdapter(new NumericWheelAdapter(1, 12));
|
|
|
- wvMonth.setCurrentItem(month);
|
|
|
+ llTimeOver.setVisibility(View.VISIBLE);
|
|
|
}
|
|
|
- // 日
|
|
|
- if (startYear == endYear && startMonth == endMonth) {
|
|
|
- if (list_big.contains(String.valueOf(month + 1))) {
|
|
|
- if (endDay > 31) {
|
|
|
- endDay = 31;
|
|
|
- }
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(startDay, endDay));
|
|
|
- } else if (list_little.contains(String.valueOf(month + 1))) {
|
|
|
- if (endDay > 30) {
|
|
|
- endDay = 30;
|
|
|
- }
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(startDay, endDay));
|
|
|
- } else {
|
|
|
- // 闰年
|
|
|
- if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
|
|
|
- if (endDay > 29) {
|
|
|
- endDay = 29;
|
|
|
- }
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(startDay, endDay));
|
|
|
- } else {
|
|
|
- if (endDay > 28) {
|
|
|
- endDay = 28;
|
|
|
- }
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(startDay, endDay));
|
|
|
- }
|
|
|
- }
|
|
|
- wvDay.setCurrentItem(day - startDay);
|
|
|
- } else if (year == startYear && month + 1 == startMonth) {
|
|
|
- // 起始日期的天数控制
|
|
|
- if (list_big.contains(String.valueOf(month + 1))) {
|
|
|
-
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(startDay, 31));
|
|
|
- } else if (list_little.contains(String.valueOf(month + 1))) {
|
|
|
-
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(startDay, 30));
|
|
|
- } else {
|
|
|
- // 闰年
|
|
|
- if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
|
|
|
-
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(startDay, 29));
|
|
|
- } else {
|
|
|
-
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(startDay, 28));
|
|
|
- }
|
|
|
- }
|
|
|
- wvDay.setCurrentItem(day - startDay);
|
|
|
- } else if (year == endYear && month + 1 == endMonth) {
|
|
|
- // 终止日期的天数控制
|
|
|
- if (list_big.contains(String.valueOf(month + 1))) {
|
|
|
- if (endDay > 31) {
|
|
|
- endDay = 31;
|
|
|
- }
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(1, endDay));
|
|
|
- } else if (list_little.contains(String.valueOf(month + 1))) {
|
|
|
- if (endDay > 30) {
|
|
|
- endDay = 30;
|
|
|
- }
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(1, endDay));
|
|
|
- } else {
|
|
|
- // 闰年
|
|
|
- if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
|
|
|
- if (endDay > 29) {
|
|
|
- endDay = 29;
|
|
|
- }
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(1, endDay));
|
|
|
- } else {
|
|
|
- if (endDay > 28) {
|
|
|
- endDay = 28;
|
|
|
- }
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(1, endDay));
|
|
|
- }
|
|
|
- }
|
|
|
- wvDay.setCurrentItem(day - 1);
|
|
|
- } else {
|
|
|
- // 判断大小月及是否闰年,用来确定"日"的数据
|
|
|
- if (list_big.contains(String.valueOf(month + 1))) {
|
|
|
-
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(1, 31));
|
|
|
- } else if (list_little.contains(String.valueOf(month + 1))) {
|
|
|
-
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(1, 30));
|
|
|
- } else {
|
|
|
- // 闰年
|
|
|
- if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(1, 29));
|
|
|
- } else {
|
|
|
+ TimePickViewHolder.OnDateChangeListener onDateChangeListener = new TimePickViewHolder.OnDateChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onChangeDate(String date) {
|
|
|
+ tvExpirationTime.setText(date);
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(1, 28));
|
|
|
- }
|
|
|
- }
|
|
|
- wvDay.setCurrentItem(day - 1);
|
|
|
- }
|
|
|
|
|
|
- // 添加"年"监听
|
|
|
- wvYear.setOnItemSelectedListener(new OnItemSelectedListener() {
|
|
|
+ /**
|
|
|
+ * 拍照选择回调
|
|
|
+ *
|
|
|
+ * @param type
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void onImageType(String type, final int clickPosition) {
|
|
|
+ if (type.equals(getString(R.string.take_photo))) {
|
|
|
+ PermissionsUtils.requestPermissionToast((BaseActivity) mContext, new Consumer<Boolean>() {
|
|
|
@Override
|
|
|
- public void onItemSelected(int index) {
|
|
|
- int year_num = index + startYear;
|
|
|
- currentYear = year_num;
|
|
|
- int currentMonthItem = wvMonth.getCurrentItem();//记录上一次的item位置
|
|
|
- // 判断大小月及是否闰年,用来确定"日"的数据
|
|
|
- if (startYear == endYear) {
|
|
|
- //重新设置月份
|
|
|
- wvMonth.setAdapter(new NumericWheelAdapter(startMonth, endMonth));
|
|
|
-
|
|
|
- if (currentMonthItem > wvMonth.getAdapter().getItemsCount() - 1) {
|
|
|
- currentMonthItem = wvMonth.getAdapter().getItemsCount() - 1;
|
|
|
- wvMonth.setCurrentItem(currentMonthItem);
|
|
|
- }
|
|
|
-
|
|
|
- int monthNum = currentMonthItem + startMonth;
|
|
|
-
|
|
|
- if (startMonth == endMonth) {
|
|
|
- //重新设置日
|
|
|
- setReDay(year_num, monthNum, startDay, endDay, list_big, list_little);
|
|
|
- } else if (monthNum == startMonth) {
|
|
|
- //重新设置日
|
|
|
- setReDay(year_num, monthNum, startDay, 31, list_big, list_little);
|
|
|
- } else if (monthNum == endMonth) {
|
|
|
- setReDay(year_num, monthNum, 1, endDay, list_big, list_little);
|
|
|
- } else {//重新设置日
|
|
|
- setReDay(year_num, monthNum, 1, 31, list_big, list_little);
|
|
|
- }
|
|
|
- } else if (year_num == startYear) {//等于开始的年
|
|
|
- //重新设置月份
|
|
|
- wvMonth.setAdapter(new NumericWheelAdapter(startMonth, 12));
|
|
|
-
|
|
|
- if (currentMonthItem > wvMonth.getAdapter().getItemsCount() - 1) {
|
|
|
- currentMonthItem = wvMonth.getAdapter().getItemsCount() - 1;
|
|
|
- wvMonth.setCurrentItem(currentMonthItem);
|
|
|
- }
|
|
|
-
|
|
|
- int month = currentMonthItem + startMonth;
|
|
|
- if (month == startMonth) {
|
|
|
- //重新设置日
|
|
|
- setReDay(year_num, month, startDay, 31, list_big, list_little);
|
|
|
- } else {
|
|
|
- //重新设置日
|
|
|
- setReDay(year_num, month, 1, 31, list_big, list_little);
|
|
|
- }
|
|
|
-
|
|
|
- } else if (year_num == endYear) {
|
|
|
- //重新设置月份
|
|
|
- wvMonth.setAdapter(new NumericWheelAdapter(1, endMonth));
|
|
|
- if (currentMonthItem > wvMonth.getAdapter().getItemsCount() - 1) {
|
|
|
- currentMonthItem = wvMonth.getAdapter().getItemsCount() - 1;
|
|
|
- wvMonth.setCurrentItem(currentMonthItem);
|
|
|
- }
|
|
|
- int monthNum = currentMonthItem + 1;
|
|
|
-
|
|
|
- if (monthNum == endMonth) {
|
|
|
- //重新设置日
|
|
|
- setReDay(year_num, monthNum, 1, endDay, list_big, list_little);
|
|
|
- } else {
|
|
|
- //重新设置日
|
|
|
- setReDay(year_num, monthNum, 1, 31, list_big, list_little);
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
- //重新设置月份
|
|
|
- wvMonth.setAdapter(new NumericWheelAdapter(1, 12));
|
|
|
- //重新设置日
|
|
|
- setReDay(year_num, wvMonth.getCurrentItem() + 1, 1, 31, list_big, list_little);
|
|
|
+ public void accept(Boolean aBoolean) {
|
|
|
+ if (aBoolean) {
|
|
|
+ Intent cameraIntent = new Intent(
|
|
|
+ "android.media.action.IMAGE_CAPTURE");
|
|
|
+ cameraIntent.putExtra("output", PhotoUtils
|
|
|
+ .getCameraStrImgCachePathUri(mContext));
|
|
|
+ cameraIntent.putExtra(
|
|
|
+ "android.intent.extra.videoQuality", 1);
|
|
|
+ startActivityForResult(cameraIntent, 1);
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- // 添加"月"监听
|
|
|
- wvMonth.setOnItemSelectedListener(new OnItemSelectedListener() {
|
|
|
+ }, Manifest.permission.CAMERA);
|
|
|
+ } else {
|
|
|
+ PermissionsUtils.requestPermissionToast((BaseActivity) mContext, new Consumer<Boolean>() {
|
|
|
@Override
|
|
|
- public void onItemSelected(int index) {
|
|
|
- int month_num = index + 1;
|
|
|
-
|
|
|
- if (startYear == endYear) {
|
|
|
- month_num = month_num + startMonth - 1;
|
|
|
- if (startMonth == endMonth) {
|
|
|
- //重新设置日
|
|
|
- setReDay(currentYear, month_num, startDay, endDay, list_big, list_little);
|
|
|
- } else if (startMonth == month_num) {
|
|
|
-
|
|
|
- //重新设置日
|
|
|
- setReDay(currentYear, month_num, startDay, 31, list_big, list_little);
|
|
|
- } else if (endMonth == month_num) {
|
|
|
- setReDay(currentYear, month_num, 1, endDay, list_big, list_little);
|
|
|
- } else {
|
|
|
- setReDay(currentYear, month_num, 1, 31, list_big, list_little);
|
|
|
- }
|
|
|
- } else if (currentYear == startYear) {
|
|
|
- month_num = month_num + startMonth - 1;
|
|
|
- if (month_num == startMonth) {
|
|
|
- //重新设置日
|
|
|
- setReDay(currentYear, month_num, startDay, 31, list_big, list_little);
|
|
|
- } else {
|
|
|
- //重新设置日
|
|
|
- setReDay(currentYear, month_num, 1, 31, list_big, list_little);
|
|
|
- }
|
|
|
-
|
|
|
- } else if (currentYear == endYear) {
|
|
|
- if (month_num == endMonth) {
|
|
|
- //重新设置日
|
|
|
- setReDay(currentYear, wvMonth.getCurrentItem() + 1, 1, endDay, list_big, list_little);
|
|
|
- } else {
|
|
|
- setReDay(currentYear, wvMonth.getCurrentItem() + 1, 1, 31, list_big, list_little);
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
- //重新设置日
|
|
|
- setReDay(currentYear, month_num, 1, 31, list_big, list_little);
|
|
|
+ public void accept(Boolean aBoolean) {
|
|
|
+ if (aBoolean) {
|
|
|
+ Intent intent = new Intent(mContext, PickImageActivity.class);
|
|
|
+ intent.putExtra(IntentConstant.CROPPER, false);
|
|
|
+ startActivityForResult(intent, 0);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
- });
|
|
|
+ }, Manifest.permission.READ_EXTERNAL_STORAGE);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- private void setReDay(int year_num, int monthNum, int startD, int endD, List<String> list_big, List<String> list_little) {
|
|
|
- int currentItem = wvDay.getCurrentItem();
|
|
|
-
|
|
|
-// int maxItem;
|
|
|
- if (list_big.contains(String.valueOf(monthNum))) {
|
|
|
- if (endD > 31) {
|
|
|
- endD = 31;
|
|
|
- }
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(startD, endD));
|
|
|
-// maxItem = endD;
|
|
|
- } else if (list_little.contains(String.valueOf(monthNum))) {
|
|
|
- if (endD > 30) {
|
|
|
- endD = 30;
|
|
|
- }
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(startD, endD));
|
|
|
-// maxItem = endD;
|
|
|
- } else {
|
|
|
- if ((year_num % 4 == 0 && year_num % 100 != 0)
|
|
|
- || year_num % 400 == 0) {
|
|
|
- if (endD > 29) {
|
|
|
- endD = 29;
|
|
|
- }
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(startD, endD));
|
|
|
-// maxItem = endD;
|
|
|
- } else {
|
|
|
- if (endD > 28) {
|
|
|
- endD = 28;
|
|
|
- }
|
|
|
- wvDay.setAdapter(new NumericWheelAdapter(startD, endD));
|
|
|
-// maxItem = endD;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (currentItem > wvDay.getAdapter().getItemsCount() - 1) {
|
|
|
- currentItem = wvDay.getAdapter().getItemsCount() - 1;
|
|
|
- wvDay.setCurrentItem(currentItem);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 当获取到图片
|
|
|
+ *
|
|
|
+ * @param position
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void onImageTake(String imageUrl, int position) {
|
|
|
+ if (position == 0) {
|
|
|
+ ImageLoaderUtil.getInstance().loadRoundImage(imageUrl, 6, ivFront);
|
|
|
+ }
|
|
|
+ if (position == 1) {
|
|
|
+ ImageLoaderUtil.getInstance().loadRoundImage(imageUrl, 6, ivReverse);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * activity回调
|
|
|
+ *
|
|
|
+ * @param requestCode
|
|
|
+ * @param resultCode
|
|
|
+ * @param data
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
|
|
+ super.onActivityResult(requestCode, resultCode, data);
|
|
|
+ mvpPresenter.onActivityForResult(requestCode, resultCode, data);
|
|
|
+ }
|
|
|
}
|