Skip to content

Commit e97e8dd

Browse files
committed
Merge remote-tracking branch 'origin/main' into main
2 parents c843973 + cdd0de7 commit e97e8dd

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

app/src/main/java/com/timilehinaregbesola/mathalarm/notification/MathAlarmNotification.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class MathAlarmNotification(
5252
Timber.d("Showing notification for '${alarm.title}'")
5353
val builder = buildNotification(alarm)
5454
// builder.addAction(getCompleteAction(alarm))
55-
var uriExists = false
55+
var uriExists: Boolean
5656
var toneUri = alarm.alarmTone.toUri()
5757
player.apply {
5858
init()
@@ -62,6 +62,7 @@ class MathAlarmNotification(
6262
inputStream?.close()
6363
uriExists = true
6464
} catch (e: Exception) {
65+
uriExists = false
6566
Timber.w("File corresponding to the uri does not exist $toneUri")
6667
}
6768
toneUri = if (uriExists) toneUri else RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM)

app/src/main/java/com/timilehinaregbesola/mathalarm/presentation/MainActivity.kt

+11-1
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,18 @@ class MainActivity : AppCompatActivity() {
3333
lateinit var preferences: AlarmPreferencesImpl
3434

3535
override fun onCreate(savedInstanceState: Bundle?) {
36-
installSplashScreen()
36+
val splashscreen = installSplashScreen()
3737
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+
// }
3848
setContent {
3949
val isDarkTheme = preferences.shouldUseDarkColors()
4050
updateTheme(isDarkTheme)

app/src/main/java/com/timilehinaregbesola/mathalarm/presentation/alarmlist/components/AlarmListScreen.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ fun ListDisplayScreen(
205205
stickyHeader {
206206
ListHeader(enabled, nearestAlarmMessage.value ?: "", darkTheme)
207207
}
208-
items(alarmList) { alarm ->
208+
items(
209+
items = alarmList,
210+
key = { alarm -> alarm.alarmId }
211+
) { alarm ->
209212
AlarmItem(
210213
alarm = alarm,
211214
onEditAlarm = {

core/src/main/java/com/timilehinaregbesola/mathalarm/usecases/ShowAlarm.kt

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class ShowAlarm(
2222

2323
if (alarm.repeat && alarm.isOn) {
2424
scheduleNextAlarm(alarm)
25-
} else {
2625
}
2726

2827
if (alarm.isOn.not()) {

0 commit comments

Comments
 (0)