adding a context null check

This commit is contained in:
tibbi
2023-07-26 21:36:45 +02:00
parent ab141cbaad
commit b984d98e52

View File

@ -19,7 +19,7 @@ import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.getProperTextColor import com.simplemobiletools.commons.extensions.getProperTextColor
import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.commons.extensions.updateTextColors
import kotlinx.android.synthetic.main.fragment_clock.view.* import kotlinx.android.synthetic.main.fragment_clock.view.*
import java.util.* import java.util.Calendar
class ClockFragment : Fragment() { class ClockFragment : Fragment() {
private val ONE_SECOND = 1000L private val ONE_SECOND = 1000L
@ -111,8 +111,8 @@ class ClockFragment : Fragment() {
} }
fun updateAlarm() { fun updateAlarm() {
view.apply { context?.getClosestEnabledAlarmString { nextAlarm ->
requireContext().getClosestEnabledAlarmString { nextAlarm -> view.apply {
clock_alarm.beVisibleIf(nextAlarm.isNotEmpty()) clock_alarm.beVisibleIf(nextAlarm.isNotEmpty())
clock_alarm.text = nextAlarm clock_alarm.text = nextAlarm
clock_alarm.colorCompoundDrawable(requireContext().getProperTextColor()) clock_alarm.colorCompoundDrawable(requireContext().getProperTextColor())