Coder Social home page Coder Social logo

arjungupta08 / horizontal-calendardate-with-click-listener Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 1.0 141 KB

it shows an horizontal row of dates and days of an perticular month and it is clickable.

Kotlin 100.00%
calendar calendar-view clickable date horizontalcalendar kotlin-android month android-library horizontal library

horizontal-calendardate-with-click-listener's Introduction

Horizontal CalendarDate With Click listener

  • it shows an horizontal row of dates and days of an perticular month.
  • You can switch betweeen months easily.

How To

To get a Git project into your build:

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

 dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
                     google()
                     mavenCentral()
                     maven { url uri("https://jitpack.io") }    			     
		}
	}

Step 2. Add the dependency

 dependencies {
	  implementation ("com.github.ArjunGupta08:Horizontal-CalendarDate-With-Click-listener:1.1.0")
	}

Step-3 SetUp your Click Listeners

// implement interface in your activity
class MainActivity : AppCompatActivity(), HorizontalCalendarAdapter.OnItemClickListener {

override fun onItemClick(ddMmYy: String, dd: String, day: String) {
    findViewById<TextView>(R.id.selectedDate).text = "Selected date: $ddMmYy"
    findViewById<TextView>(R.id.selectedDD).text = "Selected DD: $dd"
    findViewById<TextView>(R.id.selectedDay).text = "Selected day: $day"
}

Step 4 recycler View SetUp

    tvDateMonth = findViewById(R.id.text_date_month)
    ivCalendarNext = findViewById(R.id.iv_calendar_next)
    ivCalendarPrevious = findViewById(R.id.iv_calendar_previous)

    recyclerView = findViewById(R.id.recyclerView)     
    recyclerView.layoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)

    val calendarSetUp = HorizontalCalendarSetUp()
    
    val tvMonth = calendarSetUp.setUpCalendarAdapter(recyclerView, this@MainActivity) // Make sure to implement the interface as guided in step-3
    tvDateMonth.text = tvMonth

    // SetUp your previous and next month keys
    calendarSetUp.setUpCalendarPrevNextClickListener(ivCalendarNext, ivCalendarPrevious, this@MainActivity) {
        tvDateMonth.text = it
    }

horizontal-calendardate-with-click-listener's People

Contributors

arjungupta08 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

wxy2016

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.