diff --git a/app/build.gradle b/app/build.gradle index 602c3aa2f3c516b4932665773e71bc50bc2c4f9a..40fd01099c7a00b2b2dbfe38c92fe2e308555969 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,7 +12,7 @@ plugins { def versionMajor = 2 def versionMinor = 12 -def versionPatch = 1 +def versionPatch = 2 def getGitHash = { -> def stdOut = new ByteArrayOutputStream() diff --git a/app/src/main/java/foundation/e/apps/ui/applicationlist/ApplicationListRVAdapter.kt b/app/src/main/java/foundation/e/apps/ui/applicationlist/ApplicationListRVAdapter.kt index 88c9f233d3e2cefc686ac9d695fe22f2cf24386a..66cc24c811a8a2d708dbbced255990bd933267e0 100644 --- a/app/src/main/java/foundation/e/apps/ui/applicationlist/ApplicationListRVAdapter.kt +++ b/app/src/main/java/foundation/e/apps/ui/applicationlist/ApplicationListRVAdapter.kt @@ -18,10 +18,11 @@ package foundation.e.apps.ui.applicationlist import android.content.Context +import android.content.pm.PackageManager +import android.graphics.drawable.Drawable import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.ImageView import androidx.appcompat.app.AlertDialog import androidx.core.content.ContextCompat import androidx.core.view.children @@ -180,21 +181,20 @@ class ApplicationListRVAdapter( } } Origin.GITLAB_RELEASES -> { - setSystemAppIcon(appIcon, searchApp) + appIcon.load(getAppIcon(appIcon.context, searchApp.package_name)) { + placeholder(shimmerDrawable) + } } else -> Timber.wtf("${searchApp.package_name} is from an unknown origin") } } - private fun setSystemAppIcon(imageView: ImageView, app: Application) { - if (!app.isSystemApp) return - try { - imageView.run { - setImageDrawable(context.packageManager.getApplicationIcon(app.package_name)) - } - } catch (e: Exception) { - Timber.w("Icon could not be set for system app - ${app.package_name} - ${e.message}") - e.printStackTrace() + private fun getAppIcon(context: Context, packageName: String): Drawable? { + return try { + context.packageManager.getApplicationIcon(packageName) + } catch (e: PackageManager.NameNotFoundException) { + Timber.w("Icon could not be set for system app - $packageName: ${e.message}") + null } }