From 84b73517f178b0775880ca4aa836a7f23794e7da Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 18 Jul 2019 21:36:14 +0200 Subject: [PATCH] avoid a glitch with showing the current time view twice at weekly view --- .../calendar/pro/fragments/WeekFragment.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt index 2dad7c923..0c31b2875 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt @@ -56,6 +56,7 @@ class WeekFragment : Fragment(), WeeklyCalendar { private var wasExtraHeightAdded = false private var dimPastEvents = true private var selectedGrid: View? = null + private var currentTimeView: ImageView? = null private var events = ArrayList() private var allDayHolders = ArrayList() private var allDayRows = ArrayList>() @@ -372,7 +373,12 @@ class WeekFragment : Fragment(), WeeklyCalendar { if (todayColumnIndex != -1) { val minutes = DateTime().minuteOfDay val todayColumn = getColumnWithId(todayColumnIndex) - (inflater.inflate(R.layout.week_now_marker, null, false) as ImageView).apply { + if (currentTimeView != null) { + mView.week_events_holder.removeView(currentTimeView) + } + + currentTimeView = (inflater.inflate(R.layout.week_now_marker, null, false) as ImageView) + currentTimeView!!.apply { applyColorFilter(primaryColor) mView.week_events_holder.addView(this, 0) val extraWidth = (todayColumn.width * 0.3).toInt()