Skip to content

Commit

Permalink
Today selection issue fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
tizisdeepan committed Aug 7, 2019
1 parent 3cb97ce commit 2ae462f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions app/src/main/java/com/events/calendarsample/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ class MainActivity : AppCompatActivity(), EventsCalendar.Callback {
eventsCalendar.addEvent(c)
c.add(Calendar.DAY_OF_MONTH, 7)
eventsCalendar.addEvent(c)
c.add(Calendar.MONTH, 1)
c[Calendar.DAY_OF_MONTH] = 1
eventsCalendar.addEvent(c)

selected.setOnClickListener {
val dates = eventsCalendar.getDatesFromSelectedRange()
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
app:eventDotColor="#ff0000"
app:isBoldTextOnSelectionEnabled="true"
app:monthTitleColor="#ffffff"
app:monthTitleTextSize="16sp"
app:monthTitleTextSize="24sp"
app:primaryTextColor="#c4c4c4"
app:rangeSelectionColor="#ffe600"
app:rangeSelectionEndColor="#c1ae01"
Expand All @@ -29,7 +29,7 @@
app:selectedTextColor="#000000"
app:selectionColor="#ffe600"
app:weekHeaderColor="#c6c6c6"
app:weekHeaderTextSize="16sp" />
app:weekHeaderTextSize="14sp" />

<TextView
android:id="@+id/selected"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class DateText : View {
isCurrentMonth = attributes.getBoolean(R.styleable.DateText_isCurrentMonth, false)
isSelected = attributes.getBoolean(R.styleable.DateText_isSelected, false)
hasEvent = attributes.getBoolean(R.styleable.DateText_hasEvent, false)
isToday = attributes.getBoolean(R.styleable.DateText_isToday, false)
isPast = attributes.getBoolean(R.styleable.DateText_isPast, false)
} finally {
attributes.recycle()
Expand Down Expand Up @@ -280,7 +279,7 @@ class DateText : View {
}

fun setIsToday(isToday: Boolean) {
this.isToday = isToday
if (EventsCalendarUtil.isToday(mDate)) this.isToday = isToday
invalidate()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.content.Context
import android.os.AsyncTask
import android.util.AttributeSet
import android.util.Log
import android.util.MonthDisplayHelper
import android.view.LayoutInflater
import android.view.View
Expand Down Expand Up @@ -40,7 +41,7 @@ class DatesGridLayout : ViewGroup, DateText.DateSelectListener {
private var mHeight = 0

private var isLoadingFirstTime = true
private var mTranslationDistance= 0f
private var mTranslationDistance = 0f
private var mCallback: CallBack? = null
private var mSelectedDatePosition: Int = 0
private var mPreviousMonthDots: EventDots? = null
Expand Down

0 comments on commit 2ae462f

Please sign in to comment.