File tree 4 files changed +17
-4
lines changed
app/src/main/java/com/timilehinaregbesola/mathalarm
core/src/main/java/com/timilehinaregbesola/mathalarm/usecases
4 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ class MathAlarmNotification(
52
52
Timber .d(" Showing notification for '${alarm.title} '" )
53
53
val builder = buildNotification(alarm)
54
54
// builder.addAction(getCompleteAction(alarm))
55
- var uriExists = false
55
+ var uriExists: Boolean
56
56
var toneUri = alarm.alarmTone.toUri()
57
57
player.apply {
58
58
init ()
@@ -62,6 +62,7 @@ class MathAlarmNotification(
62
62
inputStream?.close()
63
63
uriExists = true
64
64
} catch (e: Exception ) {
65
+ uriExists = false
65
66
Timber .w(" File corresponding to the uri does not exist $toneUri " )
66
67
}
67
68
toneUri = if (uriExists) toneUri else RingtoneManager .getDefaultUri(RingtoneManager .TYPE_ALARM )
Original file line number Diff line number Diff line change @@ -33,8 +33,18 @@ class MainActivity : AppCompatActivity() {
33
33
lateinit var preferences: AlarmPreferencesImpl
34
34
35
35
override fun onCreate (savedInstanceState : Bundle ? ) {
36
- installSplashScreen()
36
+ val splashscreen = installSplashScreen()
37
37
super .onCreate(savedInstanceState)
38
+
39
+ // Keep the splash screen on-screen until the UI state is loaded. This condition is
40
+ // evaluated each time the app needs to be redrawn so it should be fast to avoid blocking
41
+ // the UI.
42
+ // splashScreen.setKeepOnScreenCondition {
43
+ // when (uiState) {
44
+ // Loading -> true
45
+ // is Success -> false
46
+ // }
47
+ // }
38
48
setContent {
39
49
val isDarkTheme = preferences.shouldUseDarkColors()
40
50
updateTheme(isDarkTheme)
Original file line number Diff line number Diff line change @@ -205,7 +205,10 @@ fun ListDisplayScreen(
205
205
stickyHeader {
206
206
ListHeader (enabled, nearestAlarmMessage.value ? : " " , darkTheme)
207
207
}
208
- items(alarmList) { alarm ->
208
+ items(
209
+ items = alarmList,
210
+ key = { alarm -> alarm.alarmId }
211
+ ) { alarm ->
209
212
AlarmItem (
210
213
alarm = alarm,
211
214
onEditAlarm = {
Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ class ShowAlarm(
22
22
23
23
if (alarm.repeat && alarm.isOn) {
24
24
scheduleNextAlarm(alarm)
25
- } else {
26
25
}
27
26
28
27
if (alarm.isOn.not ()) {
You can’t perform that action at this time.
0 commit comments