diff --git a/app/src/main/java/de/jeanlucmakiola/clockula/alarm/android/AndroidAlarmScheduler.kt b/app/src/main/java/de/jeanlucmakiola/clockula/alarm/android/AndroidAlarmScheduler.kt index 6cb3d11..bbd8669 100644 --- a/app/src/main/java/de/jeanlucmakiola/clockula/alarm/android/AndroidAlarmScheduler.kt +++ b/app/src/main/java/de/jeanlucmakiola/clockula/alarm/android/AndroidAlarmScheduler.kt @@ -5,13 +5,13 @@ import android.app.PendingIntent import android.content.Context import android.content.Intent import dagger.hilt.android.qualifiers.ApplicationContext +import de.jeanlucmakiola.clockula.MainActivity import de.jeanlucmakiola.clockula.alarm.AlarmCapabilities import de.jeanlucmakiola.clockula.alarm.AlarmIntents import de.jeanlucmakiola.clockula.alarm.AlarmScheduler import de.jeanlucmakiola.clockula.alarm.receiver.AlarmFireReceiver import de.jeanlucmakiola.clockula.domain.alarm.ScheduleMode import de.jeanlucmakiola.clockula.domain.alarm.SchedulingPolicy -import de.jeanlucmakiola.clockula.ui.ring.AlarmRingActivity import kotlin.time.Instant import javax.inject.Inject import javax.inject.Singleton @@ -92,12 +92,20 @@ class AndroidAlarmScheduler @Inject constructor( PENDING_INTENT_FLAGS, ) - /** What the system opens when the user taps the status-bar alarm icon. */ + /** + * What the system opens when the user taps the status-bar alarm icon or the + * lockscreen's next-alarm line: the **alarms list**, which is what "show me + * my next alarm" means. It pointed at the ring screen until M9, so tapping + * it opened a ring screen for an alarm that was not ringing, which resolved + * to `Finished` and closed itself (M9 D21). `MainActivity` is `singleTop`, + * so an existing task is brought forward and `onNewIntent` selects the tab. + */ private fun showPendingIntent(): PendingIntent = PendingIntent.getActivity( context, AlarmIntents.REQUEST_SHOW, - Intent(context, AlarmRingActivity::class.java).apply { - flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK + Intent(context, MainActivity::class.java).apply { + action = AlarmIntents.ACTION_SHOW_ALARMS + flags = Intent.FLAG_ACTIVITY_NEW_TASK }, PENDING_INTENT_FLAGS, )