parent
c59fa5b667
commit
4df691fcb0
@ -1,6 +1,7 @@
|
|||||||
package de.mm20.launcher2.ui.component
|
package de.mm20.launcher2.ui.component
|
||||||
|
|
||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
|
import android.content.pm.PackageManager
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
@ -81,7 +82,11 @@ fun SearchActionIcon(
|
|||||||
|
|
||||||
LaunchedEffect(componentName) {
|
LaunchedEffect(componentName) {
|
||||||
drawable = withContext(Dispatchers.IO) {
|
drawable = withContext(Dispatchers.IO) {
|
||||||
context.packageManager.getActivityIcon(componentName)
|
try {
|
||||||
|
context.packageManager.getActivityIcon(componentName)
|
||||||
|
} catch (e: PackageManager.NameNotFoundException) {
|
||||||
|
null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package de.mm20.launcher2.ui.launcher.widgets.music
|
package de.mm20.launcher2.ui.launcher.widgets.music
|
||||||
|
|
||||||
|
import android.content.pm.PackageManager
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.media.session.PlaybackState.CustomAction
|
import android.media.session.PlaybackState.CustomAction
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
@ -416,7 +417,11 @@ fun CustomActionIcon(action: CustomAction, playerPackage: String?) {
|
|||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val resources = remember(playerPackage) {
|
val resources = remember(playerPackage) {
|
||||||
playerPackage?.let {
|
playerPackage?.let {
|
||||||
context.packageManager.getResourcesForApplication(it)
|
try {
|
||||||
|
context.packageManager.getResourcesForApplication(it)
|
||||||
|
} catch (e: PackageManager.NameNotFoundException) {
|
||||||
|
null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user