All Projects → tejpratap46 → Recyclercalendarandroid

tejpratap46 / Recyclercalendarandroid

Licence: mit
A simple DIY library to generate your own custom Calendar View using RecyclerView, written in Kotlin

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Recyclercalendarandroid

Cvcalendar
A custom visual calendar for iOS 8+ written in Swift (>= 4.0).
Stars: ✭ 3,435 (+4038.55%)
Mutual labels:  calendar, calendar-view, calendar-component
Calendarview
An Easy to Use Calendar for iOS (Swift 5.0)
Stars: ✭ 429 (+416.87%)
Mutual labels:  calendar, calendar-view, calendar-component
Aircalendarview
Airbnb APP CalendarView
Stars: ✭ 96 (+15.66%)
Mutual labels:  calendar, android-ui, calendar-view
Primedatepicker
PrimeDatePicker is a tool that provides picking a single day, multiple days, and a range of days.
Stars: ✭ 292 (+251.81%)
Mutual labels:  calendar, calendar-view, calendar-component
GCCalendar
A customizable calendar view for iOS 9+ written in Swift.
Stars: ✭ 53 (-36.14%)
Mutual labels:  calendar, calendar-component, calendar-view
Xamarin.plugin.calendar
Calendar plugin for Xamarin.Forms
Stars: ✭ 159 (+91.57%)
Mutual labels:  calendar, calendar-view, calendar-component
Calendar Ios
Calendar View
Stars: ✭ 154 (+85.54%)
Mutual labels:  calendar, calendar-view, calendar-component
Calendarview
Android上一个优雅、万能自定义UI、仿iOS、支持垂直、水平方向切换、支持周视图、自定义周起始、性能高效的日历控件,支持热插拔实现的UI定制!支持标记、自定义颜色、农历、自定义月视图各种显示模式等。Canvas绘制,速度快、占用内存低,你真的想不到日历居然还可以如此优雅!An elegant, highly customized and high-performance Calendar Widget on Android.
Stars: ✭ 7,998 (+9536.14%)
Mutual labels:  calendar, calendar-view, calendar-component
Customizablecalendar
CustomizableCalendar is a library that allows you to create your calendar, customizing UI and behaviour
Stars: ✭ 214 (+157.83%)
Mutual labels:  calendar, calendar-view, calendar-component
Eventscalendar
Events Calendar is a user-friendly library that helps you achieve a cool Calendar UI with events mapping. You can customise every pixel of the calendar as per your wish and still achieve in implementing all the functionalities of the native android calendar in addition with adding dots to the calendar which represents the presence of an event on the respective dates. It can be done easily, you are just a few steps away from implementing your own badass looking Calendar for your very own project!
Stars: ✭ 188 (+126.51%)
Mutual labels:  calendar, calendar-view, calendar-component
Peppy Calendarview
Simple and fast Material Design calendar view for Android.
Stars: ✭ 30 (-63.86%)
Mutual labels:  calendar, android-ui, calendar-view
Yycalendar
Simple and Clear Calendar
Stars: ✭ 46 (-44.58%)
Mutual labels:  calendar, calendar-view, calendar-component
Vue Functional Calendar
Vue.js Functional Calendar | Component/Package
Stars: ✭ 314 (+278.31%)
Mutual labels:  calendar, calendar-component
Android Week View
Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling.
Stars: ✭ 3,347 (+3932.53%)
Mutual labels:  calendar, calendar-view
Jzcalendarweekview
Calendar Week & Day View in iOS Swift
Stars: ✭ 272 (+227.71%)
Mutual labels:  calendar, calendar-view
Calendarview2
Calendar view for Android. Pretty.
Stars: ✭ 72 (-13.25%)
Mutual labels:  calendar, calendar-view
Kotlin Agendacalendarview
Android calendar library provides easy to use widget with events
Stars: ✭ 81 (-2.41%)
Mutual labels:  calendar, calendar-view
CalendarView
日历控件
Stars: ✭ 14 (-83.13%)
Mutual labels:  calendar, calendar-view
React Timeline Gantt
A react Timeline component with virtual rendering
Stars: ✭ 347 (+318.07%)
Mutual labels:  calendar, calendar-component
Cadar
Android solution which represents month and list calendar views.
Stars: ✭ 360 (+333.73%)
Mutual labels:  calendar, calendar-view

