{"id":15029781,"url":"https://github.com/philliphsu/bottomsheetpickers","last_synced_at":"2025-04-12T22:35:48.405Z","repository":{"id":201537040,"uuid":"70112957","full_name":"philliphsu/BottomSheetPickers","owner":"philliphsu","description":"Third-party date and time pickers for Android.","archived":false,"fork":false,"pushed_at":"2019-07-02T08:35:43.000Z","size":3616,"stargazers_count":1098,"open_issues_count":19,"forks_count":142,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-04T02:07:38.232Z","etag":null,"topics":["android","bottom-sheet","date-picker","date-time","date-time-input","datetimepicker","picker-dialogs","picker-library","time-picker","ui-components","ui-design"],"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/philliphsu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-10-06T01:20:05.000Z","updated_at":"2025-02-18T09:09:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"ea54e340-3d6c-4f00-9b78-4efc12b2ff16","html_url":"https://github.com/philliphsu/BottomSheetPickers","commit_stats":null,"previous_names":["philliphsu/bottomsheetpickers"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philliphsu%2FBottomSheetPickers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philliphsu%2FBottomSheetPickers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philliphsu%2FBottomSheetPickers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philliphsu%2FBottomSheetPickers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philliphsu","download_url":"https://codeload.github.com/philliphsu/BottomSheetPickers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248642511,"owners_count":21138351,"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","bottom-sheet","date-picker","date-time","date-time-input","datetimepicker","picker-dialogs","picker-library","time-picker","ui-components","ui-design"],"created_at":"2024-09-24T20:11:37.207Z","updated_at":"2025-04-12T22:35:48.375Z","avatar_url":"https://github.com/philliphsu.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BottomSheetPickers\n[![Download](https://api.bintray.com/packages/philliphsu/maven/bottom-sheet-pickers/images/download.svg)](https://bintray.com/philliphsu/maven/bottom-sheet-pickers/_latestVersion)\n\nBottomSheetPickers is a library of new date and time pickers for Android,\nsupporting API level 14 and up.\n\n## Date Picker\n\n\u003cimg src=\"screenshots/paging-date-picker-light.png\" width=\"180\" height=\"320\"\u003e \u003cimg src=\"screenshots/month-picker-light.png\" width=\"180\" height=\"320\"\u003e \u003cimg src=\"screenshots/year-picker-light.png\" width=\"180\" height=\"320\"\u003e\n\n\u003cimg src=\"screenshots/paging-date-picker-dark.png\" width=\"180\" height=\"320\"\u003e \u003cimg src=\"screenshots/month-picker-dark.png\" width=\"180\" height=\"320\"\u003e \u003cimg src=\"screenshots/year-picker-dark.png\" width=\"180\" height=\"320\"\u003e\n\n## Time Pickers\n\n### Number Pad\n\n\u003cimg src=\"screenshots/number-pad-12h-light.png\" width=\"180\" height=\"320\"\u003e \u003cimg src=\"screenshots/number-pad-24h-light.png\" width=\"180\" height=\"320\"\u003e \u003cimg src=\"screenshots/number-pad-12h-dark.png\" width=\"180\" height=\"320\"\u003e \u003cimg src=\"screenshots/number-pad-24h-dark.png\" width=\"180\" height=\"320\"\u003e\n\n### Grid Picker\n\n\u003cimg src=\"screenshots/12h-grid-light.png\" width=\"180\" height=\"320\"\u003e \u003cimg src=\"screenshots/minutes-grid-light.png\" width=\"180\" height=\"320\"\u003e \u003cimg src=\"screenshots/24h-grid-light.png\" width=\"180\" height=\"320\"\u003e\n\n\u003cimg src=\"screenshots/12h-grid-dark.png\" width=\"180\" height=\"320\"\u003e \u003cimg src=\"screenshots/minutes-grid-dark.png\" width=\"180\" height=\"320\"\u003e \u003cimg src=\"screenshots/24h-grid-dark.png\" width=\"180\" height=\"320\"\u003e\n\n## Table of Contents\n1. [Installation](#installation)\n2. [Usage](#usage)\n    1. [Implement Callbacks](#implement-callbacks)\n    2. [Create Pickers](#create-pickers)\n    3. [Show the Dialog](#show-the-dialog)\n    4. [Theming](#theming)\n    5. [Additional Options](#additional-options)\n        1. [Basic Options](#basic-options)\n        2. [DatePickerDialog and DatePickerDialog.Builder](#datepickerdialog-and-datepickerdialogbuilder)\n        3. [NumberPadTimePickerDialog and NumberPadTimePickerDialog.Builder](#numberpadtimepickerdialog-and-numberpadtimepickerdialogbuilder)\n        4. [GridTimePickerDialog and GridTimePickerDialog.Builder](#gridtimepickerdialog-and-gridtimepickerdialogbuilder)\n        5. [Setters Only](#setters-only)\n3. [Attribution](#attribution)\n4. [License](#license)\n\n## Installation\nThis library depends on the `appcompat-v7`, `design`, and `gridlayout-v7` support libraries.\nIt is recommended that you exclude them from the library and add those dependencies on your own.\nThis will ensure both your project and this library are using the same versions of the support\nlibraries.\n\n```groovy\ndependencies {\n    // Recommended\n    compile('com.philliphsu:bottomsheetpickers:2.4.1') {\n        exclude group: 'com.android.support', module: 'appcompat-v7'\n        exclude group: 'com.android.support', module: 'design'\n        exclude group: 'com.android.support', module: 'gridlayout-v7'\n    }\n    compile 'com.android.support:appcompat-v7:[LATEST_VERSION]'\n    compile 'com.android.support:design:[LATEST_VERSION]'\n    compile 'com.android.support:gridlayout-v7:[LATEST_VERSION]'\n\n    // Standard -- not recommended!\n    compile 'com.philliphsu:bottomsheetpickers:2.4.1'\n}\n```\n\n## Usage\nYou must be using a `android.support.v4.app.FragmentActivity` or `android.support.v4.app.Fragment`.\nThe pickers are indirect subclasses of `android.support.v4.app.DialogFragment`.\n\n### Implement Callbacks\n\nTo retrieve the date or time set in the pickers, implement an appropriate callback interface.\n\n* `com.philliphsu.bottomsheetpickers.date.DatePickerDialog.OnDateSetListener`\n* `BottomSheetTimePickerDialog.OnTimeSetListener`\n\n```java\n@Override\npublic void onDateSet(DatePickerDialog dialog, int year, int monthOfYear, int dayOfMonth) {\n    Calendar cal = new java.util.GregorianCalendar();\n    cal.set(Calendar.YEAR, year);\n    cal.set(Calendar.MONTH, monthOfYear);\n    cal.set(Calendar.DAY_OF_MONTH, dayOfMonth);\n    mText.setText(\"Date set: \" + DateFormat.getDateFormat(this).format(cal.getTime()));\n}\n\n@Override\npublic void onTimeSet(ViewGroup viewGroup, int hourOfDay, int minute) {\n    Calendar cal = new java.util.GregorianCalendar();\n    cal.set(Calendar.HOUR_OF_DAY, hourOfDay);\n    cal.set(Calendar.MINUTE, minute);\n    mText.setText(\"Time set: \" + DateFormat.getTimeFormat(this).format(cal.getTime()));\n}\n```\n\n### Create Pickers\n\n```java\nCalendar now = Calendar.getInstance();\n// As of version 2.3.0, `BottomSheetDatePickerDialog` is deprecated.\nDatePickerDialog date = DatePickerDialog.newInstance(\n    MainActivity.this,\n    now.get(Calendar.YEAR),\n    now.get(Calendar.MONTH),\n    now.get(Calendar.DAY_OF_MONTH));\n\n// Configured according to the system preference for 24-hour time.\nNumberPadTimePickerDialog pad = NumberPadTimePickerDialog.newInstance(MainActivity.this);\n// Alternatively, you can set 24-hour mode on your own.\nboolean is24HourMode = ...\nNumberPadTimePickerDialog pad = NumberPadTimePickerDialog.newInstance(MainActivity.this, is24HourMode);\n\nGridTimePickerDialog grid = GridTimePickerDialog.newInstance(\n    MainActivity.this,\n    now.get(Calendar.HOUR_OF_DAY),\n    now.get(Calendar.MINUTE),\n    DateFormat.is24HourFormat(MainActivity.this));\n```\n\nAs of version 2.3.0, you have the option to create pickers using the `Builder` pattern.\nThis is helpful if you want to chain together [additional options](#additional-options)\nbefore creating the dialog. Of course, you can continue creating a dialog with\n`newInstance()` as usual, and then just call setters on the dialog itself.\n\n```java\nDatePickerDialog date = new DatePickerDialog.Builder(\n    MainActivity.this,\n    now.get(Calendar.YEAR),\n    now.get(Calendar.MONTH),\n    now.get(Calendar.DAY_OF_MONTH))\n    /* ... Set additional options ... */\n    .build();\n\n// Configured according to the system preference for 24-hour time.\nNumberPadTimePickerDialog pad = new NumberPadTimePickerDialog.Builder(MainActivity.this)\n    /* ... Set additional options ... */\n    .build();\n// Alternatively, you can set 24-hour mode on your own.\nNumberPadTimePickerDialog pad = new NumberPadTimePickerDialog.Builder(MainActivity.this, is24HourMode)\n    /* ... Set additional options ... */\n    .build();\n\nGridTimePickerDialog grid = new GridTimePickerDialog.Builder(\n    MainActivity.this,\n    now.get(Calendar.HOUR_OF_DAY),\n    now.get(Calendar.MINUTE),\n    DateFormat.is24HourFormat(MainActivity.this))\n    /* ... Set additional options ... */\n    .build();\n```\n\n### Show the Dialog\n\nPass in a `android.support.v4.app.FragmentManager` to the dialog's `show()`.\n\n```java\n// For a `android.support.v4.app.FragmentActivity`:\ndialog.show(getSupportFragmentManager(), TAG);\n\n// For a `android.support.v4.app.Fragment`:\ndialog.show(getFragmentManager(), TAG);\n```\n\n### Theming\nThe pickers automatically use your current theme's `colorAccent` defined in your `styles.xml`.\n\nYou can specify whether to use a light (default) or dark theme:\n* in `styles.xml` by specifying a boolean value for the attribute `themeDark` in your theme.\n```xml\n\u003citem name=\"themeDark\"\u003etrue\u003c/item\u003e\n```\n* in code with the dialog's `setThemeDark(boolean dark)` method. This overwrites the value specified in XML.\n\n### Additional Options\nThese additional APIs can be used to customize the appearance of the picker. They are\navailable both as setter methods and as `Builder` options, unless otherwise noted.\n\n#### Basic Options\nThese APIs are available in all pickers.\n\n* `setThemeDark(boolean dark)`\nSet a dark or light theme.\n\n* `setAccentColor(@ColorInt int color)`\nSet the accent color. This color is primarily used to tint views in the picker.\nIf this picker is using the light theme and you did not call `setHeaderColor(int)`,\nthis color will also be applied to the dialog's header.\n\n* `setBackgroundColor(@ColorInt int color)`\nSet the background color. If this color is dark, consider setting the theme dark to ensure text\nin the picker has enough contrast.\n\n* `setHeaderColor(@ColorInt int color)`\nSet the header color. If this color is light, consider setting the header text dark to ensure\nit has enough contrast.\n\n* `setHeaderTextDark(boolean dark)`\nSet the header text to use a light or dark color. The default is false, so a light color is applied.\n\n#### `DatePickerDialog` and `DatePickerDialog.Builder`\n\n* `setFirstDayOfWeek(int startOfWeek)`\nUse this to set the day (`Calendar.SUNDAY` through `Calendar.SATURDAY`) that a week should start on.\n\n* `setYearRange(int startYear, int endYear)`\nSets the range of years to be displayed by this date picker. If a minimal date and/or maximal date\nwere set using `setMinDate(Calendar)` or `setMaxDate(Calendar)`, dates in the specified range of\nyears that lie outside of the minimal and maximal dates will be disallowed from being selected.\n_This does NOT change the minimal date's year or the maximal date's year._\n\n* `setMinDate(Calendar calendar)`\nSets the minimal date that can be selected in this date picker. Dates before (but not including)\nthe specified date will be disallowed from being selected.\n\n* `setMaxDate(Calendar calendar)`\nSets the maximal date that can be selected in this date picker. Dates after (but not including)\nthe specified date will be disallowed from being selected.\n\n* `setHeaderTextColorSelected(@ColorInt int color)`\nSet the color of the header text when it is selected.\n\n* `setHeaderTextColorUnselected(@ColorInt int color)`\nSet the color of the header text when it is not selected.\n\n* `setDayOfWeekHeaderTextColorSelected(@ColorInt int color)`\nSet the color of the day-of-week header text when it is selected.\n\n* `setDayOfWeekHeaderTextColorUnselected(@ColorInt int color)`\nSet the color of the day-of-week header text when it is not selected.\n\n#### `NumberPadTimePickerDialog` and `NumberPadTimePickerDialog.Builder`\n\n* `setHeaderTextColor(@ColorInt int color)`\nSet the color of the header text that stores the inputted time.\n\n#### `GridTimePickerDialog` and `GridTimePickerDialog.Builder`\n\n* `setHeaderTextColorSelected(@ColorInt int color)`\nSet the color of the header text when it is selected.\n\n* `setHeaderTextColorUnselected(@ColorInt int color)`\nSet the color of the header text when it is not selected.\n\n* `setTimeSeparatorColor(@ColorInt int color)`\nSet the color of the time separator that separates the hour and minute views in the header.\n\n* `setAmPmTextColorSelected(@ColorInt int color)`\nSet the color of the AM/PM text when it is selected. This is equivalent to\n`setHalfDayButtonColorSelected(int)` in 24-hour time.\n\n* `setAmPmTextColorUnselected(@ColorInt int color)`\nSet the color of the AM/PM text when it is not selected. This is equivalent to\n`setHalfDayButtonColorUnselected(int)` in 24-hour time.\n\n* `setHalfDayButtonColorSelected(@ColorInt int color)`\nSet the color of the half-day image button when it is selected. This is equivalent to\n`setAmPmTextColorSelected(int)` in 12-hour time.\n\n* `setHalfDayButtonColorUnselected(@ColorInt int color)`\nSet the color of the half-day image button when it is not selected. This is equivalent to\n`setAmPmTextColorUnselected(int)` in 12-hour time.\n\n#### Setters Only\nThese are only available as setter methods in `NumberPadTimePickerDialog`.\n\n* `setHint(String hint)` or `setHint(@StringRes int resid)`\nSets the hint of the input time TextView.\n\n* `setInputTextSize(int textSize)`\nSets the text size in px of the input time TextView.\n\n* `getInputTextView()`\nReturns the `TextView` that stores the inputted time.\n\n## Attribution\n\nThis library is based on code from the following AOSP repositories:\n* https://android.googlesource.com/platform/frameworks/opt/datetimepicker\n* https://android.googlesource.com/platform/packages/apps/Calculator\n\n## License\n```\nCopyright 2017 Phillip Hsu\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```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilliphsu%2Fbottomsheetpickers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilliphsu%2Fbottomsheetpickers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilliphsu%2Fbottomsheetpickers/lists"}