Calendar Picker

Calendar Picker


Can preset a selected day. Can customize almost all text size, color, bg color, and month title.

Update:
v1.1: If no preset day, hide Selected button. Show it when a day be clicked.
v1.1.2: Remove no needed example code and intent filter which create no needed launch icon.

demo apk

pic

Add it in your root build.gradle at the end of repositories:

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

Add the dependency:

dependencies {
    compile 'com.github.maxyou:CalendarPicker:v1.1.2'
}

Only new a dialog:

Builder builder = new Builder(MainActivity.this, new Builder.CalendarPickerOnConfirm() {
            @Override
            public void onComplete(YearMonthDay yearMonthDay) {
                MyConfig.uiToast("You pick "+yearMonthDay.year+"-"+yearMonthDay.month+"-"+yearMonthDay.day);
            }
        })
                .setPromptText("选择一个日期")
                .setPromptSize(18)
                .setPromptColor(Color.RED)
                .setPromptBgColor(0xFFFFFFFF)

                .setSelectedText("已选")
                .setSelectedSize(14)
                .setSelectedColor(Color.WHITE)
                .setSelectedBgColor(0xFF1E90FF)

                .setTodayText("今天")
                .setTodaySize(14)
                .setTodayColor(Color.DKGRAY)
                .setTodayBgColor(Color.YELLOW)

                .setMonthTitle(new Builder.FormatMonthTitle() {
                    @Override
                    public String setMonthTitle(int year, int month) {
                        return ""+year+"年"+month+"月";
                    }
                })
                .setMonthTitleSize(16)
                .setMonthTitleColor(0xFFB22222)
                .setMonthTitleBgColor(0x00000000)

                .setWeekIndex(new String[]{"一", "二", "三", "四", "五", "六", "日"})
                .setWeekIndexSize(16)
                .setWeekIndexColor(0xFFFF00FF)
                .setWeekIndexBgColor(0x00000000)

                .setCancelText("取消")
                .setCancelSize(14)
                .setCancelColor(Color.RED)
                .setCancelBgColor(0xFFFFFFFF)

                .setConfirmText("确定")
                .setConfirmSize(14)
                .setConfirmColor(Color.RED)
                .setConfirmBgColor(0xFFB0E0E6)

                .setPreset(new YearMonthDay(2017, 11, 4))
                .setDaySize(16)
                .setDayColor(Color.BLUE)
                .setDayOtherMonthColor(0xFF87CEFA)
                .setMonthBaseBgColor(0xFFD0EED0)

                .setJump2Preset(true)
                //.restoreDefault()
                ;

        builder.show();

License

under MIT License.

Become a better Android Developer
Millions of developers are learning at MindOrks

Online Training Program

Featured Blogs

Our Team

MindOrks is Certainly one of the best online blog to stay on top of all the Android development news, coding and design patterns. Finally a blog I can count on to keep myself updated with latest and greatest things happening in Android world.

Vipul Shah
Android Developer
Microsoft

Become Pro in Android by watching videos

OUR LEARNERS WORK AT