[
  {
    "path": ".circleci/config.yml",
    "content": "version: 2\njobs:\n  build:\n    docker:\n      - image: circleci/android:api-28\n\n    working_directory: ~/repo\n\n    environment:\n      JVM_OPTS: -Xmx3200m\n      TERM: dumb\n\n    steps:\n      - checkout\n\n      # Download and cache dependencies\n      - restore_cache:\n          keys:\n            - v1-dependencies-{{ checksum \"build.gradle\" }}\n            # fallback to using the latest cache if no exact match is found\n            - v1-dependencies-\n\n      - run: ./gradlew dependencies\n\n      - save_cache:\n          paths:\n            - ~/.gradle\n          key: v1-dependencies-{{ checksum \"build.gradle\" }}\n\n      # run tests!\n      - run: ./gradlew test"
  },
  {
    "path": ".gitignore",
    "content": "# built application files\n*.apk\n*.ap_\n\n# files for the dex VM\n*.dex\n\n# Java class files\n*.class\n\n# generated files\nbin/\ngen/\n\n\n# Local configuration file (sdk path, etc)\nlocal.properties\n/local.properties\n\n# Eclipse\n.classpath\n.project\n.settings\n\n# Android Studio (InteliJ)\n.idea/\n/.idea/workspace.xml\n*.iml\n*.iws\n*.ipr\n/*/out\n/*/build\n/*/*/production\n\n#Gradle\n.gradletasknamecache\n.gradle/\nbuild/\nbin/\n\n#Crashlytics\ncom_crashlytics_export_strings.xml\n\n#OSx\n.DS_Store\n\n#other\nNotes"
  },
  {
    "path": "LICENSE",
    "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": "NOTICE",
    "content": "Decor\nCopyright 2015 Apache License Version 2.0\n\nThis project includes Code from Pretty, written by Madis Pink,The code is licensed with MIT.\nThe original software is available from https://github.com/madisp/pretty\n"
  },
  {
    "path": "README.md",
    "content": "Decor\n======\n\n<a href='http://android-arsenal.com/details/1/1773'><img src='https://img.shields.io/badge/Android%20Arsenal-Decor-brightgreen.svg?style=flat'></a>\n\n*Decor* is a library that applies decorators to Android layout with additional attributes\nwithout the need to extend and create a custom View for each functionality.\n\nDecor plugs into Android's layout inflation and applies custom attributes to Views.\n\nIf you have written a custom View like AutofitTextViewWithFont : to make a TextView resize it's text and have a specific font\nand if you want to animate it you can write a custom View like AnimatedAutofitTextViewWithFont and if there's another runtime\ncustom attribute you want to add you will have to yet create another custom View.\n Decor comes to the rescue to solve this unnecessary class explosion by using a separate decorator for each functionality :\n    : AutoFitDecorator , FontDecorator, AnimateDecorator (See decorators module for examples of how to create a decorator)\n     and register them in attachBaseContext :\n     \n```java \n@Override\nprotected void attachBaseContext(Context newBase) {\n   super.attachBaseContext(DecorContextWrapper.wrap(newBase)\n           .with(Decorators.getAll()));\n}\n```\n```xml\n <TextView\n        xmlns:tools=\"http://schemas.android.com/tools\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"I'm a TextView\"\n        app:decorTypefaceAsset=\"Ubuntu-M.ttf\"\n        app:decorAutoFit=\"true\"\n        tools:ignore=\"MissingPrefix\"/>\n```\nor with an ImageView : \n<ImageView xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:id=\"@+id/search\"\n    android:layout_gravity=\"center\"\n    android:layout_width=\"150dp\"\n    android:layout_height=\"24dp\"\n    android:src=\"@drawable/search_vector_drawable\"\n    app:decorAnimateSearch=\"true\" />\n    \nThis has the advantage of reusing these decorators in other Views.\nThe module decorators contains some examples of useful decorators that you can start using now,\nor write your own by extending ``` AttrsDecorator<T>``` where T is the type of the View the decor will be applied on.\n\nIf you want to apply only a subset of decorators :\n\n```java\n@Override\nprotected void attachBaseContext(Context newBase) {\n    super.attachBaseContext(DecorContextWrapper.wrap(newBase)\n            .with(new FontDecorator());\n}\n```\n\nCheck the samples for a working example :\n\n![](images/decor_sample.png)\n\n\nAndroid Studio (lint) will likely mark this XML with a warning despite being correct. You may want to add tools:ignore=\"MissingPrefix\" to either the View itself or its parent ViewGroup to get rid of it. Also add tools namespace xmlns:tools=\"http://schemas.android.com/tools\" to have access to \"ignore\" attribute.\n\nBinaries\n========\n\nBinaries and dependency information for Maven, Ivy, Gradle and others can be found at [http://search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Ccom.mounacheikhna).\n\n<a href='http://search.maven.org/#search%7Cga%7C1%7Ccom.mounacheikhna.decor'><img src='http://img.shields.io/maven-central/v/com.mounacheikhna/decor.svg'></a>\n<a href='http://search.maven.org/#search%7Cga%7C1%7Ccom.mounacheikhna.decorators'><img src='http://img.shields.io/maven-central/v/com.mounacheikhna/decorators.svg'></a>\n\nfor Gradle:\n```groovy\ncompile 'com.mounacheikhna:decor:0.2.4'\ncompile 'com.mounacheikhna:decorators:0.2.4'\n```\n\nand for Maven:\n\n```xml\n<dependency>\n    <groupId>com.mounacheikhna</groupId>\n    <artifactId>decor</artifactId>\n    <version>0.2.4</version>\n</dependency>\n<dependency>\n    <groupId>com.mounacheikhna</groupId>\n    <artifactId>decorators</artifactId>\n    <version>0.2.4</version>\n</dependency>\n```\n\nand for Ivy:\n\n```xml\n<dependency org=\"com.mounacheikhna\" name=\"decor\" rev=\"0.2.4\" />\n<dependency org=\"com.mounacheikhna\" name=\"decorators\" rev=\"0.2.4\" />\n```\n\nWant to help?\n=============\n\nFile new issues to discuss specific aspects of the API or the implementation and to propose new\nfeatures or add new decorators.\n\n\nLicence\n=======\n    Copyright (c) 2013 Madis Pink\n    Copyright (c) 2015 Mouna Cheikhna\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\nExternal code\n=======\nThis project includes code from third parties:\n[pretty](https://github.com/madisp/pretty) by [Madis Pink](https://github.com/madisp). MIT licence.\n"
  },
  {
    "path": "bors.toml",
    "content": "status = [\n  \"ci/circleci: build\"\n]\nrequired_approvals = 0\ntimeout_sec = 14400\n"
  },
  {
    "path": "build.gradle",
    "content": "\nbuildscript {\n    repositories {\n        jcenter()\n        mavenCentral()\n        google()\n        maven {\n            url 'https://oss.sonatype.org/content/repositories/snapshots'\n        }\n    }\n    dependencies {\n        classpath 'com.android.tools.build:gradle:3.4.2'\n        //classpath \"com.jakewharton.sdkmanager:gradle-plugin:0.12.0\"\n    }\n}\n\nallprojects {\n    repositories {\n        mavenCentral()\n        google()\n    }\n    // Is Release Build?\n    /*ext.isReleaseVersion = has(\"release\")\n    ext.versionCodeInt = getProperty('VERSION_CODE').toInteger()\n    version = VERSION_NAME\n    project.group = GROUP*/\n\n}\n\n\n\n"
  },
  {
    "path": "decor/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "decor/build.gradle",
    "content": "//apply plugin: \"android-sdk-manager\"\napply plugin: 'com.android.library'\n\nandroid {\n\n    compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)\n    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION\n\n    defaultConfig {\n        minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)\n        targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)\n        versionName project.VERSION_NAME\n        versionCode Integer.parseInt(project.VERSION_CODE)\n        //testInstrumentationRunner \"android.support.test.runner.AndroidJUnitRunner\"\n        testInstrumentationRunner \"android.support.test.runner.AndroidJUnitRunner\"\n\n    }\n\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n\n    testOptions {\n        unitTests.returnDefaultValues = true\n    }\n\n    lintOptions {\n        abortOnError false\n    }\n\n}\n\nrepositories {\n    mavenCentral()\n    jcenter()\n}\n\ndependencies {\n    compile fileTree(dir: 'libs', include: ['*.jar'])\n    compile \"com.android.support:appcompat-v7:28.0.0\"\n\n    //androidTestCompile 'com.android.support.test:runner:0.2'\n    //androidTestCompile 'com.android.support.test:rules:0.2'\n\n    testCompile 'junit:junit:4.12'\n    testCompile \"org.mockito:mockito-core:3.0.0\"\n    testCompile 'org.easytesting:fest-assert-core:2.0M10'\n    testCompile 'org.robolectric:robolectric:3.0'\n    testCompile 'org.apache.maven:maven-ant-tasks:2.1.3'\n}\n\napply from: '../deploy.gradle'\n"
  },
  {
    "path": "decor/gradle.properties",
    "content": "# SubProject Library Gradle Properties\n# See parent properties for global properties\n\nPOM_NAME=Decor Main Library\nPOM_ARTIFACT_ID=decor\nPOM_PACKAGING=aar"
  },
  {
    "path": "decor/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/cheikhna/Library/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": "decor/src/androidTest/java/com/mounacheikhna/decor/ApplicationTest.java",
    "content": "package com.mounacheikhna.decor;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * <a href=\"http://d.android.com/tools/testing/testing_android.html\">Testing Fundamentals</a>\n */\npublic class ApplicationTest extends ApplicationTestCase<Application> {\n    public ApplicationTest() {\n        super(Application.class);\n    }\n}"
  },
  {
    "path": "decor/src/main/AndroidManifest.xml",
    "content": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.mounacheikhna.decor\">\n\n    <application android:allowBackup=\"true\"\n            android:label=\"@string/app_name\">\n\n    </application>\n\n</manifest>\n"
  },
  {
    "path": "decor/src/main/java/com/mounacheikhna/decor/AttrsDecorator.java",
    "content": "package com.mounacheikhna.decor;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport android.util.AttributeSet;\nimport android.util.TypedValue;\nimport android.view.View;\n\n/**\n * A base class for a decorator that transform certain View subtypes with certain attributes. Useful\n * when you want to extend standard layout inflation to add your own attributes to system widgets.\n * If a view with type {@code View&lt;? extends T&gt;} is inflated and it has one of the attributes\n * returned in {@link AttrsDecorator#styleable()} ()} method then {@link AttrsDecorator#apply(View, TypedArray)}\n * will be invoked for that view.\n * @param <T> The type or parent type of View that this decorator applies to.\n */\npublic abstract class AttrsDecorator<T extends View> implements Decorator {\n\n    TypedArray values;\n\n    @Override\n    public void apply(View view, View parent, String name, Context context, AttributeSet attributeSet) {\n        if (!clazz().isAssignableFrom(view.getClass())) {\n            return;\n        }\n\n        values = obtainAttributes(context, attributeSet);\n        if(values == null || values.length() == 0) return;\n\n        try {\n            for (int i = 0; i < values.length(); i++) {\n                TypedValue buf = new TypedValue();\n                if (values.hasValue(i) && values.getValue(i, buf)) {\n                    apply((T) view, values);\n                    break;\n                }\n            }\n        } finally {\n            values.recycle();\n        }\n    }\n\n    TypedArray obtainAttributes(Context context, AttributeSet attributeSet) {\n        //TODO: instead of always passing 0 here for defStyleAttr : make it accept theme setted attribute\n        return context.getTheme().obtainStyledAttributes(attributeSet, styleable(), defStyleAttr(), 0);\n    }\n\n    protected abstract int[] styleable();\n\n    protected int defStyleAttr() {\n        return 0;\n    }\n\n    /**\n     * The class for the given viewtype. Please be kind and just return the right class here :)\n     *\n     * @return The class/typetoken for T\n     */\n    protected abstract Class<T> clazz();\n\n    /**\n     * This method will be called if a View of type T was inflated and it had one of the attributes\n     * specified by {@link AttrsDecorator#styleable()} set.\n     * @param view  The view object that is being decorated.\n     * @param typedArray A {@link TypedArray} for attributes.\n     *\n     */\n    protected abstract void apply(T view, TypedArray typedArray);\n\n}\n\n"
  },
  {
    "path": "decor/src/main/java/com/mounacheikhna/decor/DecorActivityFactory.java",
    "content": "package com.mounacheikhna.decor;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.view.View;\n\n/**\n * Created by cheikhna on 07/04/2015.\n */\npublic interface DecorActivityFactory {\n\n    /**\n     * Used to Wrap the Activity onCreateView method.\n     *\n     * You implement this method like so in you base activity.\n     * <pre>\n     * {@code\n     * public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {\n     *   return DecorContextWrapper.get(getBaseContext()).onActivityCreateView(super.onCreateView(parent, name, context, attrs), attrs);\n     * }\n     * }\n     * </pre>\n     *\n     * @param parent  parent view, can be null.\n     * @param view    result of {@code super.onCreateView(parent, name, context, attrs)}, this might be null, which is fine.\n     * @param name    Name of View we are trying to inflate\n     * @param context current context (normally the Activity's)\n     * @param attrs   see {@link android.view.LayoutInflater.Factory2#onCreateView(android.view.View, String, android.content.Context, android.util.AttributeSet)}  @return the result from the activities {@code onCreateView()}\n     * @return The view passed in, or null if nothing was passed in.\n     * @see android.view.LayoutInflater.Factory2\n     */\n    View onActivityCreateView(View parent, View view, String name, Context context, AttributeSet attrs);\n}\n"
  },
  {
    "path": "decor/src/main/java/com/mounacheikhna/decor/DecorContextWrapper.java",
    "content": "package com.mounacheikhna.decor;\n\nimport android.content.Context;\nimport android.content.ContextWrapper;\nimport android.view.LayoutInflater;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\n/**\n * Created by cheikhna on 05/04/2015.\n */\npublic class DecorContextWrapper extends ContextWrapper  {\n\n    private DecorLayoutInflater mInflater;\n    private List<Decorator> mDecorators;\n\n    /**\n     * @param base ContextBase to Wrap.\n     */\n    public DecorContextWrapper(Context base) {\n        super(base);\n        mDecorators = new ArrayList<>();\n    }\n\n    /**\n     * wrap the context\n     * @param base ContextBase to Wrap.\n     * @return ContextWrapper to pass back to the activity.\n     */\n    public static DecorContextWrapper wrap(Context base) {\n        return new DecorContextWrapper(base);\n    }\n\n    public ContextWrapper with(Decorator... decorators) {\n        Collections.addAll(mDecorators, decorators);\n        return this;\n    }\n\n    @Override\n    public Object getSystemService(String name) {\n        if(LAYOUT_INFLATER_SERVICE.equals(name)) {\n            if(mInflater == null) {\n                mInflater = new DecorLayoutInflater(LayoutInflater.from(getBaseContext()), this, mDecorators, false);\n            }\n            return mInflater;\n        }\n        return super.getSystemService(name);\n    }\n\n}\n"
  },
  {
    "path": "decor/src/main/java/com/mounacheikhna/decor/DecorFactory.java",
    "content": "package com.mounacheikhna.decor;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.view.View;\n\nimport java.util.Collection;\n\n/**\n * Created by cheikhna on 05/04/2015.\n */\npublic class DecorFactory {\n\n    private final Collection<Decorator> decorators;\n\n    public DecorFactory(Collection<Decorator> decorators) {\n        this.decorators = decorators;\n    }\n\n    public View onViewCreated(View view,  String name,  View parent,  Context context, AttributeSet attrs) {\n        if (view == null) {\n            return null;\n        }\n        for (Decorator d : decorators) {\n            d.apply(view, parent, name, context, attrs);\n        }\n        return view;\n    }\n\n    public View onViewCreated(View view, Context context, AttributeSet attrs) {\n        //TODO: implement\n        return view;\n    }\n\n}\n"
  },
  {
    "path": "decor/src/main/java/com/mounacheikhna/decor/DecorLayoutInflater.java",
    "content": "package com.mounacheikhna.decor;\n\nimport android.annotation.TargetApi;\nimport android.content.Context;\nimport android.os.Build;\nimport android.util.AttributeSet;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.util.Collection;\n\n/**\n * Created by cheikhna on 05/04/2015.\n */\npublic class DecorLayoutInflater extends LayoutInflater implements DecorActivityFactory {\n\n    private static final String[] CLASS_PREFIX_LIST = {\n            \"android.widget.\",\n            \"android.webkit.\"\n    };\n\n    private final DecorFactory mDecorFactory;\n    private Collection<Decorator> mDecorators;\n    private boolean mSetPrivateFactory = false;\n    private Field mConstructorArgs = null;\n\n    protected DecorLayoutInflater(Context context, Collection<Decorator> decorators) {\n        super(context);\n        mDecorators = decorators;\n        mDecorFactory = new DecorFactory(mDecorators);\n        initLayoutFactories(false);\n    }\n\n    protected DecorLayoutInflater(LayoutInflater original, Context newContext, Collection<Decorator> decorators, final boolean isCloned) {\n        super(original, newContext);\n        mDecorators = decorators;\n        mDecorFactory = new DecorFactory(mDecorators);\n        initLayoutFactories(isCloned);\n    }\n\n    @Override\n    public LayoutInflater cloneInContext(Context newContext) {\n        return new DecorLayoutInflater(this, newContext, mDecorators, true);\n    }\n\n    private void initLayoutFactories(final boolean isCloned) {\n        if (isCloned) return;\n        // If we are HC+ we get and set Factory2 otherwise we just wrap Factory1\n        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {\n            if (getFactory2() != null && !(getFactory2() instanceof WrapperFactory2)) {\n                // Sets both Factory/Factory2\n                setFactory2(getFactory2());\n            }\n        }\n        // We can do this as setFactory2 is used for both methods.\n        if (getFactory() != null && !(getFactory() instanceof WrapperFactory)) {\n            setFactory(getFactory());\n        }\n    }\n\n    @Override\n    public View inflate(int resource, ViewGroup root, boolean attachToRoot) {\n        setPrivateFactoryInternal();\n        return super.inflate(resource, root, attachToRoot);\n    }\n\n    private void setPrivateFactoryInternal() {\n        // Already tried to set the factory.\n        if (mSetPrivateFactory) return;\n        //if (!hasReflection()) return;\n        // Skip if not attached to an activity.\n        if (!(getContext() instanceof Factory2)) {\n            mSetPrivateFactory = true;\n            return;\n        }\n\n        final Method setPrivateFactoryMethod = ReflectionUtils\n                .getMethod(LayoutInflater.class, \"setPrivateFactory\");\n\n        if (setPrivateFactoryMethod != null) {\n            ReflectionUtils.invokeMethod(this,\n                    setPrivateFactoryMethod,\n                    new PrivateWrapperFactory2((Factory2) getContext(), this, mDecorFactory));\n        }\n        mSetPrivateFactory = true;\n    }\n\n    @Override\n    public void setFactory(Factory factory) {\n        // Only set our factory and wrap calls to the Factory trying to be set!\n        if (!(factory instanceof WrapperFactory)) {\n            super.setFactory(new WrapperFactory(factory, this, mDecorFactory));\n        } else {\n            super.setFactory(factory);\n        }\n    }\n\n    @Override\n    @TargetApi(Build.VERSION_CODES.HONEYCOMB)\n    public void setFactory2(Factory2 factory2) {\n        // Only set our factory and wrap calls to the Factory2 trying to be set!\n        if (!(factory2 instanceof WrapperFactory2)) {\n            super.setFactory2(new WrapperFactory2(factory2, mDecorFactory));\n        } else {\n            super.setFactory2(factory2);\n        }\n    }\n\n    /**\n     * The LayoutInflater onCreateView is the fourth port of call for LayoutInflation.\n     * BUT only for none CustomViews.\n     */\n    \n    @Override\n    @TargetApi(Build.VERSION_CODES.HONEYCOMB)\n    protected View onCreateView(View parent, String name, AttributeSet attrs) throws ClassNotFoundException {\n        return mDecorFactory.onViewCreated(\n                super.onCreateView(parent, name, attrs), name, parent, getContext(), attrs);\n    }\n\n    /**\n     * The LayoutInflater onCreateView is the fourth port of call for LayoutInflation.\n     * BUT only for none CustomViews.\n     * Basically if this method doesn't inflate the View nothing probably will.\n     */\n    \n    @Override\n    protected View onCreateView(String name, AttributeSet attrs) throws ClassNotFoundException {\n        // This mimics the {@code PhoneLayoutInflater} in the way it tries to inflate the base\n        // classes, if this fails its pretty certain the app will fail at this point.\n        View view = null;\n        for (String prefix : CLASS_PREFIX_LIST) {\n            try {\n                view = createView(name, prefix, attrs);\n            } catch (ClassNotFoundException ignored) {\n            }\n        }\n        // In this case we want to let the base class take a crack\n        // at it.\n        if (view == null) view = super.onCreateView(name, attrs);\n\n        return mDecorFactory.onViewCreated(view, name, null, view.getContext(), attrs);\n    }\n\n    @Override\n    public View onActivityCreateView(View parent, View view, String name, Context context, AttributeSet attrs) {\n        return mDecorFactory.onViewCreated(createCustomViewInternal(parent, view, name, context, attrs), context, attrs);\n    }\n\n\n    /**\n     * Wrapped factories for Pre and Post HC\n     */\n\n    /**\n     * Factory 1 is the first port of call for LayoutInflation\n     */\n    private static class WrapperFactory implements Factory {\n\n        private final Factory mFactory;\n        private final DecorLayoutInflater mInflater;\n        private final DecorFactory mDecorFactory;\n\n        public WrapperFactory(Factory factory, DecorLayoutInflater inflater, DecorFactory decorFactory) {\n            this.mFactory = factory;\n            this.mInflater = inflater;\n            this.mDecorFactory = decorFactory;\n        }\n\n        @Override\n        public View onCreateView(String name, Context context, AttributeSet attrs) {\n            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {\n                return  mDecorFactory.onViewCreated(\n                            mInflater.createCustomViewInternal(\n                                null, mFactory.onCreateView(name, context, attrs), name, context, attrs\n                        ),\n                        context, attrs\n                );\n            }\n            return mDecorFactory.onViewCreated(\n                        mFactory.onCreateView(name, context, attrs),\n                        name, null, context, attrs\n            );\n        }\n    }\n\n\n    /**\n     * Factory 2 is the second port of call for LayoutInflation\n     */\n    @TargetApi(Build.VERSION_CODES.HONEYCOMB)\n    private static class WrapperFactory2 implements Factory2 {\n        protected final Factory2 mFactory2;\n        protected final DecorFactory mDecorFactory;\n\n        public WrapperFactory2(Factory2 mFactory2, DecorFactory mDecorFactory) {\n            this.mFactory2 = mFactory2;\n            this.mDecorFactory = mDecorFactory;\n        }\n\n        \n        @Override\n        public View onCreateView(String name, Context context, AttributeSet attrs) {\n            return mDecorFactory.onViewCreated(\n                    mFactory2.onCreateView(name, context, attrs),\n                    name, null, context, attrs);\n        }\n\n        \n        @Override\n        public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {\n            return mDecorFactory.onViewCreated(\n                    mFactory2.onCreateView(parent, name, context, attrs),\n                    name, parent, context, attrs);\n        }\n    }\n\n    /**\n     * Private factory is step three for Activity Inflation, this is what is attached to the\n     * Activity on HC+ devices.\n     */\n    @TargetApi(Build.VERSION_CODES.HONEYCOMB)\n    private static class PrivateWrapperFactory2 extends WrapperFactory2 {\n\n        private final DecorLayoutInflater mInflater;\n\n        public PrivateWrapperFactory2(Factory2 factory2, DecorLayoutInflater inflater, DecorFactory decorFactory) {\n            super(factory2, decorFactory);\n            mInflater = inflater;\n        }\n\n        @Override\n        public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {\n            return mDecorFactory.onViewCreated(\n                    mInflater.createCustomViewInternal(parent,\n                            mFactory2.onCreateView(parent, name, context, attrs),\n                            name, context, attrs\n                    ),\n                    name, parent, context, attrs\n            );\n        }\n    }\n\n\n    /**\n     * Nasty method to inflate custom layouts that haven't been handled else where. If this fails it\n     * will fall back through to the PhoneLayoutInflater method of inflating custom views where\n     * we will NOT have a hook into.\n     *\n     * @param parent      parent view\n     * @param view        view if it has been inflated by this point, if this is not null this method\n     *                    just returns this value.\n     * @param name        name of the thing to inflate.\n     * @param viewContext Context to inflate by if parent is null\n     * @param attrs       Attr for this view which we can steal fontPath from too.\n     * @return view or the View we inflate in here.\n     */\n    private View createCustomViewInternal(View parent, View view, String name, Context viewContext, AttributeSet attrs) {\n        // I by no means advise anyone to do this normally, but Google have locked down access to\n        // the createView() method, so we never get a callback with attributes at the end of the\n        // createViewFromTag chain (which would solve all this unnecessary rubbish).\n        // We at the very least try to optimise this as much as possible.\n        // We only call for customViews (As they are the ones that never go through onCreateView(...)).\n        // We also maintain the Field reference and make it accessible which will make a pretty\n        // significant difference to performance on Android 4.0+.\n\n        if (view == null && name.indexOf('.') > -1) {\n            if (mConstructorArgs == null)\n                mConstructorArgs = ReflectionUtils.getField(LayoutInflater.class, \"mConstructorArgs\");\n\n            final Object[] mConstructorArgsArr = (Object[]) ReflectionUtils.getValue(mConstructorArgs, this);\n            final Object lastContext = mConstructorArgsArr[0];\n            // The LayoutInflater actually finds out the correct context to use. We just need to set\n            // it on the mConstructor for the internal method.\n            // Set the constructor ars up for the createView, not sure why we can't pass these in.\n            mConstructorArgsArr[0] = viewContext;\n            ReflectionUtils.setValue(mConstructorArgs, this, mConstructorArgsArr);\n            try {\n                view = createView(name, null, attrs);\n            } catch (ClassNotFoundException ignored) {\n            } finally {\n                mConstructorArgsArr[0] = lastContext;\n                ReflectionUtils.setValue(mConstructorArgs, this, mConstructorArgsArr);\n            }\n        }\n        return view;\n    }\n\n}"
  },
  {
    "path": "decor/src/main/java/com/mounacheikhna/decor/Decorator.java",
    "content": "package com.mounacheikhna.decor;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.view.View;\n\n\n/**\n * A class that operates on already constructed views, i.e., decorates them.\n */\npublic interface Decorator {\n    /**\n     * Decorates the given view.\n     * This method will be called by Decor for every {@link View} created in the layout\n     * @param view The view to decorate. Never null.\n     * @param parent The parent view, if available. May be null.\n     * @param name The name of the tag in the layout file, e.g. {@code TextView}.\n     * @param context The context where the view was constructed in.\n     * @param attrs A read-only set of tag attributes.\n     */\n    public void apply( View view,  View parent,  String name,  Context context,  AttributeSet attrs);\n\n}\n"
  },
  {
    "path": "decor/src/main/java/com/mounacheikhna/decor/ReflectionUtils.java",
    "content": "package com.mounacheikhna.decor;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\n\n\nclass ReflectionUtils {\n\n    static Field getField(Class clazz, String fieldName) {\n        try {\n            final Field f = clazz.getDeclaredField(fieldName);\n            f.setAccessible(true);\n            return f;\n        } catch (NoSuchFieldException ignored) {\n        }\n        return null;\n    }\n\n    static Object getValue(Field field, Object obj) {\n        try {\n            return field.get(obj);\n        } catch (IllegalAccessException ignored) {\n        }\n        return null;\n    }\n\n    static void setValue(Field field, Object obj, Object value) {\n        try {\n            field.set(obj, value);\n        } catch (IllegalAccessException ignored) {\n        }\n    }\n\n    static Method getMethod(Class clazz, String methodName) {\n        final Method[] methods = clazz.getMethods();\n        for (Method method : methods) {\n            if (method.getName().equals(methodName)) {\n                method.setAccessible(true);\n                return method;\n            }\n        }\n        return null;\n    }\n\n    static void invokeMethod(Object object, Method method, Object... args) {\n        try {\n            if (method == null) return;\n            method.invoke(object, args);\n        } catch (IllegalAccessException ignored) {\n            ignored.printStackTrace();\n        } catch (InvocationTargetException ignored) {\n            ignored.printStackTrace();\n        }\n    }\n}\n"
  },
  {
    "path": "decor/src/main/res/layout/test_layout.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<TextView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    app:decorAttr=\"Test\"/>\n"
  },
  {
    "path": "decor/src/main/res/values/attrs.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <declare-styleable name=\"DecorExample\">\n        <attr name=\"decorAttr\" format=\"string\" />\n    </declare-styleable>\n</resources>\n"
  },
  {
    "path": "decor/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">Decor</string>\n</resources>\n"
  },
  {
    "path": "decor/src/test/java/com/mounacheikhna/decor/AttrsDecoratorTest.java",
    "content": "package com.mounacheikhna.decor;\n\nimport android.content.Context;\nimport android.content.res.Resources;\nimport android.content.res.TypedArray;\nimport android.util.AttributeSet;\nimport android.util.TypedValue;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.ImageView;\nimport android.widget.TextView;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.robolectric.RobolectricTestRunner;\nimport org.robolectric.RuntimeEnvironment;\nimport org.robolectric.annotation.Config;\n\nimport static org.fest.assertions.api.Assertions.assertThat;\nimport static org.mockito.Matchers.any;\nimport static org.mockito.Matchers.eq;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.mockito.MockitoAnnotations.initMocks;\n\n/**\n * Created by cheikhna on 30/04/15.\n */\n@RunWith(RobolectricTestRunner.class)\n@Config(manifest = Config.NONE)\npublic class AttrsDecoratorTest {\n\n    @Mock View view;\n    @Mock TextView textView;\n    @Mock ViewGroup parent;\n    @Mock AttributeSet attributeSet;\n    Context context;\n    TestAttrsDecorator attrsDecorator;\n\n    @Before\n    public void setUp() throws Exception {\n        initMocks(this);\n        context = RuntimeEnvironment.application;\n        attrsDecorator = spy(new TestAttrsDecorator()); //spying on this object under test is temporary TODO: don't use Spy\n    }\n\n    @Test\n    public void decorNotAppliedOnWidgetOfAnotherType() throws Exception {\n        String name = \"android.widget.ImageView\";\n        ImageView imageView = mock(ImageView.class);\n        attrsDecorator.apply(imageView, parent, name, context, attributeSet);\n        assertThat(attrsDecorator.values).isNull();\n    }\n\n    @Test\n    public void decorNotAppliedOnWidgetButWithoutAttr() throws Exception {\n        String name = \"android.widget.TextView\";\n        spyWithTypedArray(null);\n        attrsDecorator.apply(textView, parent, name, context, attributeSet);\n        assertThat(attrsDecorator.values).isNull();\n    }\n\n    @Test\n    public void decorNotAppliedOnWidgetWithAttrWithoutValue() throws Exception {\n        TypedArray typedArray = mockTypedArray(1, false);// we suppose we dont have custom attr here\n        spyWithTypedArray(typedArray);\n        String name = \"android.widget.TextView\";\n        attrsDecorator.apply(textView, parent, name, context, attributeSet);\n        assertThat(attrsDecorator.values).isNotNull();\n        verify(typedArray).recycle();\n        assertThat(attrsDecorator.getDecorStrValue()).isNull();\n    }\n\n    @Test\n    public void decorAppliedWithAttrValue() throws Exception {\n        TypedArray typedArray = mockTypedArray(1, true);\n        when(typedArray.getString(0)).thenReturn(\"test\");\n        spyWithTypedArray(typedArray);\n        String name = \"android.widget.TextView\";\n        attrsDecorator.apply(textView, parent, name, context, attributeSet);\n        assertThat(attrsDecorator.values).isNotNull();\n        assertThat(attrsDecorator.values.length()).isGreaterThan(0);\n        verify(typedArray).recycle();\n        assertThat(attrsDecorator.getDecorStrValue()).isEqualTo(\"test\");\n    }\n\n    private void spyWithTypedArray(TypedArray typedArray) {\n        doReturn(typedArray).when(attrsDecorator).obtainAttributes(context, attributeSet);\n    }\n\n    /*private void mockTheme(TypedArray typedArray) {\n        Resources.Theme theme = mock(Resources.Theme.class);\n        when(theme.obtainStyledAttributes(attributeSet, attrsDecorator.styleable(), 0, 0)).thenReturn(typedArray);\n        when(context.getTheme()).thenReturn(theme);\n    }*/\n\n    private TypedArray mockTypedArray(int length, boolean valueToReturn) {\n        TypedArray typedArray = mock(TypedArray.class);\n        when(typedArray.length()).thenReturn(length);\n        when(typedArray.hasValue(0)).thenReturn(valueToReturn);\n        when(typedArray.getValue(eq(0), any(TypedValue.class))).thenReturn(valueToReturn);\n        doNothing().when(typedArray).recycle();\n        return typedArray;\n    }\n\n}\n"
  },
  {
    "path": "decor/src/test/java/com/mounacheikhna/decor/DecorFactoryTest.java",
    "content": "package com.mounacheikhna.decor;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.view.View;\nimport android.view.ViewGroup;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.robolectric.RobolectricTestRunner;\nimport org.robolectric.annotation.Config;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\n\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.MockitoAnnotations.initMocks;\n\n/**\n * Created by cheikhna on 28/04/15.\n */\n@RunWith(RobolectricTestRunner.class)\n@Config(manifest = Config.NONE)\npublic class DecorFactoryTest {\n\n    @Mock Context context;\n    @Mock View view;\n    @Mock Decorator decorator;\n    @Mock ViewGroup parent;\n    @Mock AttributeSet attributeSet;\n\n    private DecorFactory decorFactory;\n\n    @Before\n    public void setUp() throws Exception {\n        initMocks(this);\n        Collection<Decorator> decorators = new ArrayList<>();\n        decorators.add(decorator);\n        decorFactory = new DecorFactory(decorators);\n    }\n\n    @Test\n    public void addDecoratorDoesApplyIt() throws Exception {\n        String name = \"android.view.View\";\n        decorFactory.onViewCreated(view, name, parent, context, attributeSet);\n        verify(decorator).apply(view, parent, name, context, attributeSet);\n    }\n\n    @Test\n    public void NoDecoratorAppliedToNullView() throws Exception {\n        String name = \"android.view.View\";\n        decorFactory.onViewCreated(null, name, parent, context, attributeSet);\n        verify(decorator, never()).apply(null, parent, name, context, attributeSet);\n    }\n\n}\n"
  },
  {
    "path": "decor/src/test/java/com/mounacheikhna/decor/TestAttrsDecorator.java",
    "content": "package com.mounacheikhna.decor;\n\nimport android.content.res.TypedArray;\nimport android.widget.TextView;\n\n/**\n * Created by cheikhna on 28/04/2015.\n */\npublic class TestAttrsDecorator extends AttrsDecorator<TextView> {\n\n    private String decorStrValue;\n\n    @Override\n    protected int[] styleable() {\n        return R.styleable.DecorExample;\n    }\n\n/*    @Override\n    protected int[] attrs() {\n        return new int[] {R.attr.decorAttr};\n    }*/\n\n    @Override\n    protected Class<TextView> clazz() {\n        return TextView.class;\n    }\n\n    @Override\n    protected void apply(TextView textView, TypedArray typedArray) {\n        decorStrValue = typedArray.getString(R.styleable.DecorExample_decorAttr);\n    }\n\n    public String getDecorStrValue() {\n        return decorStrValue;\n    }\n}\n"
  },
  {
    "path": "decorators/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "decorators/build.gradle",
    "content": "//apply plugin: \"android-sdk-manager\"\napply plugin: 'com.android.library'\n\nandroid {\n\n    compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)\n    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION\n\n    defaultConfig {\n        minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)\n        targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)\n        versionName project.VERSION_NAME\n        versionCode Integer.parseInt(project.VERSION_CODE)\n    }\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n\n    lintOptions {\n        abortOnError false\n    }\n\n}\n\n\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    compile fileTree(dir: 'libs', include: ['*.jar'])\n    compile project(':decor')\n    compile \"com.android.support:appcompat-v7:28.0.0\"\n    compile \"com.android.support:palette-v7:28.0.0\"\n    compile \"com.android.support:support-v4:28.0.0\"\n}\n\n\napply from: '../deploy.gradle'\n"
  },
  {
    "path": "decorators/gradle.properties",
    "content": "\nPOM_NAME=Decor's Decorators\nPOM_ARTIFACT_ID=decorators\nPOM_PACKAGING=aar\n"
  },
  {
    "path": "decorators/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/cheikhna/Library/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": "decorators/src/androidTest/java/com/mounacheikhna/decorators/ApplicationTest.java",
    "content": "package com.mounacheikhna.decorators;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * <a href=\"http://d.android.com/tools/testing/testing_android.html\">Testing Fundamentals</a>\n */\npublic class ApplicationTest extends ApplicationTestCase<Application> {\n    public ApplicationTest() {\n        super(Application.class);\n    }\n}"
  },
  {
    "path": "decorators/src/main/AndroidManifest.xml",
    "content": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.mounacheikhna.decorators\">\n\n    <application android:allowBackup=\"true\" android:label=\"@string/app_name\">\n\n    </application>\n\n</manifest>\n"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/AutofitDecorator.java",
    "content": "package com.mounacheikhna.decorators;\n\n/**\n * Created by cheikhna on 09/04/2015.\n */\n\nimport android.content.Context;\nimport android.content.res.Resources;\nimport android.content.res.TypedArray;\nimport android.text.Layout;\nimport android.text.StaticLayout;\nimport android.text.TextPaint;\nimport android.util.DisplayMetrics;\nimport android.util.Log;\nimport android.util.TypedValue;\nimport android.widget.TextView;\n\nimport com.mounacheikhna.decor.AttrsDecorator;\n\n/**\n * A decorator for a TextView to resize it's text to be no larger than the width of the view.\n * (An example of a complicated decorator )\n */\npublic class AutofitDecorator extends AttrsDecorator<TextView> {\n\n    private static final String TAG = \"AutofitDecorator\";\n    private static final boolean SPEW = false;\n\n    private TextView mTextView;\n\n    // Minimum size of the text in pixels\n    private static final int DEFAULT_MIN_TEXT_SIZE = 11; //sp\n\n    // How precise we want to be when reaching the target textWidth size\n    private static final float PRECISION = 0.5f;\n\n    // Attributes\n    private boolean mSizeToFit;\n    private int mMaxLines;\n    private float mMinTextSize;\n    private float mMaxTextSize;\n\n    private float mPrecision;\n\n    private TextPaint mPaint;\n\n\n    @Override\n    protected int[] styleable() {\n        return R.styleable.AutofitDecorator;\n    }\n\n    @Override\n    protected Class<TextView> clazz() {\n        return TextView.class;\n    }\n\n    @Override\n    protected void apply(TextView view, TypedArray typedArray) {\n        mTextView = view;\n        boolean isAutofit = typedArray.getBoolean(R.styleable.AutofitDecorator_decorAutofitText, false);\n        if(!isAutofit) return;\n\n        float scaledDensity = mTextView.getContext().getResources().getDisplayMetrics().scaledDensity;\n        boolean sizeToFit = true;\n        int minTextSize = (int) scaledDensity * DEFAULT_MIN_TEXT_SIZE;\n        float precision = PRECISION;\n\n        //TODO: deal with case when one of these values is absent\n\n        sizeToFit = typedArray.getBoolean(R.styleable.AutofitDecorator_decorSizeToFit, sizeToFit);\n\n        minTextSize = typedArray.getDimensionPixelSize(R.styleable.AutofitDecorator_decorMinTextSize, minTextSize);\n\n        precision = typedArray.getFloat(R.styleable.AutofitDecorator_decorPrecision, precision);\n\n        mPaint = new TextPaint();\n        setSizeToFit(sizeToFit);\n        setRawTextSize(mTextView.getTextSize());\n        setRawMinTextSize(minTextSize);\n        setPrecision(precision);\n    }\n\n    /**\n     * If true, the text will automatically be resized to fit its constraints; if false, it will act\n     * like a normal TextView.\n     */\n    public void setSizeToFit(boolean sizeToFit) {\n        mSizeToFit = sizeToFit;\n        refitText();\n    }\n\n    private void setRawTextSize(float size) {\n        if (size != mMaxTextSize) {\n            mMaxTextSize = size;\n            refitText();\n        }\n    }\n\n    private void setRawMinTextSize(float minSize) {\n        if (minSize != mMinTextSize) {\n            mMinTextSize = minSize;\n            refitText();\n        }\n    }\n\n    /**\n     * Set the amount of precision used to calculate the correct text size to fit within it's\n     * bounds. Lower precision is more precise and takes more time.\n     *\n     * @param precision The amount of precision.\n     */\n    public void setPrecision(float precision) {\n        if (precision != mPrecision) {\n            mPrecision = precision;\n            refitText();\n        }\n    }\n\n    /**\n     * @return the amount of precision used to calculate the correct text size to fit within it's\n     * bounds.\n     */\n    public float getPrecision() {\n        return mPrecision;\n    }\n\n\n    /**\n     * Re size the font so the specified text fits in the text box assuming the text box is the\n     * specified width.\n     */\n    private void refitText() {\n        if (!mSizeToFit) {\n            return;\n        }\n\n        if (mMaxLines <= 0) {\n            // Don't auto-size since there's no limit on lines.\n            return;\n        }\n\n        String text = mTextView.getText().toString();\n        int targetWidth = mTextView.getWidth() - mTextView.getPaddingLeft() - mTextView.getPaddingRight();\n        if (targetWidth > 0) {\n            Context context = mTextView.getContext();\n            Resources r = Resources.getSystem();\n            DisplayMetrics displayMetrics;\n\n            float size = mMaxTextSize;\n            float high = size;\n            float low = 0;\n\n            if (context != null) {\n                r = context.getResources();\n            }\n            displayMetrics = r.getDisplayMetrics();\n\n            mPaint.set(mTextView.getPaint());\n            mPaint.setTextSize(size);\n\n            if ((mMaxLines == 1 && mPaint.measureText(text) > targetWidth)\n                    || getLineCount(text, mPaint, size, targetWidth, displayMetrics) > mMaxLines) {\n                size = getTextSize(text, mPaint, targetWidth, mMaxLines, low, high, mPrecision,\n                        displayMetrics);\n            }\n\n            if (size < mMinTextSize) {\n                size = mMinTextSize;\n            }\n\n            mTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);\n        }\n    }\n\n    /**\n     * Recursive binary search to find the best size for the text\n     */\n    private static float getTextSize(String text, TextPaint paint,\n                                     float targetWidth, int maxLines,\n                                     float low, float high, float precision,\n                                     DisplayMetrics displayMetrics) {\n        float mid = (low + high) / 2.0f;\n        int lineCount = 1;\n        StaticLayout layout = null;\n\n        paint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, mid,\n                displayMetrics));\n\n        if (maxLines != 1) {\n            layout = new StaticLayout(text, paint, (int) targetWidth, Layout.Alignment.ALIGN_NORMAL,\n                    1.0f, 0.0f, true);\n            lineCount = layout.getLineCount();\n        }\n\n        if (SPEW) {\n            Log.d(TAG, \"low=\" + low + \" high=\" + high + \" mid=\" + mid +\n                    \" target=\" + targetWidth + \" maxLines=\" + maxLines + \" lineCount=\" + lineCount);\n        }\n\n        if (lineCount > maxLines) {\n            return getTextSize(text, paint, targetWidth, maxLines, low, mid, precision,\n                    displayMetrics);\n        } else if (lineCount < maxLines) {\n            return getTextSize(text, paint, targetWidth, maxLines, mid, high, precision,\n                    displayMetrics);\n        } else {\n            float maxLineWidth = 0;\n            if (maxLines == 1) {\n                maxLineWidth = paint.measureText(text);\n            } else {\n                for (int i = 0; i < lineCount; i++) {\n                    if (layout.getLineWidth(i) > maxLineWidth) {\n                        maxLineWidth = layout.getLineWidth(i);\n                    }\n                }\n            }\n\n            if ((high - low) < precision) {\n                return low;\n            } else if (maxLineWidth > targetWidth) {\n                return getTextSize(text, paint, targetWidth, maxLines, low, mid, precision,\n                        displayMetrics);\n            } else if (maxLineWidth < targetWidth) {\n                return getTextSize(text, paint, targetWidth, maxLines, mid, high, precision,\n                        displayMetrics);\n            } else {\n                return mid;\n            }\n        }\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    //@Override //since we cant have override with it here -> issue when frmwrk calls setTextSize on this afterwards\n                //probably it wont work (is there a way to have a delegate for mTextView to pass to this when setTextSize is called on it)\n    public void setTextSize(int unit, float size) {\n        if (!mSizeToFit) {\n            mTextView.setTextSize(unit, size);\n        }\n\n        Context context = mTextView.getContext();\n        Resources r = Resources.getSystem();\n\n        if (context != null) {\n            r = context.getResources();\n        }\n\n        setRawTextSize(TypedValue.applyDimension(unit, size, r.getDisplayMetrics()));\n    }\n\n    private static int getLineCount(String text, TextPaint paint, float size, float width,\n                                    DisplayMetrics displayMetrics) {\n        paint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, size,\n                displayMetrics));\n        StaticLayout layout = new StaticLayout(text, paint, (int) width,\n                Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, true);\n        return layout.getLineCount();\n    }\n\n}\n"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/BlurDecorator.java",
    "content": "package com.mounacheikhna.decorators;\n\nimport android.content.res.TypedArray;\nimport android.os.Build;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.FrameLayout;\nimport android.widget.ImageView;\n\nimport com.mounacheikhna.decor.AttrsDecorator;\nimport com.mounacheikhna.decorators.utils.BlurUtils;\n\n/**\n * Created by cheikhna on 03/04/2015.\n */\npublic class BlurDecorator extends AttrsDecorator<View> {\n\n    @Override\n    protected int[] styleable() {\n        return R.styleable.BlurDecorator;\n    }\n\n    @Override\n    protected Class<View> clazz() {\n        return View.class;\n    }\n\n    @Override\n    protected void apply(View view, TypedArray typedArray) {\n        boolean isBlur = typedArray.getBoolean(R.styleable.BlurDecorator_decorBlur, false);\n        if(!isBlur || Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) return;\n\n        //i'm guessing this part here doesn't work because i'm using the same blur as ngAndroid and they are\n        //doing their injection in a different point in the inflation\n        ViewGroup parent = (ViewGroup) view.getParent();\n        FrameLayout layout = new FrameLayout(view.getContext());\n        layout.setLayoutParams(view.getLayoutParams());\n        int index = parent.indexOfChild(view);\n        parent.removeViewAt(index);\n        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,\n                ViewGroup.LayoutParams.MATCH_PARENT);\n        view.setLayoutParams(layoutParams);\n        layout.addView(view);\n        parent.addView(layout, index);\n\n        final ImageView imageView = new ImageView(view.getContext());\n        imageView.setLayoutParams(layoutParams);\n        imageView.setVisibility(View.GONE);\n        layout.addView(imageView);\n\n        view.setVisibility(View.GONE);\n        view.setDrawingCacheEnabled(true);\n        imageView.setImageBitmap(BlurUtils.blurBitmap(view.getDrawingCache(), view.getContext()));\n        imageView.setVisibility(View.VISIBLE);\n    }\n\n}"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/ColorFilterDecorator.java",
    "content": "package com.mounacheikhna.decorators;\n\nimport android.content.res.TypedArray;\nimport android.widget.ImageView;\n\nimport com.mounacheikhna.decor.AttrsDecorator;\n\n\n/**\n * Created by cheikhna on 01/03/2015.\n */\npublic class ColorFilterDecorator extends AttrsDecorator<ImageView> {\n\n    @Override\n    protected int[] styleable() {\n        return R.styleable.ColorFilterDecorator;\n    }\n\n\n    @Override\n    protected Class<ImageView> clazz() {\n        return ImageView.class;\n    }\n\n    @Override\n    protected void apply(ImageView view, TypedArray typedArray) {\n        int color = typedArray.getColor(R.styleable.ColorFilterDecorator_decorColorFilter, 0);\n        if (color != 0) {\n            view.setColorFilter(color);\n        }\n    }\n\n}\n"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/Decorators.java",
    "content": "package com.mounacheikhna.decorators;\n\nimport com.mounacheikhna.decor.Decorator;\n\n/**\n * Created by cheikhna on 11/04/2015.\n */\n\n/**\n * A utility class to obtain all decorators defined in this library\n */\npublic final class Decorators {\n\n    /**\n     * Get all the decorators already defined\n     * @return available decorators\n     */\n    public static Decorator[] getAll() {\n        return new Decorator[] {\n            new AutofitDecorator(),\n            new BlurDecorator(),\n            new ColorFilterDecorator(),\n            new ErrorDecorator(),\n            new FontDecorator(),\n            new ReloadTextDecorator()\n        };\n    }\n\n}\n"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/ErrorDecorator.java",
    "content": "package com.mounacheikhna.decorators;\n\nimport android.content.res.TypedArray;\nimport android.graphics.drawable.Drawable;\nimport android.widget.EditText;\n\nimport com.mounacheikhna.decor.AttrsDecorator;\n\n/**\n * Created by cheikhna on 09/02/2015.\n */\npublic class ErrorDecorator extends AttrsDecorator<EditText> {\n\n    @Override\n    protected int[] styleable() {\n        return R.styleable.ErrorDecorator;\n    }\n\n    @Override\n    protected Class<EditText> clazz() {\n        return EditText.class;\n    }\n\n    @Override\n    protected void apply(EditText view, TypedArray typedArray) {\n        Drawable errorIcon = typedArray.getDrawable(R.styleable.ErrorDecorator_decorErrorIcon);\n        CharSequence errorText = typedArray.getString(R.styleable.ErrorDecorator_decorErrorText);\n        view.setError(errorText, errorIcon);\n    }\n\n}"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/FontDecorator.java",
    "content": "package com.mounacheikhna.decorators;\n\nimport android.content.res.TypedArray;\nimport android.graphics.Typeface;\nimport android.widget.TextView;\n\nimport com.mounacheikhna.decor.AttrsDecorator;\n\n\npublic class FontDecorator extends AttrsDecorator<TextView> {\n\n    @Override\n    protected int[] styleable() {\n        return R.styleable.FontDecorator;\n    }\n\n    @Override\n    protected Class<TextView> clazz() {\n        return TextView.class;\n    }\n\n   /* @Override\n    protected int defStyleAttr() {\n        return R.attr.decorTypefaceAsset;\n    }*/\n\n    @Override\n    protected void apply(TextView view, TypedArray typedArray) {\n        String typefacePath = typedArray.getString(R.styleable.FontDecorator_decorTypefaceAsset);\n        if(typefacePath == null) return;\n        view.setTypeface(Typeface.createFromAsset(\n                view.getResources().getAssets(), typefacePath));\n    }\n}"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/OnActionBaseDecorator.java",
    "content": "package com.mounacheikhna.decorators;\n\nimport android.app.Activity;\nimport android.view.View;\n\nimport com.mounacheikhna.decor.AttrsDecorator;\n\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\n\n\n/**\n * Created by cheikhna on 02/04/2015.\n */\npublic abstract class OnActionBaseDecorator extends AttrsDecorator<View> {\n\n    protected Activity mContainerActivity;\n\n    public OnActionBaseDecorator(Activity activity) {\n        mContainerActivity = activity;\n    }\n\n    @Override\n    protected Class<View> clazz() {\n        return View.class;\n    }\n\n    protected boolean onAction(String methodName) {\n        Method mHandler = null;\n        try {\n            if(mContainerActivity != null) {\n                mHandler = mContainerActivity.getClass().getMethod(methodName);\n            }\n        } catch (NoSuchMethodException e) {\n            e.printStackTrace();\n        }\n\n        if (mHandler == null) return false;\n        try {\n            mHandler.invoke(mContainerActivity);\n            return true;\n        } catch (IllegalAccessException e) {\n            e.printStackTrace();\n            throw new IllegalStateException(\"Could not execute non public method of the activity\", e);\n        } catch (InvocationTargetException e) {\n            e.printStackTrace();\n            throw new IllegalStateException(\"Could not execute method of the activity\", e);\n        }\n    }\n\n}\n"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/OnLongClickDecorator.java",
    "content": "package com.mounacheikhna.decorators;\n\nimport android.app.Activity;\nimport android.content.res.TypedArray;\nimport android.view.View;\nimport android.view.View.OnLongClickListener;\n\n/**\n * Created by cheikhna on 02/04/2015.\n */\npublic class OnLongClickDecorator extends OnActionBaseDecorator {\n\n    public OnLongClickDecorator(Activity activity) {\n        super(activity);\n    }\n\n    @Override\n    protected int[] styleable() {\n        return R.styleable.OnLongClickDecorator;\n    }\n\n    @Override\n    protected void apply(View view, final TypedArray typedArray) {\n        view.setOnLongClickListener(new OnLongClickListener() {\n            @Override\n            public boolean onLongClick(View v) {\n                onAction(typedArray.getString(R.styleable.OnLongClickDecorator_decorOnLongClick));\n                return true;\n            }\n        });\n    }\n\n}\n"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/OnTouchDecorator.java",
    "content": "package com.mounacheikhna.decorators;\n\nimport android.app.Activity;\nimport android.content.res.TypedArray;\nimport android.view.MotionEvent;\nimport android.view.View;\nimport android.view.View.OnTouchListener;\n\n/**\n * Created by cheikhna on 17/02/2015.\n */\npublic class OnTouchDecorator extends OnActionBaseDecorator {\n\n    public OnTouchDecorator(Activity activity) {\n        super(activity);\n    }\n\n\n    @Override\n    protected int[] styleable() {\n        return R.styleable.OnTouchDecorator;\n    }\n\n    @Override\n    protected void apply(View view, final TypedArray typedArray) {\n        view.setOnTouchListener(new OnTouchListener() {\n            @Override\n            public boolean onTouch(View v, MotionEvent event) {\n                return onAction(typedArray.getString(R.styleable.OnTouchDecorator_decorOnTouch));\n            }\n        });\n    }\n\n}\n"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/ReloadTextDecorator.java",
    "content": "package com.mounacheikhna.decorators;\n\nimport android.content.res.TypedArray;\nimport android.widget.TextView;\nimport com.mounacheikhna.decor.AttrsDecorator;\n\n/**\n * Created by m.cheikhna on 11/08/2016.\n */\npublic class ReloadTextDecorator extends AttrsDecorator<TextView> {\n\n    @Override\n    protected int[] styleable() {\n        return R.styleable.ReloadTextDecorator;\n    }\n\n    @Override\n    protected Class<TextView> clazz() {\n        return TextView.class;\n    }\n\n    @Override\n    protected void apply(TextView view, TypedArray typedArray) {\n        //TODO: the problem is to find a redo-able thing here\n        //maybe having just a callback -> then you cant trigger it\n        //i need a way to watch change to something and reload in that case\n\n        //or suppose we have every time our StringsTextView\n        //then in BaseActivity reload that goes through all strings and refreshes\n\n    }\n}\n"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/SearchAnimateDecorator.java",
    "content": "package com.mounacheikhna.decorators;\n\nimport android.annotation.TargetApi;\nimport android.content.res.TypedArray;\nimport android.graphics.drawable.AnimatedVectorDrawable;\nimport android.os.Build;\nimport android.view.View;\nimport android.view.animation.AnimationUtils;\nimport android.view.animation.Interpolator;\nimport android.widget.ImageView;\n\nimport com.mounacheikhna.decor.AttrsDecorator;\n\n/**\n * Created by mounacheikhna on 01/04/2015.\n */\n@TargetApi(Build.VERSION_CODES.LOLLIPOP)\npublic class SearchAnimateDecorator extends AttrsDecorator<ImageView> {\n\n    private boolean expanded = false;\n    private ImageView mIv;\n    private AnimatedVectorDrawable mSearchToBar;\n    private AnimatedVectorDrawable mBarToSearch;\n    private Interpolator mInterp;\n    private int mDuration;\n    private float mOffset;\n\n\n    @Override\n    protected int[] styleable() {\n        return R.styleable.SearchAnimateDecorator;\n    }\n\n    @Override\n    protected Class<ImageView> clazz() {\n        return ImageView.class;\n    }\n\n    @Override\n    protected void apply(ImageView view, TypedArray typedArray) {\n        boolean shouldAnimate = typedArray.getBoolean(R.styleable.SearchAnimateDecorator_decorAnimateSearch, false);\n        if(!shouldAnimate) return;\n\n        mIv = view;\n        mSearchToBar = (AnimatedVectorDrawable) view.getContext().getResources().getDrawable(R.drawable.anim_search_to_bar);\n        mBarToSearch = (AnimatedVectorDrawable) view.getContext().getResources().getDrawable(R.drawable.anim_bar_to_search);\n        mInterp = AnimationUtils.loadInterpolator(view.getContext(), android.R.interpolator.linear_out_slow_in);\n        mDuration = view.getContext().getResources().getInteger(R.integer.duration_bar);\n        // iv is sized to hold the search+bar so when only showing the search icon, translate the\n        // whole view left by half the difference to keep it centered\n        mOffset = -71f * (int) view.getContext().getResources().getDisplayMetrics().scaledDensity;\n        view.setTranslationX(mOffset);\n        view.setOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View v) {\n                animate(v);\n            }\n        });\n    }\n\n    //TODO: do a version of this for pre-lollipop or dont allow the use of it\n    @TargetApi(Build.VERSION_CODES.LOLLIPOP)\n    public void animate(View view) {\n        if (!expanded) {\n            mIv.setImageDrawable(mSearchToBar);\n            mSearchToBar.start();\n            mIv.animate().translationX(0f).setDuration(mDuration).setInterpolator(mInterp);\n            //text.animate().alpha(1f).setStartDelay(duration - 100).setDuration(100).setInterpolator(interp);\n        } else {\n            mIv.setImageDrawable(mBarToSearch);\n            mBarToSearch.start();\n            mIv.animate().translationX(mOffset).setDuration(mDuration).setInterpolator(mInterp);\n            //text.setAlpha(0f);\n        }\n        expanded = !expanded;\n    }\n\n}\n"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/ShimmerDecorator.java",
    "content": "package com.mounacheikhna.decorators;\n\nimport android.content.res.TypedArray;\nimport android.widget.TextView;\n\nimport com.mounacheikhna.decor.AttrsDecorator;\n\n/**\n * Created by cheikhna on 15/04/2015.\n */\npublic class ShimmerDecorator extends AttrsDecorator<TextView> {\n\n    @Override\n    protected int[] styleable() {\n        return R.styleable.SearchAnimateDecorator;\n    }\n\n    @Override\n    protected Class<TextView> clazz() {\n        return TextView.class;\n    }\n\n    @Override\n    protected void apply(TextView view, TypedArray typedArray) {\n        //TODO: implement\n    }\n}\n"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/utils/BlurUtils.java",
    "content": "package com.mounacheikhna.decorators.utils;\n\nimport android.annotation.TargetApi;\nimport android.content.Context;\nimport android.graphics.Bitmap;\nimport android.os.Build;\nimport android.renderscript.Allocation;\nimport android.renderscript.Element;\nimport android.renderscript.RenderScript;\nimport android.renderscript.ScriptIntrinsicBlur;\n\n/**\n * Created by cheikhna on 04/04/2015.\n */\npublic class BlurUtils {\n    private static final float SCALE_RATIO = 5f;\n    private static final float DEFAULT_BLUR_RADIUS = 5.f;\n\n    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)\n    public static Bitmap blurBitmap(Bitmap bitmap, Context context){\n        int width = bitmap.getWidth(), height = bitmap.getHeight();\n        Bitmap b = Bitmap.createScaledBitmap(Bitmap.createScaledBitmap(bitmap,(int)(width/SCALE_RATIO), (int)(height/SCALE_RATIO), false), width, height, false);\n        return blurBitmap(b, DEFAULT_BLUR_RADIUS, context);\n    }\n\n\n    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)\n    private static Bitmap blurBitmap(Bitmap src, float blurRadius, Context context) {\n        RenderScript rs = RenderScript.create(context);\n        Bitmap.Config conf = Bitmap.Config.ARGB_8888;\n        Bitmap blurredBitmap = Bitmap.createBitmap(src.getWidth(), src.getHeight(), conf);\n\n        final Allocation input = Allocation.createFromBitmap(rs, src, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);\n        final Allocation output = Allocation.createTyped(rs, input.getType());\n\n        final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));\n        script.setRadius(blurRadius);\n        script.setInput(input);\n        script.forEach(output);\n        output.copyTo(blurredBitmap);\n        return blurredBitmap;\n    }\n\n}\n"
  },
  {
    "path": "decorators/src/main/res/anim-v21/anim_bar_fill.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<objectAnimator\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:propertyName=\"trimPathStart\"\n    android:valueFrom=\"1\"\n    android:valueTo=\"0\"\n    android:valueType=\"floatType\"\n    android:duration=\"@integer/duration_bar\"\n    android:interpolator=\"@android:interpolator/linear_out_slow_in\" />"
  },
  {
    "path": "decorators/src/main/res/anim-v21/anim_search_empty.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<objectAnimator\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:propertyName=\"trimPathStart\"\n    android:valueFrom=\"0\"\n    android:valueTo=\"1\"\n    android:valueType=\"floatType\"\n    android:duration=\"@integer/duration_search\"\n    android:interpolator=\"@android:interpolator/fast_out_slow_in\" />"
  },
  {
    "path": "decorators/src/main/res/drawable-v21/anim_bar_to_search.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<animated-vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:drawable=\"@drawable/search_vector_drawable\" >\n    <target\n        android:name=\"search\"\n        android:animation=\"@anim/anim_bar_fill\"\n        />\n    <target\n        android:name=\"bar\"\n        android:animation=\"@anim/anim_search_empty\"\n        />\n</animated-vector>\n"
  },
  {
    "path": "decorators/src/main/res/drawable-v21/anim_search_to_bar.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<animated-vector\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:drawable=\"@drawable/search_vector_drawable\">\n\n    <target\n        android:name=\"search\"\n        android:animation=\"@anim/anim_search_empty\" />\n\n    <target\n        android:name=\"bar\"\n        android:animation=\"@anim/anim_bar_fill\" />\n\n</animated-vector>\n"
  },
  {
    "path": "decorators/src/main/res/drawable-v21/search_vector_drawable.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"150dp\"\n    android:height=\"24dp\"\n    android:viewportWidth=\"150\"\n    android:viewportHeight=\"24\">\n    <path\n        android:name=\"search\"\n        android:pathData=\"@string/path_search\"\n        android:strokeWidth=\"2\"\n        android:strokeColor=\"#ffffff\"\n        android:strokeAlpha=\"0.8\"\n        android:strokeLineCap=\"round\" />\n    <path\n        android:name=\"bar\"\n        android:pathData=\"M0,23 L149,23\"\n        android:strokeWidth=\"2\"\n        android:strokeColor=\"#ffffff\"\n        android:strokeAlpha=\"0.8\"\n        android:strokeLineCap=\"square\" />\n</vector>"
  },
  {
    "path": "decorators/src/main/res/values/attrs.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <!-- all attributes here prefixed with decor to avoid conflicts with other apps & lib attributes -->\n\n    <declare-styleable name=\"FontDecorator\">\n        <attr name=\"decorTypefaceAsset\" format=\"string\" />\n    </declare-styleable>\n\n    <declare-styleable name=\"ReloadTextDecorator\">\n        <attr name=\"decorReload\" format=\"boolean\" />\n    </declare-styleable>\n\n    <declare-styleable name=\"ErrorDecorator\">\n        <attr name=\"decorErrorText\" format=\"string\" />\n        <attr name=\"decorErrorIcon\" format=\"reference\" />\n    </declare-styleable>\n\n    <attr name=\"decorRound\" format=\"reference\" />\n    <attr name=\"decorCornerRadius\" format=\"dimension\" />\n\n    <declare-styleable name=\"OnTouchDecorator\">\n        <attr name=\"decorOnTouch\" format=\"string\"/>\n    </declare-styleable>\n\n    <declare-styleable name=\"ColorFilterDecorator\">\n        <attr name=\"decorColorFilter\" format=\"color\" />\n    </declare-styleable>\n\n    <attr name=\"decorCircular\" format=\"boolean\" />\n\n    <declare-styleable name=\"OnLongClickDecorator\">\n        <attr name=\"decorOnLongClick\" format=\"string\" />\n    </declare-styleable>\n\n    <declare-styleable name=\"LayoutManagerDecorator\">\n        <attr name=\"decorLayoutManager\" format=\"string\"/>\n        <attr name=\"decorLayoutManagerOrientation\" format=\"string\" />\n    </declare-styleable>\n\n    <declare-styleable name=\"BlurDecorator\">\n        <attr name=\"decorBlur\" format=\"boolean\" />\n    </declare-styleable>\n\n    <attr name=\"decorColorDescendents\" format=\"boolean|reference\" />\n\n    <declare-styleable name=\"SearchAnimateDecorator\">\n        <attr name=\"decorAnimateSearch\" format=\"boolean|reference\" />\n    </declare-styleable>\n\n    <attr name=\"decorOptimise\" format=\"boolean\" />\n\n    <declare-styleable name=\"ShimmerDecorator\">\n        <attr name=\"decorShimmer\" format=\"boolean\" />\n    </declare-styleable>\n\n    <declare-styleable name=\"AutofitDecorator\">\n        <attr name=\"decorAutofitText\" format=\"boolean|reference\" />\n        <attr name=\"decorSizeToFit\" format=\"float|reference\" />\n        <attr name=\"decorMinTextSize\" format=\"reference\" />\n        <attr name=\"decorPrecision\" format=\"float|reference\" />\n    </declare-styleable>\n\n</resources>"
  },
  {
    "path": "decorators/src/main/res/values/integers.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <integer name=\"duration_bar\">800</integer>\n    <integer name=\"duration_search\">800</integer>\n</resources>"
  },
  {
    "path": "decorators/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">Decorators</string>\n    <string name=\"path_search\">\"M141,17 A9,9 0 1,1 142,16 L149,23\"</string>\n</resources>\n"
  },
  {
    "path": "deploy.gradle",
    "content": "\napply plugin: 'maven'\napply plugin: 'signing'\n\n\ndef isReleaseBuild() {\n    return VERSION_NAME.contains(\"SNAPSHOT\") == false\n}\n\ndef getReleaseRepositoryUrl() {\n    return \"https://oss.sonatype.org/service/local/staging/deploy/maven2/\"\n}\n\ndef getSnapshotRepositoryUrl() {\n    return \"https://oss.sonatype.org/content/repositories/snapshots/\"\n}\n\ndef getRepositoryUsername() {\n    return hasProperty('sonatypeUsername') ? sonatypeUsername : \"\"\n}\n\ndef getRepositoryPassword() {\n    return hasProperty('sonatypePassword') ? sonatypePassword : \"\"\n}\n\nafterEvaluate { project ->\n    uploadArchives {\n        repositories {\n            mavenDeployer {\n                beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }\n\n                pom.groupId = GROUP\n                pom.version = VERSION_NAME\n                pom.artifactId = POM_ARTIFACT_ID\n\n                repository(url: getReleaseRepositoryUrl()) {\n                    authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())\n                }\n                snapshotRepository(url: getSnapshotRepositoryUrl()) {\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                            email POM_DEVELOPER_EMAIL\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        source = android.sourceSets.main.java.srcDirs\n        classpath += project.files(android.getBootClasspath().join(File.pathSeparator))\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.srcDirs\n    }\n\n    artifacts {\n        archives androidSourcesJar\n        archives androidJavadocsJar\n    }\n\n}"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "#Mon Jan 26 23:14:25 CET 2015\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-5.5.1-all.zip\n"
  },
  {
    "path": "gradle.properties",
    "content": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Settings specified in this file will override any Gradle settings\n# configured through the IDE.\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\n\nVERSION_NAME=0.2.4\nVERSION_CODE=5\nGROUP=com.mounacheikhna\n\nPOM_PACKAGING=aar\nPOM_URL=https://github.com/chemouna/Decor\nPOM_DESCRIPTION=Android layout decorator : Injecting custom attributes in layout files, Using decorators to get rid of unnecessary class explosion with custom views\nPOM_SCM_URL=https://github.com/chemouna/Decor\nPOM_SCM_CONNECTION=scm:git@github.com:chemouna/Decor.git\nPOM_SCM_DEV_CONNECTION=scm:git@github.com:chemouna/Decor.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=chemouna\nPOM_DEVELOPER_NAME=Mouna Cheikhna\nPOM_DEVELOPER_EMAIL=cheikhnamouna@gmail.com\n\nANDROID_BUILD_MIN_SDK_VERSION=14\nANDROID_BUILD_TARGET_SDK_VERSION=28\nANDROID_BUILD_SDK_VERSION=28\nANDROID_BUILD_TOOLS_VERSION=29.0.0\nANDROID_SUPPORT_VERSION=28.0.0\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# For Cygwin, ensure paths are in UNIX format before anything is touched.\nif $cygwin ; then\n    [ -n \"$JAVA_HOME\" ] && JAVA_HOME=`cygpath --unix \"$JAVA_HOME\"`\nfi\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\\\"`/\" >&-\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >&-\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\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\r\n@rem ##########################################################################\r\n@rem\r\n@rem  Gradle startup script for Windows\r\n@rem\r\n@rem ##########################################################################\r\n\r\n@rem Set local scope for the variables with windows NT shell\r\nif \"%OS%\"==\"Windows_NT\" setlocal\r\n\r\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r\nset DEFAULT_JVM_OPTS=\r\n\r\nset DIRNAME=%~dp0\r\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\r\nset APP_BASE_NAME=%~n0\r\nset APP_HOME=%DIRNAME%\r\n\r\n@rem Find java.exe\r\nif defined JAVA_HOME goto findJavaFromJavaHome\r\n\r\nset JAVA_EXE=java.exe\r\n%JAVA_EXE% -version >NUL 2>&1\r\nif \"%ERRORLEVEL%\" == \"0\" goto init\r\n\r\necho.\r\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:findJavaFromJavaHome\r\nset JAVA_HOME=%JAVA_HOME:\"=%\r\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\r\n\r\nif exist \"%JAVA_EXE%\" goto init\r\n\r\necho.\r\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:init\r\n@rem Get command-line arguments, handling Windowz variants\r\n\r\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\r\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\r\n\r\n:win9xME_args\r\n@rem Slurp the command line arguments.\r\nset CMD_LINE_ARGS=\r\nset _SKIP=2\r\n\r\n:win9xME_args_slurp\r\nif \"x%~1\" == \"x\" goto execute\r\n\r\nset CMD_LINE_ARGS=%*\r\ngoto execute\r\n\r\n:4NT_args\r\n@rem Get arguments from the 4NT Shell from JP Software\r\nset CMD_LINE_ARGS=%$\r\n\r\n:execute\r\n@rem Setup the command line\r\n\r\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\r\n\r\n@rem Execute Gradle\r\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%\r\n\r\n:end\r\n@rem End local scope for the variables with windows NT shell\r\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\r\n\r\n:fail\r\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r\nrem the _cmd.exe /c_ return code!\r\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\r\nexit /b 1\r\n\r\n:mainEnd\r\nif \"%OS%\"==\"Windows_NT\" endlocal\r\n\r\n:omega\r\n"
  },
  {
    "path": "samples/build.gradle",
    "content": "//apply plugin: \"android-sdk-manager\"\napply plugin: 'com.android.application'\n\nrepositories {\n    mavenCentral()\n}\n\n\nandroid {\n\n    compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)\n    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION\n\n    defaultConfig {\n        minSdkVersion 14\n        targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)\n    }\n\n    /*lintOptions {\n        disable 'MissingPrefix'\n    }*/\n}\n\ndependencies {\n\n    compile project(':decor')\n    compile project(':decorators')\n\n    /*compile 'com.mounacheikhna:decor:0.2.4'\n    compile 'com.mounacheikhna:decorators:0.2.4'*/\n\n    compile \"com.android.support:support-v4:+\"\n}\n"
  },
  {
    "path": "samples/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n          package=\"com.mounacheikhna.decor.samples\"\n          android:versionCode=\"1\"\n          android:versionName=\"1.0\" >\n    <application\n        android:icon=\"@drawable/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:theme=\"@style/AppTheme\">\n        <activity android:name=\"com.mounacheikhna.decor.samples.SampleActivity\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n        </activity>\n    </application>\n</manifest>\n"
  },
  {
    "path": "samples/src/main/assets/ubuntu-font-license-1.0.txt",
    "content": "Version 1.0\n\nPreamble\n\nThis licence allows the licensed fonts to be used, studied, modified and redistributed freely. The fonts, including any derivative works, can be bundled, embedded, and redistributed provided the terms of this licence are met. The fonts and derivatives, however, cannot be released under any other licence. The requirement for fonts to remain under this licence does not require any document created using the fonts or their derivatives to be published under this licence, as long as the primary purpose of the document is not to be a vehicle for the distribution of the fonts.\n\nDefinitions\n\n\"Font Software\" refers to the set of files released by the Copyright Holder(s) under this licence and clearly marked as such. This may include source files, build scripts and documentation.\n\n\"Original Version\" refers to the collection of Font Software components as received under this licence.\n\n\"Modified Version\" refers to any derivative made by adding to, deleting, or substituting — in part or in whole — any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.\n\n\"Copyright Holder(s)\" refers to all individuals and companies who have a copyright ownership of the Font Software.\n\n\"Substantially Changed\" refers to Modified Versions which can be easily identified as dissimilar to the Font Software by users of the Font Software comparing the Original Version with the Modified Version.\n\nTo \"Propagate\" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification and with or without charging a redistribution fee), making available to the public, and in some countries other activities as well.\n\nPermission & Conditions\n\nThis licence does not grant any rights under trademark law and all such rights are reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to propagate the Font Software, subject to the below conditions:\n\nEach copy of the Font Software must contain the above copyright notice and this licence. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.\nThe font name complies with the following:\nThe Original Version must retain its name, unmodified.\nModified Versions which are Substantially Changed must be renamed to avoid use of the name of the Original Version or similar names entirely.\nModified Versions which are not Substantially Changed must be renamed to both\nretain the name of the Original Version and\nadd additional naming elements to distinguish the Modified Version from the Original Version. The name of such Modified Versions must be the name of the Original Version, with \"derivative X\" where X represents the name of the new work, appended to that name.\nThe name(s) of the Copyright Holder(s) and any contributor to the Font Software shall not be used to promote, endorse or advertise any Modified Version, except\nas required by this licence,\nto acknowledge the contribution(s) of the Copyright Holder(s) or\nwith their explicit written permission.\nThe Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this licence, and must not be distributed under any other licence. The requirement for fonts to remain under this licence does not affect any document created using the Font Software, except any version of the Font Software extracted from a document created using the Font Software may only be distributed under this licence.\nTermination\n\nThis licence becomes null and void if any of the above conditions are not met.\n\nDisclaimer\n\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.\n\nUbuntu Font Licence Version 1.0 (plain text)\n"
  },
  {
    "path": "samples/src/main/java/com/mounacheikhna/decor/samples/CustomImageView.java",
    "content": "package com.mounacheikhna.decor.samples;\n\nimport android.annotation.TargetApi;\nimport android.content.Context;\nimport android.os.Build;\nimport android.util.AttributeSet;\nimport android.widget.ImageView;\n\n/**\n * Created by cheikhna on 12/04/2015.\n */\npublic class CustomImageView extends ImageView {\n\n    public CustomImageView(Context context) {\n        super(context);\n    }\n\n    public CustomImageView(Context context, AttributeSet attrs) {\n        super(context, attrs);\n    }\n\n    public CustomImageView(Context context, AttributeSet attrs, int defStyleAttr) {\n        super(context, attrs, defStyleAttr);\n    }\n\n    @TargetApi(Build.VERSION_CODES.LOLLIPOP)\n    public CustomImageView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {\n        super(context, attrs, defStyleAttr, defStyleRes);\n    }\n\n}\n"
  },
  {
    "path": "samples/src/main/java/com/mounacheikhna/decor/samples/CustomTextView.java",
    "content": "package com.mounacheikhna.decor.samples;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.widget.TextView;\n\npublic class CustomTextView extends TextView {\n\n    public CustomTextView(Context context) {\n        super(context);\n    }\n\n    public CustomTextView(Context context, AttributeSet attrs) {\n        super(context, attrs);\n    }\n\n    public CustomTextView(Context context, AttributeSet attrs, int defStyle) {\n        super(context, attrs, defStyle);\n    }\n\n}\n"
  },
  {
    "path": "samples/src/main/java/com/mounacheikhna/decor/samples/SampleActivity.java",
    "content": "package com.mounacheikhna.decor.samples;\n\nimport android.content.Context;\nimport android.os.Bundle;\nimport android.support.v4.app.FragmentActivity;\nimport android.widget.Toast;\n\nimport com.mounacheikhna.decor.DecorContextWrapper;\nimport com.mounacheikhna.decorators.Decorators;\n\npublic class SampleActivity extends FragmentActivity /*ActionBarActivity*/ /*Activity*/ {\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.main);\n    }\n\n    public void onIvTouch() {\n        Toast.makeText(this, \" Touch detected \", Toast.LENGTH_SHORT).show();\n    }\n\n    public void onRobotLongClick() {\n        Toast.makeText(this, \" Long click detected \", Toast.LENGTH_SHORT).show();\n    }\n\n    @Override\n    protected void attachBaseContext(Context newBase) {\n        super.attachBaseContext(DecorContextWrapper.wrap(newBase)\n                .with(Decorators.getAll()));\n    }\n\n}"
  },
  {
    "path": "samples/src/main/java/com/mounacheikhna/decor/samples/SampleApp.java",
    "content": "package com.mounacheikhna.decor.samples;\n\nimport android.app.Application;\nimport android.content.Context;\nimport com.mounacheikhna.decor.DecorContextWrapper;\nimport com.mounacheikhna.decorators.Decorators;\n\npublic class SampleApp extends Application {\n\n  @Override\n  protected void attachBaseContext(Context newBase) {\n    super.attachBaseContext(DecorContextWrapper.wrap(newBase)\n        .with(Decorators.getAll()));\n  }\n\n}\n"
  },
  {
    "path": "samples/src/main/java/com/mounacheikhna/decor/samples/SampleFragment.java",
    "content": "package com.mounacheikhna.decor.samples;\n\nimport android.os.Bundle;\nimport android.support.v4.app.Fragment;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.view.ViewStub;\n\npublic class SampleFragment extends Fragment /*android.app.Fragment*/ {\n\n    @Override\n    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n        View view = inflater.inflate(R.layout.main_frag, container, false);\n\n        ViewStub stubWithDecorAttr = (ViewStub) view.findViewById(R.id.stub_with_decor_attr);\n        stubWithDecorAttr.inflate();\n        return view;\n    }\n\n}\n    "
  },
  {
    "path": "samples/src/main/java/com/mounacheikhna/decor/samples/StringReloadableTextView.java",
    "content": "package com.mounacheikhna.decor.samples;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.widget.TextView;\n\n/**\n * Created by m.cheikhna on 11/08/2016.\n */\npublic class StringReloadableTextView extends TextView {\n\n    public StringReloadableTextView(Context context) {\n        super(context);\n    }\n\n    public StringReloadableTextView(Context context, AttributeSet attrs) {\n        super(context, attrs);\n    }\n\n    public StringReloadableTextView(Context context, AttributeSet attrs, int defStyleAttr) {\n        super(context, attrs, defStyleAttr);\n    }\n\n}\n"
  },
  {
    "path": "samples/src/main/res/layout/api_dependent_layout.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<merge />"
  },
  {
    "path": "samples/src/main/res/layout/main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<FrameLayout\n    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\n    <fragment\n        android:name=\"com.mounacheikhna.decor.samples.SampleFragment\"\n        android:id=\"@+id/sample_frg\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        tools:layout=\"@layout/main_frag\"/>\n\n</FrameLayout>\n"
  },
  {
    "path": "samples/src/main/res/layout/main_frag.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:padding=\"12dp\"\n    app:decorColorDescendents=\"true\"\n    tools:ignore=\"MissingPrefix\">\n\n    <include layout=\"@layout/api_dependent_layout\" />\n\n    <TextView\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"Hi, I'm a TextView\"\n        android:layout_marginBottom=\"8dp\" />\n\n    <EditText\n        android:id=\"@+id/edittext\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"@string/textview_example\"\n        style=\"@style/decoratedEditText\"/>\n\n    <Button\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"And I'm a Button\"\n        app:decorTypefaceAsset=\"Ubuntu-M.ttf\" />\n\n    <ImageView\n        android:id=\"@+id/iv\"\n        android:layout_width=\"200dp\"\n        android:layout_height=\"140dp\"\n        android:src=\"@drawable/tb3\"\n        app:decorOnTouch=\"onIvTouch\"\n        app:decorCircular=\"true\"\n        tools:background=\"@android:color/holo_green_dark\"/>\n\n    <ImageView\n        android:id=\"@+id/colorRobot\"\n        android:layout_width=\"90dp\"\n        android:layout_height=\"90dp\"\n        android:src=\"@drawable/ic_launcher\"\n        app:decorColorFilter=\"@color/material_blue_grey_800\"\n        app:decorOnLongClick=\"onRobotLongClick\"/>\n\n    <!--<TextView\n        android:id=\"@+id/tv_with_theme_attr\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"I'm a textview with a decor attribute set in theme attr\"/>-->\n\n    <com.mounacheikhna.decor.samples.CustomImageView\n        android:id=\"@+id/customIv\"\n        android:layout_width=\"90dp\"\n        android:layout_height=\"90dp\"\n        android:src=\"@drawable/ic_launcher\"\n        app:decorColorFilter=\"@color/material_blue_grey_800\"/>\n\n    <ViewStub\n        android:id=\"@+id/stub_with_decor_attr\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout=\"@layout/stub_with_custom_attributes\"/>\n\n</LinearLayout>"
  },
  {
    "path": "samples/src/main/res/layout/stub_with_custom_attributes.xml",
    "content": "<TextView\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    android:text=\"@string/text_with_custom_attr\"\n    app:decorTypefaceAsset=\"Ubuntu-M.ttf\"\n    tools:ignore=\"MissingPrefix\"/>\n"
  },
  {
    "path": "samples/src/main/res/layout-v21/api_dependent_layout.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ImageView xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:id=\"@+id/search\"\n    android:layout_gravity=\"center\"\n    android:layout_width=\"150dp\"\n    android:layout_height=\"24dp\"\n    android:src=\"@drawable/search_vector_drawable\"\n    app:decorAnimateSearch=\"true\"\n    tools:showIn=\"@layout/main_frag\" />"
  },
  {
    "path": "samples/src/main/res/values/attrs.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n</resources>\n"
  },
  {
    "path": "samples/src/main/res/values/strings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <string name=\"app_label\">Pretty samples</string>\n    <string name=\"textview_example\">Hi, I\\'m a TextView with a different font</string>\n    <string name=\"text_without_decor_attr\">Test stub without decor attribute</string>\n    <string name=\"text_with_custom_attr\">Text with decor attribute</string>\n</resources>"
  },
  {
    "path": "samples/src/main/res/values/styles.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <style name=\"AppTheme\" parent=\"android:style/Theme.Holo.Light\">\n        <!--<item name=\"decorTypefaceAsset\">\"Ubuntu-M.ttf\"</item>-->\n    </style>\n\n    <style name=\"decoratedEditText\">\n        <item name=\"decorErrorIcon\">@drawable/ic_error_et</item>\n        <item name=\"decorErrorText\">\"Error\"</item>\n        <item name=\"decorTypefaceAsset\">\"Ubuntu-M.ttf\"</item>\n    </style>\n\n</resources>"
  },
  {
    "path": "settings.gradle",
    "content": "include ':decor' , ':decorators', ':samples'\n"
  }
]