├── .github └── workflows │ ├── ci.yml │ └── publish-release.yml ├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── commit451 │ │ └── bitmapji │ │ └── sample │ │ └── MainActivity.kt │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── layout │ └── activity_main.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── bitmapji ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── commit451 │ └── bitmapji │ └── Bitmapji.kt ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── publish.gradle └── settings.gradle /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | jvm: 7 | runs-on: ubuntu-latest 8 | 9 | strategy: 10 | fail-fast: false 11 | matrix: 12 | java-version: 13 | - 11 14 | 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v2 18 | 19 | - name: Validate Gradle Wrapper 20 | uses: gradle/wrapper-validation-action@v1 21 | 22 | - name: Configure JDK 23 | uses: actions/setup-java@v2 24 | with: 25 | distribution: 'zulu' 26 | java-version: ${{ matrix.java-version }} 27 | 28 | - name: Test 29 | run: ./gradlew build -------------------------------------------------------------------------------- /.github/workflows/publish-release.yml: -------------------------------------------------------------------------------- 1 | name: Publish Release 2 | 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | 8 | env: 9 | RELEASE_SIGNING_ENABLED: true 10 | 11 | jobs: 12 | publish: 13 | 14 | runs-on: ubuntu-latest 15 | if: github.repository == 'Commit451/Bitmapji' 16 | 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@v2 20 | 21 | - name: Install JDK 11 22 | uses: actions/setup-java@v1 23 | with: 24 | java-version: 11 25 | 26 | - name: Set version 27 | run: sed -i "s/VERSION_NAME=0.0.1/VERSION_NAME=$GITHUB_REF_NAME/" gradle.properties 28 | 29 | - name: Upload release 30 | run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-daemon --no-parallel 31 | env: 32 | ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} 33 | ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} 34 | ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }} 35 | ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} 36 | 37 | - name: Publish release 38 | run: ./gradlew closeAndReleaseRepository --no-daemon --no-parallel 39 | env: 40 | ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} 41 | ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io 2 | 3 | ### Android ### 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # Log Files 26 | *.log 27 | 28 | 29 | ### Intellij ### 30 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm 31 | 32 | *.iml 33 | 34 | ## Directory-based project format: 35 | .idea/ 36 | # if you remove the above rule, at least ignore the following: 37 | 38 | # User-specific stuff: 39 | # .idea/workspace.xml 40 | # .idea/tasks.xml 41 | # .idea/dictionaries 42 | 43 | # Sensitive or high-churn files: 44 | # .idea/dataSources.ids 45 | # .idea/dataSources.xml 46 | # .idea/sqlDataSources.xml 47 | # .idea/dynamic.xml 48 | # .idea/uiDesigner.xml 49 | 50 | # Gradle: 51 | # .idea/gradle.xml 52 | # .idea/libraries 53 | 54 | # Mongo Explorer plugin: 55 | # .idea/mongoSettings.xml 56 | 57 | ## File-based project format: 58 | *.ipr 59 | *.iws 60 | 61 | ## Plugin-specific files: 62 | 63 | # IntelliJ 64 | out/ 65 | 66 | # mpeltonen/sbt-idea plugin 67 | .idea_modules/ 68 | 69 | # JIRA plugin 70 | atlassian-ide-plugin.xml 71 | 72 | # Crashlytics plugin (for Android Studio and IntelliJ) 73 | com_crashlytics_export_strings.xml 74 | 75 | # Ignore Gradle GUI config 76 | gradle-app.setting 77 | 78 | # Mobile Tools for Java (J2ME) 79 | .mtj.tmp/ 80 | 81 | # Package Files # 82 | *.war 83 | *.ear 84 | 85 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 86 | hs_err_pid* 87 | 88 | *.DS_Store 89 | 90 | app/gradle.properties -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bitmapji 2 | Emoji as Bitmap for Android 3 | 4 | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.commit451/bitmapji/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.commit451/bitmapji) 5 | 6 | ## Gradle 7 | ```groovy 8 | dependencies { 9 | implementation("com.commit451:bitmapji:latest.release.here") 10 | } 11 | ``` 12 | 13 | ## Usage 14 | ```kotlin 15 | val size = resources.getDimensionPixelSize(R.dimen.bitmap_size) 16 | val bitmap = Bitmapji.create( 17 | this, 18 | "\uD83D\uDD25", 19 | size.toFloat() 20 | ) 21 | // do something with the bitmap 22 | imageView.setImageBitmap(bitmap) 23 | ``` 24 | 25 | License 26 | -------- 27 | 28 | Copyright 2022 Commit 451 29 | 30 | Licensed under the Apache License, Version 2.0 (the "License"); 31 | you may not use this file except in compliance with the License. 32 | You may obtain a copy of the License at 33 | 34 | http://www.apache.org/licenses/LICENSE-2.0 35 | 36 | Unless required by applicable law or agreed to in writing, software 37 | distributed under the License is distributed on an "AS IS" BASIS, 38 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 39 | See the License for the specific language governing permissions and 40 | limitations under the License. 41 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | apply plugin: "kotlin-android" 3 | 4 | android { 5 | compileSdkVersion 32 6 | 7 | defaultConfig { 8 | applicationId "com.commit451.bitmapji.sample" 9 | minSdkVersion 16 10 | targetSdkVersion 32 11 | versionCode 1 12 | versionName "1.0" 13 | 14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 15 | } 16 | 17 | buildFeatures { 18 | viewBinding true 19 | } 20 | 21 | buildTypes { 22 | release { 23 | minifyEnabled false 24 | proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" 25 | } 26 | } 27 | 28 | } 29 | 30 | dependencies { 31 | implementation "androidx.appcompat:appcompat:1.4.1" 32 | implementation "androidx.core:core-ktx:1.7.0" 33 | implementation "com.github.jinatonic.confetti:confetti:1.1.2" 34 | implementation project(":bitmapji") 35 | } 36 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/commit451/bitmapji/sample/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.commit451.bitmapji.sample 2 | 3 | import android.os.Bundle 4 | import android.view.animation.LinearInterpolator 5 | import androidx.appcompat.app.AppCompatActivity 6 | import androidx.interpolator.view.animation.FastOutSlowInInterpolator 7 | import com.commit451.bitmapji.Bitmapji 8 | import com.commit451.bitmapji.sample.databinding.ActivityMainBinding 9 | import com.github.jinatonic.confetti.ConfettiManager 10 | import com.github.jinatonic.confetti.ConfettiSource 11 | import com.github.jinatonic.confetti.ConfettoGenerator 12 | import com.github.jinatonic.confetti.confetto.BitmapConfetto 13 | import java.util.concurrent.TimeUnit 14 | 15 | class MainActivity : AppCompatActivity() { 16 | 17 | private lateinit var binding: ActivityMainBinding 18 | 19 | override fun onCreate(savedInstanceState: Bundle?) { 20 | super.onCreate(savedInstanceState) 21 | binding = ActivityMainBinding.inflate(layoutInflater) 22 | setContentView(binding.root) 23 | 24 | val size = resources.getDimensionPixelSize(R.dimen.bitmap_size) 25 | val bitmap = Bitmapji.create( 26 | this, 27 | "❤️", 28 | size.toFloat() 29 | ) 30 | binding.image.setImageBitmap(bitmap) 31 | binding.buttonConfetti.setOnClickListener { 32 | val velocity = resources.getDimensionPixelOffset(R.dimen.confetti_velocity) 33 | .toFloat() 34 | val deviation = resources.getDimensionPixelOffset(R.dimen.confetti_velocity_deviation) 35 | .toFloat() 36 | val confettoGenerator = ConfettoGenerator { 37 | BitmapConfetto(bitmap) 38 | } 39 | val source = ConfettiSource(0, -size, binding.confetti.width, -size) 40 | val confettiManager = ConfettiManager(this, confettoGenerator, source, binding.confetti) 41 | .setVelocityX(0f, 0f) 42 | .setVelocityY(velocity, deviation) 43 | .setRotationalVelocity(45f, 60f) 44 | .setTTL(TimeUnit.SECONDS.toMillis(3)) 45 | .enableFadeOut(LinearInterpolator()) 46 | confettiManager.setNumInitialCount(10) 47 | .setEmissionDuration(0) 48 | .animate() 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | 13 |