Skip to content

Commit

Permalink
support intent actions: and (closes #106)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bnyro committed Jul 21, 2023
1 parent 4d274db commit b33ad26
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@

<intent-filter>
<action android:name="android.intent.action.SET_ALARM" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.SET_TIMER" />

<action android:name="android.intent.action.SHOW_ALARMS" />
<action android:name="android.intent.action.SHOW_TIMERS" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/com/bnyro/clock/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.bnyro.clock.ui

import android.os.Bundle
import android.provider.AlarmClock
import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.isSystemInDarkTheme
Expand All @@ -24,9 +25,10 @@ class MainActivity : ComponentActivity() {
setContent {
val settingsModel: SettingsModel = viewModel()

Log.e("action", intent?.action.toString())
val initialTab = when (intent?.action) {
AlarmClock.ACTION_SET_ALARM -> NavRoutes.Alarm
AlarmClock.ACTION_SET_TIMER -> NavRoutes.Timer
AlarmClock.ACTION_SET_ALARM, AlarmClock.ACTION_SHOW_ALARMS -> NavRoutes.Alarm
AlarmClock.ACTION_SET_TIMER, AlarmClock.ACTION_SHOW_TIMERS -> NavRoutes.Timer
else -> NavRoutes.Clock
}

Expand Down

0 comments on commit b33ad26

Please sign in to comment.