Code Monkey home page Code Monkey logo

calendarpicker's Introduction

Calendar Picker

Calendar Picker


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

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.0.3'
}

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.

calendarpicker's People

Contributors

maxyou avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.