This initial commit scaffolds the project with essential docs, assets, and build configs. It adds Android icons, design assets, and release metadata to support mobile targets. A fastlane config and F-Droid manifest are included to streamline builds. - Adds F-Droid configuration for automated builds - Includes license and privacy policy documents - Provides app icons and assets for Android and design system
35 lines
1001 B
Kotlin
35 lines
1001 B
Kotlin
package de.wechselbild.wallpaper
|
|
|
|
import android.content.BroadcastReceiver
|
|
import android.content.Context
|
|
import android.content.Intent
|
|
import java.util.concurrent.Executors
|
|
|
|
class WallpaperAlarmReceiver : BroadcastReceiver() {
|
|
override fun onReceive(context: Context, intent: Intent) {
|
|
if (!WallpaperStore.enabled(context)) {
|
|
WallpaperScheduler.cancel(context)
|
|
return
|
|
}
|
|
val applicationContext = context.applicationContext
|
|
val result = goAsync()
|
|
executor.execute {
|
|
try {
|
|
if (WallpaperScheduler.claimIfDue(applicationContext)) try {
|
|
WallpaperStore.applyNext(applicationContext)
|
|
} finally {
|
|
WallpaperScheduler.scheduleNext(applicationContext)
|
|
}
|
|
} finally {
|
|
WallpaperScheduler.ensureScheduled(applicationContext)
|
|
WallpaperRotationService.rescheduleRunningService()
|
|
result.finish()
|
|
}
|
|
}
|
|
}
|
|
|
|
companion object {
|
|
private val executor = Executors.newSingleThreadExecutor()
|
|
}
|
|
}
|