{"id":21083887,"url":"https://github.com/spongebobsun/mcalendarview","last_synced_at":"2025-04-09T23:16:43.522Z","repository":{"id":28921256,"uuid":"32446394","full_name":"SpongeBobSun/mCalendarView","owner":"SpongeBobSun","description":"Customizable \u0026 Shrinkable Calendar Widget for Android","archived":false,"fork":false,"pushed_at":"2018-08-24T12:12:50.000Z","size":8925,"stargazers_count":244,"open_issues_count":44,"forks_count":73,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-09T23:16:38.598Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SpongeBobSun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-18T08:20:04.000Z","updated_at":"2025-03-07T22:54:43.000Z","dependencies_parsed_at":"2022-08-02T12:14:06.459Z","dependency_job_id":null,"html_url":"https://github.com/SpongeBobSun/mCalendarView","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpongeBobSun%2FmCalendarView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpongeBobSun%2FmCalendarView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpongeBobSun%2FmCalendarView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpongeBobSun%2FmCalendarView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpongeBobSun","download_url":"https://codeload.github.com/SpongeBobSun/mCalendarView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125593,"owners_count":21051771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T20:20:30.092Z","updated_at":"2025-04-09T23:16:43.503Z","avatar_url":"https://github.com/SpongeBobSun.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mCalendarView\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-mCalendarView-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/2420)\n\nCustomizable \u0026 Expandable Calendar Widget for Android\n\n## Project Components\nmCalendarView provide below components.\n\n* mCalendarView, which is our customizable calendar widget.\n* ExpCalendarView, which is expandable calendar widget.\n* BaseCellView, an abstract view class for date cells.\n* BaseMarkView, an abstract view class for marked / highlighted date cells.\n* MarkStyle, provide built-in and default mark / highlight style values.\n* DefaultCellView, default view for date cells.\n* DefaultMarkView, dafault view for mark / highlight cells.\n* OnDateClickListener, which will be triggered when date cell is clicked.\n* OnMonthChangeListener, which will be triggered when changing month by sliding left / right.\n\n## Project Structure\nAfter checkout this repo, you will get a sample project and the mCalendarView module is located in `mcalendarview` folder.\n\nClass `mCalednarView` is for normal calendar view.\n\nClass `ExpCalendarView` is for expandable calendar view.\n\nExpandable calendar view is contributed by my homie [mBigMing](https://github.com/mBigFlower). Big thank you for that.\n\n## Screenshots\nI used Android built-in `screenrecord` command to get the screenshot. But for some reason I don't know, the screen color is weird...\n\n![Alt ](./screenshot/shot.gif)\n![Alt ](./screenshot/exp.gif)\n## Usage\n\n### Download\nAdd dependency to your `build.gradle`\n\n    ```\n    dependencies {\n        compile 'sun.bob:mcalendarview:1.0.0'\n    }\n    ```\n\n### Add to Layout\nTo use mCalendarView, you need to add it in layout by using xml file or Java code. \n\n#### Add normal calendarview\n\n###### Make sure you specifiy an `FragmentActivity` or it's sub-class as mCalendarView's context.\n\n\t    \u003csun.bob.mcalendarview.mCalendarView\n        android:layout_width=\"400dp\"\n        android:layout_height=\"400dp\"\n        tools:context=\".MainActivity\"\n        android:id=\"@+id/calendar\"\n        /\u003e\n        \n#### Add expandable calendarview\n\n    \u003csun.bob.mcalendarview.views.ExpCalendarView\n        android:id=\"@+id/calendar_exp\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        tools:context=\".MainActivity\" /\u003e\n        \n### Jump to Date\nBy default, mCalendarView will display current month. If you what to jump to another month, use `travelTo(DateData date)` function in mCalendarView.\n\n\tmCalendarView calendarView = ((mCalendarView) findViewById(R.id.calendar));\n\tcalendarView.travelTo(new DateData(1992, 5, 5));\n\t\n### Mark / Highlight a Date\nAndroid's built-in widget dosen't have this feature, that's why I'm writing this widget.\n\nThere are two method in mCalendarViewClass to highlight a date.\n\t\n* markDate(int year, int month, int day);\n* markDate(DateData date); \n\t\nTo mark / highlight a date, use one of those two functions in mCalendarView.\n\nBelow function will hightlight a date with default / global color and style.\n\n\tmCalendarView calendarView = ((mCalendarView) findViewById(R.id.calendar));\n\tcalendarView.markDate(2015, 10, 7);\n\t\nBelow function will let you specify a customized hightlight style and color.\n\n\tmCalendarView calendarView = ((mCalendarView) findViewById(R.id.calendar));\n\tcalendarView.markDate(\n\t\tnew DateData(2016, 3, 1).setMarkStyle(new MarkStyle(MarkStyle.DOT, Color.GREEN)\n\t);\n\t\n### Use built-in Mark Styles\n\nmCalendarView provide below built-in mark styles. Mark styles are defined in class `MarkStyle`.\n\n* Change Background Color. \n\t\t\n\t\tMarkStyle.BACKGROUND\n* Add a dot under date text.\n\n\t\tMarkStyle.DOT\n* Add a colored vertical bar on the left side of date text.\n\n\t\tMarkStyle.LEFTSIDEBAR\n* Add a colored vertical bar on the right side of date text.\n\n\t\tMarkStyle.RIGHTSIDEBAR\n\t\t\nTo specify the default / global highlight style, use `setMarkedStyle(int style)` function in mCalendarView.\n\n\tmCalendarView calendarView = ((mCalendarView) findViewById(R.id.calendar));\n\tcalendarView.setMarkedStyle(MarkStyle.BACKGROUND);\n\t\nDefault highlight style is change background color.\n\nTo specify the default / global highlight style and color, use `setMarkedStyle(int style, int color)` function in mCalendarView.\n\nTo specify a highlight style and color for one day, use `setMarkStyle(MarkStyle markStyle)` function in DateData.\n\nYou can get screenshots of each mark styles in `More ScreenShots` Section\n\n### Use Customize Date Cell\nmCalendarView allows you using your own views for date cells, but there are some restrictions.\n\n* Your customized view must extend `BaseCellView`, which inherit from `LinearLayout`.\n\n* Your customized view must implement `setDisplayText`. This function will be called when mCalendarView need to display something in the cell. Usually it's date number or day of week ('Sun', 'Mon'...'Sat').\n\t\t\n\t\tpublic class DateCellView extends BaseCellView {\n\t\t    public DateCellView(Context context) {\n\t\t        super(context);\n\t\t    }\n\t\t\n\t\t    public DateCellView(Context context, AttributeSet attrs) {\n\t\t        super(context, attrs);\n\t\t    }\n\t\t\n\t\t    @Override\n\t\t    public void setDisplayText(String text) {\n\t\t        ((TextView) this.findViewById(R.id.id_cell_text)).setText(text);\n\t\t    }\n\t\t}\n* Create a layout xml in your project which root node is your customized view. For example, I created a `layout_date_cell.xml` in the sample project.\n\n\t\t\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\t\t\u003csun.bob.mcalendarviewtest.DateCellView \n\t\t\txmlns:android=\"http://schemas.android.com/apk/res/android\"\n\t\t    android:orientation=\"vertical\"\n\t\t    android:layout_width=\"100dp\"\n\t\t    android:layout_height=\"100dp\"\n\t\t    android:background=\"#00ADA3\"\u003e\n\t\t    \u003cTextView\n\t\t        android:layout_width=\"match_parent\"\n\t\t        android:layout_height=\"match_parent\"\n\t\t        android:textColor=\"#FFFFFF\"\n\t\t        android:id=\"@+id/id_cell_text\"/\u003e\n\t\t\u003c/sun.bob.mcalendarviewtest.DateCellView\u003e\n* Build your view and pass its id to mCalendarView by calling `setDateCell(int dateCellResId)`.\n\n\t\tmCalendarView calendarView = ((mCalendarView) findViewById(R.id.calendar));\n\t\tcalendarView.setDateCell(R.layout.layout_date_cell)\n\t\t\n### Use Customized Mark Cell\nmCalendar allows you using your own views for marked / highlighted date cells.\n\nTo use this feature, your view need to extend `BaseMarkView`.\n\nThe rest parts are the same with `Use Customized Date Cell`.\n\n### Set OnMonthChangeListener\n`OnMonthChangeListener` is an abstract class and will be invoked when user sliding right or left to change month. It will provide value of current year and month as parameter.\n\n\tpublic abstract void onMonthChange(int year, int month);\n\nTo set an OnMonthChangeListener, extend this class and call `setOnMonthChangeListener(OnMonthChangeListener l)` function in mCalendarView.\n\n\tcalendarView.setOnMonthChangeListener(new OnMonthChangeListener() {\n            @Override\n            public void onMonthChange(int year, int month) {\n                Toast.makeText(MainActivity.this, String.format(\"%d-%d\", year, month), Toast.LENGTH_SHORT).show();\n            }\n        });\n        \n### Set OnDateClickListener\n`OnDateClickListener` is an abstract class and will be invoked when use click on date cells. It will provide a `DateData` as parameter.\n\n\tpublic abstract void onDateClick(View view,DateData date);\n\nTo set an OnDateClickListener, extend this class and call `setOnDateClickListener(OnDateClickListener l)` function in mCalendarView.\n\n\tcalendarView.setOnDateClickListener(new OnDateClickListener() {\n            @Override\n            public void onDateClick(View view, DateData date) {\n                Toast.makeText(MainActivity.this, String.format(\"%d-%d\", date.getMonth(), date.getDay()), Toast.LENGTH_SHORT).show();\n            }\n        });\n        \n### Expand \u0026 Shrink\n\n\texpCalendarView.expand();\n\texpCalendarView.shrink();\n        \n# More Screenshots\n#### MarkStyle.BACKGROUND\n![Alt ](./screenshot/MarkStyle.BACKGROUND.png)\n\n#### MarkStyle.DOT\n\n![Alt ](./screenshot/MarkStyle.DOT.png)\n\n#### MarkStyle.LEFTSIDEBAR\n\n![Alt](./screenshot/MarkStyle.LEFTSIDEBAR.png)\n\n#### MarkStyle.RIGHTSIDEBAR\n\n![Alt](./screenshot/MarkStyle.RIGHTSIDEBAR.png)\n\n# Credits\n\n### [mBigMing](https://github.com/mBigFlower)\n\nFor Expandabel calendar view.\n\n### [oong](https://github.com/oong) \u0026 [Barry](https://github.com/fg2q1q3q)\n\nFor bug fix.\n\n### [Rodrigo Arantes](https://github.com/rodriggoarantes)\n\nFor WeekColumnView Translate in ExpCalendarView.\n\n# APPs which using mCalendarView\n### [Natural Family Planning (NFP)](https://play.google.com/store/apps/details?id=com.projectcaruso.naturalfamilyplaning\u0026hl=en)\n\n### [BeSAFE](https://play.google.com/store/apps/details?id=aman.sow.apps.besafe\u0026hl=en)\n\n# License\nCopyright 2015 Bob Sun\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nSee LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspongebobsun%2Fmcalendarview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspongebobsun%2Fmcalendarview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspongebobsun%2Fmcalendarview/lists"}