summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-07-15 22:48:34 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-07-15 22:48:34 +0000
commitba9c44550fca6288b52ea37bcaa9c5edd3c6600f (patch)
treeab3e72a737f9a06d795b113507b52c2fd286311a
parentb1becd0416dd17a98412105daafbbbcd3ec83ed6 (diff)
parent5f4c87cabd62da9a9f797e715abed2750fd55660 (diff)
downloadCalendar-ba9c44550fca6288b52ea37bcaa9c5edd3c6600f.tar.gz
Merge "Fix: warning: unnecessary safe call on a non-null receiver of type ___. This expression will have nullable type in future releases"
-rw-r--r--src/com/android/calendar/AllInOneActivity.kt46
-rw-r--r--src/com/android/calendar/CalendarController.kt4
-rw-r--r--src/com/android/calendar/CalendarViewAdapter.kt2
-rw-r--r--src/com/android/calendar/DayFragment.kt6
-rw-r--r--src/com/android/calendar/DayView.kt20
-rw-r--r--src/com/android/calendar/EventInfoFragment.kt4
-rw-r--r--src/com/android/calendar/EventLoader.kt2
-rw-r--r--src/com/android/calendar/GeneralPreferences.kt6
-rw-r--r--src/com/android/calendar/Utils.kt46
-rw-r--r--src/com/android/calendar/alerts/DismissAlarmsService.kt2
-rw-r--r--src/com/android/calendar/alerts/QuickResponseActivity.kt2
-rw-r--r--src/com/android/calendar/month/MonthByWeekAdapter.kt2
-rw-r--r--src/com/android/calendar/month/MonthByWeekFragment.kt26
-rw-r--r--src/com/android/calendar/month/MonthWeekEventsView.kt58
-rw-r--r--src/com/android/calendar/month/SimpleDayPickerFragment.kt16
-rw-r--r--src/com/android/calendar/month/SimpleWeekView.kt26
-rw-r--r--src/com/android/calendar/widget/CalendarAppWidgetProvider.kt2
-rw-r--r--src/com/android/calendar/widget/CalendarAppWidgetService.kt62
18 files changed, 166 insertions, 166 deletions
diff --git a/src/com/android/calendar/AllInOneActivity.kt b/src/com/android/calendar/AllInOneActivity.kt
index 1747bf58..162eabb6 100644
--- a/src/com/android/calendar/AllInOneActivity.kt
+++ b/src/com/android/calendar/AllInOneActivity.kt
@@ -305,7 +305,7 @@ class AllInOneActivity : Activity(), EventHandler, OnSharedPreferenceChangeListe
res.getDimension(R.dimen.max_portrait_calendar_controls_width).toInt()
)
}
- mControlsAnimateHeight = res?.getDimension(R.dimen.calendar_controls_height).toInt()
+ mControlsAnimateHeight = res.getDimension(R.dimen.calendar_controls_height).toInt()
mHideControls = true
mIsMultipane = Utils.getConfigBool(this, R.bool.multiple_pane_config)
mIsTabletConfig = Utils.getConfigBool(this, R.bool.tablet_config)
@@ -356,18 +356,18 @@ class AllInOneActivity : Activity(), EventHandler, OnSharedPreferenceChangeListe
private fun parseViewAction(intent: Intent?): Long {
var timeMillis: Long = -1
val data: Uri? = intent?.getData()
- if (data != null && data?.isHierarchical()) {
+ if (data != null && data.isHierarchical()) {
val path = data.getPathSegments()
if (path?.size == 2 && path!![0].equals("events")) {
try {
mViewEventId = data.getLastPathSegment()?.toLong() as Long
if (mViewEventId != -1L) {
- mIntentEventStartMillis = intent?.getLongExtra(EXTRA_EVENT_BEGIN_TIME, 0)
- mIntentEventEndMillis = intent?.getLongExtra(EXTRA_EVENT_END_TIME, 0)
- mIntentAttendeeResponse = intent?.getIntExtra(
+ mIntentEventStartMillis = intent.getLongExtra(EXTRA_EVENT_BEGIN_TIME, 0)
+ mIntentEventEndMillis = intent.getLongExtra(EXTRA_EVENT_END_TIME, 0)
+ mIntentAttendeeResponse = intent.getIntExtra(
ATTENDEE_STATUS, Attendees.ATTENDEE_STATUS_NONE
)
- mIntentAllDay = intent?.getBooleanExtra(EXTRA_EVENT_ALL_DAY, false)
+ mIntentAllDay = intent.getBooleanExtra(EXTRA_EVENT_ALL_DAY, false)
as Boolean
timeMillis = mIntentEventStartMillis
}
@@ -413,7 +413,7 @@ class AllInOneActivity : Activity(), EventHandler, OnSharedPreferenceChangeListe
}
val cancelItem: MenuItem? = mOptionsMenu?.findItem(R.id.action_cancel)
if (cancelItem != null) {
- cancelItem?.setVisible(false)
+ cancelItem.setVisible(false)
}
}
@@ -541,7 +541,7 @@ class AllInOneActivity : Activity(), EventHandler, OnSharedPreferenceChangeListe
val data: Uri? = intent.getData()
if (data != null) {
try {
- eventId = data?.getLastPathSegment()?.toLong() as Long
+ eventId = data.getLastPathSegment()?.toLong() as Long
} catch (e: NumberFormatException) {
if (DEBUG) {
Log.d(TAG, "Create new event")
@@ -554,12 +554,12 @@ class AllInOneActivity : Activity(), EventHandler, OnSharedPreferenceChangeListe
val end: Long = intent.getLongExtra(EXTRA_EVENT_END_TIME, -1)
info = EventInfo()
if (end != -1L) {
- info?.endTime = Time()
- info?.endTime?.set(end)
+ info.endTime = Time()
+ info.endTime?.set(end)
}
if (begin != -1L) {
- info?.startTime = Time()
- info?.startTime?.set(begin)
+ info.startTime = Time()
+ info.startTime?.set(begin)
}
info.id = eventId
// We set the viewtype so if the user presses back when they are
@@ -810,10 +810,10 @@ class AllInOneActivity : Activity(), EventHandler, OnSharedPreferenceChangeListe
if (event.eventType != EventType.UPDATE_TITLE || mActionBar == null) {
return
}
- val start: Long? = event?.startTime?.toMillis(false /* use isDst */)
+ val start: Long? = event.startTime?.toMillis(false /* use isDst */)
val end: Long?
end = if (event.endTime != null) {
- event?.endTime?.toMillis(false /* use isDst */)
+ event.endTime?.toMillis(false /* use isDst */)
} else {
start
}
@@ -824,8 +824,8 @@ class AllInOneActivity : Activity(), EventHandler, OnSharedPreferenceChangeListe
)
val oldDate: CharSequence? = mDateRange?.getText()
mDateRange?.setText(msg)
- updateSecondaryTitleFields(if (event?.selectedTime != null)
- event?.selectedTime?.toMillis(true) as Long else start)
+ updateSecondaryTitleFields(if (event.selectedTime != null)
+ event.selectedTime?.toMillis(true) as Long else start)
if (!TextUtils.equals(oldDate, msg)) {
mDateRange?.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED)
if (mShowWeekNum && mWeekTextView != null) {
@@ -907,23 +907,23 @@ class AllInOneActivity : Activity(), EventHandler, OnSharedPreferenceChangeListe
override fun handleEvent(event: EventInfo?) {
var displayTime: Long = -1
if (event?.eventType == EventType.GO_TO) {
- if (event?.extraLong and CalendarController.EXTRA_GOTO_BACK_TO_PREVIOUS != 0L) {
+ if (event.extraLong and CalendarController.EXTRA_GOTO_BACK_TO_PREVIOUS != 0L) {
mBackToPreviousView = true
- } else if (event?.viewType != mController?.previousViewType &&
- event?.viewType != ViewType.EDIT
+ } else if (event.viewType != mController?.previousViewType &&
+ event.viewType != ViewType.EDIT
) {
// Clear the flag is change to a different view type
mBackToPreviousView = false
}
setMainPane(
- null, R.id.main_pane, event?.viewType, event?.startTime?.toMillis(false)
+ null, R.id.main_pane, event.viewType, event.startTime?.toMillis(false)
as Long, false
)
if (mShowCalendarControls) {
val animationSize =
if (mOrientation == Configuration.ORIENTATION_LANDSCAPE) mControlsAnimateWidth
else mControlsAnimateHeight
- val noControlsView = event?.viewType == ViewType.MONTH
+ val noControlsView = event.viewType == ViewType.MONTH
if (mControlsMenu != null) {
mControlsMenu?.setVisible(!noControlsView)
mControlsMenu?.setEnabled(!noControlsView)
@@ -965,8 +965,8 @@ class AllInOneActivity : Activity(), EventHandler, OnSharedPreferenceChangeListe
}
}
displayTime =
- if (event?.selectedTime != null) event?.selectedTime?.toMillis(true) as Long
- else event?.startTime?.toMillis(true) as Long
+ if (event.selectedTime != null) event.selectedTime?.toMillis(true) as Long
+ else event.startTime?.toMillis(true) as Long
if (!mIsTabletConfig) {
mActionBarMenuSpinnerAdapter?.setTime(displayTime)
}
diff --git a/src/com/android/calendar/CalendarController.kt b/src/com/android/calendar/CalendarController.kt
index 16ee8fdd..41984bf7 100644
--- a/src/com/android/calendar/CalendarController.kt
+++ b/src/com/android/calendar/CalendarController.kt
@@ -440,7 +440,7 @@ class CalendarController private constructor(context: Context?) {
// Set mTime if selectedTime is set
val temp1 = event.selectedTime
- if (temp1 != null && temp1?.toMillis(false) != 0L) {
+ if (temp1 != null && temp1.toMillis(false) != 0L) {
mTime?.set(event.selectedTime)
} else {
if (startMillis != 0L) {
@@ -450,7 +450,7 @@ class CalendarController private constructor(context: Context?) {
val temp2 = event.endTime
if (mtimeMillis < startMillis ||
temp2 != null && mtimeMillis > temp2.toMillis(false)) {
- mTime?.set(event.startTime)
+ mTime.set(event.startTime)
}
}
event.selectedTime = mTime
diff --git a/src/com/android/calendar/CalendarViewAdapter.kt b/src/com/android/calendar/CalendarViewAdapter.kt
index 2fe10272..44590b8f 100644
--- a/src/com/android/calendar/CalendarViewAdapter.kt
+++ b/src/com/android/calendar/CalendarViewAdapter.kt
@@ -133,7 +133,7 @@ class CalendarViewAdapter(context: Context, viewType: Int, showDate: Boolean) :
v = convertView
}
val weekDay: TextView = v?.findViewById(R.id.top_button_weekday) as TextView
- val date: TextView = v?.findViewById(R.id.top_button_date) as TextView
+ val date: TextView = v.findViewById(R.id.top_button_date) as TextView
when (mCurrentMainView) {
ViewType.DAY -> {
weekDay.setVisibility(View.VISIBLE)
diff --git a/src/com/android/calendar/DayFragment.kt b/src/com/android/calendar/DayFragment.kt
index 39e92f5b..36413cde 100644
--- a/src/com/android/calendar/DayFragment.kt
+++ b/src/com/android/calendar/DayFragment.kt
@@ -154,7 +154,7 @@ class DayFragment : Fragment, CalendarController.EventHandler, ViewFactory {
val diff: Int = currentView?.compareToVisibleTimeRange(goToTime as Time) as Int
if (diff == 0) {
// In visible range. No need to switch view
- currentView?.setSelected(goToTime, ignoreTime, animateToday)
+ currentView.setSelected(goToTime, ignoreTime, animateToday)
} else {
// Figure out which way to animate
if (diff > 0) {
@@ -214,8 +214,8 @@ class DayFragment : Fragment, CalendarController.EventHandler, ViewFactory {
// TODO support a range of time
// TODO support event_id
// TODO support select message
- goTo(msg?.selectedTime, msg?.extraLong and CalendarController.EXTRA_GOTO_DATE != 0L,
- msg?.extraLong and CalendarController.EXTRA_GOTO_TODAY != 0L)
+ goTo(msg.selectedTime, msg.extraLong and CalendarController.EXTRA_GOTO_DATE != 0L,
+ msg.extraLong and CalendarController.EXTRA_GOTO_TODAY != 0L)
} else if (msg?.eventType == CalendarController.EventType.EVENTS_CHANGED) {
eventsChanged()
}
diff --git a/src/com/android/calendar/DayView.kt b/src/com/android/calendar/DayView.kt
index 58126f20..7a9a4070 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,
@@ -836,7 +836,7 @@ class DayView(
diff += 7
}
time!!.monthDay -= diff
- time?.normalize(true /* ignore isDst */)
+ time.normalize(true /* ignore isDst */)
}
}
@@ -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,7 +3276,7 @@ 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
) {
@@ -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
diff --git a/src/com/android/calendar/EventInfoFragment.kt b/src/com/android/calendar/EventInfoFragment.kt
index 2f007ab5..b81c439e 100644
--- a/src/com/android/calendar/EventInfoFragment.kt
+++ b/src/com/android/calendar/EventInfoFragment.kt
@@ -366,7 +366,7 @@ class EventInfoFragment : DialogFragment, OnCheckedChangeListener, CalendarContr
}
a!!.gravity = Gravity.LEFT or Gravity.TOP
}
- window?.setAttributes(a)
+ window.setAttributes(a)
}
fun setDialogParams(x: Int, y: Int, minTop: Int) {
@@ -681,7 +681,7 @@ class EventInfoFragment : DialogFragment, OnCheckedChangeListener, CalendarContr
if (mResponseRadioGroup?.getVisibility() == View.VISIBLE) {
val id: Int = mResponseRadioGroup!!.getCheckedRadioButtonId()
if (id != View.NO_ID) {
- text.add((getView()?.findViewById(R.id.response_label) as TextView)?.getText())
+ text.add((getView()?.findViewById(R.id.response_label) as TextView).getText())
text.add(
(mResponseRadioGroup?.findViewById(id) as RadioButton)
.getText().toString() + PERIOD_SPACE
diff --git a/src/com/android/calendar/EventLoader.kt b/src/com/android/calendar/EventLoader.kt
index a05e8a2e..4795773a 100644
--- a/src/com/android/calendar/EventLoader.kt
+++ b/src/com/android/calendar/EventLoader.kt
@@ -128,7 +128,7 @@ class EventLoader(context: Context) {
// Check if we are still the most recent request.
if (id == eventLoader?.mSequenceNumber?.get()) {
- eventLoader?.mHandler?.post(successCallback)
+ eventLoader.mHandler.post(successCallback)
} else {
eventLoader?.mHandler?.post(cancelCallback)
}
diff --git a/src/com/android/calendar/GeneralPreferences.kt b/src/com/android/calendar/GeneralPreferences.kt
index dd4c9550..9406eff6 100644
--- a/src/com/android/calendar/GeneralPreferences.kt
+++ b/src/com/android/calendar/GeneralPreferences.kt
@@ -248,8 +248,8 @@ class GeneralPreferences : PreferenceFragment(), OnSharedPreferenceChangeListene
mVibrate?.setChecked(Utils.getDefaultVibrate(getActivity(), prefs))
// If needed, migrate the old alerts type settin
- if (prefs?.contains(KEY_ALERTS) == false && prefs?.contains(KEY_ALERTS_TYPE) == true) {
- val type: String? = prefs?.getString(KEY_ALERTS_TYPE, ALERT_TYPE_STATUS_BAR)
+ if (prefs?.contains(KEY_ALERTS) == false && prefs.contains(KEY_ALERTS_TYPE) == true) {
+ val type: String? = prefs.getString(KEY_ALERTS_TYPE, ALERT_TYPE_STATUS_BAR)
if (type.equals(ALERT_TYPE_OFF)) {
mAlert?.setChecked(false)
mPopup?.setChecked(false)
@@ -264,7 +264,7 @@ class GeneralPreferences : PreferenceFragment(), OnSharedPreferenceChangeListene
mPopup?.setEnabled(true)
}
// clear out the old setting
- prefs?.edit().remove(KEY_ALERTS_TYPE).commit()
+ prefs.edit().remove(KEY_ALERTS_TYPE).commit()
}
}
diff --git a/src/com/android/calendar/Utils.kt b/src/com/android/calendar/Utils.kt
index ef780485..52af887c 100644
--- a/src/com/android/calendar/Utils.kt
+++ b/src/com/android/calendar/Utils.kt
@@ -186,13 +186,13 @@ object Utils {
return ViewType.EDIT
}
if (extras != null) {
- if (extras?.getBoolean(INTENT_KEY_DETAIL_VIEW, false)) {
+ if (extras.getBoolean(INTENT_KEY_DETAIL_VIEW, false)) {
// This is the "detail" view which is either agenda or day view
return prefs?.getInt(
GeneralPreferences.KEY_DETAILED_VIEW,
GeneralPreferences.DEFAULT_DETAILED_VIEW
) as Int
- } else if (INTENT_VALUE_VIEW_TYPE_DAY.equals(extras?.getString(INTENT_KEY_VIEW_TYPE))) {
+ } else if (INTENT_VALUE_VIEW_TYPE_DAY.equals(extras.getString(INTENT_KEY_VIEW_TYPE))) {
// Not sure who uses this. This logic came from LaunchActivity
return ViewType.DAY
}
@@ -275,12 +275,12 @@ object Utils {
//
// silent and never -> off
// always -> on
- val vibrateWhen: String? = prefs?.getString(KEY_ALERTS_VIBRATE_WHEN, null)
+ val vibrateWhen: String? = prefs.getString(KEY_ALERTS_VIBRATE_WHEN, null)
vibrate = vibrateWhen != null && vibrateWhen.equals(
context
.getString(R.string.prefDefault_alerts_vibrate_true)
)
- prefs?.edit().remove(KEY_ALERTS_VIBRATE_WHEN).commit()
+ prefs.edit().remove(KEY_ALERTS_VIBRATE_WHEN).commit()
Log.d(
TAG, "Migrating KEY_ALERTS_VIBRATE_WHEN(" +
vibrateWhen + ") to KEY_ALERTS_VIBRATE = " + vibrate
@@ -302,8 +302,8 @@ object Utils {
val prefs: SharedPreferences? = GeneralPreferences.getSharedPreferences(context)
val ss = prefs?.getStringSet(key, null)
if (ss != null) {
- val strings = arrayOfNulls<String>(ss?.size)
- return ss?.toTypedArray()
+ val strings = arrayOfNulls<String>(ss.size)
+ return ss.toTypedArray()
}
return defaultValue
}
@@ -463,11 +463,11 @@ object Utils {
// time.
val data: Uri? = intent?.getData()
var millis: Long? = intent?.getLongExtra(EXTRA_EVENT_BEGIN_TIME, -1)?.toLong()
- if (millis == -1L && data != null && data?.isHierarchical()) {
- val path: List<String> = data?.getPathSegments() as List<String>
+ if (millis == -1L && data != null && data.isHierarchical()) {
+ val path: List<String> = data.getPathSegments() as List<String>
if (path.size == 2 && path[0].equals("time")) {
try {
- millis = (data?.getLastPathSegment()?.toLong())
+ millis = (data.getLastPathSegment()?.toLong())
} catch (e: NumberFormatException) {
Log.i(
"Calendar", "timeFromIntentInMillis: Data existed but no valid time " +
@@ -818,8 +818,8 @@ object Utils {
}
val res: Resources? = context?.getResources()
CONFLICT_COLOR = res?.getColor(R.color.month_dna_conflict_time_color) as Int
- WORK_DAY_START_MINUTES = res?.getInteger(R.integer.work_start_minutes) as Int
- WORK_DAY_END_MINUTES = res?.getInteger(R.integer.work_end_minutes) as Int
+ WORK_DAY_START_MINUTES = res.getInteger(R.integer.work_start_minutes) as Int
+ WORK_DAY_END_MINUTES = res.getInteger(R.integer.work_end_minutes) as Int
WORK_DAY_END_LENGTH = DAY_IN_MINUTES - WORK_DAY_END_MINUTES
WORK_DAY_MINUTES = WORK_DAY_END_MINUTES - WORK_DAY_START_MINUTES
mMinutesLoaded = true
@@ -1085,7 +1085,7 @@ object Utils {
val strandIterator = strands.values.iterator()
while (strandIterator.hasNext()) {
val strand = strandIterator.next()
- if (strand?.count < 1 && strand.allDays == null) {
+ if (strand.count < 1 && strand.allDays == null) {
strandIterator.remove()
continue
}
@@ -1115,17 +1115,17 @@ object Utils {
" for " + dayStartMinute.toString() + " " + dayEndMinute
)
}
- strand?.points!![strand?.position] = x.toFloat()
- strand?.position = strand?.position?.inc() as Int
+ strand?.points!![strand.position] = x.toFloat()
+ strand.position = strand.position.inc() as Int
- strand?.points!![strand?.position] = y0.toFloat()
- strand?.position = strand?.position?.inc() as Int
+ strand.points!![strand.position] = y0.toFloat()
+ strand.position = strand.position.inc() as Int
- strand?.points!![strand?.position] = x.toFloat()
- strand?.position = strand?.position.inc() as Int
+ strand.points!![strand.position] = x.toFloat()
+ strand.position = strand.position.inc() as Int
- strand?.points!![strand?.position] = y1.toFloat()
- strand?.position = strand?.position.inc() as Int
+ strand.points!![strand.position] = y1.toFloat()
+ strand.position = strand.position.inc() as Int
}
}
@@ -1221,9 +1221,9 @@ object Utils {
var strand: DNAStrand? = strands.get(color)
if (strand == null) {
strand = DNAStrand()
- strand?.color = color
- strand?.count = 0
- strands?.put(strand?.color, strand)
+ strand.color = color
+ strand.count = 0
+ strands.put(strand.color, strand)
}
return strand
}
diff --git a/src/com/android/calendar/alerts/DismissAlarmsService.kt b/src/com/android/calendar/alerts/DismissAlarmsService.kt
index 88683d3a..f18cb0b7 100644
--- a/src/com/android/calendar/alerts/DismissAlarmsService.kt
+++ b/src/com/android/calendar/alerts/DismissAlarmsService.kt
@@ -84,7 +84,7 @@ class DismissAlarmsService : IntentService("DismissAlarmsService") {
getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
nm.cancel(notificationId as Int)
}
- if (SHOW_ACTION.equals(intent?.getAction())) {
+ if (SHOW_ACTION.equals(intent.getAction())) {
// Show event on Calendar app by building an intent and task stack to start
// EventInfoActivity with AllInOneActivity as the parent activity rooted to home.
val i: Intent = AlertUtils.buildEventViewIntent(this, eventId as Long,
diff --git a/src/com/android/calendar/alerts/QuickResponseActivity.kt b/src/com/android/calendar/alerts/QuickResponseActivity.kt
index afccaffd..cbe86366 100644
--- a/src/com/android/calendar/alerts/QuickResponseActivity.kt
+++ b/src/com/android/calendar/alerts/QuickResponseActivity.kt
@@ -43,7 +43,7 @@ class QuickResponseActivity : ListActivity(), OnItemClickListener {
finish()
return
}
- mEventId = intent?.getLongExtra(EXTRA_EVENT_ID, -1) as Long
+ mEventId = intent.getLongExtra(EXTRA_EVENT_ID, -1) as Long
if (mEventId == -1L) {
finish()
return
diff --git a/src/com/android/calendar/month/MonthByWeekAdapter.kt b/src/com/android/calendar/month/MonthByWeekAdapter.kt
index da617950..1d14b62a 100644
--- a/src/com/android/calendar/month/MonthByWeekAdapter.kt
+++ b/src/com/android/calendar/month/MonthByWeekAdapter.kt
@@ -330,7 +330,7 @@ class MonthByWeekAdapter(context: Context?, params: HashMap<String?, Int?>) :
// Clear the visual cues of the click animation and related running code.
private fun clearClickedView(v: MonthWeekEventsView?) {
mListView?.removeCallbacks(mDoClick)
- synchronized(v as Any) { v?.clearClickedDay() }
+ synchronized(v as Any) { v.clearClickedDay() }
mClickedView = null
}
diff --git a/src/com/android/calendar/month/MonthByWeekFragment.kt b/src/com/android/calendar/month/MonthByWeekFragment.kt
index 9fe9fe49..c8e93f93 100644
--- a/src/com/android/calendar/month/MonthByWeekFragment.kt
+++ b/src/com/android/calendar/month/MonthByWeekFragment.kt
@@ -131,7 +131,7 @@ class MonthByWeekFragment @JvmOverloads constructor(
private fun updateUri(): Uri {
val child: SimpleWeekView? = mListView?.getChildAt(0) as? SimpleWeekView
if (child != null) {
- val julianDay: Int = child?.getFirstJulianDay()
+ val julianDay: Int = child.getFirstJulianDay()
mFirstLoadedJulianDay = julianDay
}
// -1 to ensure we get all day events from any time zone
@@ -222,11 +222,11 @@ class MonthByWeekFragment @JvmOverloads constructor(
mFirstDayOfWeek = Utils.getFirstDayOfWeek(mContext)
mShowWeekNumber = Utils.getShowWeekNumber(mContext)
val weekParams = HashMap<String?, Int?>()
- weekParams?.put(SimpleWeeksAdapter.WEEK_PARAMS_NUM_WEEKS, mNumWeeks)
- weekParams?.put(SimpleWeeksAdapter.WEEK_PARAMS_SHOW_WEEK, if (mShowWeekNumber) 1 else 0)
- weekParams?.put(SimpleWeeksAdapter.WEEK_PARAMS_WEEK_START, mFirstDayOfWeek)
- weekParams?.put(MonthByWeekAdapter.WEEK_PARAMS_IS_MINI, if (mIsMiniMonth) 1 else 0)
- weekParams?.put(
+ weekParams.put(SimpleWeeksAdapter.WEEK_PARAMS_NUM_WEEKS, mNumWeeks)
+ weekParams.put(SimpleWeeksAdapter.WEEK_PARAMS_SHOW_WEEK, if (mShowWeekNumber) 1 else 0)
+ weekParams.put(SimpleWeeksAdapter.WEEK_PARAMS_WEEK_START, mFirstDayOfWeek)
+ weekParams.put(MonthByWeekAdapter.WEEK_PARAMS_IS_MINI, if (mIsMiniMonth) 1 else 0)
+ weekParams.put(
SimpleWeeksAdapter.WEEK_PARAMS_JULIAN_DAY,
Time.getJulianDay(mSelectedDay.toMillis(true), mSelectedDay.gmtoff)
)
@@ -383,21 +383,21 @@ class MonthByWeekFragment @JvmOverloads constructor(
if (event?.eventType === EventType.GO_TO) {
var animate = true
if (mDaysPerWeek * mNumWeeks * 2 < Math.abs(
- Time.getJulianDay(event?.selectedTime?.toMillis(true) as Long,
- event?.selectedTime?.gmtoff as Long) -
- Time.getJulianDay(mFirstVisibleDay?.toMillis(true) as Long,
- mFirstVisibleDay?.gmtoff as Long) -
+ Time.getJulianDay(event.selectedTime?.toMillis(true) as Long,
+ event.selectedTime?.gmtoff as Long) -
+ Time.getJulianDay(mFirstVisibleDay.toMillis(true) as Long,
+ mFirstVisibleDay.gmtoff as Long) -
mDaysPerWeek * mNumWeeks / 2L
)
) {
animate = false
}
- mDesiredDay.set(event?.selectedTime)
+ mDesiredDay.set(event.selectedTime)
mDesiredDay.normalize(true)
- val animateToday = event?.extraLong and
+ val animateToday = event.extraLong and
CalendarController.EXTRA_GOTO_TODAY.toLong() != 0L
val delayAnimation: Boolean =
- goTo(event?.selectedTime?.toMillis(true)?.toLong() as Long,
+ goTo(event.selectedTime?.toMillis(true)?.toLong() as Long,
animate, true, false)
if (animateToday) {
// If we need to flash today start the animation after any
diff --git a/src/com/android/calendar/month/MonthWeekEventsView.kt b/src/com/android/calendar/month/MonthWeekEventsView.kt
index e4b15494..2f15de03 100644
--- a/src/com/android/calendar/month/MonthWeekEventsView.kt
+++ b/src/com/android/calendar/month/MonthWeekEventsView.kt
@@ -215,7 +215,7 @@ class MonthWeekEventsView
effectiveWidth -= SPACING_WEEK_NUMBER
}
DNA_ALL_DAY_WIDTH = effectiveWidth / numDays - 2 * DNA_SIDE_PADDING
- mDNAAllDayPaint?.setStrokeWidth(DNA_ALL_DAY_WIDTH.toFloat())
+ mDNAAllDayPaint.setStrokeWidth(DNA_ALL_DAY_WIDTH.toFloat())
mDayXs = IntArray(numDays)
for (day in 0 until numDays) {
mDayXs!![day] = computeDayLeftPosition(day) + DNA_WIDTH / 2 + DNA_SIDE_PADDING
@@ -322,20 +322,20 @@ class MonthWeekEventsView
loadColors(getContext())
// TODO modify paint properties depending on isMini
mMonthNumPaint = Paint()
- mMonthNumPaint?.setFakeBoldText(false)
- mMonthNumPaint?.setAntiAlias(true)
- mMonthNumPaint?.setTextSize(TEXT_SIZE_MONTH_NUMBER.toFloat())
- mMonthNumPaint?.setColor(mMonthNumColor)
- mMonthNumPaint?.setStyle(Style.FILL)
- mMonthNumPaint?.setTextAlign(Align.RIGHT)
- mMonthNumPaint?.setTypeface(Typeface.DEFAULT)
+ mMonthNumPaint.setFakeBoldText(false)
+ mMonthNumPaint.setAntiAlias(true)
+ mMonthNumPaint.setTextSize(TEXT_SIZE_MONTH_NUMBER.toFloat())
+ mMonthNumPaint.setColor(mMonthNumColor)
+ mMonthNumPaint.setStyle(Style.FILL)
+ mMonthNumPaint.setTextAlign(Align.RIGHT)
+ mMonthNumPaint.setTypeface(Typeface.DEFAULT)
mMonthNumAscentHeight = (-mMonthNumPaint!!.ascent() + 0.5f).toInt()
mMonthNumHeight = (mMonthNumPaint!!.descent() - mMonthNumPaint!!.ascent() + 0.5f).toInt()
mEventPaint = TextPaint()
- mEventPaint?.setFakeBoldText(true)
- mEventPaint?.setAntiAlias(true)
- mEventPaint?.setTextSize(TEXT_SIZE_EVENT_TITLE.toFloat())
- mEventPaint?.setColor(mMonthEventColor)
+ mEventPaint.setFakeBoldText(true)
+ mEventPaint.setAntiAlias(true)
+ mEventPaint.setTextSize(TEXT_SIZE_EVENT_TITLE.toFloat())
+ mEventPaint.setColor(mMonthEventColor)
mSolidBackgroundEventPaint = TextPaint(mEventPaint)
mSolidBackgroundEventPaint?.setColor(EVENT_TEXT_COLOR)
mFramedEventPaint = TextPaint(mSolidBackgroundEventPaint)
@@ -347,13 +347,13 @@ class MonthWeekEventsView
mEventAscentHeight = (-mEventPaint.ascent() + 0.5f).toInt()
mEventHeight = (mEventPaint.descent() - mEventPaint.ascent() + 0.5f).toInt()
mEventExtrasPaint = TextPaint()
- mEventExtrasPaint?.setFakeBoldText(false)
- mEventExtrasPaint?.setAntiAlias(true)
- mEventExtrasPaint?.setStrokeWidth(EVENT_SQUARE_BORDER.toFloat())
- mEventExtrasPaint?.setTextSize(TEXT_SIZE_EVENT.toFloat())
- mEventExtrasPaint?.setColor(mMonthEventExtraColor)
- mEventExtrasPaint?.setStyle(Style.FILL)
- mEventExtrasPaint?.setTextAlign(Align.LEFT)
+ mEventExtrasPaint.setFakeBoldText(false)
+ mEventExtrasPaint.setAntiAlias(true)
+ mEventExtrasPaint.setStrokeWidth(EVENT_SQUARE_BORDER.toFloat())
+ mEventExtrasPaint.setTextSize(TEXT_SIZE_EVENT.toFloat())
+ mEventExtrasPaint.setColor(mMonthEventExtraColor)
+ mEventExtrasPaint.setStyle(Style.FILL)
+ mEventExtrasPaint.setTextAlign(Align.LEFT)
mExtrasHeight = (mEventExtrasPaint.descent() - mEventExtrasPaint.ascent() + 0.5f).toInt()
mExtrasAscentHeight = (-mEventExtrasPaint.ascent() + 0.5f).toInt()
mExtrasDescent = (mEventExtrasPaint.descent() + 0.5f).toInt()
@@ -388,11 +388,11 @@ class MonthWeekEventsView
mEventSquarePaint.setAntiAlias(false)
if (DEBUG_LAYOUT) {
Log.d("EXTRA", "mScale=$mScale")
- Log.d("EXTRA", "mMonthNumPaint ascent=" + mMonthNumPaint?.ascent()
- ?.toString() + " descent=" + mMonthNumPaint?.descent()?.toString() +
+ Log.d("EXTRA", "mMonthNumPaint ascent=" + mMonthNumPaint.ascent()
+ .toString() + " descent=" + mMonthNumPaint.descent().toString() +
" int height=" + mMonthNumHeight)
- Log.d("EXTRA", "mEventPaint ascent=" + mEventPaint?.ascent()
- ?.toString() + " descent=" + mEventPaint.descent().toString() +
+ Log.d("EXTRA", "mEventPaint ascent=" + mEventPaint.ascent()
+ .toString() + " descent=" + mEventPaint.descent().toString() +
" int height=" + mEventHeight
.toString() + " int ascent=" + mEventAscentHeight)
Log.d("EXTRA", "mEventExtrasPaint ascent=" + mEventExtrasPaint.ascent()
@@ -603,25 +603,25 @@ class MonthWeekEventsView
y = mMonthNumAscentHeight + TOP_PADDING_MONTH_NUMBER
var isFocusMonth: Boolean = mFocusDay!!.get(i)
var isBold = false
- mMonthNumPaint?.setColor(if (isFocusMonth) mMonthNumColor else mMonthNumOtherColor)
+ mMonthNumPaint.setColor(if (isFocusMonth) mMonthNumColor else mMonthNumOtherColor)
while (i < numCount) {
if (mHasToday && todayIndex == i) {
- mMonthNumPaint?.setColor(mMonthNumTodayColor)
- mMonthNumPaint?.setFakeBoldText(true.also { isBold = it })
+ mMonthNumPaint.setColor(mMonthNumTodayColor)
+ mMonthNumPaint.setFakeBoldText(true.also { isBold = it })
if (i + 1 < numCount) {
// Make sure the color will be set back on the next
// iteration
isFocusMonth = !mFocusDay!!.get(i + 1)
}
- } else if (mFocusDay?.get(i) !== isFocusMonth) {
+ } else if (mFocusDay.get(i) !== isFocusMonth) {
isFocusMonth = mFocusDay!!.get(i)
- mMonthNumPaint?.setColor(if (isFocusMonth) mMonthNumColor else mMonthNumOtherColor)
+ mMonthNumPaint.setColor(if (isFocusMonth) mMonthNumColor else mMonthNumOtherColor)
}
x = computeDayLeftPosition(i - offset) - SIDE_PADDING_MONTH_NUMBER
canvas.drawText(mDayNumbers!!.get(i) as String, x.toFloat(), y.toFloat(),
mMonthNumPaint as Paint)
if (isBold) {
- mMonthNumPaint?.setFakeBoldText(false.also { isBold = it })
+ mMonthNumPaint.setFakeBoldText(false.also { isBold = it })
}
i++
}
diff --git a/src/com/android/calendar/month/SimpleDayPickerFragment.kt b/src/com/android/calendar/month/SimpleDayPickerFragment.kt
index 01fcbac6..0444104a 100644
--- a/src/com/android/calendar/month/SimpleDayPickerFragment.kt
+++ b/src/com/android/calendar/month/SimpleDayPickerFragment.kt
@@ -121,7 +121,7 @@ open class SimpleDayPickerFragment(initialTime: Long) : ListFragment(), OnScroll
midnight.second = 0
midnight.monthDay++
val millisToMidnight: Long = midnight.normalize(true) - currentMillis
- mHandler?.postDelayed(this, millisToMidnight)
+ mHandler.postDelayed(this, millisToMidnight)
if (mAdapter != null) {
mAdapter?.notifyDataSetChanged()
}
@@ -179,10 +179,10 @@ open class SimpleDayPickerFragment(initialTime: Long) : ListFragment(), OnScroll
*/
protected open fun setUpAdapter() {
val weekParams = HashMap<String?, Int?>()
- weekParams?.put(SimpleWeeksAdapter.WEEK_PARAMS_NUM_WEEKS, mNumWeeks)
- weekParams?.put(SimpleWeeksAdapter.WEEK_PARAMS_SHOW_WEEK, if (mShowWeekNumber) 1 else 0)
- weekParams?.put(SimpleWeeksAdapter.WEEK_PARAMS_WEEK_START, mFirstDayOfWeek)
- weekParams?.put(SimpleWeeksAdapter.WEEK_PARAMS_JULIAN_DAY,
+ weekParams.put(SimpleWeeksAdapter.WEEK_PARAMS_NUM_WEEKS, mNumWeeks)
+ weekParams.put(SimpleWeeksAdapter.WEEK_PARAMS_SHOW_WEEK, if (mShowWeekNumber) 1 else 0)
+ weekParams.put(SimpleWeeksAdapter.WEEK_PARAMS_WEEK_START, mFirstDayOfWeek)
+ weekParams.put(SimpleWeeksAdapter.WEEK_PARAMS_JULIAN_DAY,
Time.getJulianDay(mSelectedDay.toMillis(false), mSelectedDay.gmtoff))
if (mAdapter == null) {
mAdapter = SimpleWeeksAdapter(getActivity(), weekParams)
@@ -482,7 +482,7 @@ open class SimpleDayPickerFragment(initialTime: Long) : ListFragment(), OnScroll
}
// Figure out where we are
- val offset = if (child?.getBottom() < WEEK_MIN_VISIBLE_HEIGHT) 1 else 0
+ val offset = if (child.getBottom() < WEEK_MIN_VISIBLE_HEIGHT) 1 else 0
// Use some hysteresis for checking which month to highlight. This
// causes the month to transition when two full weeks of a month are
// visible.
@@ -494,9 +494,9 @@ open class SimpleDayPickerFragment(initialTime: Long) : ListFragment(), OnScroll
// Find out which month we're moving into
val month: Int
month = if (mIsScrollingUp) {
- child?.getFirstMonth()
+ child.getFirstMonth()
} else {
- child?.getLastMonth()
+ child.getLastMonth()
}
// And how it relates to our current highlighted month
diff --git a/src/com/android/calendar/month/SimpleWeekView.kt b/src/com/android/calendar/month/SimpleWeekView.kt
index 4d1298d4..c43774a9 100644
--- a/src/com/android/calendar/month/SimpleWeekView.kt
+++ b/src/com/android/calendar/month/SimpleWeekView.kt
@@ -241,12 +241,12 @@ open class SimpleWeekView(context: Context) : View(context) {
p.setTextSize(MINI_DAY_NUMBER_TEXT_SIZE.toFloat())
p.setStyle(Style.FILL)
mMonthNumPaint = Paint()
- mMonthNumPaint?.setFakeBoldText(true)
- mMonthNumPaint?.setAntiAlias(true)
- mMonthNumPaint?.setTextSize(MINI_DAY_NUMBER_TEXT_SIZE.toFloat())
- mMonthNumPaint?.setColor(mFocusMonthColor)
- mMonthNumPaint?.setStyle(Style.FILL)
- mMonthNumPaint?.setTextAlign(Align.CENTER)
+ mMonthNumPaint.setFakeBoldText(true)
+ mMonthNumPaint.setAntiAlias(true)
+ mMonthNumPaint.setTextSize(MINI_DAY_NUMBER_TEXT_SIZE.toFloat())
+ mMonthNumPaint.setColor(mFocusMonthColor)
+ mMonthNumPaint.setStyle(Style.FILL)
+ mMonthNumPaint.setTextAlign(Align.CENTER)
}
/**
@@ -360,23 +360,23 @@ open class SimpleWeekView(context: Context) : View(context) {
i++
}
var isFocusMonth = mFocusDay!![i]
- mMonthNumPaint?.setColor(if (isFocusMonth) mFocusMonthColor else mOtherMonthColor)
- mMonthNumPaint?.setFakeBoldText(false)
+ mMonthNumPaint.setColor(if (isFocusMonth) mFocusMonthColor else mOtherMonthColor)
+ mMonthNumPaint.setFakeBoldText(false)
while (i < nDays) {
if (mFocusDay!![i] != isFocusMonth) {
isFocusMonth = mFocusDay!![i]
- mMonthNumPaint?.setColor(if (isFocusMonth) mFocusMonthColor else mOtherMonthColor)
+ mMonthNumPaint.setColor(if (isFocusMonth) mFocusMonthColor else mOtherMonthColor)
}
if (mHasToday && mToday == i) {
- mMonthNumPaint?.setTextSize(MINI_TODAY_NUMBER_TEXT_SIZE.toFloat())
- mMonthNumPaint?.setFakeBoldText(true)
+ mMonthNumPaint.setTextSize(MINI_TODAY_NUMBER_TEXT_SIZE.toFloat())
+ mMonthNumPaint.setFakeBoldText(true)
}
val x = (2 * i + 1) * (mWidth - mPadding * 2) / divisor + mPadding
canvas.drawText(mDayNumbers!![i] as String, x.toFloat(), y.toFloat(),
mMonthNumPaint as Paint)
if (mHasToday && mToday == i) {
- mMonthNumPaint?.setTextSize(MINI_DAY_NUMBER_TEXT_SIZE.toFloat())
- mMonthNumPaint?.setFakeBoldText(false)
+ mMonthNumPaint.setTextSize(MINI_DAY_NUMBER_TEXT_SIZE.toFloat())
+ mMonthNumPaint.setFakeBoldText(false)
}
i++
}
diff --git a/src/com/android/calendar/widget/CalendarAppWidgetProvider.kt b/src/com/android/calendar/widget/CalendarAppWidgetProvider.kt
index b3539f22..fcc5be3b 100644
--- a/src/com/android/calendar/widget/CalendarAppWidgetProvider.kt
+++ b/src/com/android/calendar/widget/CalendarAppWidgetProvider.kt
@@ -63,7 +63,7 @@ class CalendarAppWidgetProvider : AppWidgetProvider() {
action.equals(Utils.getWidgetScheduledUpdateAction(context as Context)))
) {
val service = Intent(context, CalendarAppWidgetService::class.java)
- context?.startService(service)
+ context.startService(service)
} else {
super.onReceive(context, intent)
}
diff --git a/src/com/android/calendar/widget/CalendarAppWidgetService.kt b/src/com/android/calendar/widget/CalendarAppWidgetService.kt
index 114fdf12..0b55c2ab 100644
--- a/src/com/android/calendar/widget/CalendarAppWidgetService.kt
+++ b/src/com/android/calendar/widget/CalendarAppWidgetService.kt
@@ -270,80 +270,80 @@ class CalendarAppWidgetService : RemoteViewsService() {
val displayColor: Int = Utils.getDisplayColorFromColor(eventInfo!!.color)
val now: Long = System.currentTimeMillis()
if (!eventInfo!!.allDay && eventInfo!!.start <= now && now <= eventInfo!!.end) {
- views?.setInt(
+ views.setInt(
R.id.widget_row, "setBackgroundResource",
R.drawable.agenda_item_bg_secondary
)
} else {
- views?.setInt(
+ views.setInt(
R.id.widget_row, "setBackgroundResource",
R.drawable.agenda_item_bg_primary
)
}
- if (!eventInfo?.allDay) {
- updateTextView(views, R.id.`when`, eventInfo?.visibWhen
- as Int, eventInfo?.`when`)
- updateTextView(views, R.id.where, eventInfo?.visibWhere
- as Int, eventInfo?.where)
+ if (!eventInfo.allDay) {
+ updateTextView(views, R.id.`when`, eventInfo.visibWhen
+ as Int, eventInfo.`when`)
+ updateTextView(views, R.id.where, eventInfo.visibWhere
+ as Int, eventInfo.where)
}
- updateTextView(views, R.id.title, eventInfo?.visibTitle as Int, eventInfo?.title)
+ updateTextView(views, R.id.title, eventInfo.visibTitle as Int, eventInfo.title)
views.setViewVisibility(R.id.agenda_item_color, View.VISIBLE)
- val selfAttendeeStatus: Int = eventInfo?.selfAttendeeStatus as Int
+ val selfAttendeeStatus: Int = eventInfo.selfAttendeeStatus as Int
if (eventInfo!!.allDay) {
if (selfAttendeeStatus == Attendees.ATTENDEE_STATUS_INVITED) {
- views?.setInt(
+ views.setInt(
R.id.agenda_item_color, "setImageResource",
R.drawable.widget_chip_not_responded_bg
)
- views?.setInt(R.id.title, "setTextColor", displayColor)
+ views.setInt(R.id.title, "setTextColor", displayColor)
} else {
- views?.setInt(
+ views.setInt(
R.id.agenda_item_color, "setImageResource",
R.drawable.widget_chip_responded_bg
)
- views?.setInt(R.id.title, "setTextColor", mAllDayColor)
+ views.setInt(R.id.title, "setTextColor", mAllDayColor)
}
if (selfAttendeeStatus == Attendees.ATTENDEE_STATUS_DECLINED) {
// 40% opacity
- views?.setInt(
+ views.setInt(
R.id.agenda_item_color, "setColorFilter",
Utils.getDeclinedColorFromColor(displayColor)
)
} else {
- views?.setInt(R.id.agenda_item_color, "setColorFilter", displayColor)
+ views.setInt(R.id.agenda_item_color, "setColorFilter", displayColor)
}
} else if (selfAttendeeStatus == Attendees.ATTENDEE_STATUS_DECLINED) {
- views?.setInt(R.id.title, "setTextColor", mDeclinedColor)
- views?.setInt(R.id.`when`, "setTextColor", mDeclinedColor)
- views?.setInt(R.id.where, "setTextColor", mDeclinedColor)
- views?.setInt(
+ views.setInt(R.id.title, "setTextColor", mDeclinedColor)
+ views.setInt(R.id.`when`, "setTextColor", mDeclinedColor)
+ views.setInt(R.id.where, "setTextColor", mDeclinedColor)
+ views.setInt(
R.id.agenda_item_color, "setImageResource",
R.drawable.widget_chip_responded_bg
)
// 40% opacity
- views?.setInt(
+ views.setInt(
R.id.agenda_item_color, "setColorFilter",
Utils.getDeclinedColorFromColor(displayColor)
)
} else {
- views?.setInt(R.id.title, "setTextColor", mStandardColor)
- views?.setInt(R.id.`when`, "setTextColor", mStandardColor)
- views?.setInt(R.id.where, "setTextColor", mStandardColor)
+ views.setInt(R.id.title, "setTextColor", mStandardColor)
+ views.setInt(R.id.`when`, "setTextColor", mStandardColor)
+ views.setInt(R.id.where, "setTextColor", mStandardColor)
if (selfAttendeeStatus == Attendees.ATTENDEE_STATUS_INVITED) {
- views?.setInt(
+ views.setInt(
R.id.agenda_item_color, "setImageResource",
R.drawable.widget_chip_not_responded_bg
)
} else {
- views?.setInt(
+ views.setInt(
R.id.agenda_item_color, "setImageResource",
R.drawable.widget_chip_responded_bg
)
}
- views?.setInt(R.id.agenda_item_color, "setColorFilter", displayColor)
+ views.setInt(R.id.agenda_item_color, "setColorFilter", displayColor)
}
- var start: Long = eventInfo?.start as Long
- var end: Long = eventInfo?.end as Long
+ var start: Long = eventInfo.start as Long
+ var end: Long = eventInfo.end as Long
// An element in ListView.
if (eventInfo!!.allDay) {
val tz: String? = Utils.getTimeZone(mContext, null)
@@ -352,7 +352,7 @@ class CalendarAppWidgetService : RemoteViewsService() {
end = Utils.convertAlldayLocalToUTC(recycle, end, tz as String)
}
val fillInIntent: Intent = CalendarAppWidgetProvider.getLaunchFillInIntent(
- mContext, eventInfo?.id, start, end, eventInfo?.allDay
+ mContext, eventInfo.id, start, end, eventInfo.allDay
)
views.setOnClickFillInIntent(R.id.widget_row, fillInIntent)
views
@@ -502,10 +502,10 @@ class CalendarAppWidgetService : RemoteViewsService() {
mModel = buildAppWidgetModel(mContext, matrixCursor, tz)
} finally {
if (matrixCursor != null) {
- matrixCursor?.close()
+ matrixCursor.close()
}
if (cursor != null) {
- cursor?.close()
+ cursor.close()
}
}