RecyclerCalendarAndroid

A DIY calendar generator library for android written in Kotlin.

Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories:

allprojects {  
  repositories {
    ...
    maven {
      url 'https://jitpack.io'
    }
  }
}

Step 2. Add the dependency

dependencies {
 implementation 'com.github.tejpratap46:RecyclerCalendarAndroid:LATEST_RELEASE_TAG'
}

Try It

Download From Play Store

Here are sample calenders you can create with this library :

Week Calendar Month With Events Month With Swipe Pages
Code At: horizontal Code At: vertical Code At: viewpager
Week Calender.gif Month With Events.gif Month With Events.gif

Above sample are not the limit of this library, possiblities are endless as you can create custom view for each date as well as add custom Business Login on top of it.


Here is how you can create your own Calendar using RecyclerCalendarAndroid. Create a RecyclerView Adapter which extends RecyclerCalendarBaseAdapter

  1. Implement following methods:
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
    val view: View = LayoutInflater.from(parent.context).inflate(R.layout.item_calendar_horizontal, parent, false)
    return MonthCalendarViewHolder(view)
}
  1. Create ViewHolder Class for you View which extends RecyclerView.ViewHolder:
class MonthCalendarViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
    val textViewDay: TextView = itemView.findViewById(R.id.textCalenderItemVerticalDay)
    val textViewDate: TextView = itemView.findViewById(R.id.textCalenderItemVerticalDate)
    val viewEvent: View = itemView.findViewById(R.id.viewCalenderItemVerticalEvent)
}
  1. Now just implament onBindViewHolder
override fun onBindViewHolder(
        holder: RecyclerView.ViewHolder,
        position: Int,
        calendarItem: RecyclerCalenderViewItem
	) {
    val monthViewHolder: MonthCalendarViewHolder = holder as MonthCalendarViewHolder
	// first reset view of current item as it will be reused for different dates and header.
	{
	    // Reset all you view here...
		monthViewHolder.itemView.visibility = View.VISIBLE
		monthViewHolder.itemView.setOnClickListener(null)
	}
	
	// Calendar item as 3 parts
	// 1. Header -> Where you put month name, year etc.
	// 2. Empty Space -> This is empty space to fill days before first day of month start, hide every view of ViewHolder Here
	// 3. Date -> This is a date, customise your date with event, tecket information, Available slot OR just selection etc here
	if (calendarItem.isHeader) {
	    val selectedCalendar = Calendar.getInstance(Locale.getDefault())  
		selectedCalendar.time = calendarItem.date  
  
		val month: String = CalendarUtils.getMonth(selectedCalendar.get(Calendar.MONTH)) ?: ""  
		val year = selectedCalendar[Calendar.YEAR].toLong()  
  
		monthViewHolder.textViewDay.text = year.toString()  
		monthViewHolder.textViewDate.text = month
	} else if (calendarItem.isEmpty) {
		monthViewHolder.itemView.visibility = View.GONE
		monthViewHolder.textViewDay.text = ""
		monthViewHolder.textViewDate.text = ""
	} else {  
	    val calendarDate = Calendar.getInstance(Locale.getDefault())  
	    calendarDate.time = calendarItem.date

		val day: String = CalendarUtils.getDay(calendarDate.get(Calendar.DAY_OF_WEEK)) ?: ""

		monthViewHolder.textViewDay.text = day

		val dateInt: Int =  
        (CalendarUtils.dateStringFromFormat(calendarDate.time, CalendarUtils.DB_DATE_FORMAT)  
            ?: "0").toInt()

		if (eventMap.contains(dateInt)) {
			// As an example, here im checking if this date has any event passed from constructor
	        monthViewHolder.viewEvent.visibility = View.VISIBLE
	        // Set background color from event information
			monthViewHolder.viewEvent.setBackgroundColor(eventMap.get(dateInt)!!.color)  
	    }  
 
		// Set Date to textView
	    monthViewHolder.textViewDate.text = CalendarUtils.dateStringFromFormat(calendarDate.time, CalendarUtils.DISPLAY_DATE_FORMAT) ?: ""  
  
		// Here as an example, im sending Tap data to listener
	    monthViewHolder.itemView.setOnClickListener {  
			dateSelectListener.onDateSelected(calendarItem.date, eventMap[dateInt])  
	    }  
	}
}

