avoid a glitch with showing the current time view twice at weekly view

This commit is contained in:
tibbi 2019-07-18 21:36:14 +02:00
parent 775e51767b
commit 84b73517f1
1 changed files with 7 additions and 1 deletions

View File

@ -56,6 +56,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
private var wasExtraHeightAdded = false private var wasExtraHeightAdded = false
private var dimPastEvents = true private var dimPastEvents = true
private var selectedGrid: View? = null private var selectedGrid: View? = null
private var currentTimeView: ImageView? = null
private var events = ArrayList<Event>() private var events = ArrayList<Event>()
private var allDayHolders = ArrayList<RelativeLayout>() private var allDayHolders = ArrayList<RelativeLayout>()
private var allDayRows = ArrayList<HashSet<Int>>() private var allDayRows = ArrayList<HashSet<Int>>()
@ -372,7 +373,12 @@ class WeekFragment : Fragment(), WeeklyCalendar {
if (todayColumnIndex != -1) { if (todayColumnIndex != -1) {
val minutes = DateTime().minuteOfDay val minutes = DateTime().minuteOfDay
val todayColumn = getColumnWithId(todayColumnIndex) 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) applyColorFilter(primaryColor)
mView.week_events_holder.addView(this, 0) mView.week_events_holder.addView(this, 0)
val extraWidth = (todayColumn.width * 0.3).toInt() val extraWidth = (todayColumn.width * 0.3).toInt()