{"id":25560031,"url":"https://github.com/styropyr0/customizabledatepicker","last_synced_at":"2025-04-12T04:54:21.175Z","repository":{"id":263973046,"uuid":"891477890","full_name":"styropyr0/CustomizableDatePicker","owner":"styropyr0","description":"An Android library that offers a flexible and visually enhanced date picker, allowing developers to easily integrate and customize date selection dialogs in their applications. It supports theming, localization, and additional features to align with various app designs and user experiences.","archived":false,"fork":false,"pushed_at":"2025-03-27T17:46:49.000Z","size":304,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T04:54:11.567Z","etag":null,"topics":["android","android-library","android-ui","dateparser","datepicker","datepicker-component","datepickerdialog","datetime","java","kotlin","kotlin-android"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/styropyr0.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-20T12:06:49.000Z","updated_at":"2025-03-27T17:46:53.000Z","dependencies_parsed_at":"2025-02-20T17:36:19.446Z","dependency_job_id":"a5733118-1c49-48fe-8667-97ad515bbc79","html_url":"https://github.com/styropyr0/CustomizableDatePicker","commit_stats":null,"previous_names":["styropyr0/customizabledatepicker"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styropyr0%2FCustomizableDatePicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styropyr0%2FCustomizableDatePicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styropyr0%2FCustomizableDatePicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styropyr0%2FCustomizableDatePicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/styropyr0","download_url":"https://codeload.github.com/styropyr0/CustomizableDatePicker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248519472,"owners_count":21117757,"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":["android","android-library","android-ui","dateparser","datepicker","datepicker-component","datepickerdialog","datetime","java","kotlin","kotlin-android"],"created_at":"2025-02-20T17:28:55.181Z","updated_at":"2025-04-12T04:54:21.167Z","avatar_url":"https://github.com/styropyr0.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Customizable Date Picker\n\n#### Latest version: 1.2\nThis is a fully customizable date picker component for Android that offers a variety of customization options and a simple API for displaying a date picker with a wide range of features.\n\nPlease note that this library requires Java Version 11 at the least, and  \n```gradle\nminSdk = 28  //or above\n```\n\n![Project Logo](./images/scr1.jpeg)\n\n## Features\n\n- **Custom Date Highlighting**: Highlight specific dates with custom backgrounds or text colors.  \n- **Customizable UI**: Customize buttons, calendar layout, top bar, and date view appearance.  \n- **Flexible Date Range**: Set custom date ranges and enable/disable dates.  \n- **Simple to Use**: Easy-to-use API for showing the date picker and handling date selection.  \n- **Gesture Month Switching**: Option to enable swipe gestures for month navigation.  \n\n---\n\n## Installation\n\nTo include the **Customizable Date Picker** in your project, follow the instructions below.\n\n```gradle\ndependencies {\n    implementation 'com.github.styropyr0:CustomizableDatePicker:1.1'\n}\n```\nor for `app:build.gradle.kts`\n\n```kotlin\ndependencies {\n    implementation(\"com.github.styropyr0:CustomizableDatePicker:1.1\")\n}\n```\n\nAdd the following to your `settings.gradle`:\n\n```gradle\ndependencyResolutionManagement {\n    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n    repositories {\n        mavenCentral()\n        maven { url 'https://jitpack.io' }\n    }\n}\n```\nor for `settings.gradle.kts`\n\n```kotlin\ndependencyResolutionManagement {\n\t\trepositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n\t\trepositories {\n\t\t\tmavenCentral()\n\t\t\tmaven { url = uri(\"https://jitpack.io\") }\n\t\t}\n\t}\n```\n---\n\n## Customization Options\n\nThe `CustomCalendarResources` singleton provides a variety of methods for customizing the appearance and behavior of the date picker. Below is a comprehensive list of available options.\n\n---\n\n### **Date Picker Title**\n\n- **Set Title Text**  \n  Define the title text for the date picker.  \n  ```kotlin\n  CustomCalendarResources.setTitle(\"Select a Date\")\n  ```\n\n- **Set Title Font Size**  \n  Adjust the font size of the title text.  \n  ```kotlin\n  CustomCalendarResources.setTitleFontSize(16f)\n  ```\n\n- **Set Title Text Color**  \n  Change the color of the title text.  \n  ```kotlin\n  CustomCalendarResources.setTitleColor(Color.BLACK)\n  ```\n\n- **Set Title Visibility**  \n  Show or hide the title in the date picker.  \n  ```kotlin\n  CustomCalendarResources.setTitleVisibility(View.VISIBLE)\n  ```\n\n---\n\n### **Drawer Customization**\n\n- **Set Drawer Color**  \n  Customize the color of the drawer.  \n  ```kotlin\n  CustomCalendarResources.setDrawerColor(Color.parseColor(\"#C3DBD3D2\"))\n  ```\n\n- **Set Drawer Visibility**  \n  Show or hide the drawer. \n  ```kotlin\n  CustomCalendarResources.setDrawerVisibility(View.VISIBLE)\n  ```\n\n---\n\n### **Top Bar Customization**\n\n- **Top Bar Background Color**  \n  Customize the background color of the top bar.  \n  ```kotlin\n  CustomCalendarResources.setTopBarBackgroundColor(Color.WHITE)\n  ```\n\n- **Sunday Day Color in Top Bar**  \n  Define the color for Sundays in the top bar.  \n  ```kotlin\n  CustomCalendarResources.setTopBarSundayColor(Color.RED)\n  ```\n\n- **Default Day Color in Top Bar**  \n  Specify the default color for other weekdays in the top bar.  \n  ```kotlin\n  CustomCalendarResources.setTopBarDefaultDayColor(Color.parseColor(\"#848487\"))\n  ```\n\n- **Top Bar Days Background**  \n  Set a background drawable for the top bar days.  \n  ```kotlin\n  CustomCalendarResources.setTopBarDaysBackground(R.drawable.days_background)\n  ```\n\n---\n\n### **Calendar Customization**\n\n- **Set Highlight Date Background**  \n  Set the drawable for highlighting selected dates.  \n  ```kotlin\n  CustomCalendarResources.setCalendarDayHighlightBackground(R.drawable.highlight_background)\n  ```\n\n- **Set Default Date Background**  \n  Define the default background for calendar dates.  \n  ```kotlin\n  CustomCalendarResources.setCalendarDayBackgroundDefault(R.drawable.default_background)\n  ```\n\n- **Set Calendar Days Text Color**  \n  Change the text color for all calendar dates.  \n  ```kotlin\n  CustomCalendarResources.setCalendarDaysTextColor(Color.BLACK)\n  ```\n\n- **Set Disabled Days Text Color**  \n  Customize the text color for disabled dates.  \n  ```kotlin\n  CustomCalendarResources.setCalendarDaysDisabledTextColor(Color.GRAY)\n  ```\n\n- **Set Highlighted Days Text Color**  \n  Specify the text color for highlighted dates.  \n  ```kotlin\n  CustomCalendarResources.setCalendarDaysHighlightTextColor(Color.RED)\n  ```\n\n- **Set Calendar Background Color**  \n  Adjust the background color of the calendar.  \n  ```kotlin\n  CustomCalendarResources.setCalendarBackgroundColor(Color.WHITE)\n  ```\n\n- **Set Font**  \n  Change the font for all calendar text.  \n  ```kotlin\n  CustomCalendarResources.setFont(R.font.dm_sans_medium)\n  ```\n\n---\n\n### **Buttons**\n\n- **Button Background Drawable**  \n  Set a custom drawable for the buttons.  \n  ```kotlin\n  CustomCalendarResources.setButtonDrawable(R.drawable.button_background)\n  ```\n\n- **Button Text Color**  \n  Change the color of the button text.  \n  ```kotlin\n  CustomCalendarResources.setButtonTextColor(Color.WHITE)\n  ```\n\n- **Button Font Size**  \n  Adjust the font size of the button text.  \n  ```kotlin\n  CustomCalendarResources.setButtonFontSize(14f)\n  ```\n\n---\n\n### **Selectors**\n\n- **Set Selector Background**  \n  Define the background drawable for the selectors.  \n  ```kotlin\n  CustomCalendarResources.setSelectorBackground(R.drawable.selector_background)\n  ```\n\n- **Set Selector Text Color**  \n  Change the text color for the selectors.  \n  ```kotlin\n  CustomCalendarResources.setSelectorTextColor(Color.BLACK)\n  ```\n\n- **Selector Font Size**  \n  Adjust the font size for selectors (month/year).  \n  ```kotlin\n  CustomCalendarResources.setSelectorFontSize(16f)\n  ```\n\n---\n\n### **Gestures and Navigation**\n\n- **Enable Gesture-based Month Switching**  \n  Toggle gestures for switching months.  \n  ```kotlin\n  CustomCalendarResources.useGestureForSwitchingMonths(true)\n  ```\n\n- **Month Switch Icons (Left and Right)**  \n  Change the icons for navigating months.  \n  ```kotlin\n  CustomCalendarResources.setMonthSwitchIconLeft(R.drawable.ic_arrow_left)\n  CustomCalendarResources.setMonthSwitchIconRight(R.drawable.ic_arrow_right)\n  ```\n\n- **Year Switch Icon**  \n  Set the icon for switching years.  \n  ```kotlin\n  CustomCalendarResources.setYearSwitchIcon(R.drawable.ic_arrow_down)\n  ```\n\n---\n\n### **Popup Customization**\n\n- **Popup Background**  \n  Customize the background of popups.  \n  ```kotlin\n  CustomCalendarResources.setPopupBackground(R.drawable.popup_background)\n  ```\n\n---\n\n### **Font Sizes**\n\n- **Calendar Font Size**  \n  Adjust the font size for calendar text.  \n  ```kotlin\n  CustomCalendarResources.setCalendarFontSize(14f)\n  ```\n\n- **Year Dropdown Font Size**  \n  Customize the font size for the year dropdown menu.  \n  ```kotlin\n  CustomCalendarResources.setYearDropdownFontSize(12f)\n  ```\n  \n## The `show()` Method\n\nThe `show()` method is used to display the date picker with full flexibility. Here's a detailed breakdown of the parameters:\n\n```kotlin\nfun show(\n    context: Context,\n    date: String,\n    displayView: View? = null, \n    offset: String = \"0-0-0\",\n    upperLimit: String = today(), \n    todo: () -\u003e Unit = {} \n)\n```\n\n#### Parameters:\n- **`context`**: The `Context` in which the date picker will be displayed (usually `Activity` or `Fragment`).\n- **`date`**: The date to show initially, in the format `dd-MM-yyyy`.\n- **`displayView`**: A `TextView` or `Button` whose text will be updated with the selected date. If not provided, no view will be updated.\n- **`offset`**: A string that defines the offset for date selection. The format is `\"dd-mm-yyyy\"`. For example, `\"0-0-5\"` will show dates from 5 years ago.\n- **`upperLimit`**: The latest date a user can select, in the format `dd-MM-yyyy`. By default, this is today's date.\n- **`todo`**: An optional callback that will be called after a date is selected. This allows you to perform actions after the date is picked.\n\n#### Example:\n\n```kotlin\nval datePicker = CustomizableDatePicker()\ndatePicker.show(\n    this,\n    \"20-10-2023\", // Default date\n    v as Button, // Button to display the selected date\n    offset = \"0-0-5\", // Show dates from 5 years ago\n    upperLimit = \"31-12-2025\" // Limit to dates up to 31st December 2025\n) {\n    // Code to run after date selection\n}\n```\n\n## DateManager Class\n\nThe `DateManager` class provides utility functions for managing and formatting dates.\n\n#### Key Methods:\n\n- **`today()`**: Returns today's date in `dd-MM-yyyy` format.\n  \n  ```kotlin\n  val currentDate = DateManager.today() // \"21-11-2024\"\n  ```\n\n- **`formatDate(date: String, currentFormat: String, finalFormat: String)`**: Formats a given date from one format to another.\n\n  ```kotlin\n  val formattedDate = DateManager.formatDate(\"21-11-2024\", \"dd-MM-yyyy\", \"yyyy/MM/dd\")\n  ```\n\n## Conclusion\n\nThe **Customizable Date Picker** provides a highly customizable and easy-to-use date picker for Android applications. With flexible options for appearance and behavior, you can tailor the date picker to match your app's design requirements. The integration of gesture-based month switching and an offset for date ranges makes it a versatile solution for various use cases.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyropyr0%2Fcustomizabledatepicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstyropyr0%2Fcustomizabledatepicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyropyr0%2Fcustomizabledatepicker/lists"}