All Projects → zhanghai → AppIconLoader

zhanghai / AppIconLoader

Licence: Apache-2.0 license
Android app icon loader from AOSP iconloaderlib

Programming Languages

java
68154 projects - #9 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to AppIconLoader

slight
Easy, sample and flexible library for loading, caching and displaying images on Android. written in Kotlin
Stars: ✭ 29 (-74.11%)
Mutual labels:  image-loader, imageloader
image-loader
Image loading library for Android
Stars: ✭ 19 (-83.04%)
Mutual labels:  image-loader, imageloader
neon
Provides Jetpack Compose support for different image loading libraries.
Stars: ✭ 13 (-88.39%)
Mutual labels:  imageloader
vue-load-image
A Vue component for showing loader during image loading https://john015.github.io/vue-load-image/
Stars: ✭ 60 (-46.43%)
Mutual labels:  image-loader
angular-image-loader
A simple progressive, responsive, lazy image and video loading library for Angular that detects browser size and loads the appropriate image or video only when the element is in viewport. This package requires @thisissoon/angular-inviewport
Stars: ✭ 21 (-81.25%)
Mutual labels:  image-loader
pixel
A lightweight image loader for Android backed by Kotlin Coroutines.
Stars: ✭ 79 (-29.46%)
Mutual labels:  image-loader
Android Iconics
Android-Iconics - Use any icon font, or vector (.svg) as drawable in your application.
Stars: ✭ 4,916 (+4289.29%)
Mutual labels:  android-icon
Sketch
Sketch 是 Android 上一个强大且全面的图片加载器,支持 GIF,手势缩放以及分块显示超大图片。Sketch is a powerful and comprehensive image loader on Android, with support for GIF, gesture zooming, block display super large image
Stars: ✭ 1,557 (+1290.18%)
Mutual labels:  image-loader
Coil
Image loading for Android backed by Kotlin Coroutines.
Stars: ✭ 7,469 (+6568.75%)
Mutual labels:  image-loader
v-lazy-img
simplistic vue.js directive for image lazy loading
Stars: ✭ 25 (-77.68%)
Mutual labels:  image-loader
vue-image-loader
🌟 Async image loader plugin for Vue.js
Stars: ✭ 41 (-63.39%)
Mutual labels:  image-loader
Glideimageview
基于Glide V4.9.0封装的图片加载库,可以监听加载图片时的进度
Stars: ✭ 1,741 (+1454.46%)
Mutual labels:  imageloader
Glide
An image loading and caching library for Android focused on smooth scrolling
Stars: ✭ 32,046 (+28512.5%)
Mutual labels:  imageloader
SvgGlidePlugins
Plugins for Glide 4 image loading libraries for load SVG
Stars: ✭ 60 (-46.43%)
Mutual labels:  imageloader

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

Google Play

Sample APK

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].