SkillAgentSearch skills...

AppIconLoader

Android app icon loader from AOSP iconloaderlib

Install / Use

/learn @zhanghai/AppIconLoader
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

AppIconLoader

Android CI status GitHub release License

Android app icon loader from AOSP iconloaderlib, with optional Glide and Coil integration.

This is not an officially supported Google product.

Why AppIconLoader?

Because PackageManager.getApplicationIcon() (or PackageItemInfo.loadIcon()) just doesn't work well with adaptive icons. Non-adaptive icons usually have some shadow baked in (it's the recommended behavior), however adaptive icons never contain a shadow themselves, so we'll need to manually add the shadow or icons with a white background will just blend into our app's own background.

This library packaged the AOSP iconloaderlib for loading app icons, which has proper shadow and badging logic, and added easy integration with Glide and Coil.

Meanwhile, by passing true for the shrinkNonAdaptiveIcons parameter, this library can also synthesize adaptive icons for apps that don't have it.

Preview

<a href="https://play.google.com/store/apps/details?id=me.zhanghai.android.appiconloader.sample" target="_blank"><img alt="Google Play" height="90" src="https://play.google.com/intl/en_US/badges/images/generic/en_badge_web_generic.png"/></a>

Sample APK

<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/2.png" width="49%" />

Integration

Gradle:

// For using with Glide.
implementation 'me.zhanghai.android.appiconloader:appiconloader-glide:1.5.0'
// For using with Coil.
implementation 'me.zhanghai.android.appiconloader:appiconloader-coil:1.5.0'
// For using AppIconLoader directly.
implementation 'me.zhanghai.android.appiconloader:appiconloader:1.5.0'
// For using iconloaderlib directly.
implementation 'me.zhanghai.android.appiconloader:appiconloader-iconloaderlib:1.5.0'

Usage

Glide integration

See Glide's documentation on registering a ModuleLoader.

Inside your implementation of AppGlideModule.registerComponents(), you can have something like the following code fragment:

int iconSize = context.getResources().getDimensionPixelSize(R.dimen.app_icon_size);
registry.prepend(PackageInfo.class, Bitmap.class, new AppIconModelLoader.Factory(iconSize,
        false, context));

See also the sample app's AppGlideModule implementation.

After the setup above, Glide will support loading app icons with the app's PackageInfo.

GlideApp.with(imageView)
        .load(packageInfo)
        .into(imageView);

Coil integration

val iconSize = context.resources.getDimensionPixelSize(R.dimen.app_icon_size)
Coil.setImageLoader(
    ImageLoader.Builder(context)
        .components {
            add(AppIconKeyer())
            add(AppIconFetcher.Factory(iconSize, false, context))
        }
        .build()
)

After the setup above, Coil will support loading app icons with the app's PackageInfo.

imageView.loadAny(packageInfo)

AppIconLoader

AppIconLoader is the API exposed by this library, and you can simply call AppIconLoader.loadIcon() to load an app icon. You can also use AppIconLoader.getIconKey() to generate a cache key for your loaded icon.

iconloaderlib

Please refer to its source code.

License

Copyright 2020 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
View on GitHub
GitHub Stars170
CategoryDevelopment
Updated1mo ago
Forks12

Languages

Java

Security Score

100/100

Audited on Feb 23, 2026

No findings