Skip to content

Commit

Permalink
调整
Browse files Browse the repository at this point in the history
  • Loading branch information
yannecer committed Mar 30, 2020
1 parent 5e8439f commit be7fd69
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions ncalendar/src/main/java/com/necer/calendar/BaseCalendar.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.necer.calendar;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.MotionEvent;
Expand Down Expand Up @@ -44,23 +43,12 @@
public abstract class BaseCalendar extends ViewPager implements ICalendar {


//5.0
//修改部分参数命名
//增加多选预置 可取消可不取消
//重写InnerPainter
//增加日期变化行为参数 1、点击选中 2、点击跳转(上下月的情况) 3、滑动翻页 4、api跳转 等
//跳转日期不用post
//优化adapter模式


//变更
//1、单选重复点击会重复回调


private Context mContext;
private Attrs mAttrs;
private boolean mScrollEnable = true;
private CheckModel mCheckModel;//选中模式
private final static String mDefaultStartDate = "1901-01-01";
private final static String mDefaultEndDateDate = "2099-12-31";

private boolean mDefaultCheckedFirstDate;//默认选择时,翻页选中第一个日期

Expand Down Expand Up @@ -99,8 +87,8 @@ public BaseCalendar(@NonNull Context context, @Nullable AttributeSet attributeSe
mDateChangeBehavior = DateChangeBehavior.INITIALIZE;
mTotalCheckedDateList = new ArrayList<>();
mInitializeDate = new LocalDate();
mStartDate = new LocalDate("1901-01-01");
mEndDate = new LocalDate("2099-12-31");
mStartDate = new LocalDate(mDefaultStartDate);
mEndDate = new LocalDate(mDefaultEndDateDate);

//背景颜色
if (mAttrs.showNumberBackground) {
Expand Down Expand Up @@ -143,11 +131,11 @@ private void initAdapter() {
throw new IllegalArgumentException("startDate必须在endDate之前");
}

if (mStartDate.isBefore(new LocalDate("1901-01-01"))) {
if (mStartDate.isBefore(new LocalDate(mDefaultStartDate))) {
throw new IllegalArgumentException("startDate必须在1901-01-01之后");
}

if (mEndDate.isAfter(new LocalDate("2099-12-31"))) {
if (mEndDate.isAfter(new LocalDate(mDefaultEndDateDate))) {
throw new IllegalArgumentException("endDate必须在2099-12-31之前");
}

Expand Down Expand Up @@ -506,7 +494,7 @@ public void exchangeCheckedDateList(List<LocalDate> dateList) {
}


public void setOnMWDateChangeListener(OnMWDateChangeListener onMWDateChangeListener) {
protected void setOnMWDateChangeListener(OnMWDateChangeListener onMWDateChangeListener) {
this.mOnMWDateChangeListener = onMWDateChangeListener;
}

Expand Down

0 comments on commit be7fd69

Please sign in to comment.