MonthYearPicker
This is an android library to open a month and year picker.
Install / Use
/learn @Dibyendu91/MonthYearPickerREADME
Month-Year Picker
About
This is a library to open a picker with month and year view. You can pick any month and year from
picker and you will receive a calender instance from where you can fetch selected month year.
Preview
<img src="screen_shots/month-view.png" width="200" align="left" hspace="20"/> <img src="screen_shots/year-view.png" width="200" align="center" hspace="20"/> <img src="screen_shots/month-year-picker.gif" width="200" align="right" hspace="20"/>Setup
Use the following step to use this library. You can download a jar from GitHub's releases page.
Or use Gradle:
repositories {
google()
jcenter()
}
dependencies {
implementation 'com.dibyendu.picker:picker:1.0.0'
implementation "com.google.android.material:material:${material_version}"
}
buildFeatures {
viewBinding = true
}
Or use Maven:
<dependency>
<groupId>com.dibyendu.picker</groupId>
<artifactId>picker</artifactId>
<version>1.0.0</version>
<type>pom</type>
</dependency>
Usage
import com.dibyendu.picker.util.PickerUtils
import com.dibyendu.picker.view.MonthYearPickerDialog
import com.dibyendu.picker.listener.PickerListener
MonthYearPickerDialog.show(context = this, calendar = calendar, listener = object : PickerListener {
override fun onSetResult(calendar: Calendar) {
mCalendar = calendar
val date: String = PickerUtils.getMonthYearDisplay(
this@Activity,
calendar,
PickerUtils.Format.SHORT
)
}
})
Attributes
Classes
- MonthYearPickerDialog: Use this class name to inflate the picker view
- PickerUtils: Use this class reference to access all utils properties to display selected month
- PickerListener: Use this listener to get result after month year selection from picker.
- Format: Use this enum to get month name format as given input. Two types of format available.
- LONG: This type will provide full name format.
- SHORT: This type will provide short name format.
year in simple text.
Methods
- show(context: Activity, calendar: Calendar, listener: PickerListener): Use this method to open
the picker view. You have to pass these given parameters to access the view.
- context: Activity context.
- calendar: Calendar instance. It is an optional parameter. If you don't provide calendar instance of your own, it will take current calendar date time by default.
- listener: Need to implement PickerListener.
- getMonthYearDisplay(context: Context, calendar: Calendar, format: Format): Use this method to
get month display name as given format.
- context: Application context.
- calendar: Calendar instance.
- format: Format type. It is an optional parameter. If you don't provide any format, by
default it will take
LONGformat.
- getMonth(calendar: Calendar, format: Format): Use this method to get only selected month from
picker.
- calendar: Calendar instance.
- format: Format type. It is an optional parameter. If you don't provide any format, by
default it will take
LONGformat.
- getYear(calendar: Calendar): Use this method to get only selected year from picker.
Related Skills
node-connect
345.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
106.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
