[
  {
    "path": ".buildscript/deploy_snapshot.sh",
    "content": "#!/bin/bash\n#\n# Deploy a jar, source jar, and javadoc jar to Sonatype's snapshot repo.\n#\n# Adapted from https://coderwall.com/p/9b_lfq and\n# http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/\n\nSLUG=\"hzsweers/RxPalette\"\nJDK=\"oraclejdk8\"\nBRANCH=\"master\"\n\nset -e\n\nif [ \"$TRAVIS_REPO_SLUG\" != \"$SLUG\" ]; then\n  echo \"Skipping snapshot deployment: wrong repository. Expected '$SLUG' but was '$TRAVIS_REPO_SLUG'.\"\nelif [ \"$TRAVIS_JDK_VERSION\" != \"$JDK\" ]; then\n  echo \"Skipping snapshot deployment: wrong JDK. Expected '$JDK' but was '$TRAVIS_JDK_VERSION'.\"\nelif [ \"$TRAVIS_PULL_REQUEST\" != \"false\" ]; then\n  echo \"Skipping snapshot deployment: was pull request.\"\nelif [ \"$TRAVIS_BRANCH\" != \"$BRANCH\" ]; then\n  echo \"Skipping snapshot deployment: wrong branch. Expected '$BRANCH' but was '$TRAVIS_BRANCH'.\"\nelse\n  echo \"Deploying snapshot...\"\n  ./gradlew clean uploadArchives\n  echo \"Snapshot deployed!\"\nfi\n"
  },
  {
    "path": ".buildscript/settings.xml",
    "content": "<settings>\n    <servers>\n        <server>\n            <id>sonatype-nexus-snapshots</id>\n            <username>${env.SONATYPE_NEXUS_USERNAME}</username>\n            <password>${env.SONATYPE_NEXUS_PASSWORD}</password>\n        </server>\n    </servers>\n</settings>\n"
  },
  {
    "path": ".gitignore",
    "content": "###OSX###\n\n.DS_Store\n.AppleDouble\n.LSOverride\n\n# Icon must ends with two \\r.\nIcon\n\n\n# Thumbnails\n._*\n\n# Files that might appear on external disk\n.Spotlight-V100\n.Trashes\n\n\n###Linux###\n\n*~\n\n# KDE directory preferences\n.directory\n\n\n###Android###\n\n# Built application files\n*.apk\n*.ap_\n\n# Files for ART and Dalvik VM\n*.dex\n\n# Java class files\n*.class\n\n# Generated files\nbin/\ngen/\n\n# Gradle files\n.gradle/\n.gradletasknamecache\nbuild/\n\n# Local configuration file (sdk path, etc)\nlocal.properties\n\n# Proguard folder generated by Eclipse\nproguard/\n\n# Lint\nlint-report.html\nlint-report_files/\nlint_result.txt\n\n# Mobile Tools for Java (J2ME)\n.mtj.tmp/\n\n# Package Files #\n*.war\n*.ear\n\n# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml\nhs_err_pid*\n\n\n###IntelliJ###\n\n*.iml\n*.ipr\n*.iws\n.idea/\n\n\n###Eclipse###\n\n*.pydevproject\n.metadata\ntmp/\n*.tmp\n*.bak\n*.swp\n*~.nib\n.settings/\n.loadpath\n\n# External tool builders\n.externalToolBuilders/\n\n# Locally stored \"Eclipse launch configurations\"\n*.launch\n\n# CDT-specific\n.cproject\n\n# PDT-specific\n.buildpath\n\n# sbteclipse plugin\n.target\n\n# TeXlipse plugin\n.texlipse\n\n# Misc\nannotations\nprivate.props\n\n# [Maven] ========================\ntarget/\npom.xml.tag\npom.xml.releaseBackup\npom.xml.versionsBackup\npom.xml.next\nrelease.properties\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: android\n\nandroid:\n  components:\n    - tools\n    - platform-tools\n    - build-tools-23.0.2\n    - android-23\n    - extra-android-m2repository\n\njdk:\n  - oraclejdk8\n\nscript:\n  - ./gradlew \":$MODULE:build\" \":$MODULE-kotlin:build\"\n\nafter_success:\n  - .buildscript/deploy_snapshot.sh\n\nenv:\n  matrix:\n    - MODULE=rxpalette\n  global:\n    - secure: \"nrPJdE/UdDyVBIiTXD+lxKRenqaXgFomWlUGbina1Y5jNYzyUlXwBYC3blzrCSeJsTe7XvPr1iyQAkgdG+IG5HKIPExEvHZUS7mPaKIIEHOEQDlt/2H6Ge2ZH7VJx446pStiZMXj2DYIkoPskVZH7uZ8C85yUFEWZhQ5QZOdo30zUmb2HWsk5kjm/K+WSuF+vUBDuXbAuRHOUJ0j3tqTo0IJxKeIC1AtFfm97fQJK9fIuvc2kLhdge1BkcI+1P28jCedwidmGrcqF+g41PJGNAz61HEfi3HOBcpoS0qIiKYwvcEnBQNjRZ+gDrPUohVqWntJC/rZHmGu0NS3mhEeRXYvn36f8eOYNs392RXmiDUMFlWFtNUd3U0E6P5GobPJI9b9RbaK/lMiyzL5uvBIUNxzXo3i8hBShzlVk4Vk8MyNvMF1bVzpyABEOjMqiPxv9Gc8+ID77t1+iTOpvg6P15AKHUpMi4SsHVRZYAt5JTn0MATK3299/129KLEcvn7csSPhHDMINjNxlhFGgzNjj2Me19irFLbSuATy1NqI93gEgvN0w4PUGU0CeB2JJpkKnmFLj7C21KXCizleCtyovCXwyAe5ypvxy0zW9qssvZ+OdLS71XWy2K/7RLNfEYBP9Qq9xKj2pr361KWUF6aF+Rlj28AjcR6r1/TS1f7mg7A=\"\n    - secure: \"IWYmV1voMD/idGmeWTCpq+fps07mSomllOmmMKG/FwdLPu+HdDRLh4awa02J0bdI8bqTW1+MQC/u4IUKfMttp9rE7A+sob1EqmCTFJgpMAJ+VbKfBisnPVG5tVNV1LEkj9Hi8ide6EntOKPDduC9QFonN05xipt+t5slJrRyCo4sPVYByl1Hn1EC4NvZViie7JlB4r+cNaLVHL0JboqLvvbPgdslw6NuaoLYWy2yQr8JZRP3PVWj4jEQ7y+Ek+6V5KTQs62YbyXCETBgeWHm4L6oL7g7nMVWURq5isILZgI7GEHtD5oX+CjOLOgkQkPGyREOLsLDSHw/Ymd96bit2mXyZgSMKNq+Nz3U4kl67hHjMZubmRa3eAdVypM98YeCKfepUf6Wk0PUXPEZplXBG0E12MW5QKi0JkW15WZeVaBxBKMdZJYOyPiVGpMF6A0HxXFrgxRr3TgdB0Dis1hzVuvYQ3gm6WV24mki81FoYwj2XxsgUc+A2hsfuLjC2+1ceabebIdHniJPOjYlFnEdKHimQExCvjIxCpUJ8c0uZkAQlL9zy8hUc6Sx3AjIPsFABwczNxxgD6b5T9o0hOOPOXwHIcTK76xdjtuHnlfMet+cat/GdgOzVpdg2lrVnEXaXk9RbSooAgpaZ2InOZB3vzEqdEXOxCE790GI8EzKsNA=\"\n\nbranches:\n  except:\n    - gh-pages\n\nnotifications:\n  email: false\n\nsudo: false\n\ncache:\n  directories:\n    - $HOME/.gradle\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "Change Log\n==========\n\nVersion 0.3.0 *2016-2-5*\n----------------------------\n\n* Uses RxJava's new `fromCallable()` API under the hood now\n* Dependency updates\n  * RxJava 1.1.0\n  * Support libraries 23.1.1\n  * Kotlin 1.0.0-rc-1036\n\nNote that there will probably be a patch release when Kotlin goes release 1.0.0. Doing the release\nnow because rc-1036 introduced some backward-incompatible class file changes.\n\nVersion 0.2.0 *2015-11-1*\n----------------------------\n\n* Removed `generateAsync` API. Just use normal scheduler selection with your RxJava chains.\n* Kotlin extensions only support `Palette.Builder().asObservable` now. Function extensions can't be done as static \nfunctions on the `Palette` class itself since it has no `companion` object.\n* Errors properly propagated via `onError` rather than at creation.\n* `onComplete()` properly called when generation is complete.\n* Full sample, unit tests, and CI\n\nVersion 0.1.0 *2015-10-27*\n----------------------------\n\nInitial release.\n"
  },
  {
    "path": "LICENSE.txt",
    "content": "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "RxPalette\n=========\n\nRxJava binding APIs for the [Palette][palette] Android library.\n\nUsage\n-----\n\nJava:\n```java\nRxPalette.generate(bitmap)\n        .subscribe({ palette ->\n            // Do stuff\n        });\n        \nRxPalette.generate(new Palette.Builder(bitmap).maximumColorCount(10))\n        .subscribe({ palette ->\n            // Do stuff\n        });\n```\n\nKotlin:\n```kotlin\n// Extensions directly applied Palette.Builder\nPalette.Builder(bitmap)\n        .maximumColorCount(10)\n        .asObservable()\n        .subscribe({ palette ->\n            // Do stuff\n        });\n```\n\nDownload\n--------\n\nJava bindings:\n```groovy\ncompile 'io.sweers.rxpalette:rxpalette:0.3.0'\n```\n\nKotlin bindings:\n```groovy\ncompile 'io.sweers.rxpalette:rxpalette-kotlin:0.3.0'\n```\n\nSnapshots of the development version are available in [Sonatype's snapshots repository][snapshots].\n\nLicense\n-------\n\n    Copyright (C) 2015 Zac Sweers\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n [palette]: https://developer.android.com/reference/android/support/v7/graphics/Palette.html\n [snapshots]: https://oss.sonatype.org/content/repositories/snapshots/\n"
  },
  {
    "path": "RELEASING.md",
    "content": "Releasing\n========\n\n 1. Change the version in `gradle.properties` to a non-SNAPSHOT version.\n 2. Update the `CHANGELOG.md` for the impending release.\n 3. Update the `README.md` with the new version.\n 4. `git commit -am \"Prepare for release X.Y.Z.\"` (where X.Y.Z is the new version)\n 5. `git tag -a X.Y.Z -m \"Version X.Y.Z\"` (where X.Y.Z is the new version)\n 6. `./gradlew clean uploadArchives`\n 7. Update the `gradle.properties` to the next SNAPSHOT version.\n 8. `git commit -am \"Prepare next development version.\"`\n 9. `git push && git push --tags`\n 10. Visit [Sonatype Nexus](https://oss.sonatype.org/) and promote the artifact.\n"
  },
  {
    "path": "build.gradle",
    "content": "subprojects {\n    buildscript {\n        repositories {\n            jcenter()\n            mavenCentral()\n        }\n    }\n\n    repositories {\n        jcenter()\n        mavenCentral()\n    }\n\n    group = GROUP\n    version = VERSION_NAME\n\n    // The default 'assemble' task only applies to normal variants. Add test variants as well.\n    afterEvaluate {\n        android.testVariants.all { variant ->\n            tasks.getByName('assemble').dependsOn variant.assemble\n        }\n\n        // TODO Why does android studio hiccup on this?\n//        tasks.withType(com.android.build.gradle.internal.tasks.AndroidTestTask.getClass()) { task ->\n//            task.doFirst {\n//                logging.level = LogLevel.INFO\n//            }\n//            task.doLast {\n//                logging.level = LogLevel.LIFECYCLE\n//            }\n//        }\n    }\n}\n\ntask clean(type: Delete) {\n    delete rootProject.buildDir\n}\n\next {\n    androidPlugin = 'com.android.tools.build:gradle:2.2.2'\n    minSdkVersion = 14\n    targetSdkVersion = 23\n    compileSdkVersion = 23\n    buildToolsVersion = '23.0.2'\n\n    ci = 'true'.equals(System.getenv('CI'))\n\n    def kotlinVersion = '1.0.0'\n    kotlinPlugin = \"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion\"\n    kotlinStdlib = \"org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion\"\n\n    def supportVersion = '23.2.1'\n    supportAnnotations = \"com.android.support:support-annotations:$supportVersion\"\n    supportV4 = \"com.android.support:support-v4:$supportVersion\"\n    supportPalette = \"com.android.support:palette-v7:$supportVersion\"\n\n    supportTestRunner = 'com.android.support.test:runner:0.4'\n    supportTestRules = 'com.android.support.test:rules:0.4'\n    supportTestEspresso = 'com.android.support.test.espresso:espresso-core:2.2.1'\n    supportTestEspressoContrib = 'com.android.support.test.espresso:espresso-contrib:2.2.1'\n    rxJava = 'io.reactivex.rxjava2:rxjava:2.0.0'\n    junit = 'junit:junit:4.12'\n    robolectric = 'org.robolectric:robolectric:3.1.4'\n    truth = 'com.google.truth:truth:0.27'\n\n    // Sample app dependencies\n    supportAppCompat = \"com.android.support:appcompat-v7:$supportVersion\"\n    rxAndroid = 'io.reactivex.rxjava2:rxandroid:2.0.0'\n    supportRecyclerView = \"com.android.support:recyclerview-v7:$supportVersion\"\n    butterKnife = 'com.jakewharton:butterknife:7.0.1'\n    glide = 'com.github.bumptech.glide:glide:3.7.0'\n    glideOkhttp = 'com.github.bumptech.glide:okhttp3-integration:1.4.0@aar'\n    okhttp3 = 'com.squareup.okhttp3:okhttp:3.2.0'\n\n    def retrofitVersion = '2.0.0'\n    retrofit = \"com.squareup.retrofit2:retrofit:$retrofitVersion\"\n    retrofitMoshi = \"com.squareup.retrofit2:converter-moshi:$retrofitVersion\"\n    retrofitRxJava = \"com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0\"\n}\n\ntask wrapper(type: Wrapper) {\n    gradleVersion = '2.14.1'\n    distributionUrl = \"https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip\"\n}\n"
  },
  {
    "path": "gradle/gradle-mvn-push.gradle",
    "content": "/*\n * Copyright 2013 Chris Banes\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\napply plugin: 'maven'\napply plugin: 'signing'\n\ndef isReleaseBuild() {\n    return VERSION_NAME.contains(\"SNAPSHOT\") == false\n}\n\ndef getRepositoryUsername() {\n    return hasProperty('SONATYPE_NEXUS_USERNAME') ? SONATYPE_NEXUS_USERNAME : \"\"\n}\n\ndef getRepositoryPassword() {\n    return hasProperty('SONATYPE_NEXUS_PASSWORD') ? SONATYPE_NEXUS_PASSWORD : \"\"\n}\n\nafterEvaluate { project ->\n    uploadArchives {\n        repositories {\n            mavenDeployer {\n                beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }\n\n                pom.groupId = GROUP\n                pom.artifactId = POM_ARTIFACT_ID\n                pom.version = VERSION_NAME\n\n                repository(url: \"https://oss.sonatype.org/service/local/staging/deploy/maven2/\") {\n                    authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())\n                }\n                snapshotRepository(url: \"https://oss.sonatype.org/content/repositories/snapshots/\") {\n                    authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())\n                }\n\n                pom.project {\n                    name POM_NAME\n                    packaging POM_PACKAGING\n                    description POM_DESCRIPTION\n                    url POM_URL\n\n                    scm {\n                        url POM_SCM_URL\n                        connection POM_SCM_CONNECTION\n                        developerConnection POM_SCM_DEV_CONNECTION\n                    }\n\n                    licenses {\n                        license {\n                            name POM_LICENCE_NAME\n                            url POM_LICENCE_URL\n                            distribution POM_LICENCE_DIST\n                        }\n                    }\n\n                    developers {\n                        developer {\n                            id POM_DEVELOPER_ID\n                            name POM_DEVELOPER_NAME\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    signing {\n        required { isReleaseBuild() && gradle.taskGraph.hasTask(\"uploadArchives\") }\n        sign configurations.archives\n    }\n\n    task androidJavadocs(type: Javadoc) {\n        if (!project.plugins.hasPlugin('kotlin-android')) {\n            source = android.sourceSets.main.java.srcDirs\n        }\n        classpath += project.files(android.getBootClasspath().join(File.pathSeparator))\n        exclude '**/internal/*'\n\n        if (JavaVersion.current().isJava8Compatible()) {\n            options.addStringOption('Xdoclint:none', '-quiet')\n        }\n    }\n\n    task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {\n        classifier = 'javadoc'\n        from androidJavadocs.destinationDir\n    }\n\n    task androidSourcesJar(type: Jar) {\n        classifier = 'sources'\n        from android.sourceSets.main.java.sourceFiles\n    }\n\n    artifacts {\n        archives androidSourcesJar\n        archives androidJavadocsJar\n    }\n}\n"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "#Sun Nov 06 14:26:33 CET 2016\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-2.14.1-all.zip\n"
  },
  {
    "path": "gradle.properties",
    "content": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will override*\n# any settings specified in this file.\n\n# For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/build_environment.html\n\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\n# Default value: -Xmx10248m -XX:MaxPermSize=256m\n# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8\n\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\n# org.gradle.parallel=true\nGROUP=io.sweers.rxpalette\nVERSION_NAME=0.3.1-SNAPSHOT\n\nPOM_DESCRIPTION=RxJava binding APIs for Palette.\nPOM_URL=https://github.com/hzsweers/RxPalette/\nPOM_SCM_URL=https://github.com/hzsweers/RxPalette/\nPOM_SCM_CONNECTION=scm:git:git://github.com/hzsweers/RxPalette.git\nPOM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/hzsweers/RxPalette.git\nPOM_LICENCE_NAME=The Apache Software License, Version 2.0\nPOM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt\nPOM_LICENCE_DIST=repo\nPOM_DEVELOPER_ID=hzsweers\nPOM_DEVELOPER_NAME=Zac Sweers\n"
  },
  {
    "path": "gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto init\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto init\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:init\n@rem Get command-line arguments, handling Windowz variants\n\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\n\n:win9xME_args\n@rem Slurp the command line arguments.\nset CMD_LINE_ARGS=\nset _SKIP=2\n\n:win9xME_args_slurp\nif \"x%~1\" == \"x\" goto execute\n\nset CMD_LINE_ARGS=%*\ngoto execute\n\n:4NT_args\n@rem Get arguments from the 4NT Shell from JP Software\nset CMD_LINE_ARGS=%$\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "rxpalette/build.gradle",
    "content": "buildscript {\n    dependencies {\n        classpath rootProject.ext.androidPlugin\n    }\n}\n\napply plugin: 'com.android.library'\n\ndependencies {\n    compile fileTree(dir: 'libs', include: ['*.jar'])\n    compile rootProject.ext.rxJava\n    compile rootProject.ext.supportAnnotations\n    compile rootProject.ext.supportPalette\n\n    testCompile rootProject.ext.junit\n    testCompile rootProject.ext.robolectric\n    testCompile rootProject.ext.truth\n}\n\nandroid {\n    compileSdkVersion rootProject.ext.compileSdkVersion\n    buildToolsVersion rootProject.ext.buildToolsVersion\n\n    defaultConfig {\n        minSdkVersion rootProject.ext.minSdkVersion\n    }\n\n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_1_7\n        targetCompatibility JavaVersion.VERSION_1_7\n    }\n\n    dexOptions {\n        preDexLibraries = !rootProject.ext.ci\n    }\n\n    lintOptions {\n        textReport true\n        textOutput 'stdout'\n    }\n\n    buildTypes {\n        debug {\n            testCoverageEnabled true\n        }\n    }\n\n    packagingOptions {\n        exclude 'LICENSE.txt'\n    }\n}\n\napply from: rootProject.file('gradle/gradle-mvn-push.gradle')\n"
  },
  {
    "path": "rxpalette/gradle.properties",
    "content": "POM_ARTIFACT_ID=rxpalette\nPOM_NAME=RxPalette\nPOM_PACKAGING=aar\n"
  },
  {
    "path": "rxpalette/src/main/AndroidManifest.xml",
    "content": "<manifest package=\"io.sweers.rxpalette\"/>\n"
  },
  {
    "path": "rxpalette/src/main/java/io/sweers/rxpalette/RxPalette.java",
    "content": "package io.sweers.rxpalette;\n\nimport android.graphics.Bitmap;\nimport android.support.annotation.CheckResult;\nimport android.support.annotation.NonNull;\nimport android.support.v7.graphics.Palette;\n\nimport java.util.concurrent.Callable;\n\nimport io.reactivex.Single;\n\n/**\n * Static factory methods for creating {@linkplain Single singles} for {@link Palette}.\n */\npublic final class RxPalette {\n\n    /**\n     * Returns a {@linkplain Single single} that emits a {@linkplain Palette palette} from the source {@code bitmap}\n     */\n    @CheckResult @NonNull\n    public static Single<Palette> generate(@NonNull final Bitmap bitmap) {\n        return Single.fromCallable(new Callable<Palette>() {\n            @Override\n            public Palette call() throws Exception {\n                return Palette.from(bitmap).generate();\n            }\n        });\n    }\n\n    /**\n     * Returns a {@linkplain Single single} that emits a {@linkplain Palette palette} from the source {@code bitmap}\n     */\n    @CheckResult @NonNull\n    public static Single<Palette> generate(@NonNull final Palette.Builder builder) {\n        return Single.fromCallable(new Callable<Palette>() {\n            @Override\n            public Palette call() throws Exception {\n                return builder.generate();\n            }\n        });\n    }\n}\n"
  },
  {
    "path": "rxpalette/src/test/java/io/sweers/rxpalette/RxPaletteTest.java",
    "content": "package io.sweers.rxpalette;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.graphics.Bitmap;\nimport android.graphics.BitmapFactory;\nimport android.support.v7.graphics.Palette;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.robolectric.Robolectric;\nimport org.robolectric.RobolectricTestRunner;\nimport org.robolectric.annotation.Config;\n\nimport io.reactivex.subscribers.TestSubscriber;\n\n@RunWith(RobolectricTestRunner.class)\n@Config(constants = BuildConfig.class, sdk = 21)\npublic class RxPaletteTest {\n\n    private Bitmap bitmap;\n\n    @Before\n    public void setUp() {\n        Context context = Robolectric.buildActivity(Activity.class).create().get();\n        bitmap = BitmapFactory.decodeResource(context.getResources(), android.R.drawable.star_on);\n    }\n\n    @Test\n    public void testGenerate() {\n        RxPalette.generate(bitmap)\n                .test()\n                .assertNoErrors()\n                .assertComplete()\n                .assertValueCount(1);\n    }\n\n    @Test\n    public void testBuilderGenerate() {\n        RxPalette.generate(Palette.from(bitmap))\n                .test()\n                .assertNoErrors()\n                .assertComplete()\n                .assertValueCount(1);\n    }\n\n    @Test\n    public void testNullGenerate() {\n        Bitmap nullBitmap = null;\n        //noinspection ConstantConditions\n        RxPalette.generate(nullBitmap)\n                .test()\n        \t\t.assertError(IllegalArgumentException.class);\n    }\n\n    @Test\n    public void testNullBuilderGenerate() {\n        TestSubscriber<Palette> testSubscriber = new TestSubscriber<>();\n        Palette.Builder nullBuilder = null;\n        //noinspection ConstantConditions\n        RxPalette.generate(nullBuilder)\n                .test()\n\t\t\t\t.assertError(NullPointerException.class);\n    }\n}\n"
  },
  {
    "path": "rxpalette-kotlin/build.gradle",
    "content": "buildscript {\n    dependencies {\n        classpath rootProject.ext.androidPlugin\n        classpath rootProject.ext.kotlinPlugin\n    }\n}\n\napply plugin: 'com.android.library'\napply plugin: 'kotlin-android'\n\ndependencies {\n    compile project(':rxpalette')\n    compile rootProject.ext.kotlinStdlib\n\n    testCompile rootProject.ext.junit\n    testCompile rootProject.ext.robolectric\n    testCompile rootProject.ext.truth\n}\n\nandroid {\n    compileSdkVersion rootProject.ext.compileSdkVersion\n    buildToolsVersion rootProject.ext.buildToolsVersion\n\n    defaultConfig {\n        minSdkVersion rootProject.ext.minSdkVersion\n    }\n\n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_1_7\n        targetCompatibility JavaVersion.VERSION_1_7\n    }\n\n    dexOptions {\n        preDexLibraries = !rootProject.ext.ci\n    }\n\n    lintOptions {\n        textReport true\n        textOutput 'stdout'\n    }\n\n    sourceSets {\n        main.java.srcDirs += 'src/main/kotlin'\n        test.java.srcDirs += 'src/test/kotlin'\n    }\n}\n\napply from: rootProject.file('gradle/gradle-mvn-push.gradle')\n"
  },
  {
    "path": "rxpalette-kotlin/gradle.properties",
    "content": "POM_ARTIFACT_ID=rxpalette-kotlin\nPOM_NAME=RxPalette Kotlin\nPOM_PACKAGING=aar\n"
  },
  {
    "path": "rxpalette-kotlin/src/main/AndroidManifest.xml",
    "content": "<manifest package=\"io.sweers.rxpalette.kotlin\"/>\n"
  },
  {
    "path": "rxpalette-kotlin/src/main/kotlin/io/sweers/rxpalette/RxPalette.kt",
    "content": "package io.sweers.rxpalette\n\nimport android.support.v7.graphics.Palette\nimport io.reactivex.Single\n\n/**\n * Returns a [single][Single] that emits a [palette][Palette] from the source `bitmap`\n */\npublic inline fun Palette.Builder.asSingle(): Single<Palette> = RxPalette.generate(this)\n"
  },
  {
    "path": "rxpalette-kotlin/src/test/kotlin/io/sweers/rxpalette/RxPaletteTest.kt",
    "content": "package io.sweers.rxpalette\n\nimport android.app.Activity\nimport android.content.Context\nimport android.graphics.Bitmap\nimport android.graphics.BitmapFactory\nimport android.support.v7.graphics.Palette\nimport org.junit.Before\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.robolectric.Robolectric\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.annotation.Config\nimport kotlin.properties.Delegates\n\n\n@RunWith(RobolectricTestRunner::class)\n@Config(constants = BuildConfig::class, sdk = intArrayOf(21))\npublic class RxPaletteTest {\n\n    var bitmap: Bitmap by Delegates.notNull<Bitmap>()\n\n    @Before fun setUp() {\n        val context: Context = Robolectric.buildActivity(Activity::class.java).create().get()\n        bitmap = BitmapFactory.decodeResource(context.resources, android.R.drawable.star_on)\n    }\n\n    @Test fun testBuilderGenerate() {\n        Palette.Builder(bitmap).asSingle()\n            .test()\n            .assertNoErrors()\n            .assertComplete()\n            .assertValueCount(1)\n    }\n\n    @Test fun testNullBuilderGenerate() {\n        val nullBuilder: Palette.Builder? = null\n        nullBuilder?.asSingle()?.test()?.assertNoErrors()?.assertNoValues()?.assertNotComplete()\n    }\n}\n"
  },
  {
    "path": "sample/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "sample/build.gradle",
    "content": "buildscript {\n    dependencies {\n        classpath rootProject.ext.androidPlugin\n        classpath rootProject.ext.kotlinPlugin\n    }\n}\n\napply plugin: 'com.android.application'\n\nandroid {\n    compileSdkVersion rootProject.ext.compileSdkVersion\n    buildToolsVersion rootProject.ext.buildToolsVersion\n\n    defaultConfig {\n        applicationId \"io.sweers.rxpalette.sample\"\n        minSdkVersion rootProject.ext.minSdkVersion\n        targetSdkVersion rootProject.ext.targetSdkVersion\n        versionCode 1\n        versionName \"1.0\"\n    }\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n\n    sourceSets {\n        main.java.srcDirs += 'src/main/kotlin'\n    }\n}\n\ndependencies {\n    compile rootProject.ext.supportAppCompat\n    compile rootProject.ext.supportPalette\n    compile rootProject.ext.supportRecyclerView\n    compile rootProject.ext.kotlinStdlib\n    compile rootProject.ext.rxJava\n    compile rootProject.ext.rxAndroid\n    compile rootProject.ext.retrofit\n    compile rootProject.ext.retrofitMoshi\n    compile rootProject.ext.retrofitRxJava\n    compile rootProject.ext.okhttp3\n    compile rootProject.ext.butterKnife\n    compile rootProject.ext.glide\n    compile rootProject.ext.glideOkhttp\n    compile project(':rxpalette')\n    compile project(':rxpalette-kotlin')\n}\n"
  },
  {
    "path": "sample/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /Users/pandanomic/dev/android/android-sdk/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n"
  },
  {
    "path": "sample/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest package=\"io.sweers.rxpalette.sample\"\n          xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <uses-permission android:name=\"android.permission.INTERNET\" />\n\n    <application\n            android:name=\".RxPaletteSampleApplication\"\n            android:allowBackup=\"true\"\n            android:icon=\"@mipmap/ic_launcher\"\n            android:label=\"@string/app_name\"\n            android:supportsRtl=\"true\"\n            android:theme=\"@style/AppTheme\">\n        <activity android:name=\".MainActivity\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\"/>\n\n                <category android:name=\"android.intent.category.LAUNCHER\"/>\n            </intent-filter>\n        </activity>\n\n        <meta-data\n            android:name=\"io.sweers.rxpalette.sample.GlideConfiguration\"\n            android:value=\"GlideModule\" />\n        <meta-data\n            android:name=\"com.bumptech.glide.integration.okhttp3.OkHttpGlideModule\"\n            android:value=\"GlideModule\" />\n    </application>\n\n</manifest>\n"
  },
  {
    "path": "sample/src/main/java/io/sweers/rxpalette/sample/GlideConfiguration.java",
    "content": "package io.sweers.rxpalette.sample;\n\nimport android.app.ActivityManager;\nimport android.content.Context;\nimport android.support.v4.app.ActivityManagerCompat;\n\nimport com.bumptech.glide.Glide;\nimport com.bumptech.glide.GlideBuilder;\nimport com.bumptech.glide.load.DecodeFormat;\nimport com.bumptech.glide.module.GlideModule;\n\n/**\n * Configure Glide to set desired image quality.\n */\npublic class GlideConfiguration implements GlideModule {\n\n    @Override\n    public void applyOptions(Context context, GlideBuilder builder) {\n        // Prefer RGB 535 on lower end devices\n        ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);\n        builder.setDecodeFormat(ActivityManagerCompat.isLowRamDevice(am)\n                ? DecodeFormat.PREFER_RGB_565\n                : DecodeFormat.PREFER_ARGB_8888);\n    }\n\n    @Override\n    public void registerComponents(Context context, Glide glide) {\n\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/io/sweers/rxpalette/sample/MainActivity.java",
    "content": "package io.sweers.rxpalette.sample;\n\nimport android.graphics.Bitmap;\nimport android.graphics.Color;\nimport android.os.Bundle;\nimport android.support.v7.app.AppCompatActivity;\nimport android.support.v7.graphics.Palette;\nimport android.support.v7.widget.LinearLayoutManager;\nimport android.support.v7.widget.RecyclerView;\nimport android.util.Log;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.ImageView;\nimport android.widget.ProgressBar;\nimport android.widget.TextView;\nimport android.widget.Toast;\n\nimport com.bumptech.glide.Glide;\nimport com.bumptech.glide.load.resource.bitmap.GlideBitmapDrawable;\nimport com.bumptech.glide.load.resource.drawable.GlideDrawable;\nimport com.bumptech.glide.request.RequestListener;\nimport com.bumptech.glide.request.target.Target;\n\nimport java.util.List;\n\nimport butterknife.Bind;\nimport butterknife.ButterKnife;\nimport io.reactivex.android.schedulers.AndroidSchedulers;\nimport io.reactivex.functions.Consumer;\nimport io.reactivex.observers.DisposableSingleObserver;\nimport io.reactivex.schedulers.Schedulers;\nimport io.sweers.rxpalette.RxPalette;\nimport io.sweers.rxpalette.sample.api.ImgurResponse;\nimport io.sweers.rxpalette.sample.api.model.Album;\nimport io.sweers.rxpalette.sample.api.model.Image;\n\npublic class MainActivity extends AppCompatActivity {\n\n    @Bind(R.id.recyclerview)\n    RecyclerView recyclerView;\n\n    @Bind(R.id.loading)\n    ProgressBar progressBar;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n        ButterKnife.bind(this);\n\n        LinearLayoutManager layoutManager = new LinearLayoutManager(this);\n        recyclerView.setLayoutManager(layoutManager);\n\n        RxPaletteSampleApplication.get()\n                .getImgurApi()\n                .getAlbum(\"jx90V\")\n                .subscribeOn(Schedulers.io())\n                .observeOn(AndroidSchedulers.mainThread())\n                .subscribe(new DisposableSingleObserver<ImgurResponse<Album>>() {\n                    @Override\n                    public void onSuccess(ImgurResponse<Album> albumImgurResponse) {\n                        Adapter adapter = new Adapter(albumImgurResponse.data.images);\n                        progressBar.setVisibility(View.GONE);\n                        recyclerView.setVisibility(View.VISIBLE);\n                        recyclerView.setAdapter(adapter);\n                    }\n\n                    @Override\n                    public void onError(Throwable e) {\n                        Toast.makeText(MainActivity.this, \"Error: \" + e, Toast.LENGTH_LONG).show();\n                        Log.e(\"ERROR\", \"OnError\", e);\n                    }\n                });\n    }\n\n    public static class Adapter extends RecyclerView.Adapter<ImageHolder> {\n\n        private final List<Image> images;\n\n        private Adapter(List<Image> images) {\n            this.images = images;\n        }\n\n\n        @Override\n        public ImageHolder onCreateViewHolder(ViewGroup parent, int viewType) {\n            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.image_item, parent, false);\n            return new ImageHolder(view);\n        }\n\n        @Override\n        public void onBindViewHolder(final ImageHolder holder, int position) {\n            Image image = images.get(position);\n            Glide.with(holder.imageView.getContext())\n                    .load(image.link)\n                    .crossFade()\n                    .centerCrop()\n                    .listener(new BitmapListener() {\n                        @Override\n                        public void onBitmapReady(Bitmap bitmap) {\n                            RxPalette.generate(bitmap)\n                                    .subscribeOn(Schedulers.computation())\n                                    .observeOn(AndroidSchedulers.mainThread())\n                                    .subscribe(new Consumer<Palette>() {\n                                        @Override\n                                        public void accept(Palette palette) {\n                                            Palette.Swatch swatch = palette.getVibrantSwatch() != null\n                                                    ? palette.getVibrantSwatch()\n                                                    : palette.getMutedSwatch();\n\n                                            holder.textView.setTextColor(swatch != null\n                                                    ? swatch.getTitleTextColor()\n                                                    : Color.BLACK);\n                                            holder.textView.setBackgroundColor(swatch != null\n                                                    ? swatch.getRgb()\n                                                    : Color.WHITE);\n                                        }\n                                    });\n                        }\n                    })\n                    .into(holder.imageView);\n        }\n\n        @Override\n        public int getItemCount() {\n            return images.size();\n        }\n    }\n\n    public static class ImageHolder extends RecyclerView.ViewHolder {\n\n        @Bind(R.id.image)\n        ImageView imageView;\n\n        @Bind(R.id.text)\n        TextView textView;\n\n        public ImageHolder(View itemView) {\n            super(itemView);\n            ButterKnife.bind(this, itemView);\n        }\n    }\n\n    /**\n     * RequestListener that forwards the bitmap onto a callback\n     */\n    private abstract static class BitmapListener implements RequestListener<String, GlideDrawable> {\n\n        @Override\n        public boolean onException(\n                Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {\n            return false;\n        }\n\n        @Override\n        public boolean onResourceReady(\n                GlideDrawable resource,\n                String model,\n                Target<GlideDrawable> target,\n                boolean isFromMemoryCache,\n                boolean isFirstResource) {\n            onBitmapReady(GlideBitmapDrawable.class.cast(resource).getBitmap());\n            return false;\n        }\n\n        public void onBitmapReady(Bitmap bitmap) {\n\n        }\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/io/sweers/rxpalette/sample/RxPaletteSampleApplication.java",
    "content": "package io.sweers.rxpalette.sample;\n\nimport android.app.Application;\n\nimport io.sweers.rxpalette.sample.api.ImgurApi;\n\npublic final class RxPaletteSampleApplication extends Application {\n\n    private static RxPaletteSampleApplication instance;\n\n    private ImgurApi imgurApi;\n\n    @Override\n    public void onCreate() {\n        super.onCreate();\n        instance = this;\n        imgurApi = new ImgurApi(\"4e2bb69101e4b13\");\n    }\n\n    public static RxPaletteSampleApplication get() {\n        return instance;\n    }\n\n    public ImgurApi getImgurApi() {\n        return imgurApi;\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/io/sweers/rxpalette/sample/api/ImgurApi.java",
    "content": "package io.sweers.rxpalette.sample.api;\n\nimport com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;\n\nimport java.io.IOException;\n\nimport io.reactivex.Single;\nimport io.sweers.rxpalette.sample.api.model.Album;\nimport io.sweers.rxpalette.sample.api.service.AlbumService;\nimport okhttp3.Interceptor;\nimport okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.Response;\nimport retrofit2.Retrofit;\nimport retrofit2.converter.moshi.MoshiConverterFactory;\n\n/**\n * The core class of the Imgur API.\n *\n * Note that Most of the Imgur API is adapted from https://github.com/Rabrg/imgur-api\n *\n * @author Ryan Greene\n */\npublic class ImgurApi {\n\n    private final AlbumService albumService;\n\n    /**\n     * Constructs a new ImgurApi with the specified clientId.\n     *\n     * @param clientId The client id.\n     */\n    public ImgurApi(final String clientId) {\n        OkHttpClient okHttpClient = new OkHttpClient.Builder()\n                .addInterceptor(new Interceptor() {\n                    @Override\n                    public Response intercept(Interceptor.Chain chain) throws IOException {\n                        Request request = chain.request();\n                        request = request.newBuilder().addHeader(\"Authorization\", \"Client-ID \" + clientId).build();\n                        return chain.proceed(request);\n                    }\n                })\n                .build();\n        albumService = new Retrofit.Builder()\n                .baseUrl(\"https://api.imgur.com/3/\")\n                .client(okHttpClient)\n                .addConverterFactory(MoshiConverterFactory.create())\n                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())\n                .build()\n                .create(AlbumService.class);\n    }\n\n    /**\n     * Get information about a specific album.\n     *\n     * @param id The id of the album.\n     * @return A response containing information about the album.\n     */\n    public Single<ImgurResponse<Album>> getAlbum(final String id) {\n        return albumService.getAlbum(id);\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/io/sweers/rxpalette/sample/api/ImgurResponse.java",
    "content": "package io.sweers.rxpalette.sample.api;\n\n\nimport io.sweers.rxpalette.sample.api.model.Model;\n\n/**\n * Represents a single response from a request.\n * @param <M> The data model returned with the response.\n * @author Ryan Greene\n */\npublic class ImgurResponse<M extends Model> {\n\n    /**\n     * The data model returned with the response.\n     */\n    public M data;\n\n    /**\n     * Whether or not the request was a success.\n     */\n    public boolean success;\n\n    /**\n     * The status code returned from the request.\n     */\n    public int status;\n}\n"
  },
  {
    "path": "sample/src/main/java/io/sweers/rxpalette/sample/api/model/Album.java",
    "content": "package io.sweers.rxpalette.sample.api.model;\n\nimport java.util.List;\n\npublic class Album extends Model {\n\n    public String id;\n    public String title;\n    public String description;\n    public long datetime;\n    public String cover;\n    public int cover_width;\n    public int cover_height;\n    public String account_url;\n    public int account_id;\n    public String privacy;\n    public String layout;\n    public int views;\n    public String link;\n    public boolean favorite;\n    public String section;\n    public int order;\n    public String deletehash;\n    public int images_count;\n    public List<Image> images;\n}\n"
  },
  {
    "path": "sample/src/main/java/io/sweers/rxpalette/sample/api/model/Image.java",
    "content": "package io.sweers.rxpalette.sample.api.model;\n\npublic class Image extends Model {\n\n    public String id;\n    public String title;\n    public String description;\n    public long datetime;\n    public String type;\n    public boolean animated;\n    public int width;\n    public int height;\n    public long size;\n    public int views;\n    public long bandwidth;\n    public String deletehash;\n    public String name;\n    public String section;\n    public String link;\n    public String gifv;\n    public String mp4;\n    public String webm;\n    public boolean looping;\n    public boolean favorite;\n    public String vote;\n    public String account_url;\n    public String account_id;\n}\n"
  },
  {
    "path": "sample/src/main/java/io/sweers/rxpalette/sample/api/model/Model.java",
    "content": "package io.sweers.rxpalette.sample.api.model;\n\npublic abstract class Model {\n}\n"
  },
  {
    "path": "sample/src/main/java/io/sweers/rxpalette/sample/api/service/AlbumService.java",
    "content": "package io.sweers.rxpalette.sample.api.service;\n\nimport io.reactivex.Single;\nimport io.sweers.rxpalette.sample.api.ImgurResponse;\nimport io.sweers.rxpalette.sample.api.model.Album;\nimport io.sweers.rxpalette.sample.api.model.Image;\nimport retrofit2.http.GET;\nimport retrofit2.http.Path;\n\n/**\n * An interface containing all album related services used by the Retrofit REST client.\n *\n * @author Ryan Greene\n */\npublic interface AlbumService {\n\n    @GET(\"album/{id}\")\n    Single<ImgurResponse<Album>> getAlbum(@Path(\"id\") String id);\n\n    @GET(\"album/{albumId}/{imageId}\")\n    Single<ImgurResponse<Image>> getAlbumImage(@Path(\"albumId\") String albumId, @Path(\"imageId\") String imageId);\n}\n"
  },
  {
    "path": "sample/src/main/res/layout/activity_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<FrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\"io.sweers.rxpalette.MainActivity\">\n\n    <android.support.v7.widget.RecyclerView\n            android:id=\"@+id/recyclerview\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:visibility=\"gone\"\n            />\n\n    <android.support.v4.widget.ContentLoadingProgressBar\n            android:id=\"@+id/loading\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:layout_gravity=\"center\"\n            android:indeterminate=\"true\"\n            style=\"@style/Widget.AppCompat.ProgressBar\"\n            />\n\n</FrameLayout>\n"
  },
  {
    "path": "sample/src/main/res/layout/image_item.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n        xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:orientation=\"vertical\"\n        android:padding=\"16dp\"\n        >\n\n    <ImageView\n            android:id=\"@+id/image\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"200dp\"\n            android:contentDescription=\"Image\"\n            />\n\n    <TextView\n            android:id=\"@+id/text\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:padding=\"16dp\"\n            android:text=\"@string/lorem\"\n            />\n\n</LinearLayout>\n"
  },
  {
    "path": "sample/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"colorPrimary\">#3F51B5</color>\n    <color name=\"colorPrimaryDark\">#303F9F</color>\n    <color name=\"colorAccent\">#FF4081</color>\n</resources>\n"
  },
  {
    "path": "sample/src/main/res/values/dimens.xml",
    "content": "<resources>\n    <!-- Default screen margins, per the Android Design guidelines. -->\n    <dimen name=\"activity_horizontal_margin\">16dp</dimen>\n    <dimen name=\"activity_vertical_margin\">16dp</dimen>\n</resources>\n"
  },
  {
    "path": "sample/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">RxPalette Sample</string>\n    <string name=\"lorem\">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut\n        labore et dolore magna aliqua.</string>\n</resources>\n"
  },
  {
    "path": "sample/src/main/res/values/styles.xml",
    "content": "<resources>\n\n    <!-- Base application theme. -->\n    <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar\">\n        <!-- Customize your theme here. -->\n        <item name=\"colorPrimary\">@color/colorPrimary</item>\n        <item name=\"colorPrimaryDark\">@color/colorPrimaryDark</item>\n        <item name=\"colorAccent\">@color/colorAccent</item>\n    </style>\n\n</resources>\n"
  },
  {
    "path": "sample/src/main/res/values-w820dp/dimens.xml",
    "content": "<resources>\n    <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as screen margins) for screens with more than 820dp of available width. This\n         would include 7\" and 10\" devices in landscape (~960dp and ~1280dp respectively). -->\n    <dimen name=\"activity_horizontal_margin\">64dp</dimen>\n</resources>\n"
  },
  {
    "path": "settings.gradle",
    "content": "rootProject.name = 'rxpalette-root'\ninclude ':rxpalette'\ninclude ':rxpalette-kotlin'\ninclude ':sample'\n"
  }
]