Skip to content
/ LXIV Public

LXIV is Android Module (Library) for managing Base64 String to Bitmap vice versa using Encoder and Decoder Builder

License

Notifications You must be signed in to change notification settings

TEGRAXD/LXIV

Repository files navigation

LXIV

Maven Central

LXIV is Base64 encoder and decoder to convert Base64 String to Bitmap, or Bitmap to Base64. Using builder pattern to make sure your development easy and take less time.

Download

Download the source code from GitHub's releases page or using Gradle, Maven, Jitpack (soon).

Using Gradle (Project):

repositories {
    // Add Maven Central repository
    mavenCentral()
}

then, add LXIV in Gradle (Module):

dependencies {
    // Using Gradle Groovy DSL
    implementation 'com.github.suganda8:lxiv:1.0.1'

    // Using Gradle Kotlin DSL
    // implementation("com.github.suganda8:lxiv:1.0.1")
}

Using Maven:

<dependency>
  <groupId>com.github.suganda8</groupId>
  <artifactId>lxiv</artifactId>
  <version>1.0.1</version>
  <type>aar</type>
</dependency>

For info on using the bleeding edge, see the Snapshots (soon) docs page.

Usage

Build encoder from uri to base64 string

// Get uri from intent's data
val uri = data.data

// Encode Uri (You should do this in background)
val base64EncodedString = LXIV.createEncoder().fromUri(requireContext()) {
    // Input is depends, fromUri or fromBitmap.
    it.input = uri
    it.quality = 75
    it.compressFormat = Bitmap.CompressFormat.JPEG
    // You could leave or not setting up the flag
    it.flag = Base64.DEFAULT
}

Build decoder from base64 string to bitmap

// Decode Base64 String
val bitmap = LXIV.createDecoder().asBitmap {
    // Set base64 string
    it.base64String = binding.tietDecoderBase64StringFrDecoder.text.toString()
    // You could leave or not setting up the flag
    it.flag = Base64.DEFAULT
}

// Set bitmap into ImageView
binding.imgvImageLoadedFrDecoder.setImageBitmap(bitmap)

Status

Version 1.0.1 is now released.

Developer

Tegar Bangun Suganda

@canaryv8 (Twitter)
@suganda8 (Github)

License

Copyright 2021 Tegar Bangun Suganda, ASTARIA.

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.

About

LXIV is Android Module (Library) for managing Base64 String to Bitmap vice versa using Encoder and Decoder Builder

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages