mark the current month label with orange
This commit is contained in:
parent
7deffa6d0a
commit
761c45c414
|
@ -1,11 +1,13 @@
|
|||
package com.simplemobiletools.calendar.fragments
|
||||
|
||||
import android.content.res.Resources
|
||||
import android.os.Bundle
|
||||
import android.support.v4.app.Fragment
|
||||
import android.util.SparseArray
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import com.simplemobiletools.calendar.*
|
||||
import com.simplemobiletools.calendar.views.SmallMonthView
|
||||
import kotlinx.android.synthetic.main.year_fragment.view.*
|
||||
|
@ -46,6 +48,8 @@ class YearFragment : Fragment(), YearlyCalendar {
|
|||
mView.month_2.setDays(days)
|
||||
|
||||
val res = resources
|
||||
markCurrentMonth(res)
|
||||
|
||||
for (i in 1..12) {
|
||||
val monthView = mView.findViewById(res.getIdentifier("month_" + i, "id", activity.packageName)) as SmallMonthView
|
||||
var dayOfWeek = dateTime.withMonthOfYear(i).dayOfWeek().get()
|
||||
|
@ -59,6 +63,15 @@ class YearFragment : Fragment(), YearlyCalendar {
|
|||
}
|
||||
}
|
||||
|
||||
private fun markCurrentMonth(res: Resources) {
|
||||
val now = DateTime()
|
||||
if (now.year == mYear) {
|
||||
val monthLabel = mView.findViewById(res.getIdentifier("month_${now.monthOfYear}_label", "id", activity.packageName)) as TextView
|
||||
monthLabel.setTextColor(Utils.adjustAlpha(res.getColor(R.color.colorPrimary), Constants.HIGH_ALPHA))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun setListener(listener: NavigationListener) {
|
||||
mListener = listener
|
||||
}
|
||||
|
@ -68,7 +81,6 @@ class YearFragment : Fragment(), YearlyCalendar {
|
|||
return
|
||||
|
||||
val res = resources
|
||||
|
||||
for (i in 1..12) {
|
||||
val monthView = mView.findViewById(res.getIdentifier("month_$i", "id", context.packageName)) as SmallMonthView
|
||||
monthView.setEvents(events.get(i))
|
||||
|
|
Loading…
Reference in New Issue