{"id":26498935,"url":"https://github.com/todou/calendarpager","last_synced_at":"2025-03-20T14:51:07.920Z","repository":{"id":29639343,"uuid":"33180669","full_name":"ToDou/CalendarPager","owner":"ToDou","description":"This is one horizontal calendar with viewPager","archived":false,"fork":false,"pushed_at":"2015-07-08T11:09:59.000Z","size":9939,"stargazers_count":208,"open_issues_count":5,"forks_count":39,"subscribers_count":10,"default_branch":"master","last_synced_at":"2023-11-07T21:34:37.785Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ToDou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-31T11:00:15.000Z","updated_at":"2023-02-03T09:44:20.000Z","dependencies_parsed_at":"2022-09-03T18:40:47.843Z","dependency_job_id":null,"html_url":"https://github.com/ToDou/CalendarPager","commit_stats":null,"previous_names":[],"tags_count":1,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToDou%2FCalendarPager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToDou%2FCalendarPager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToDou%2FCalendarPager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToDou%2FCalendarPager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ToDou","download_url":"https://codeload.github.com/ToDou/CalendarPager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244637056,"owners_count":20485445,"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":"2025-03-20T14:51:07.326Z","updated_at":"2025-03-20T14:51:07.910Z","avatar_url":"https://github.com/ToDou.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CalendarPager\nThis is one horizontal calendar with viewPager.\n\nThe header is create by recyclerview. Every item draw based on week by week.You can slide the week recyclerview to next week or pref. I write it because I have used in my work.You just should input your first and last day. Then the calendar will be create one by one.\n\nMaybe not perfect. I will thanks for your suggestion.\n\nScreeshot\n====\n\n* WeekRecyclerView\n\n![](/screenshot/screenshot.gif)\n\n* MonthSwitchView\n\n![](/screenshot/screenshot_switch.gif)\n\n* ExpandCalendarView\n\n![](/screenshot/screenshot_expand.gif)\n\nInstallation\n====\n```groovy\ndependencies {\n    compile 'com.github.todou:calendarpager:1.0.0'\n}\n```\n\nJust Do\n====\n\n###WeekRecyclerView\n\nFirst you should add the layout WeekRecyclerView and WeekDayViewPager. @layout/view_week_label and text_day_label can add by yourself.\n```xml\n  \u003cinclude layout=\"@layout/view_week_label\"/\u003e\n  \n    \u003ccom.test.tudou.library.WeekPager.view.WeekRecyclerView\n        android:id=\"@+id/header_recycler_view\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"48dp\"\n        android:clipToPadding=\"false\"\n        android:scrollbars=\"none\"/\u003e\n\n    \u003cTextView\n        android:id=\"@+id/text_day_label\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:padding=\"@dimen/default_padding\"\n        tools:text=\"sjidg\"\n        android:layout_gravity=\"center_horizontal\"\n        /\u003e\n\n    \u003ccom.test.tudou.library.WeekPager.view.WeekDayViewPager\n      android:id=\"@+id/view_pager\"\n      android:layout_width=\"match_parent\"\n      android:layout_height=\"0dp\"\n      android:layout_weight=\"1\"\n      android:background=\"#DDDDDD\"/\u003e\n    \n```\nThen to init the adapter and viewpager. Also you can add the setDayScrollListener to change the text of text_day_label textView to show the day.\n```java\n  private void setUpPager() {\n    mPagerAdapter = new SimplePagerAdapter(getSupportFragmentManager());\n    mViewPagerContent.setOffscreenPageLimit(OFFSCREEN_PAGE_LIMIT);\n    mViewPagerContent.setAdapter(mPagerAdapter);\n    mViewPagerContent.setWeekRecyclerView(mWeekRecyclerView);\n    mViewPagerContent.setDayScrollListener(this);\n    mWeekViewAdapter = new WeekViewAdapter(this, mViewPagerContent);\n    mWeekViewAdapter.setTextNormalColor(getResources().getColor(android.R.color.darker_gray));\n    mWeekRecyclerView.setAdapter(mWeekViewAdapter);\n  }\n    \n```\nAnd you should create one adapter to extends WeekPagerAdapter. Return one Fragment by createFragmentPager(int position). \n\nLike This:\n```java\n  public class SimplePagerAdapter extends WeekPagerAdapter {\n\n    public SimplePagerAdapter(FragmentManager fm) {\n      super(fm);\n    }\n    \n    @Override protected Fragment createFragmentPager(int position) {\n      return SimpleFragment.newInstance(mDays.get(position));\n    }\n  }\n```\n\nLast you can load the data.\n```java\n  private void setUpData() {\n    ArrayList\u003cCalendarDay\u003e reachAbleDays = new ArrayList\u003c\u003e();\n    reachAbleDays.add(new CalendarDay(2015, 5, 1));\n    reachAbleDays.add(new CalendarDay(2015, 5, 4));\n    reachAbleDays.add(new CalendarDay(2015, 5, 6));\n    reachAbleDays.add(new CalendarDay(2015, 5, 20));\n    mWeekViewAdapter.setData(reachAbleDays.get(0), reachAbleDays.get(reachAbleDays.size() - 1), null);\n    mPagerAdapter.setData(reachAbleDays.get(0), reachAbleDays.get(reachAbleDays.size() - 1));\n    mViewPagerContent.setCurrentPosition(DayUtils.calculateDayPosition(mWeekViewAdapter.getFirstShowDay(), new CalendarDay(2015, 5, 6)));\n  }\n    \n```\nYou can use \n```java\n    mViewPagerContent.setCurrentPosition(position);\n```\nto change the current pager\n\nIf you want one color to distinguish some days. You can add reachAbleDays. And set the color by setTextUnableColor\n```java\n    ...\n    mWeekViewAdapter.setData(reachAbleDays.get(0), reachAbleDays.get(reachAbleDays.size() - 1), reachAbleDays);\n    ...\n    \n```\n\n###MonthSwitchView\n\nOk!Add layout first.\n```xml\n  \u003ccom.test.tudou.library.MonthSwitchPager.view.MonthSwitchView\n    android:id=\"@+id/view_month\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"/\u003e\n    \n```\nThen initial the data, Pay attention to the selectday must set after initial the startday and endday.\n```java\n    mMonthPagerView.setData(new CalendarDay(2015, 5, 4), new CalendarDay(2020, 12, 2));\n    mMonthPagerView.setOnDayClickListener(this);\n    mMonthPagerView.setSelectDay(new CalendarDay(2016, 10, 1));\n    \n```\nFinally, your activity can Implements MonthView.OnDayClickListener to get the click event.\n```java\n    @Override public void onDayClick(CalendarDay calendarDay) {\n        Toast.makeText(this, calendarDay.getDayString(), Toast.LENGTH_SHORT).show();\n    }\n    \n```\n\n###ExpandCalendarView\nYou can add it\n```xml\n   \u003ccom.test.tudou.library.expandcalendar.view.ExpandCalendarView\n        android:id=\"@+id/view_calendar\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\" /\u003e\n    \n```\nThen to add data to the Calendar\n```java\n   private void updateData() {\n        mMonthPagerView.setData(new CalendarDay(2015, 5, 4), new CalendarDay(2020, 12, 2));\n        mMonthPagerView.setOnDayClickListener(this);\n        mMonthPagerView.setSelectDay(new CalendarDay(2016, 10, 16));\n\n    }\n\n    @Override\n    public void onDayClick(CalendarDay calendarDay) {\n        textExample.setText(\"Click at \" + calendarDay.getDayString());\n    }\n    \n```\nFinally, get the click data as this\n```java\npublic class ExpandCalendarActivity extends ActionBarActivity implements ExpandCalendarMonthView.OnDayClickListener {\n    ...\n    @Override\n    public void onDayClick(CalendarDay calendarDay) {\n        textExample.setText(\"Click at \" + calendarDay.getDayString());\n    }\n    \n```\n\nIf you have saw. I will thanks for your suggestion.\n\n\n\nThanks\n====\n* [flavienlaurent/datetimepicker](https://github.com/flavienlaurent/datetimepicker)\n\n* [chenupt/SpringIndicator](https://github.com/chenupt/SpringIndicator)\n\nLicense\n====\n\u003cpre\u003e\nCopyright 2015 ToDou\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\u003c/pre\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftodou%2Fcalendarpager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftodou%2Fcalendarpager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftodou%2Fcalendarpager/lists"}