Skip to content

Commit 5cdeee4

Browse files
committed
Removed unnecessary methods and code for updating selected date background.
1 parent b43621b commit 5cdeee4

File tree

3 files changed

+1
-13
lines changed

3 files changed

+1
-13
lines changed

CalendarView/src/main/java/com/shahzadafridi/calendarview/CalendarView.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,6 @@ class CalendarView : LinearLayout, CalenderViewInterface {
270270
return this
271271
}
272272

273-
override fun withUpdateSelectDate(calendar: Calendar): CalendarView {
274-
this.selectedDate = calendar
275-
return this
276-
}
277-
278273
override fun withYearPanel(
279274
dateFormat: String?,
280275
textColor: Int?,

CalendarView/src/main/java/com/shahzadafridi/calendarview/CalenderViewInterface.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ interface CalenderViewInterface {
1616
fun withDayPanel(font: Int? = null, textColor: Int? = null, textSize: Float? = null, selectedTextColor: Int? = null, selectedBackground:Int? = null, background: Int? = null): CalendarView
1717
fun withDayPanelMargin(top: Int = 0,bottom: Int = 0,left: Int = 0,right: Int = 0): CalendarView
1818
fun withCalenderViewBg(background: Int? = null): CalendarView
19-
fun withUpdateSelectDate(selectedDate: Calendar): CalendarView
2019
fun buildCalendar(): CalendarView
2120
fun onMonthClick(view: View?, month: String, position: Int)
2221
interface EventHandler{

app/src/main/java/com/shahzadafridi/sample/MainActivity.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,11 @@ class MainActivity : AppCompatActivity() {
5050
add("SAT")
5151
}
5252

53-
var selectedDate: Calendar? = null
54-
5553
override fun onCreate(savedInstanceState: Bundle?) {
5654
super.onCreate(savedInstanceState)
5755
binding = ActivityMainBinding.inflate(layoutInflater)
5856
setContentView(binding.root)
5957
//@isXMLConfiguration true because values setup in XML
60-
selectedDate = Calendar.getInstance()
6158
setUpCalendarView(binding.calendarView,true)
6259
}
6360

@@ -130,7 +127,7 @@ class MainActivity : AppCompatActivity() {
130127
.withCalenderViewBg(
131128
background = R.drawable.rect_lr_wround_bg
132129
)
133-
.withUpdateSelectDate(selectedDate!!)
130+
134131
.withEvents(
135132
events = events,
136133
eventDotColor = R.color.green
@@ -143,9 +140,6 @@ class MainActivity : AppCompatActivity() {
143140

144141
override fun onDayClick(view: View?, date: Date, position: Int) {
145142
val df = SimpleDateFormat.getDateInstance()
146-
selectedDate = Calendar.getInstance().apply {
147-
time = date
148-
}
149143
Toast.makeText(this@MainActivity, df.format(date), Toast.LENGTH_SHORT).show()
150144
Log.e("TEST", "onDayClick")
151145
}

0 commit comments

Comments
 (0)