above code is direct example from VerticalRecyclerCalendarAdapter


For People who want to just use simple date picker/selection calendar, i have created SimpleRecyclerCalendarView

To use SimpleRecyclerCalendarView, just include following in your .xml

<com.tejpratapsingh.recyclercalendar.views.SimpleRecyclerCalendarView  
  android:id="@+id/calendarRecyclerView"  
  android:layout_width="match_parent"  
  android:layout_height="match_parent" />

And in Your Activity, include following

val calenderView: SimpleRecyclerCalendarView = findViewById(R.id.calendarRecyclerView)  
  
val date = Date()  
date.time = System.currentTimeMillis()  
  
// Start From Date
val startCal = Calendar.getInstance()  
  
// End Date
val endCal = Calendar.getInstance()  
endCal.time = date  
endCal.add(Calendar.MONTH, 3)  
  
val configuration: SimpleRecyclerCalendarConfiguration =
            SimpleRecyclerCalendarConfiguration(
                calenderViewType = RecyclerCalendarConfiguration.CalenderViewType.VERTICAL, // calendarViewType could be VERTICAL OR HORIZONTAL
                calendarLocale = Locale.getDefault(),
                includeMonthHeader = true,
                selectionMode = SimpleRecyclerCalendarConfiguration.SelectionModeNone() // selectionMode could be one of [SelectionModeNone, SelectionModeSingle, SelectionModeMultiple, SelectionModeRange]
            )

        calenderView!!.initialise(
            startDate,
            endDate,
            configuration,
            object : SimpleRecyclerCalendarAdapter.OnDateSelected {
                override fun onDateSelected(date: Date) {
                    Toast.makeText(
                        calenderView!!.context,
                        "Date Selected: ${CalendarUtils.getGmt(date)}",
                        Toast.LENGTH_LONG
                    ).show()
                }
            })

To know More about SimpleRecyclerCalendarView visit SimpleRecyclerCalendarActivity

For People who want to just use infinite date picker/selection calendar, i have created InfiniteRecyclerCalendarView

To use InfiniteRecyclerCalendarView, just include following in your .xml

<com.tejpratapsingh.recyclercalendar.views.InfiniteRecyclerCalendarView  
  android:id="@+id/calendarRecyclerView"  
  android:layout_width="match_parent"  
  android:layout_height="match_parent" />

And in Your Activity, include following

val calenderView: InfiniteRecyclerCalendarView = findViewById(R.id.calendarRecyclerView)  
  
val date = Date()  
date.time = System.currentTimeMillis()  
  
// Start From Date
val startCal = Calendar.getInstance()  
  
// End Date
val endCal = Calendar.getInstance()  
endCal.time = date  
endCal.add(Calendar.MONTH, 3)  
  
val configuration: InfiniteRecyclerCalendarConfiguration =
            InfiniteRecyclerCalendarConfiguration(
                calenderViewType = RecyclerCalendarConfiguration.CalenderViewType.VERTICAL, // calendarViewType could be VERTICAL OR HORIZONTAL
                calendarLocale = Locale.getDefault(),
                includeMonthHeader = true,
                selectionMode = InfiniteRecyclerCalendarConfiguration.SelectionModeNone() // selectionMode could be one of [SelectionModeNone, SelectionModeSingle, SelectionModeMultiple, SelectionModeRange]
            )

        calenderView!!.initialise(
            configuration,
            object : InfiniteRecyclerCalenderAdapter.OnDateSelected {
                override fun onDateSelected(date: Date) {
                    Toast.makeText(
                        calenderView!!.context,
                        "Date Selected: ${CalendarUtils.getGmt(date)}",
                        Toast.LENGTH_LONG
                    ).show()
                }
            })

To know More about InfiniteRecyclerCalendarActivity visit InfiniteRecyclerCalendarActivity

Donate

ko-fi

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].