Repository: gfx/gradle-android-ribbonizer-plugin Branch: master Commit: fab8dae9a298 Files: 54 Total size: 55.3 KB Directory structure: gitextract_x6z246hr/ ├── .gitignore ├── CHANGES.md ├── LICENSE ├── Makefile ├── README.md ├── VERSION ├── build.gradle ├── buildSrc/ │ ├── build.gradle │ └── settings.gradle ├── circle.yml ├── example-custom/ │ ├── build.gradle │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── github/ │ │ └── gfx/ │ │ └── ribbonizer/ │ │ └── example/ │ │ └── MainActivity.java │ └── res/ │ ├── layout/ │ │ └── activity_main.xml │ ├── mipmap-anydpi-v26/ │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ ├── values/ │ │ ├── dimens.xml │ │ ├── ic_launcher_background.xml │ │ ├── strings.xml │ │ └── styles.xml │ ├── values-v26/ │ │ └── colors.xml │ └── values-w820dp/ │ └── dimens.xml ├── example-simple/ │ ├── build.gradle │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── github/ │ │ └── gfx/ │ │ └── ribbonizer/ │ │ └── example/ │ │ └── MainActivity.java │ └── res/ │ ├── layout/ │ │ └── activity_main.xml │ ├── values/ │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── values-w820dp/ │ └── dimens.xml ├── gradle/ │ └── wrapper/ │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties.sample ├── gradlew ├── gradlew.bat ├── metadata.gradle ├── plugin/ │ ├── build.gradle │ └── src/ │ ├── main/ │ │ ├── groovy/ │ │ │ └── com/ │ │ │ └── github/ │ │ │ └── gfx/ │ │ │ └── ribbonizer/ │ │ │ ├── CustomColorRibbonBuilder.java │ │ │ ├── FilterBuilder.java │ │ │ ├── GrayRibbonBuilder.java │ │ │ ├── GrayScaleBuilder.java │ │ │ ├── GreenRibbonBuilder.java │ │ │ ├── YellowRibbonBuilder.java │ │ │ ├── filter/ │ │ │ │ ├── ColorRibbonFilter.java │ │ │ │ └── GrayScaleFilter.java │ │ │ └── plugin/ │ │ │ ├── Resources.java │ │ │ ├── Ribbonizer.java │ │ │ ├── RibbonizerExtension.java │ │ │ ├── RibbonizerPlugin.groovy │ │ │ └── RibbonizerTask.groovy │ │ └── resources/ │ │ └── META-INF/ │ │ └── gradle-plugins/ │ │ └── com.github.gfx.ribbonizer.properties │ └── test/ │ └── groovy/ │ └── com/ │ └── github/ │ └── gfx/ │ └── ribbonizer/ │ └── test/ │ └── ResourcesTest.groovy ├── settings.gradle └── versioning.gradle ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ .gradle local.properties .idea .DS_Store build/ reports/ gradle.properties *.iml ================================================ FILE: CHANGES.md ================================================ # The revision history of android-ribbonizer-plugin ## v2.1.0 2017/08/19 * Allow null values for filters and ribbon labels * Added `largeRibbon` option to increase visibility in launcher icon foreground assets ## v2.0.0 2017/07/21 No code change from v1.1.0; the reason of bumping the version is that v1.1.0 has breaking changes in the artifact id (`s/plugin/ribbonizer-plugin/`). ## v1.1.0 2017/07/21 https://github.com/gfx/gradle-android-ribbonizer-plugin/compare/v1.0.0...v1.1.0 * Change the artifact id from `plugin` to `ribbonizer-plugin` * [#16](https://github.com/gfx/gradle-android-ribbonizer-plugin/pull/16) Support for android:roundIcon launcher images * [#19](https://github.com/gfx/gradle-android-ribbonizer-plugin/pull/19) Exclude XML resources ## v1.0.0 2016/11/16 * Add `customColorRibbonFilter(variant, iconFile, color)` (#13) ## v0.6.0 - 2016-06-16 * Add `forcedVariantsNames` (#11) ## v0.5.0 - 2015-11-19 * Build with Android Gradle plugin v1.5.0 ## v0.4.0 - 2015-06-05 * [Add RibbonizerExtension#grayScaleFilter by kazy1991 · Pull Request #4 · gfx/gradle-android-ribbonizer-plugin](https://github.com/gfx/gradle-android-ribbonizer-plugin/pull/4) * Add ways to add icon names (see `example-custom/build.gradle` for example) ## v0.3.0 - 2015-04-15 * Fix "AndroidManifest.xml not found" errors ## v0.2.0 - 2015-04-12 * Add `example-custom` to show how to use the `ribbonizer` extension block ## v0.1.1 - 2015-04-03 * Fix a crash caused by an Android Studio issue ## v0.1.0 - 2015-03-29 * Initial Release ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 FUJI Goro (gfx) . Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: Makefile ================================================ check: ./gradlew clean check bintrayUpload publish: check ./gradlew releng ./gradlew -PdryRun=false --info plugin:bintrayUpload update-examples: ./gradlew ribbonize cp ./example-simple/build/generated/ribbonizer/res/debug/mipmap-xxhdpi/ic_launcher.png ic-debug.png cp ./example-custom/build/generated/ribbonizer/res/localBeta/mipmap-xxhdpi/ic_launcher.png ic-beta.png ================================================ FILE: README.md ================================================ # DEPRECATED No longer actively maintained, I recommend [Mikel's easylauncher-gradle-plugin](https://github.com/akaita/easylauncher-gradle-plugin) which might not have seen much love lately either, but seems to still work since the JFrog shutdown. # Ribbonizer plugin for Android [![Circle CI](https://circleci.com/gh/gfx/gradle-android-ribbonizer-plugin.svg?style=svg&branch=master)](https://circleci.com/gh/gfx/gradle-android-ribbonizer-plugin) [![Download](https://api.bintray.com/packages/gfx/maven/ribbonizer-plugin/images/download.svg)](https://bintray.com/gfx/maven/ribbonizer-plugin/_latestVersion) This is a ribbonizer as a Gradle plugin for Android, which adds a ribbon to launcher icons. ![](ic-beta.png) ![](ic-debug.png) ## Usage ```groovy // in build.gradle buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.2' classpath 'com.github.gfx.ribbonizer:ribbonizer-plugin:2.1.0' } } ``` ```groovy // in app/build.gradle apply plugin: 'com.github.gfx.ribbonizer' android { // ... buildTypes { debug {/*debuggable build, which will ribbonized automatically*/} beta { //debuggable build which will automatically ribbonized. debuggable true } canary { //non-debuggable build which will no automatically ribbonized. //But, we force one of its flavors. See `ribbonizer` for how-to debuggable false } release {/*non-debuggable build. Will not be rebbonized automatically*/} } productFlavors { local {} qa {} staging {} production {} } } ribbonizer { // "manifest application[android:icon]" is automatically added to the list iconNames "@drawable/ic_notification", "@drawable/widget_preview" builder { variant, iconFile -> // change ribbon colors by product flavors if (variant.flavorName == "local") { return grayRibbonFilter(variant, iconFile) } else if (variant.flavorName == "qa") { // customColorRibbonFilter allows setting any color code def filter = customColorRibbonFilter(variant, iconFile, "#00C89C") // Finer control of the label text can be achieved by setting it manually, or set to // null for an unlabelled ribbon. The default is to use the flavor name. filter.label = "QA" + variant.versionCode return filter } else if (variant.flavorName == "staging") { return yellowRibbonFilter(variant, iconFile) } else if (variant.buildType.name == "debug") { if (variant.flavorName == "production") { // Particular configurations can be skipped by returning no filters return null } else { // Other filters can be applied, as long as they implement Consumer return grayScaleFilter(variant, iconFile) } } else { return greenRibbonFilter(variant, iconFile) } } //Although `canary` build-type is marked as `non-debuggable` //we can still force specific variants to be ribbonized: forcedVariantsNames "localCanary" } ``` ## Project Structure ``` plugin/ - The main module of a Gradle plugin example/ - An example android application that uses this plugin buildSrc/ - A helper module to use this plugin in example modules ``` You can test this project with `./gradlew check`. ## Release Engineering ```console ./gradlew bumpMinor # or bumpMajor, bumpPatch make publish # upload artifacts to bintray jcenter ``` ## Author And License The MIT License (MIT) Copyright (c) 2015 FUJI Goro (gfx) . Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: VERSION ================================================ 2.1.0 ================================================ FILE: build.gradle ================================================ apply from: './versioning.gradle' apply from: './metadata.gradle' ext { metadata.version = versionName } buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.novoda:bintray-release:0.5.0' // https://github.com/novoda/bintray-release } } allprojects { repositories { jcenter() } } ================================================ FILE: buildSrc/build.gradle ================================================ System.setProperty("java.awt.headless", "true") repositories { jcenter() } dependencies { compile project(':plugin') } ================================================ FILE: buildSrc/settings.gradle ================================================ include ':plugin' project(':plugin').projectDir = new File('../plugin') ================================================ FILE: circle.yml ================================================ machine: java: version: oraclejdk8 environment: TERM: dumb GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1024m -XX:+HeapDumpOnOutOfMemoryError" -Dorg.gradle.daemon=false' dependencies: pre: - echo y | android -s update sdk -u -a -t "tools" # update Android SDK that includes sdkmanager(1) - mkdir -p "$ANDROID_HOME"/licenses - echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME"/licenses/android-sdk-license - $ANDROID_HOME/tools/bin/sdkmanager "platform-tools" "extras;android;m2repository" test: override: - TERM=dumb ./gradlew check - TERM=dumb ./gradlew ribbonize ================================================ FILE: example-custom/build.gradle ================================================ import com.android.build.gradle.api.ApplicationVariant apply plugin: 'com.android.application' apply plugin: 'com.github.gfx.ribbonizer' android { compileSdkVersion 26 buildToolsVersion '26.0.0' defaultConfig { minSdkVersion 15 targetSdkVersion 26 versionCode 1 versionName "1.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } lintOptions { abortOnError false } buildTypes { debug {} beta { debuggable true } canary { debuggable false } release {} } productFlavors { local {} qa {} staging {} production {} } } ribbonizer { iconNames "@drawable/abc_btn_check_to_on_mtrl_000", "@drawable/abc_btn_radio_to_on_mtrl_000", "@mipmap/ic_launcher_foreground" builder { ApplicationVariant variant, File iconFile -> if (variant.flavorName == "local") { return grayRibbonFilter(variant, iconFile) } else if (variant.flavorName == "qa") { def filter = customColorRibbonFilter(variant, iconFile, "#00C89C") filter.label = null//"QA" + variant.versionCode filter.largeRibbon = (iconFile.name == "ic_launcher_foreground.png") return filter } else if (variant.buildType.name == "debug") { if (variant.flavorName == "production") { return null } return customColorRibbonFilter(variant, iconFile, "#0000FF") } else { return greenRibbonFilter(variant, iconFile) } } forcedVariantsNames "localCanary" } dependencies { compile 'com.jakewharton:butterknife:6.1.0' compile 'com.android.support:appcompat-v7:25.0.0' } ================================================ FILE: example-custom/src/main/AndroidManifest.xml ================================================ ================================================ FILE: example-custom/src/main/java/com/github/gfx/ribbonizer/example/MainActivity.java ================================================ package com.github.gfx.ribbonizer.example; import android.app.Activity; import android.app.AlertDialog; import android.os.Bundle; import android.widget.TextView; import butterknife.ButterKnife; import butterknife.InjectView; import butterknife.OnClick; public class MainActivity extends Activity { @InjectView(R.id.text) TextView textView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.inject(this); } @OnClick(R.id.button) void onButtonClick() { new AlertDialog.Builder(this) .setTitle("Hello, Android!") .setMessage("This is an example app.") .setPositiveButton("OK", null) .show(); } } ================================================ FILE: example-custom/src/main/res/layout/activity_main.xml ================================================