Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
akaita committed Feb 11, 2018
1 parent 0e2acf9 commit bc6a485
Show file tree
Hide file tree
Showing 83 changed files with 1,824 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.gradle
local.properties
.idea
.DS_Store
build/
reports/
gradle.properties
*.iml
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog for easylauncher plugin

## v0.5.0 2018/01/12

* Simplify DSL
* Add support for adaptive launcher icons
* Add support for variant-specific configuration
* Add ribbon to debuggable type by default

## v0.4.0 2018/01/06

* Add capability to disable plugin
* Give priority to flavor over buildType

## v0.3.0 2018/01/06

* Initial internal release
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
check:
./gradlew clean check bintrayUpload

publish: check
./gradlew releng
./gradlew -PdryRun=false --info plugin:bintrayUpload

update-examples:
./gradlew easylauncher
cp ./example-simple/build/generated/easylauncher/res/debug/mipmap-xxhdpi/ic_launcher.png ic-debug.png
cp ./example-custom/build/generated/easylauncher/res/localBeta/mipmap-xxhdpi/ic_launcher.png ic-beta.png
134 changes: 134 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Easylauncher gradle plugin for Android

This gradle plugin will add a different ribbon to each of your (debuggable) Android app variants. You can of course configure it as you will.

![](icons/ic_launcher_debug.png) ![](ic_launcher_beta.png)
// TODO more icons

## Usage

```groovy
// in build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.akaita.android:easylauncher:0.5.0'
}
}
```

```groovy
// in app/build.gradle
apply plugin: 'com.akaita.android.easylauncher'
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 {}
}
}
```


Optionally, customize the plugin's behaviour
```groovy
easylauncher {
// "manifest application[android:icon]" is automatically added to the list
iconNames "@mipmap/ic_launcher_foreground" // Traditional launcher icon
foregroundIconNames "@mipmap/ic_launcher_foreground" // Foreground of adaptive launcher icon
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 = [
customColorRibbonFilter("#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()
}
}
}
```


## Available filters

| Filter | Result |
| - | - |
| `grayRibbonFilter()` | ![](icons/grayRibbon.png) |
| `greenRibbonFilter()` | ![](icons/greenRibbon.png) |
| `yellowRibbonFilter()` | ![](icons/yellowRibbon.png) |
| `orangeRibbonFilter()` | ![](icons/orangeRibbon.png) |
| `redRibbonFilter()` | ![](icons/redRibbon.png) |
| `blueRibbonFilter()` | ![](icons/blueRibbon.png) |
| `grayscaleFilter()` | ![](icons/grayscale.png) |
| `customColorRibbonFilter("#6600CC")` | ![](icons/customColorRibbon.png) |
| `overlayFilter(new File("example-custom/launcherOverlay/beta.png"))` | ![](icons/overlay.png) |



## Project Structure

```
plugin/ - Gradle plugin
example-simple/ - Example Android application using easylauncher with the default behaviour
example-custom/ - Example Android application using easylauncher with the custom configuration
buildSrc/ - Helper module to use this plugin in example modules
icons/ - Examples of icons generated by this plugin
```


## Contributing

You can already see my plans for the plugin in the project's Issues section.

Still, I'm open to feature-requests and suggestions.
Of course, a PR is the best way to get something you want into the plugin ;)


## Credits

Easylauncher started as an extension of [Fuji Goro's `ribbonizer` plugin](https://github.com/maskarade/gradle-android-ribbonizer-plugin).
As it evolved, I decided it changed enough to be worth releasing as a separate plugin.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
26 changes: 26 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apply from: './versioning.gradle'
apply from: './metadata.gradle'

ext {
metadata.version = versionName
}

buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.novoda:bintray-release:0.8.0' // https://github.com/novoda/bintray-release
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.21"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:1.2.21"
}
}

allprojects {
repositories {
jcenter()
google()
}
}
9 changes: 9 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
System.setProperty("java.awt.headless", "true")

repositories {
jcenter()
}

dependencies {
compile project(':plugin')
}
2 changes: 2 additions & 0 deletions buildSrc/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include ':plugin'
project(':plugin').projectDir = new File('../plugin')
87 changes: 87 additions & 0 deletions example-custom/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

apply plugin: 'com.akaita.android.easylauncher'

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'

defaultConfig {
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
}

lintOptions {
abortOnError false
}

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 {}
}
}

easylauncher {
iconNames "@mipmap/ic_launcher_foreground" // Traditional launcher icon
foregroundIconNames "@mipmap/ic_launcher_foreground" // Foreground of adaptive launcher icon

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 = [
customColorRibbonFilter("#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()
}
}
}

dependencies {
compile 'com.android.support:appcompat-v7:27.0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib:1.2.21"
}
Binary file added example-custom/launcherOverlay/beta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions example-custom/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.akaita.android.easylauncher.example">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.akaita.android.easylauncher.example.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Binary file added example-custom/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.akaita.android.easylauncher.example

import android.app.Activity
import android.app.AlertDialog
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : Activity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

button.setOnClickListener {
AlertDialog.Builder(this)
.setTitle("Hello, Android!")
.setMessage("This is an example app.")
.setPositiveButton("OK", null)
.show()
}
}
}
28 changes: 28 additions & 0 deletions example-custom/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context="com.akaita.android.easylauncher.example.MainActivity">

<TextView
android:id="@+id/text"
android:layout_gravity="center_horizontal"
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large"
android:text="@string/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<Button
android:layout_margin="22dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button"
android:id="@+id/button"
android:layout_gravity="center_horizontal"/>

</LinearLayout>
5 changes: 5 additions & 0 deletions example-custom/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions example-custom/src/main/res/values-v26/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#1c7917</color>
</resources>
Loading

0 comments on commit bc6a485

Please sign in to comment.