{"id":22283723,"url":"https://github.com/fennifith/adaptiveiconview","last_synced_at":"2025-09-12T13:32:52.895Z","repository":{"id":97398266,"uuid":"100893494","full_name":"fennifith/AdaptiveIconView","owner":"fennifith","description":"A library to allow easy implementation of pre-Oreo adaptive icon support in Android launchers.","archived":false,"fork":false,"pushed_at":"2019-08-06T19:58:30.000Z","size":1061,"stargazers_count":30,"open_issues_count":10,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-11T23:08:22.410Z","etag":null,"topics":["android","android-library","android-ui"],"latest_commit_sha":null,"homepage":"https://jitpack.io/#me.jfenn/AdaptiveIconView","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fennifith.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-20T22:58:32.000Z","updated_at":"2025-03-11T14:06:58.000Z","dependencies_parsed_at":"2023-03-13T16:14:28.916Z","dependency_job_id":null,"html_url":"https://github.com/fennifith/AdaptiveIconView","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/fennifith/AdaptiveIconView","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fennifith%2FAdaptiveIconView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fennifith%2FAdaptiveIconView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fennifith%2FAdaptiveIconView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fennifith%2FAdaptiveIconView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fennifith","download_url":"https://codeload.github.com/fennifith/AdaptiveIconView/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fennifith%2FAdaptiveIconView/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274821745,"owners_count":25356358,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-library","android-ui"],"created_at":"2024-12-03T16:41:52.540Z","updated_at":"2025-09-12T13:32:52.869Z","avatar_url":"https://github.com/fennifith.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"AdaptiveIconView is a library built to allow an easy implementation of pre-Oreo adaptive icon support in Android launchers. Special thanks to [Lawnchair](https://github.com/LawnchairLauncher/Lawnchair) and its developers for providing the method used to access -v26 assets on pre-Oreo devices. \n\nFor demonstration purposes, sample APKs can be downloaded [here](../../releases).\n\n[![](https://jitpack.io/v/me.jfenn/AdaptiveIconView.svg)](https://jitpack.io/#me.jfenn/AdaptiveIconView)\n[![Build Status](https://travis-ci.com/fennifith/AdaptiveIconView.svg)](https://travis-ci.com/fennifith/AdaptiveIconView)\n[![Discord](https://img.shields.io/discord/514625116706177035.svg?logo=discord\u0026colorB=7289da)](https://discord.gg/sVtzgbr)\n\n## Screenshots\n\n| Circles | Squircles | Teardrops |\n|---------|-----------|-----------|\n| ![img](./.github/images/circle.png?raw=true) | ![img](./.github/images/squircle.png?raw=true) | ![img](./.github/images/teardrop.png?raw=true) |\n\n## Usage\n\n### Setup\n\nThis project is published on [JitPack](https://jitpack.io/), which you can add to your project by copying the following to your root build.gradle at the end of \"repositories\".\n\n```gradle\nallprojects {\n  repositories {\n    ...\n    maven { url 'https://jitpack.io' }\n  }\n}\n```\n\nTo add the dependency, copy this line into your app module's build.gradle file.\n\n```gradle\ncompile 'me.jfenn:AdaptiveIconView:0.0.1'\n```\n\n##### Support Libraries\n\nThe Android support libraries have been refactored from `android.support.*` to `androidx.*` as detailed [here](https://developer.android.com/topic/libraries/support-library/androidx-overview). As such, AdaptiveIconView only uses the new dependencies. If your project still uses the older support libraries for some reason, you must compile your own version of the library (either refactoring it yourself or using a version from before the change).\n\n\n### Loading an Icon\n\nThe [`AdaptiveIcon`](./library/src/main/java/james/adaptiveicon/AdaptiveIcon.java) class contains multiple ways to load and store the assets required to pass to an [`AdaptiveIconView`](./library/src/main/java/james/adaptiveicon/AdaptiveIconView.java). Most methods involve the `AdaptiveIcon.Loader` subclass, which contains many customization options and several 'fallback' classes for applications passed that do not have an adaptive icon.\n\n#### Method 1: Simple, Easy, and Just About The Worst Thing That You Could Possibly Do\n\nThis method will create an asynchronous thread to load the icon for you, but you will need to properly manage it yourself to prevent memory leaks. Unless you don't care about memory leaks and just want to quickly implement something that works, in which case this is perfect for you. Coincidentally, this is the loading method that is used in the sample application.\n\n```java\nnew AdaptiveIcon.Loader()\n  .with(this) //always pass a context before calling any other methods\n  .fallback(new AdaptiveIcon.Loader.LegacyIconFallback()) //(optional) specify a fallback to use if there is no adaptive icon or if it is inaccessible to the app\n  .loadAsync(resolveInfo, new AdaptiveIcon.Loader.AsyncCallback() { //specify a ResolveInfo of the app to load the icon of\n    @Override\n    public void onResult(ResolveInfo info, AdaptiveIcon icon) {\n      //pass the loaded icon to an AdaptiveIconView\n    }\n  });\n```\n\nHowever, if you actually care about your end users at all, it would be far better to use the `load(ResolveInfo)` method instead of `loadAsync` and handle the multithreading spaghetti yourself. Please also note that, while it may not make a huge impact on performance, you can call `load` multiple times on the same `Loader` with different `ResolveInfo`s instead of creating a new `Loader` for every single icon that you need to load.\n\n#### Method 2: Do It All Yourself\n\nIgnoring the variety of different loading and fallback methods, all that the `AdaptiveIcon` class really does is store drawables, bitmaps, and a scale for the adaptive icon. With this in mind, you can easily create one yourself.\n\n```java\nAdaptiveIcon icon = new AdaptiveIcon(foregroundDrawable, backgroundDrawable, 1.0);\n```\n\nOne thing to keep in mind here is that the scale (the third parameter passed to the constructor), for some bizarre reason, is actually reversed. Smaller numbers will make the icon larger, and larger numbers will make it smaller. Keep in mind that the scale does not affect the size of the shape of the icon, only what is displayed inside of it.\n\n### Creating a View\n\nThe [AdaptiveIconView](./library/src/main/java/james/adaptiveicon/AdaptiveIconView.java) class should be pretty simple to use. The `setIcon` and `getIcon` methods set and get the `AdaptiveIcon` class it uses, updating the view automatically. `setPath(Rect, Path)`, or `setPath(String)` (which accepts a path string within a 100x100 rect) can be used to specify a shape for the icon to clip to, but you may find it easier to use `setPath(int pathType)` instead (provided types are `PATH_CIRCLE`, `PATH_SQUIRCLE`, `PATH_ROUNDED_SQUARE`, `PATH_SQUARE`, and the infamous `PATH_TEARDROP`). `setOffset(x, y)` can be used to quickly offset the drawables inside the icon for fancy movement animations.\n\nBy default, the view will set its own touch listener to animate the icon scale when it is clicked. This can be disabled by setting another touch listener (or just passing null). There are currently no methods to scale the icon yourself, but they should be added soon.\n\n### More Fallback Options\n\nIn Method 1, the `LegacyIconFallback` is used to tell the loader to create an `AdaptiveIcon` using the legacy icon if there is no adaptive icon for the specified `ResolveInfo`. In addition to this, fallbacks can be chained together - you can create another fallback as a fallback for another fallback that is the fallback for the original loader - and there are many more options that have not yet been covered. Instead of going over all of the options in detail, I will just create a table for each of the fallbacks with short descriptions of each.\n\n#### Fallback (abstract class)\n\n|Method Name|Parameters|Description|\n|-----|-----|-----|\n|withFallback|Fallback|Sets a fallback to use if there is no icon for this fallback.|\n|getFallback||Returns the current fallback, or null if there isn't one.|\n|load|Context, ResolveInfo|Loads the icon for this fallback, or this fallback's fallback if it fails.|\n\n#### LegacyIconFallback\n\n|Method Name|Parameters|Description|\n|-----|-----|-----|\n|withBackgroundColor|@ColorInt int|Sets the background to a new ColorDrawable of the passed color int (defaults to the dominant color of the legacy icon).|\n|withBackground|Drawable|Sets the background to the passed Drawable.|\n|shouldClip|@Nullable Boolean|Whether legacy icons should be clipped by the shape, or null (the default value) to determine automatically.|\n|withScale|@Nullable Double|Specify a custom scale for legacy icons, or null (default) to determine automatically.|\n|shouldRemoveShadow|boolean|Whether the shadow and other transparent parts should be removed from the icon - may sometimes result in choppy edges (defaults to false).|\n\n#### RoundIconFallback\n\n|Method Name|Parameters|Description|\n|-----|-----|-----|\n|withBackgroundColor|@ColorInt int|Sets the background to a new ColorDrawable of the passed color int (defaults to the dominant color of the round icon).|\n|withBackground|Drawable|Sets the background to the passed Drawable.|\n|withScale|@Nullable Double|Specify a custom scale for round icons, or null (default) to determine automatically.|\n|shouldRemoveShadow|boolean|Whether the shadow and other transparent parts should be removed from the icon - may sometimes result in choppy edges (defaults to false).|\n\n#### IconPackFallback\n\nThis fallback has not yet been created (see [issue #1](../../issues/1)), but will allow you to pass the package name of an icon pack for the loader to use.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffennifith%2Fadaptiveiconview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffennifith%2Fadaptiveiconview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffennifith%2Fadaptiveiconview/lists"}