Add plugin calendar event badge icon
This commit is contained in:
parent
b640e08d98
commit
ac4ba139d5
@ -2,6 +2,7 @@ package de.mm20.launcher2.calendar.providers
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import de.mm20.launcher2.calendar.PluginCalendarEventSerializer
|
import de.mm20.launcher2.calendar.PluginCalendarEventSerializer
|
||||||
@ -13,6 +14,8 @@ import de.mm20.launcher2.search.SavableSearchable
|
|||||||
import de.mm20.launcher2.search.SearchableSerializer
|
import de.mm20.launcher2.search.SearchableSerializer
|
||||||
import de.mm20.launcher2.search.UpdatableSearchable
|
import de.mm20.launcher2.search.UpdatableSearchable
|
||||||
import de.mm20.launcher2.search.UpdateResult
|
import de.mm20.launcher2.search.UpdateResult
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
data class PluginCalendarEvent(
|
data class PluginCalendarEvent(
|
||||||
val id: String,
|
val id: String,
|
||||||
@ -59,6 +62,12 @@ data class PluginCalendarEvent(
|
|||||||
return PluginCalendarEventSerializer()
|
return PluginCalendarEventSerializer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override suspend fun getProviderIcon(context: Context): Drawable? {
|
||||||
|
return withContext(Dispatchers.IO) {
|
||||||
|
context.packageManager.resolveContentProvider(authority, 0)?.loadIcon(context.packageManager)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val Domain = "plugin.calendar"
|
const val Domain = "plugin.calendar"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user