QuickShot Android Library

repository·master·Indexed 20 days ago

https://github.com/muddz/quickshot

An Android library for asynchronously capturing and saving Views, SurfaceViews, or Bitmaps as JPG, PNG, or .nomedia image files. It supports scoped storage for Android API 29+, handles memory and resource management, and provides configurable options for filenames, directory paths, and output formats.

Tokens
539
Snippets
3
Records
4
Agent score
22%

What's inside QuickShot

  1. Overview of QuickShot features

    master

    QuickShot is an Android library designed to save View, SurfaceView, or Bitmap objects as images (JPG, PNG, or .nomedia) asynchronously.

    Key capabilities include:

    • Scoped Storage Support: Compatible with Android API 29+ and scoped storage requirements.
    • Asynchronous Execution: Saves images on a background thread to prevent UI blocking.
    • Automatic Resource Management: Handles memory and errors internally.
    • Flexible Output: Supports custom paths, filenames, and formats.
  2. Install QuickShot via Gradle

    master

    Add the QuickShot dependency to your module-level build.gradle file to start using the library for asynchronous image saving.

    dependencies {
        implementation 'io.github.muddz:quickshot:1.4.0'
    }
  3. Capture a View with default settings

    master

    Use the simplest one-liner to save a View, SurfaceView, or Bitmap. When using defaults:

    • Filename: Defaults to a timestamp.
    • Path: Defaults to /Pictures in internal storage.
    • Format: Defaults to .JPG.

    You must implement a result listener to handle the outcome of the asynchronous operation.

    QuickShot.of(view).setResultListener(this).save();
  4. Configure detailed capture settings

    master

    You can customize the capture process by chaining configuration methods before calling .save().

    Available configuration methods:

    • .setResultListener(listener): Sets the callback for the asynchronous operation.
    • .enableLogging(): Enables logging for the capture process.
    • .setFilename(String): Sets a custom filename.
    • .setPath(String): Sets a custom directory path.
    • .toPNG(): Sets the output format to .PNG (Note: .JPG is the default).
    QuickShot.of(view).setResultListener(this)
                      .enableLogging()
                      .setFilename("QuickShot")
                      .setPath("MyApp")
                      .toPNG()
                      .save();