Skip to content

Commit

Permalink
对单选模式以及保存状态做了改进
Browse files Browse the repository at this point in the history
  • Loading branch information
huanghaibin-dev committed Jan 14, 2019
1 parent 29e3929 commit fb8f280
Show file tree
Hide file tree
Showing 28 changed files with 451 additions and 118 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ Android上一个优雅、高度自定义、性能高效的日历控件,完美

### Gradle
```
compile 'com.haibin:calendarview:3.4.8'
compile 'com.haibin:calendarview:3.4.9'
```
```
<dependency>
<groupId>com.haibin</groupId>
<artifactId>calendarview</artifactId>
<version>3.4.8</version>
<version>3.4.9</version>
<type>pom</type>
</dependency>
```
Expand Down
4 changes: 2 additions & 2 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ This widget has obvious advantages of memory and efficiency, adapt to many scene

### Gradle
```
compile 'com.haibin:calendarview:3.4.8'
compile 'com.haibin:calendarview:3.4.9'
```
```
<dependency>
<groupId>com.haibin</groupId>
<artifactId>calendarview</artifactId>
<version>3.4.8</version>
<version>3.4.9</version>
<type>pom</type>
</dependency>
```
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<activity android:name=".solay.SolarActivity" />
<activity android:name=".single.SingleActivity" />
<activity android:name=".progress.ProgressActivity" />
<activity android:name=".custom.CustomActivity" />
<activity android:name=".custom.CustomActivity"/>
<activity android:name=".pager.ViewPagerActivity" />
<activity android:name=".TestActivity" />
</application>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected void initView() {
@Override
public void onClick(View v) {
if (!mCalendarLayout.isExpand()) {
mCalendarView.showYearSelectLayout(mYear);
mCalendarLayout.expand(0);
return;
}
mCalendarView.showYearSelectLayout(mYear);
Expand Down Expand Up @@ -123,8 +123,9 @@ public void onClick(DialogInterface dialog, int which) {
//mCalendarView.scrollToCalendar(2018,8,30);
break;
case 5:
mCalendarView.setRange(mCalendarView.getCurYear(), mCalendarView.getCurMonth(), 6,
mCalendarView.getCurYear(), mCalendarView.getCurMonth(), 23);
mCalendarView.setRange(2016,7,1,2016,9,28);
// mCalendarView.setRange(mCalendarView.getCurYear(), mCalendarView.getCurMonth(), 6,
// mCalendarView.getCurYear(), mCalendarView.getCurMonth(), 23);
break;
case 6:
Log.e("scheme", " " + mCalendarView.getSelectedCalendar().getScheme() + " -- "
Expand Down Expand Up @@ -303,6 +304,10 @@ public void onClick(View v) {
switch (v.getId()) {
case R.id.ll_flyme:
MeiZuActivity.show(this);
Log.e("onDateSelected",
" -- " + mCalendarView.getSelectedCalendar().getScheme() +
" -- " + mCalendarView.getSelectedCalendar().toString() +
" -- " + mCalendarView.getSelectedCalendar().hasScheme());
break;
case R.id.ll_custom:
CustomActivity.show(this);
Expand Down Expand Up @@ -409,7 +414,7 @@ public void onMonthChange(int year, int month) {

@Override
public void onViewChange(boolean isMonthView) {
//Log.e("onViewChange", " --- " + (isMonthView ? "月视图" : "周视图"));
Log.e("onViewChange", " --- " + (isMonthView ? "月视图" : "周视图"));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected void initView() {
@Override
public void onClick(View v) {
if (!mCalendarLayout.isExpand()) {
mCalendarView.showYearSelectLayout(mYear);
mCalendarLayout.expand();
return;
}
mCalendarView.showYearSelectLayout(mYear);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected void initView() {
@Override
public void onClick(View v) {
if (!mCalendarLayout.isExpand()) {
mCalendarView.showYearSelectLayout(mYear);
mCalendarLayout.expand();
return;
}
mCalendarView.showYearSelectLayout(mYear);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected void initView() {
@Override
public void onClick(View v) {
if (!mCalendarLayout.isExpand()) {
mCalendarView.showYearSelectLayout(mYear);
mCalendarLayout.expand();
return;
}
mCalendarView.showYearSelectLayout(mYear);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected void initView() {
@Override
public void onClick(View v) {
if (!mCalendarLayout.isExpand()) {
mCalendarView.showYearSelectLayout(mYear);
mCalendarLayout.expand();
return;
}
mCalendarView.showYearSelectLayout(mYear);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected void initView() {
@Override
public void onClick(View v) {
if (!mCalendarLayout.isExpand()) {
mCalendarView.showYearSelectLayout(mYear);
mCalendarLayout.expand();
return;
}
mCalendarView.showYearSelectLayout(mYear);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected void initView() {
@Override
public void onClick(View v) {
if (!mCalendarLayout.isExpand()) {
mCalendarView.showYearSelectLayout(mYear);
mCalendarLayout.expand();
return;
}
mCalendarView.showYearSelectLayout(mYear);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public void onClick(View v) {
mTextRightWeek.setText("结束日期");
mTextLeftDate.setText("");
mTextRightDate.setText("");
//mCalendarView.setSelectCalendarRange(2018,10,13,2018,10,13);
break;
case R.id.iv_reduce:

Expand Down Expand Up @@ -151,7 +152,7 @@ public boolean onCalendarIntercept(Calendar calendar) {
@Override
public void onCalendarInterceptClick(Calendar calendar, boolean isClick) {
Toast.makeText(this,
calendar.toString() + (isClick ? "拦截不可点击" : "拦截滚动到无效日期"),
calendar.toString() + (isClick ? "拦截不可点击" : "拦截设定为无效日期"),
Toast.LENGTH_SHORT).show();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected void initView() {
@Override
public void onClick(View v) {
if (!mCalendarLayout.isExpand()) {
mCalendarView.showYearSelectLayout(mYear);
mCalendarLayout.expand();
return;
}
mCalendarView.showYearSelectLayout(mYear);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.LinearLayoutManager;
import android.util.Log;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
Expand Down Expand Up @@ -73,7 +74,7 @@ public void onClick(View v) {
mYear = mCalendarView.getCurYear();
}
if (!mCalendarLayout.isExpand()) {
mCalendarView.showYearSelectLayout(mYear);
mCalendarLayout.expand();
return;
}
mCalendarView.showYearSelectLayout(mYear);
Expand All @@ -85,7 +86,12 @@ public void onClick(View v) {
findViewById(R.id.fl_current).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//mCalendarView.clearSelect();
mCalendarView.scrollToCurrent();
Log.e("onDateSelected",
" -- " + mCalendarView.getSelectedCalendar().getScheme() +
" -- " + mCalendarView.getSelectedCalendar().toString() +
" -- " + mCalendarView.getSelectedCalendar().hasScheme());
}
});
mCalendarLayout = (CalendarLayout) findViewById(R.id.calendarLayout);
Expand Down Expand Up @@ -205,8 +211,7 @@ public boolean onCalendarIntercept(Calendar calendar) {
//Log.e("onCalendarIntercept", calendar.toString());
int day = calendar.getDay();
return day == 1 || day == 3 || day == 6 || day == 11 ||
day == 12 || day == 15 || day == 20 || day == 26 ||
day == mCalendarView.getCurDay();
day == 12 || day == 15 || day == 20 || day == 26 ;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected void initView() {
@Override
public void onClick(View v) {
if (!mCalendarLayout.isExpand()) {
mCalendarView.showYearSelectLayout(mYear);
mCalendarLayout.expand();
return;
}
mCalendarView.showYearSelectLayout(mYear);
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
android:layout_height="match_parent"
android:background="#fff"
android:orientation="vertical"
app:calendar_show_mode="both_month_week_view"
app:calendar_content_view_id="@+id/nestedScrollView"
app:default_status="expand">

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_range.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
app:current_month_text_color="#4f4f4f"
app:day_text_size="18sp"
app:max_select_range="-1"
app:min_select_range="3"
app:min_select_range="-1"
app:min_year="2004"
app:month_view="com.haibin.calendarviewproject.range.CustomRangeMonthView"
app:month_view_show_mode="mode_only_current"
Expand Down
4 changes: 2 additions & 2 deletions calendarview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
minSdkVersion 15
//noinspection OldTargetApi
targetSdkVersion 23
versionCode 348
versionName "3.4.8"
versionCode 349
versionName "3.4.9"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ public final static class Scheme implements Serializable {
private int shcemeColor;
private String scheme;
private String other;
private Object obj;

public Scheme() {
}
Expand Down Expand Up @@ -463,5 +464,12 @@ public void setType(int type) {
this.type = type;
}

public Object getObj() {
return obj;
}

public void setObj(Object obj) {
this.obj = obj;
}
}
}
Loading

0 comments on commit fb8f280

Please sign in to comment.