Use '==' instead of 'equals' in Kotlin

In Kotlin for a check of the structural equality '==' should be used.
Referential equality is checked with '==='.

See:
 - https://kotlinlang.org/docs/equality.html

Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
Tim Krüger 2022-03-02 09:20:07 +01:00
parent 3411728597
commit f8e8a95b34
No known key found for this signature in database
GPG Key ID: FECE3A7222C52A4E

View File

@ -289,10 +289,10 @@ class SetStatusDialogFragment :
@Suppress("ReturnCount")
private fun clearAtToUnixTime(clearAt: ClearAt?): Long {
if (clearAt != null) {
if (clearAt.type.equals("period")) {
if (clearAt.type == "period") {
return System.currentTimeMillis() / ONE_SECOND_IN_MILLIS + clearAt.time.toLong()
} else if (clearAt.type.equals("end-of")) {
if (clearAt.time.equals("day")) {
} else if (clearAt.type == "end-of") {
if (clearAt.time == "day") {
val date = Calendar.getInstance().apply {
set(Calendar.HOUR_OF_DAY, LAST_HOUR_OF_DAY)
set(Calendar.MINUTE, LAST_MINUTE_OF_HOUR)
@ -443,14 +443,14 @@ class SetStatusDialogFragment :
binding.clearStatusAfterSpinner.setSelection(0)
} else {
val clearAt = predefinedStatus.clearAt!!
if (clearAt.type.equals("period")) {
if (clearAt.type == "period") {
when (clearAt.time) {
"1800" -> binding.clearStatusAfterSpinner.setSelection(POS_HALF_AN_HOUR)
"3600" -> binding.clearStatusAfterSpinner.setSelection(POS_AN_HOUR)
"14400" -> binding.clearStatusAfterSpinner.setSelection(POS_FOUR_HOURS)
else -> binding.clearStatusAfterSpinner.setSelection(POS_DONT_CLEAR)
}
} else if (clearAt.type.equals("end-of")) {
} else if (clearAt.type == "end-of") {
when (clearAt.time) {
"day" -> binding.clearStatusAfterSpinner.setSelection(POS_TODAY)
"week" -> binding.clearStatusAfterSpinner.setSelection(POS_END_OF_WEEK)