AdaptiveIconBitmap
Generate merged bitmap from foreground and background drawables or AdaptiveIconDrawable
Install / Use
/learn @sarsamurmu/AdaptiveIconBitmapREADME
Adaptive Icon Bitmap
Get the merged bitmap from adaptive icon's foreground and background drawables.
It is inspired from AdaptiveIconView.
Usage
Setup
Make sure your root build.gradle has this
allprojects {
repositories {
// ...
maven { url 'https://jitpack.io' }
}
}
Then add this as a dependency to your project build.gradle
dependencies {
// ...
implementation 'com.github.sarsamurmu:AdaptiveIconBitmap:$version'
}
Replace $version with the latest version or commit hash.
Latest version is
Rendering Bitmap
You can use it like this
// Create a AdaptiveIcon instance
AdaptiveIcon adaptiveIcon = new AdaptiveIcon();
// Set drawables
adaptiveIcon.setForeground(FOREGROUND_DRAWABLE);
adaptiveIcon.setBackground(BACKGROUND_DRAWABLE);
// Render the icon
Bitmap renderedIcon = adaptiveIcon.render();
You can also use shorthand for setting up the drawables
adaptiveIcon.setDrawables(FOREGROUND_DRAWABLE, BACKGROUND_DRAWABLE);
or if you've AdaptiveIconDrawable, you can set the drawables like this
adaptiveIcon.setDrawable(adaptiveIconDrawable);
Setting Path
adaptiveIcon.setPath(path);
// From predefined paths
adaptiveIcon.setPath(AdaptiveIcon.PATH_CIRCLE);
adaptiveIcon.setPath(AdaptiveIcon.PATH_SQUIRCLE);
adaptiveIcon.setPath(AdaptiveIcon.PATH_ROUNDED_SQUARE);
adaptiveIcon.setPath(AdaptiveIcon.PATH_SQUARE);
adaptiveIcon.setPath(AdaptiveIcon.PATH_TEARDROP);
// Custom Path
adaptiveIcon.setPath("M 50,0 C 10,0 0,10 0,50 C 0,90 10,100 50,100 C 90,100 100,90 100,50 C 100,10 90,0 50,0 Z");
Setting Size
adaptiveIcon.setSize(size);
// Size is in pixel
// Default
adaptiveIcon.setSize(256);
License
Copyright 2021 Sarsa Murmu
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.
Related Skills
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
