diff options
Diffstat (limited to 'src/com/android/calendar/DayView.kt')
-rw-r--r-- | src/com/android/calendar/DayView.kt | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/com/android/calendar/DayView.kt b/src/com/android/calendar/DayView.kt index 42621638..84ad5833 100644 --- a/src/com/android/calendar/DayView.kt +++ b/src/com/android/calendar/DayView.kt @@ -150,7 +150,7 @@ class DayView( @Override override fun run() { if (mClickedEvent != null) { - mController?.sendEventRelatedEvent( + mController.sendEventRelatedEvent( this as Object?, EventType.VIEW_EVENT, mClickedEvent!!.id, mClickedEvent!!.startMillis, mClickedEvent!!.endMillis, this@DayView.getWidth() / 2, mClickedYLocation, @@ -835,8 +835,8 @@ class DayView( if (diff < 0) { diff += 7 } - time!!.monthDay -= diff - time?.normalize(true /* ignore isDst */) + time.monthDay -= diff + time.normalize(true /* ignore isDst */) } } @@ -1135,7 +1135,7 @@ class DayView( b.append(PERIOD_SPACE) val `when`: String? var flags: Int = DateUtils.FORMAT_SHOW_DATE - if (calEvent!!.allDay) { + if (calEvent.allDay) { flags = flags or (DateUtils.FORMAT_UTC or DateUtils.FORMAT_SHOW_WEEKDAY) } else { flags = flags or DateUtils.FORMAT_SHOW_TIME @@ -1143,7 +1143,7 @@ class DayView( flags = flags or DateUtils.FORMAT_24HOUR } } - `when` = Utils.formatDateRange(mContext, calEvent!!.startMillis, calEvent!!.endMillis, + `when` = Utils.formatDateRange(mContext, calEvent.startMillis, calEvent.endMillis, flags) b.append(`when`) b.append(PERIOD_SPACE) @@ -2058,7 +2058,7 @@ class DayView( if (i < 0 || i >= layouts!!.size) { return null } - var layout: StaticLayout? = layouts!![i] + var layout: StaticLayout? = layouts[i] // Check if we have already initialized the StaticLayout and that // the width hasn't changed (due to vertical resizing which causes // re-layout of events at min height) @@ -2117,16 +2117,16 @@ class DayView( x = mHoursWidth.toFloat() p.setStrokeWidth(GRID_LINE_INNER_WIDTH) // Line bounding the top of the all day area - mLines!![linesIndex++] = GRID_LINE_LEFT_MARGIN - mLines!![linesIndex++] = startY - mLines!![linesIndex++] = computeDayLeftPosition(mNumDays).toFloat() - mLines!![linesIndex++] = startY + mLines[linesIndex++] = GRID_LINE_LEFT_MARGIN + mLines[linesIndex++] = startY + mLines[linesIndex++] = computeDayLeftPosition(mNumDays).toFloat() + mLines[linesIndex++] = startY for (day in 0..mNumDays) { x = computeDayLeftPosition(day).toFloat() - mLines!![linesIndex++] = x - mLines!![linesIndex++] = startY - mLines!![linesIndex++] = x - mLines!![linesIndex++] = stopY + mLines[linesIndex++] = x + mLines[linesIndex++] = startY + mLines[linesIndex++] = x + mLines[linesIndex++] = stopY } p.setAntiAlias(false) canvas.drawLines(mLines, 0, linesIndex, p) @@ -2160,7 +2160,7 @@ class DayView( var alpha: Int = eventTextPaint.getAlpha() eventTextPaint.setAlpha(mEventsAlpha) for (i in 0 until numEvents) { - val event: Event = events!!.get(i) + val event: Event = events.get(i) var startDay: Int = event.startDay var endDay: Int = event.endDay if (startDay > lastDay || endDay < firstDay) { @@ -2897,15 +2897,15 @@ class DayView( } private fun cancelAnimation() { - val `in`: Animation? = mViewSwitcher?.getInAnimation() + val `in`: Animation? = mViewSwitcher.getInAnimation() if (`in` != null) { // cancel() doesn't terminate cleanly. - `in`?.scaleCurrentDuration(0f) + `in`.scaleCurrentDuration(0f) } - val out: Animation? = mViewSwitcher?.getOutAnimation() + val out: Animation? = mViewSwitcher.getOutAnimation() if (out != null) { // cancel() doesn't terminate cleanly. - out?.scaleCurrentDuration(0f) + out.scaleCurrentDuration(0f) } } @@ -3276,14 +3276,14 @@ class DayView( events = mAllDayEvents numEvents = events!!.size for (i in 0 until numEvents) { - val event: Event? = events?.get(i) + val event: Event? = events.get(i) if (!event!!.drawAsAllday() || - !mShowAllAllDayEvents && event!!.getColumn() >= maxUnexpandedColumn + !mShowAllAllDayEvents && event.getColumn() >= maxUnexpandedColumn ) { // Don't check non-allday events or events that aren't shown continue } - if (event!!.startDay <= mSelectionDay && event!!.endDay >= mSelectionDay) { + if (event.startDay <= mSelectionDay && event.endDay >= mSelectionDay) { val numRectangles = if (mShowAllAllDayEvents) mMaxAlldayEvents.toFloat() else mMaxUnexpandedAlldayEventCount.toFloat() @@ -3291,7 +3291,7 @@ class DayView( if (height > MAX_HEIGHT_OF_ONE_ALLDAY_EVENT) { height = MAX_HEIGHT_OF_ONE_ALLDAY_EVENT.toFloat() } - val eventTop: Float = yOffset + height * event?.getColumn() + val eventTop: Float = yOffset + height * event.getColumn() val eventBottom = eventTop + height if (eventTop < y && eventBottom > y) { // If the touch is inside the event rectangle, then @@ -3328,7 +3328,7 @@ class DayView( region.bottom = y + 10 val geometry: EventGeometry = mEventGeometry for (i in 0 until numEvents) { - val event: Event? = events?.get(i) + val event: Event? = events.get(i) // Compute the event rectangle. if (!geometry.computeEventRect(date, left, top, cellWidth, event as Event)) { continue @@ -3348,7 +3348,7 @@ class DayView( var closestEvent: Event? = null var minDist = (mViewWidth + mViewHeight).toFloat() // some large distance for (index in 0 until len) { - val ev: Event? = mSelectedEvents?.get(index) + val ev: Event? = mSelectedEvents.get(index) val dist: Float = geometry.pointToEvent(x.toFloat(), y.toFloat(), ev as Event) if (dist < minDist) { minDist = dist |