mhelder / easylauncher-gradle-plugin

Add a different ribbon to each of your Android app variants using this gradle plugin. Of course, configure it as you will

Home Page:https://medium.com/@cycki/ribbonize-your-android-application-laucher-icon-again-c52e08d58172?source=friends_link&sk=4747a61844ce085a648d2116780ec4d3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Easylauncher gradle plugin for Android

codecov  build  ktlint

version

Modify the launcher icon of each of your app-variants using simple Gradle rules. Add ribbons of any color, overlay your own images, customize it according to your needs!

Circle RoundedRectangle Teardrop

This library heavily relies on the original Akaita's easylauncher plugin, but introduces supports for modern build tools and Vector icons

Usage

Basic usage

// in app/build.gradle
plugins {
  id "com.starter.easylauncher" version "${{version}}"
}

see Gradle Plugin Portal for details

Advanced usage

You can customize the filters applied to each type, flavor and variant of your app.

Imagine these are the type and flavors of your app:

// in app/build.gradle
android {
    buildTypes {
        debug {
            //Debuggable, will get a default ribbon in the launcher icon
        }
        beta {
            //Debuggable, will get a default ribbon in the launcher icon
            debuggable true
        }
        canary {
            //Non-debuggable, will not get any default ribbon
            debuggable false
        }
        release {
            //Non-debuggable, will not get any default ribbon
        }
    }
    productFlavors {
        local {}
        qa {}
        staging {}
        production {}
    }
}

You could customize the plugin's behaviour like this:

easylauncher {
    defaultFlavorNaming = true // Use flavor name for default ribbon, instead of the type name
    
    productFlavors {
        local {}
        qa {
            // Add one more filter to all `qa` variants
            filters redRibbonFilter()
        }
        staging {}
        production {}
    }
    
    buildTypes {
        beta {
            // Add two more filters to all `beta` variants
            filters = [
                    customRibbon(ribbonColor: "#0000FF"),
                    overlayFilter(new File("example-custom/launcherOverlay/beta.png"))
            ]
        }
        canary {
            // Remove ALL filters to `canary` variants
            enable false
        }
        release {}
    }
    
    variants {
        productionDebug {
            // OVERRIDE all previous filters defined for `productionDebug` variant
            filters = orangeRibbonFilter("custom")
        }
    }
}

Available filters

Overlay filter

Command Result
overlayFilter(new File("example-custom/launcherOverlay/beta.png"))

Ribbon filters

Filter Command Result
Gray ribbon grayRibbonFilter()
Green ribbon greenRibbonFilter()
Yellow ribbon yellowRibbonFilter()
Orange ribbon orangeRibbonFilter()
Red ribbon redRibbonFilter()
Blue ribbon blueRibbonFilter()

Advanced Ribbon filter

Description Command Result
Custom background color customRibbon(ribbonColor: "#6600CC")
Custom label customRibbon(label: "label", ribbonColor: "#DCDCDC")
Custom text color customRibbon(label: "label", ribbonColor: "#DCDCDC", labelColor: "#000000")
Custom gravity - Top customRibbon(label: "custom", position: "top")
Custom gravity - Bottom customRibbon(position: "bottom")
Custom gravity - TopLeft customRibbon(position: "topLeft")
Custom gravity - TopRight customRibbon(position: "topRight")
Custom text size (relative to the icon size) customRibbon(position: "bottom", textSizeRatio: 0.2)
Custom font (locally installed) customRibbon(position: "top", fontName: "ComicSansMs")

Chrome-like filters

Filter Command Result
Default chromeLike()
Custom appearance chromeLike(label: "Custom", ribbonColor: "#FF00FF", labelColor: "#FFFFFF")
Custom font (locally installed) chromeLike(label: "Custom", fontName: "ComicSansMS-Bold")

Available options

  • defaultFlavorNaming: use flavor name in default ribbons, instead of using buildType
  • enable: enable/disable all filters for a flavor/type/variant
  • productFlavors: define filters for flavors (will be added to filters defined for types)
  • buildTypes: define filters for types (will be added to filter defined for flavors)
  • variants: define filters for variants (will override any other filters)

Requirements

Minimal requirements for the plugin are:

  • Gradle: 6.1.1
  • Android Gradle Plugin: 4.0.0
  • minSdkVersion: 21 (theoretically there should be no lower boundary - it just hasn't been tested)

Project Structure

easylauncher/   - source code of Gradle plugin
sample/         - root directory of supported Android applications which serve as test projects

Credits

Credits to Akaita's easylauncher plugin which this project heavily relies on

About

Add a different ribbon to each of your Android app variants using this gradle plugin. Of course, configure it as you will

https://medium.com/@cycki/ribbonize-your-android-application-laucher-icon-again-c52e08d58172?source=friends_link&sk=4747a61844ce085a648d2116780ec4d3

License:MIT License


Languages

Language:Kotlin 100.0%