Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I add labels on dates? #1131

Open
ruNNiNg-V0V opened this issue Aug 7, 2022 · 1 comment
Open

Can I add labels on dates? #1131

ruNNiNg-V0V opened this issue Aug 7, 2022 · 1 comment

Comments

@ruNNiNg-V0V
Copy link

ruNNiNg-V0V commented Aug 7, 2022

I tried add the text to dates with JsonObject, but the text is empty.

class EventDecorator(jsonTotal: JSONObject, dates: HashSet<String>) : DayViewDecorator {
    val totalData = jsonTotal
    val dates: HashSet<String> = dates
    var dDay = ""
    var label = ""
    override fun shouldDecorate(day: CalendarDay): Boolean {
        dDay = getDay(day.year, day.month, day.day)
        label = totalData.getString(dDay)
        return dates.contains(dDay)
    }

    override fun decorate(view: DayViewFacade) {
        view.addSpan(DotSpan(5f, Color.RED))
        // view.addSpan(AddTextToDates(label))
    }

    fun getDay(year: Int, month: Int, day: Int): String {
        val dDay = "$year-" + String.format(
            "%02d",
            month + 1
        ) + "-" + String.format("%02d", day)
        return dDay
    }
}
@windcloudit
Copy link

I think you can use this guide to do it, but I don't know how to increase height of row to display this text. Maybe it will be overlap.
https://stackoverflow.com/questions/61008523/add-text-to-dates-in-material-calendarview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants