Full Code of chemouna/Decor for AI

master 76873832c70a cached
77 files
103.3 KB
26.4k tokens
151 symbols
1 requests
Download .txt
Repository: chemouna/Decor
Branch: master
Commit: 76873832c70a
Files: 77
Total size: 103.3 KB

Directory structure:
gitextract_girl4kdg/

├── .circleci/
│   └── config.yml
├── .gitignore
├── LICENSE
├── NOTICE
├── README.md
├── bors.toml
├── build.gradle
├── decor/
│   ├── .gitignore
│   ├── build.gradle
│   ├── gradle.properties
│   ├── proguard-rules.pro
│   └── src/
│       ├── androidTest/
│       │   └── java/
│       │       └── com/
│       │           └── mounacheikhna/
│       │               └── decor/
│       │                   └── ApplicationTest.java
│       ├── main/
│       │   ├── AndroidManifest.xml
│       │   ├── java/
│       │   │   └── com/
│       │   │       └── mounacheikhna/
│       │   │           └── decor/
│       │   │               ├── AttrsDecorator.java
│       │   │               ├── DecorActivityFactory.java
│       │   │               ├── DecorContextWrapper.java
│       │   │               ├── DecorFactory.java
│       │   │               ├── DecorLayoutInflater.java
│       │   │               ├── Decorator.java
│       │   │               └── ReflectionUtils.java
│       │   └── res/
│       │       ├── layout/
│       │       │   └── test_layout.xml
│       │       └── values/
│       │           ├── attrs.xml
│       │           └── strings.xml
│       └── test/
│           └── java/
│               └── com/
│                   └── mounacheikhna/
│                       └── decor/
│                           ├── AttrsDecoratorTest.java
│                           ├── DecorFactoryTest.java
│                           └── TestAttrsDecorator.java
├── decorators/
│   ├── .gitignore
│   ├── build.gradle
│   ├── gradle.properties
│   ├── proguard-rules.pro
│   └── src/
│       ├── androidTest/
│       │   └── java/
│       │       └── com/
│       │           └── mounacheikhna/
│       │               └── decorators/
│       │                   └── ApplicationTest.java
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           │   └── com/
│           │       └── mounacheikhna/
│           │           └── decorators/
│           │               ├── AutofitDecorator.java
│           │               ├── BlurDecorator.java
│           │               ├── ColorFilterDecorator.java
│           │               ├── Decorators.java
│           │               ├── ErrorDecorator.java
│           │               ├── FontDecorator.java
│           │               ├── OnActionBaseDecorator.java
│           │               ├── OnLongClickDecorator.java
│           │               ├── OnTouchDecorator.java
│           │               ├── ReloadTextDecorator.java
│           │               ├── SearchAnimateDecorator.java
│           │               ├── ShimmerDecorator.java
│           │               └── utils/
│           │                   └── BlurUtils.java
│           └── res/
│               ├── anim-v21/
│               │   ├── anim_bar_fill.xml
│               │   └── anim_search_empty.xml
│               ├── drawable-v21/
│               │   ├── anim_bar_to_search.xml
│               │   ├── anim_search_to_bar.xml
│               │   └── search_vector_drawable.xml
│               └── values/
│                   ├── attrs.xml
│                   ├── integers.xml
│                   └── strings.xml
├── deploy.gradle
├── gradle/
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── samples/
│   ├── build.gradle
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── assets/
│           │   └── ubuntu-font-license-1.0.txt
│           ├── java/
│           │   └── com/
│           │       └── mounacheikhna/
│           │           └── decor/
│           │               └── samples/
│           │                   ├── CustomImageView.java
│           │                   ├── CustomTextView.java
│           │                   ├── SampleActivity.java
│           │                   ├── SampleApp.java
│           │                   ├── SampleFragment.java
│           │                   └── StringReloadableTextView.java
│           └── res/
│               ├── layout/
│               │   ├── api_dependent_layout.xml
│               │   ├── main.xml
│               │   ├── main_frag.xml
│               │   └── stub_with_custom_attributes.xml
│               ├── layout-v21/
│               │   └── api_dependent_layout.xml
│               └── values/
│                   ├── attrs.xml
│                   ├── strings.xml
│                   └── styles.xml
└── settings.gradle

================================================
FILE CONTENTS
================================================

================================================
FILE: .circleci/config.yml
================================================
version: 2
jobs:
  build:
    docker:
      - image: circleci/android:api-28

    working_directory: ~/repo

    environment:
      JVM_OPTS: -Xmx3200m
      TERM: dumb

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "build.gradle" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-

      - run: ./gradlew dependencies

      - save_cache:
          paths:
            - ~/.gradle
          key: v1-dependencies-{{ checksum "build.gradle" }}

      # run tests!
      - run: ./gradlew test

================================================
FILE: .gitignore
================================================
# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/


# Local configuration file (sdk path, etc)
local.properties
/local.properties

# Eclipse
.classpath
.project
.settings

# Android Studio (InteliJ)
.idea/
/.idea/workspace.xml
*.iml
*.iws
*.ipr
/*/out
/*/build
/*/*/production

#Gradle
.gradletasknamecache
.gradle/
build/
bin/

#Crashlytics
com_crashlytics_export_strings.xml

#OSx
.DS_Store

#other
Notes

================================================
FILE: LICENSE
================================================

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


================================================
FILE: NOTICE
================================================
Decor
Copyright 2015 Apache License Version 2.0

This project includes Code from Pretty, written by Madis Pink,The code is licensed with MIT.
The original software is available from https://github.com/madisp/pretty


================================================
FILE: README.md
================================================
Decor
======

<a href='http://android-arsenal.com/details/1/1773'><img src='https://img.shields.io/badge/Android%20Arsenal-Decor-brightgreen.svg?style=flat'></a>

*Decor* is a library that applies decorators to Android layout with additional attributes
without the need to extend and create a custom View for each functionality.

Decor plugs into Android's layout inflation and applies custom attributes to Views.

If you have written a custom View like AutofitTextViewWithFont : to make a TextView resize it's text and have a specific font
and if you want to animate it you can write a custom View like AnimatedAutofitTextViewWithFont and if there's another runtime
custom attribute you want to add you will have to yet create another custom View.
 Decor comes to the rescue to solve this unnecessary class explosion by using a separate decorator for each functionality :
    : AutoFitDecorator , FontDecorator, AnimateDecorator (See decorators module for examples of how to create a decorator)
     and register them in attachBaseContext :
     
```java 
@Override
protected void attachBaseContext(Context newBase) {
   super.attachBaseContext(DecorContextWrapper.wrap(newBase)
           .with(Decorators.getAll()));
}
```
```xml
 <TextView
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="I'm a TextView"
        app:decorTypefaceAsset="Ubuntu-M.ttf"
        app:decorAutoFit="true"
        tools:ignore="MissingPrefix"/>
```
or with an ImageView : 
<ImageView xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/search"
    android:layout_gravity="center"
    android:layout_width="150dp"
    android:layout_height="24dp"
    android:src="@drawable/search_vector_drawable"
    app:decorAnimateSearch="true" />
    
This has the advantage of reusing these decorators in other Views.
The module decorators contains some examples of useful decorators that you can start using now,
or write your own by extending ``` AttrsDecorator<T>``` where T is the type of the View the decor will be applied on.

If you want to apply only a subset of decorators :

```java
@Override
protected void attachBaseContext(Context newBase) {
    super.attachBaseContext(DecorContextWrapper.wrap(newBase)
            .with(new FontDecorator());
}
```

Check the samples for a working example :

![](images/decor_sample.png)


Android 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.

Binaries
========

Binaries 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).

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

for Gradle:
```groovy
compile 'com.mounacheikhna:decor:0.2.4'
compile 'com.mounacheikhna:decorators:0.2.4'
```

and for Maven:

```xml
<dependency>
    <groupId>com.mounacheikhna</groupId>
    <artifactId>decor</artifactId>
    <version>0.2.4</version>
</dependency>
<dependency>
    <groupId>com.mounacheikhna</groupId>
    <artifactId>decorators</artifactId>
    <version>0.2.4</version>
</dependency>
```

and for Ivy:

```xml
<dependency org="com.mounacheikhna" name="decor" rev="0.2.4" />
<dependency org="com.mounacheikhna" name="decorators" rev="0.2.4" />
```

Want to help?
=============

File new issues to discuss specific aspects of the API or the implementation and to propose new
features or add new decorators.


Licence
=======
    Copyright (c) 2013 Madis Pink
    Copyright (c) 2015 Mouna Cheikhna

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

External code
=======
This project includes code from third parties:
[pretty](https://github.com/madisp/pretty) by [Madis Pink](https://github.com/madisp). MIT licence.


================================================
FILE: bors.toml
================================================
status = [
  "ci/circleci: build"
]
required_approvals = 0
timeout_sec = 14400


================================================
FILE: build.gradle
================================================

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        google()
        maven {
            url 'https://oss.sonatype.org/content/repositories/snapshots'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        //classpath "com.jakewharton.sdkmanager:gradle-plugin:0.12.0"
    }
}

allprojects {
    repositories {
        mavenCentral()
        google()
    }
    // Is Release Build?
    /*ext.isReleaseVersion = has("release")
    ext.versionCodeInt = getProperty('VERSION_CODE').toInteger()
    version = VERSION_NAME
    project.group = GROUP*/

}





================================================
FILE: decor/.gitignore
================================================
/build


================================================
FILE: decor/build.gradle
================================================
//apply plugin: "android-sdk-manager"
apply plugin: 'com.android.library'

android {

    compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
        targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
        versionName project.VERSION_NAME
        versionCode Integer.parseInt(project.VERSION_CODE)
        //testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    testOptions {
        unitTests.returnDefaultValues = true
    }

    lintOptions {
        abortOnError false
    }

}

repositories {
    mavenCentral()
    jcenter()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile "com.android.support:appcompat-v7:28.0.0"

    //androidTestCompile 'com.android.support.test:runner:0.2'
    //androidTestCompile 'com.android.support.test:rules:0.2'

    testCompile 'junit:junit:4.12'
    testCompile "org.mockito:mockito-core:3.0.0"
    testCompile 'org.easytesting:fest-assert-core:2.0M10'
    testCompile 'org.robolectric:robolectric:3.0'
    testCompile 'org.apache.maven:maven-ant-tasks:2.1.3'
}

apply from: '../deploy.gradle'


================================================
FILE: decor/gradle.properties
================================================
# SubProject Library Gradle Properties
# See parent properties for global properties

POM_NAME=Decor Main Library
POM_ARTIFACT_ID=decor
POM_PACKAGING=aar

================================================
FILE: decor/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/cheikhna/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}


================================================
FILE: decor/src/androidTest/java/com/mounacheikhna/decor/ApplicationTest.java
================================================
package com.mounacheikhna.decor;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
 * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
 */
public class ApplicationTest extends ApplicationTestCase<Application> {
    public ApplicationTest() {
        super(Application.class);
    }
}

================================================
FILE: decor/src/main/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mounacheikhna.decor">

    <application android:allowBackup="true"
            android:label="@string/app_name">

    </application>

</manifest>


================================================
FILE: decor/src/main/java/com/mounacheikhna/decor/AttrsDecorator.java
================================================
package com.mounacheikhna.decor;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;

/**
 * A base class for a decorator that transform certain View subtypes with certain attributes. Useful
 * when you want to extend standard layout inflation to add your own attributes to system widgets.
 * If a view with type {@code View&lt;? extends T&gt;} is inflated and it has one of the attributes
 * returned in {@link AttrsDecorator#styleable()} ()} method then {@link AttrsDecorator#apply(View, TypedArray)}
 * will be invoked for that view.
 * @param <T> The type or parent type of View that this decorator applies to.
 */
public abstract class AttrsDecorator<T extends View> implements Decorator {

    TypedArray values;

    @Override
    public void apply(View view, View parent, String name, Context context, AttributeSet attributeSet) {
        if (!clazz().isAssignableFrom(view.getClass())) {
            return;
        }

        values = obtainAttributes(context, attributeSet);
        if(values == null || values.length() == 0) return;

        try {
            for (int i = 0; i < values.length(); i++) {
                TypedValue buf = new TypedValue();
                if (values.hasValue(i) && values.getValue(i, buf)) {
                    apply((T) view, values);
                    break;
                }
            }
        } finally {
            values.recycle();
        }
    }

    TypedArray obtainAttributes(Context context, AttributeSet attributeSet) {
        //TODO: instead of always passing 0 here for defStyleAttr : make it accept theme setted attribute
        return context.getTheme().obtainStyledAttributes(attributeSet, styleable(), defStyleAttr(), 0);
    }

    protected abstract int[] styleable();

    protected int defStyleAttr() {
        return 0;
    }

    /**
     * The class for the given viewtype. Please be kind and just return the right class here :)
     *
     * @return The class/typetoken for T
     */
    protected abstract Class<T> clazz();

    /**
     * This method will be called if a View of type T was inflated and it had one of the attributes
     * specified by {@link AttrsDecorator#styleable()} set.
     * @param view  The view object that is being decorated.
     * @param typedArray A {@link TypedArray} for attributes.
     *
     */
    protected abstract void apply(T view, TypedArray typedArray);

}



================================================
FILE: decor/src/main/java/com/mounacheikhna/decor/DecorActivityFactory.java
================================================
package com.mounacheikhna.decor;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;

/**
 * Created by cheikhna on 07/04/2015.
 */
public interface DecorActivityFactory {

    /**
     * Used to Wrap the Activity onCreateView method.
     *
     * You implement this method like so in you base activity.
     * <pre>
     * {@code
     * public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
     *   return DecorContextWrapper.get(getBaseContext()).onActivityCreateView(super.onCreateView(parent, name, context, attrs), attrs);
     * }
     * }
     * </pre>
     *
     * @param parent  parent view, can be null.
     * @param view    result of {@code super.onCreateView(parent, name, context, attrs)}, this might be null, which is fine.
     * @param name    Name of View we are trying to inflate
     * @param context current context (normally the Activity's)
     * @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()}
     * @return The view passed in, or null if nothing was passed in.
     * @see android.view.LayoutInflater.Factory2
     */
    View onActivityCreateView(View parent, View view, String name, Context context, AttributeSet attrs);
}


================================================
FILE: decor/src/main/java/com/mounacheikhna/decor/DecorContextWrapper.java
================================================
package com.mounacheikhna.decor;

import android.content.Context;
import android.content.ContextWrapper;
import android.view.LayoutInflater;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Created by cheikhna on 05/04/2015.
 */
public class DecorContextWrapper extends ContextWrapper  {

    private DecorLayoutInflater mInflater;
    private List<Decorator> mDecorators;

    /**
     * @param base ContextBase to Wrap.
     */
    public DecorContextWrapper(Context base) {
        super(base);
        mDecorators = new ArrayList<>();
    }

    /**
     * wrap the context
     * @param base ContextBase to Wrap.
     * @return ContextWrapper to pass back to the activity.
     */
    public static DecorContextWrapper wrap(Context base) {
        return new DecorContextWrapper(base);
    }

    public ContextWrapper with(Decorator... decorators) {
        Collections.addAll(mDecorators, decorators);
        return this;
    }

    @Override
    public Object getSystemService(String name) {
        if(LAYOUT_INFLATER_SERVICE.equals(name)) {
            if(mInflater == null) {
                mInflater = new DecorLayoutInflater(LayoutInflater.from(getBaseContext()), this, mDecorators, false);
            }
            return mInflater;
        }
        return super.getSystemService(name);
    }

}


================================================
FILE: decor/src/main/java/com/mounacheikhna/decor/DecorFactory.java
================================================
package com.mounacheikhna.decor;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;

import java.util.Collection;

/**
 * Created by cheikhna on 05/04/2015.
 */
public class DecorFactory {

    private final Collection<Decorator> decorators;

    public DecorFactory(Collection<Decorator> decorators) {
        this.decorators = decorators;
    }

    public View onViewCreated(View view,  String name,  View parent,  Context context, AttributeSet attrs) {
        if (view == null) {
            return null;
        }
        for (Decorator d : decorators) {
            d.apply(view, parent, name, context, attrs);
        }
        return view;
    }

    public View onViewCreated(View view, Context context, AttributeSet attrs) {
        //TODO: implement
        return view;
    }

}


================================================
FILE: decor/src/main/java/com/mounacheikhna/decor/DecorLayoutInflater.java
================================================
package com.mounacheikhna.decor;

import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Collection;

/**
 * Created by cheikhna on 05/04/2015.
 */
public class DecorLayoutInflater extends LayoutInflater implements DecorActivityFactory {

    private static final String[] CLASS_PREFIX_LIST = {
            "android.widget.",
            "android.webkit."
    };

    private final DecorFactory mDecorFactory;
    private Collection<Decorator> mDecorators;
    private boolean mSetPrivateFactory = false;
    private Field mConstructorArgs = null;

    protected DecorLayoutInflater(Context context, Collection<Decorator> decorators) {
        super(context);
        mDecorators = decorators;
        mDecorFactory = new DecorFactory(mDecorators);
        initLayoutFactories(false);
    }

    protected DecorLayoutInflater(LayoutInflater original, Context newContext, Collection<Decorator> decorators, final boolean isCloned) {
        super(original, newContext);
        mDecorators = decorators;
        mDecorFactory = new DecorFactory(mDecorators);
        initLayoutFactories(isCloned);
    }

    @Override
    public LayoutInflater cloneInContext(Context newContext) {
        return new DecorLayoutInflater(this, newContext, mDecorators, true);
    }

    private void initLayoutFactories(final boolean isCloned) {
        if (isCloned) return;
        // If we are HC+ we get and set Factory2 otherwise we just wrap Factory1
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            if (getFactory2() != null && !(getFactory2() instanceof WrapperFactory2)) {
                // Sets both Factory/Factory2
                setFactory2(getFactory2());
            }
        }
        // We can do this as setFactory2 is used for both methods.
        if (getFactory() != null && !(getFactory() instanceof WrapperFactory)) {
            setFactory(getFactory());
        }
    }

    @Override
    public View inflate(int resource, ViewGroup root, boolean attachToRoot) {
        setPrivateFactoryInternal();
        return super.inflate(resource, root, attachToRoot);
    }

    private void setPrivateFactoryInternal() {
        // Already tried to set the factory.
        if (mSetPrivateFactory) return;
        //if (!hasReflection()) return;
        // Skip if not attached to an activity.
        if (!(getContext() instanceof Factory2)) {
            mSetPrivateFactory = true;
            return;
        }

        final Method setPrivateFactoryMethod = ReflectionUtils
                .getMethod(LayoutInflater.class, "setPrivateFactory");

        if (setPrivateFactoryMethod != null) {
            ReflectionUtils.invokeMethod(this,
                    setPrivateFactoryMethod,
                    new PrivateWrapperFactory2((Factory2) getContext(), this, mDecorFactory));
        }
        mSetPrivateFactory = true;
    }

    @Override
    public void setFactory(Factory factory) {
        // Only set our factory and wrap calls to the Factory trying to be set!
        if (!(factory instanceof WrapperFactory)) {
            super.setFactory(new WrapperFactory(factory, this, mDecorFactory));
        } else {
            super.setFactory(factory);
        }
    }

    @Override
    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    public void setFactory2(Factory2 factory2) {
        // Only set our factory and wrap calls to the Factory2 trying to be set!
        if (!(factory2 instanceof WrapperFactory2)) {
            super.setFactory2(new WrapperFactory2(factory2, mDecorFactory));
        } else {
            super.setFactory2(factory2);
        }
    }

    /**
     * The LayoutInflater onCreateView is the fourth port of call for LayoutInflation.
     * BUT only for none CustomViews.
     */
    
    @Override
    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    protected View onCreateView(View parent, String name, AttributeSet attrs) throws ClassNotFoundException {
        return mDecorFactory.onViewCreated(
                super.onCreateView(parent, name, attrs), name, parent, getContext(), attrs);
    }

    /**
     * The LayoutInflater onCreateView is the fourth port of call for LayoutInflation.
     * BUT only for none CustomViews.
     * Basically if this method doesn't inflate the View nothing probably will.
     */
    
    @Override
    protected View onCreateView(String name, AttributeSet attrs) throws ClassNotFoundException {
        // This mimics the {@code PhoneLayoutInflater} in the way it tries to inflate the base
        // classes, if this fails its pretty certain the app will fail at this point.
        View view = null;
        for (String prefix : CLASS_PREFIX_LIST) {
            try {
                view = createView(name, prefix, attrs);
            } catch (ClassNotFoundException ignored) {
            }
        }
        // In this case we want to let the base class take a crack
        // at it.
        if (view == null) view = super.onCreateView(name, attrs);

        return mDecorFactory.onViewCreated(view, name, null, view.getContext(), attrs);
    }

    @Override
    public View onActivityCreateView(View parent, View view, String name, Context context, AttributeSet attrs) {
        return mDecorFactory.onViewCreated(createCustomViewInternal(parent, view, name, context, attrs), context, attrs);
    }


    /**
     * Wrapped factories for Pre and Post HC
     */

    /**
     * Factory 1 is the first port of call for LayoutInflation
     */
    private static class WrapperFactory implements Factory {

        private final Factory mFactory;
        private final DecorLayoutInflater mInflater;
        private final DecorFactory mDecorFactory;

        public WrapperFactory(Factory factory, DecorLayoutInflater inflater, DecorFactory decorFactory) {
            this.mFactory = factory;
            this.mInflater = inflater;
            this.mDecorFactory = decorFactory;
        }

        @Override
        public View onCreateView(String name, Context context, AttributeSet attrs) {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
                return  mDecorFactory.onViewCreated(
                            mInflater.createCustomViewInternal(
                                null, mFactory.onCreateView(name, context, attrs), name, context, attrs
                        ),
                        context, attrs
                );
            }
            return mDecorFactory.onViewCreated(
                        mFactory.onCreateView(name, context, attrs),
                        name, null, context, attrs
            );
        }
    }


    /**
     * Factory 2 is the second port of call for LayoutInflation
     */
    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    private static class WrapperFactory2 implements Factory2 {
        protected final Factory2 mFactory2;
        protected final DecorFactory mDecorFactory;

        public WrapperFactory2(Factory2 mFactory2, DecorFactory mDecorFactory) {
            this.mFactory2 = mFactory2;
            this.mDecorFactory = mDecorFactory;
        }

        
        @Override
        public View onCreateView(String name, Context context, AttributeSet attrs) {
            return mDecorFactory.onViewCreated(
                    mFactory2.onCreateView(name, context, attrs),
                    name, null, context, attrs);
        }

        
        @Override
        public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
            return mDecorFactory.onViewCreated(
                    mFactory2.onCreateView(parent, name, context, attrs),
                    name, parent, context, attrs);
        }
    }

    /**
     * Private factory is step three for Activity Inflation, this is what is attached to the
     * Activity on HC+ devices.
     */
    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    private static class PrivateWrapperFactory2 extends WrapperFactory2 {

        private final DecorLayoutInflater mInflater;

        public PrivateWrapperFactory2(Factory2 factory2, DecorLayoutInflater inflater, DecorFactory decorFactory) {
            super(factory2, decorFactory);
            mInflater = inflater;
        }

        @Override
        public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
            return mDecorFactory.onViewCreated(
                    mInflater.createCustomViewInternal(parent,
                            mFactory2.onCreateView(parent, name, context, attrs),
                            name, context, attrs
                    ),
                    name, parent, context, attrs
            );
        }
    }


    /**
     * Nasty method to inflate custom layouts that haven't been handled else where. If this fails it
     * will fall back through to the PhoneLayoutInflater method of inflating custom views where
     * we will NOT have a hook into.
     *
     * @param parent      parent view
     * @param view        view if it has been inflated by this point, if this is not null this method
     *                    just returns this value.
     * @param name        name of the thing to inflate.
     * @param viewContext Context to inflate by if parent is null
     * @param attrs       Attr for this view which we can steal fontPath from too.
     * @return view or the View we inflate in here.
     */
    private View createCustomViewInternal(View parent, View view, String name, Context viewContext, AttributeSet attrs) {
        // I by no means advise anyone to do this normally, but Google have locked down access to
        // the createView() method, so we never get a callback with attributes at the end of the
        // createViewFromTag chain (which would solve all this unnecessary rubbish).
        // We at the very least try to optimise this as much as possible.
        // We only call for customViews (As they are the ones that never go through onCreateView(...)).
        // We also maintain the Field reference and make it accessible which will make a pretty
        // significant difference to performance on Android 4.0+.

        if (view == null && name.indexOf('.') > -1) {
            if (mConstructorArgs == null)
                mConstructorArgs = ReflectionUtils.getField(LayoutInflater.class, "mConstructorArgs");

            final Object[] mConstructorArgsArr = (Object[]) ReflectionUtils.getValue(mConstructorArgs, this);
            final Object lastContext = mConstructorArgsArr[0];
            // The LayoutInflater actually finds out the correct context to use. We just need to set
            // it on the mConstructor for the internal method.
            // Set the constructor ars up for the createView, not sure why we can't pass these in.
            mConstructorArgsArr[0] = viewContext;
            ReflectionUtils.setValue(mConstructorArgs, this, mConstructorArgsArr);
            try {
                view = createView(name, null, attrs);
            } catch (ClassNotFoundException ignored) {
            } finally {
                mConstructorArgsArr[0] = lastContext;
                ReflectionUtils.setValue(mConstructorArgs, this, mConstructorArgsArr);
            }
        }
        return view;
    }

}

================================================
FILE: decor/src/main/java/com/mounacheikhna/decor/Decorator.java
================================================
package com.mounacheikhna.decor;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;


/**
 * A class that operates on already constructed views, i.e., decorates them.
 */
public interface Decorator {
    /**
     * Decorates the given view.
     * This method will be called by Decor for every {@link View} created in the layout
     * @param view The view to decorate. Never null.
     * @param parent The parent view, if available. May be null.
     * @param name The name of the tag in the layout file, e.g. {@code TextView}.
     * @param context The context where the view was constructed in.
     * @param attrs A read-only set of tag attributes.
     */
    public void apply( View view,  View parent,  String name,  Context context,  AttributeSet attrs);

}


================================================
FILE: decor/src/main/java/com/mounacheikhna/decor/ReflectionUtils.java
================================================
package com.mounacheikhna.decor;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;


class ReflectionUtils {

    static Field getField(Class clazz, String fieldName) {
        try {
            final Field f = clazz.getDeclaredField(fieldName);
            f.setAccessible(true);
            return f;
        } catch (NoSuchFieldException ignored) {
        }
        return null;
    }

    static Object getValue(Field field, Object obj) {
        try {
            return field.get(obj);
        } catch (IllegalAccessException ignored) {
        }
        return null;
    }

    static void setValue(Field field, Object obj, Object value) {
        try {
            field.set(obj, value);
        } catch (IllegalAccessException ignored) {
        }
    }

    static Method getMethod(Class clazz, String methodName) {
        final Method[] methods = clazz.getMethods();
        for (Method method : methods) {
            if (method.getName().equals(methodName)) {
                method.setAccessible(true);
                return method;
            }
        }
        return null;
    }

    static void invokeMethod(Object object, Method method, Object... args) {
        try {
            if (method == null) return;
            method.invoke(object, args);
        } catch (IllegalAccessException ignored) {
            ignored.printStackTrace();
        } catch (InvocationTargetException ignored) {
            ignored.printStackTrace();
        }
    }
}


================================================
FILE: decor/src/main/res/layout/test_layout.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:decorAttr="Test"/>


================================================
FILE: decor/src/main/res/values/attrs.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="DecorExample">
        <attr name="decorAttr" format="string" />
    </declare-styleable>
</resources>


================================================
FILE: decor/src/main/res/values/strings.xml
================================================
<resources>
    <string name="app_name">Decor</string>
</resources>


================================================
FILE: decor/src/test/java/com/mounacheikhna/decor/AttrsDecoratorTest.java
================================================
package com.mounacheikhna.decor;

import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;

import static org.fest.assertions.api.Assertions.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;

/**
 * Created by cheikhna on 30/04/15.
 */
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class AttrsDecoratorTest {

    @Mock View view;
    @Mock TextView textView;
    @Mock ViewGroup parent;
    @Mock AttributeSet attributeSet;
    Context context;
    TestAttrsDecorator attrsDecorator;

    @Before
    public void setUp() throws Exception {
        initMocks(this);
        context = RuntimeEnvironment.application;
        attrsDecorator = spy(new TestAttrsDecorator()); //spying on this object under test is temporary TODO: don't use Spy
    }

    @Test
    public void decorNotAppliedOnWidgetOfAnotherType() throws Exception {
        String name = "android.widget.ImageView";
        ImageView imageView = mock(ImageView.class);
        attrsDecorator.apply(imageView, parent, name, context, attributeSet);
        assertThat(attrsDecorator.values).isNull();
    }

    @Test
    public void decorNotAppliedOnWidgetButWithoutAttr() throws Exception {
        String name = "android.widget.TextView";
        spyWithTypedArray(null);
        attrsDecorator.apply(textView, parent, name, context, attributeSet);
        assertThat(attrsDecorator.values).isNull();
    }

    @Test
    public void decorNotAppliedOnWidgetWithAttrWithoutValue() throws Exception {
        TypedArray typedArray = mockTypedArray(1, false);// we suppose we dont have custom attr here
        spyWithTypedArray(typedArray);
        String name = "android.widget.TextView";
        attrsDecorator.apply(textView, parent, name, context, attributeSet);
        assertThat(attrsDecorator.values).isNotNull();
        verify(typedArray).recycle();
        assertThat(attrsDecorator.getDecorStrValue()).isNull();
    }

    @Test
    public void decorAppliedWithAttrValue() throws Exception {
        TypedArray typedArray = mockTypedArray(1, true);
        when(typedArray.getString(0)).thenReturn("test");
        spyWithTypedArray(typedArray);
        String name = "android.widget.TextView";
        attrsDecorator.apply(textView, parent, name, context, attributeSet);
        assertThat(attrsDecorator.values).isNotNull();
        assertThat(attrsDecorator.values.length()).isGreaterThan(0);
        verify(typedArray).recycle();
        assertThat(attrsDecorator.getDecorStrValue()).isEqualTo("test");
    }

    private void spyWithTypedArray(TypedArray typedArray) {
        doReturn(typedArray).when(attrsDecorator).obtainAttributes(context, attributeSet);
    }

    /*private void mockTheme(TypedArray typedArray) {
        Resources.Theme theme = mock(Resources.Theme.class);
        when(theme.obtainStyledAttributes(attributeSet, attrsDecorator.styleable(), 0, 0)).thenReturn(typedArray);
        when(context.getTheme()).thenReturn(theme);
    }*/

    private TypedArray mockTypedArray(int length, boolean valueToReturn) {
        TypedArray typedArray = mock(TypedArray.class);
        when(typedArray.length()).thenReturn(length);
        when(typedArray.hasValue(0)).thenReturn(valueToReturn);
        when(typedArray.getValue(eq(0), any(TypedValue.class))).thenReturn(valueToReturn);
        doNothing().when(typedArray).recycle();
        return typedArray;
    }

}


================================================
FILE: decor/src/test/java/com/mounacheikhna/decor/DecorFactoryTest.java
================================================
package com.mounacheikhna.decor;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import java.util.ArrayList;
import java.util.Collection;

import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.MockitoAnnotations.initMocks;

/**
 * Created by cheikhna on 28/04/15.
 */
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class DecorFactoryTest {

    @Mock Context context;
    @Mock View view;
    @Mock Decorator decorator;
    @Mock ViewGroup parent;
    @Mock AttributeSet attributeSet;

    private DecorFactory decorFactory;

    @Before
    public void setUp() throws Exception {
        initMocks(this);
        Collection<Decorator> decorators = new ArrayList<>();
        decorators.add(decorator);
        decorFactory = new DecorFactory(decorators);
    }

    @Test
    public void addDecoratorDoesApplyIt() throws Exception {
        String name = "android.view.View";
        decorFactory.onViewCreated(view, name, parent, context, attributeSet);
        verify(decorator).apply(view, parent, name, context, attributeSet);
    }

    @Test
    public void NoDecoratorAppliedToNullView() throws Exception {
        String name = "android.view.View";
        decorFactory.onViewCreated(null, name, parent, context, attributeSet);
        verify(decorator, never()).apply(null, parent, name, context, attributeSet);
    }

}


================================================
FILE: decor/src/test/java/com/mounacheikhna/decor/TestAttrsDecorator.java
================================================
package com.mounacheikhna.decor;

import android.content.res.TypedArray;
import android.widget.TextView;

/**
 * Created by cheikhna on 28/04/2015.
 */
public class TestAttrsDecorator extends AttrsDecorator<TextView> {

    private String decorStrValue;

    @Override
    protected int[] styleable() {
        return R.styleable.DecorExample;
    }

/*    @Override
    protected int[] attrs() {
        return new int[] {R.attr.decorAttr};
    }*/

    @Override
    protected Class<TextView> clazz() {
        return TextView.class;
    }

    @Override
    protected void apply(TextView textView, TypedArray typedArray) {
        decorStrValue = typedArray.getString(R.styleable.DecorExample_decorAttr);
    }

    public String getDecorStrValue() {
        return decorStrValue;
    }
}


================================================
FILE: decorators/.gitignore
================================================
/build


================================================
FILE: decorators/build.gradle
================================================
//apply plugin: "android-sdk-manager"
apply plugin: 'com.android.library'

android {

    compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
        targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
        versionName project.VERSION_NAME
        versionCode Integer.parseInt(project.VERSION_CODE)
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        abortOnError false
    }

}


repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':decor')
    compile "com.android.support:appcompat-v7:28.0.0"
    compile "com.android.support:palette-v7:28.0.0"
    compile "com.android.support:support-v4:28.0.0"
}


apply from: '../deploy.gradle'


================================================
FILE: decorators/gradle.properties
================================================

POM_NAME=Decor's Decorators
POM_ARTIFACT_ID=decorators
POM_PACKAGING=aar


================================================
FILE: decorators/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/cheikhna/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}


================================================
FILE: decorators/src/androidTest/java/com/mounacheikhna/decorators/ApplicationTest.java
================================================
package com.mounacheikhna.decorators;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
 * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
 */
public class ApplicationTest extends ApplicationTestCase<Application> {
    public ApplicationTest() {
        super(Application.class);
    }
}

================================================
FILE: decorators/src/main/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mounacheikhna.decorators">

    <application android:allowBackup="true" android:label="@string/app_name">

    </application>

</manifest>


================================================
FILE: decorators/src/main/java/com/mounacheikhna/decorators/AutofitDecorator.java
================================================
package com.mounacheikhna.decorators;

/**
 * Created by cheikhna on 09/04/2015.
 */

import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextPaint;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.widget.TextView;

import com.mounacheikhna.decor.AttrsDecorator;

/**
 * A decorator for a TextView to resize it's text to be no larger than the width of the view.
 * (An example of a complicated decorator )
 */
public class AutofitDecorator extends AttrsDecorator<TextView> {

    private static final String TAG = "AutofitDecorator";
    private static final boolean SPEW = false;

    private TextView mTextView;

    // Minimum size of the text in pixels
    private static final int DEFAULT_MIN_TEXT_SIZE = 11; //sp

    // How precise we want to be when reaching the target textWidth size
    private static final float PRECISION = 0.5f;

    // Attributes
    private boolean mSizeToFit;
    private int mMaxLines;
    private float mMinTextSize;
    private float mMaxTextSize;

    private float mPrecision;

    private TextPaint mPaint;


    @Override
    protected int[] styleable() {
        return R.styleable.AutofitDecorator;
    }

    @Override
    protected Class<TextView> clazz() {
        return TextView.class;
    }

    @Override
    protected void apply(TextView view, TypedArray typedArray) {
        mTextView = view;
        boolean isAutofit = typedArray.getBoolean(R.styleable.AutofitDecorator_decorAutofitText, false);
        if(!isAutofit) return;

        float scaledDensity = mTextView.getContext().getResources().getDisplayMetrics().scaledDensity;
        boolean sizeToFit = true;
        int minTextSize = (int) scaledDensity * DEFAULT_MIN_TEXT_SIZE;
        float precision = PRECISION;

        //TODO: deal with case when one of these values is absent

        sizeToFit = typedArray.getBoolean(R.styleable.AutofitDecorator_decorSizeToFit, sizeToFit);

        minTextSize = typedArray.getDimensionPixelSize(R.styleable.AutofitDecorator_decorMinTextSize, minTextSize);

        precision = typedArray.getFloat(R.styleable.AutofitDecorator_decorPrecision, precision);

        mPaint = new TextPaint();
        setSizeToFit(sizeToFit);
        setRawTextSize(mTextView.getTextSize());
        setRawMinTextSize(minTextSize);
        setPrecision(precision);
    }

    /**
     * If true, the text will automatically be resized to fit its constraints; if false, it will act
     * like a normal TextView.
     */
    public void setSizeToFit(boolean sizeToFit) {
        mSizeToFit = sizeToFit;
        refitText();
    }

    private void setRawTextSize(float size) {
        if (size != mMaxTextSize) {
            mMaxTextSize = size;
            refitText();
        }
    }

    private void setRawMinTextSize(float minSize) {
        if (minSize != mMinTextSize) {
            mMinTextSize = minSize;
            refitText();
        }
    }

    /**
     * Set the amount of precision used to calculate the correct text size to fit within it's
     * bounds. Lower precision is more precise and takes more time.
     *
     * @param precision The amount of precision.
     */
    public void setPrecision(float precision) {
        if (precision != mPrecision) {
            mPrecision = precision;
            refitText();
        }
    }

    /**
     * @return the amount of precision used to calculate the correct text size to fit within it's
     * bounds.
     */
    public float getPrecision() {
        return mPrecision;
    }


    /**
     * Re size the font so the specified text fits in the text box assuming the text box is the
     * specified width.
     */
    private void refitText() {
        if (!mSizeToFit) {
            return;
        }

        if (mMaxLines <= 0) {
            // Don't auto-size since there's no limit on lines.
            return;
        }

        String text = mTextView.getText().toString();
        int targetWidth = mTextView.getWidth() - mTextView.getPaddingLeft() - mTextView.getPaddingRight();
        if (targetWidth > 0) {
            Context context = mTextView.getContext();
            Resources r = Resources.getSystem();
            DisplayMetrics displayMetrics;

            float size = mMaxTextSize;
            float high = size;
            float low = 0;

            if (context != null) {
                r = context.getResources();
            }
            displayMetrics = r.getDisplayMetrics();

            mPaint.set(mTextView.getPaint());
            mPaint.setTextSize(size);

            if ((mMaxLines == 1 && mPaint.measureText(text) > targetWidth)
                    || getLineCount(text, mPaint, size, targetWidth, displayMetrics) > mMaxLines) {
                size = getTextSize(text, mPaint, targetWidth, mMaxLines, low, high, mPrecision,
                        displayMetrics);
            }

            if (size < mMinTextSize) {
                size = mMinTextSize;
            }

            mTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
        }
    }

    /**
     * Recursive binary search to find the best size for the text
     */
    private static float getTextSize(String text, TextPaint paint,
                                     float targetWidth, int maxLines,
                                     float low, float high, float precision,
                                     DisplayMetrics displayMetrics) {
        float mid = (low + high) / 2.0f;
        int lineCount = 1;
        StaticLayout layout = null;

        paint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, mid,
                displayMetrics));

        if (maxLines != 1) {
            layout = new StaticLayout(text, paint, (int) targetWidth, Layout.Alignment.ALIGN_NORMAL,
                    1.0f, 0.0f, true);
            lineCount = layout.getLineCount();
        }

        if (SPEW) {
            Log.d(TAG, "low=" + low + " high=" + high + " mid=" + mid +
                    " target=" + targetWidth + " maxLines=" + maxLines + " lineCount=" + lineCount);
        }

        if (lineCount > maxLines) {
            return getTextSize(text, paint, targetWidth, maxLines, low, mid, precision,
                    displayMetrics);
        } else if (lineCount < maxLines) {
            return getTextSize(text, paint, targetWidth, maxLines, mid, high, precision,
                    displayMetrics);
        } else {
            float maxLineWidth = 0;
            if (maxLines == 1) {
                maxLineWidth = paint.measureText(text);
            } else {
                for (int i = 0; i < lineCount; i++) {
                    if (layout.getLineWidth(i) > maxLineWidth) {
                        maxLineWidth = layout.getLineWidth(i);
                    }
                }
            }

            if ((high - low) < precision) {
                return low;
            } else if (maxLineWidth > targetWidth) {
                return getTextSize(text, paint, targetWidth, maxLines, low, mid, precision,
                        displayMetrics);
            } else if (maxLineWidth < targetWidth) {
                return getTextSize(text, paint, targetWidth, maxLines, mid, high, precision,
                        displayMetrics);
            } else {
                return mid;
            }
        }
    }

    /**
     * {@inheritDoc}
     */
    //@Override //since we cant have override with it here -> issue when frmwrk calls setTextSize on this afterwards
                //probably it wont work (is there a way to have a delegate for mTextView to pass to this when setTextSize is called on it)
    public void setTextSize(int unit, float size) {
        if (!mSizeToFit) {
            mTextView.setTextSize(unit, size);
        }

        Context context = mTextView.getContext();
        Resources r = Resources.getSystem();

        if (context != null) {
            r = context.getResources();
        }

        setRawTextSize(TypedValue.applyDimension(unit, size, r.getDisplayMetrics()));
    }

    private static int getLineCount(String text, TextPaint paint, float size, float width,
                                    DisplayMetrics displayMetrics) {
        paint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, size,
                displayMetrics));
        StaticLayout layout = new StaticLayout(text, paint, (int) width,
                Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, true);
        return layout.getLineCount();
    }

}


================================================
FILE: decorators/src/main/java/com/mounacheikhna/decorators/BlurDecorator.java
================================================
package com.mounacheikhna.decorators;

import android.content.res.TypedArray;
import android.os.Build;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;

import com.mounacheikhna.decor.AttrsDecorator;
import com.mounacheikhna.decorators.utils.BlurUtils;

/**
 * Created by cheikhna on 03/04/2015.
 */
public class BlurDecorator extends AttrsDecorator<View> {

    @Override
    protected int[] styleable() {
        return R.styleable.BlurDecorator;
    }

    @Override
    protected Class<View> clazz() {
        return View.class;
    }

    @Override
    protected void apply(View view, TypedArray typedArray) {
        boolean isBlur = typedArray.getBoolean(R.styleable.BlurDecorator_decorBlur, false);
        if(!isBlur || Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) return;

        //i'm guessing this part here doesn't work because i'm using the same blur as ngAndroid and they are
        //doing their injection in a different point in the inflation
        ViewGroup parent = (ViewGroup) view.getParent();
        FrameLayout layout = new FrameLayout(view.getContext());
        layout.setLayoutParams(view.getLayoutParams());
        int index = parent.indexOfChild(view);
        parent.removeViewAt(index);
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        view.setLayoutParams(layoutParams);
        layout.addView(view);
        parent.addView(layout, index);

        final ImageView imageView = new ImageView(view.getContext());
        imageView.setLayoutParams(layoutParams);
        imageView.setVisibility(View.GONE);
        layout.addView(imageView);

        view.setVisibility(View.GONE);
        view.setDrawingCacheEnabled(true);
        imageView.setImageBitmap(BlurUtils.blurBitmap(view.getDrawingCache(), view.getContext()));
        imageView.setVisibility(View.VISIBLE);
    }

}

================================================
FILE: decorators/src/main/java/com/mounacheikhna/decorators/ColorFilterDecorator.java
================================================
package com.mounacheikhna.decorators;

import android.content.res.TypedArray;
import android.widget.ImageView;

import com.mounacheikhna.decor.AttrsDecorator;


/**
 * Created by cheikhna on 01/03/2015.
 */
public class ColorFilterDecorator extends AttrsDecorator<ImageView> {

    @Override
    protected int[] styleable() {
        return R.styleable.ColorFilterDecorator;
    }


    @Override
    protected Class<ImageView> clazz() {
        return ImageView.class;
    }

    @Override
    protected void apply(ImageView view, TypedArray typedArray) {
        int color = typedArray.getColor(R.styleable.ColorFilterDecorator_decorColorFilter, 0);
        if (color != 0) {
            view.setColorFilter(color);
        }
    }

}


================================================
FILE: decorators/src/main/java/com/mounacheikhna/decorators/Decorators.java
================================================
package com.mounacheikhna.decorators;

import com.mounacheikhna.decor.Decorator;

/**
 * Created by cheikhna on 11/04/2015.
 */

/**
 * A utility class to obtain all decorators defined in this library
 */
public final class Decorators {

    /**
     * Get all the decorators already defined
     * @return available decorators
     */
    public static Decorator[] getAll() {
        return new Decorator[] {
            new AutofitDecorator(),
            new BlurDecorator(),
            new ColorFilterDecorator(),
            new ErrorDecorator(),
            new FontDecorator(),
            new ReloadTextDecorator()
        };
    }

}


================================================
FILE: decorators/src/main/java/com/mounacheikhna/decorators/ErrorDecorator.java
================================================
package com.mounacheikhna.decorators;

import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.widget.EditText;

import com.mounacheikhna.decor.AttrsDecorator;

/**
 * Created by cheikhna on 09/02/2015.
 */
public class ErrorDecorator extends AttrsDecorator<EditText> {

    @Override
    protected int[] styleable() {
        return R.styleable.ErrorDecorator;
    }

    @Override
    protected Class<EditText> clazz() {
        return EditText.class;
    }

    @Override
    protected void apply(EditText view, TypedArray typedArray) {
        Drawable errorIcon = typedArray.getDrawable(R.styleable.ErrorDecorator_decorErrorIcon);
        CharSequence errorText = typedArray.getString(R.styleable.ErrorDecorator_decorErrorText);
        view.setError(errorText, errorIcon);
    }

}

================================================
FILE: decorators/src/main/java/com/mounacheikhna/decorators/FontDecorator.java
================================================
package com.mounacheikhna.decorators;

import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.widget.TextView;

import com.mounacheikhna.decor.AttrsDecorator;


public class FontDecorator extends AttrsDecorator<TextView> {

    @Override
    protected int[] styleable() {
        return R.styleable.FontDecorator;
    }

    @Override
    protected Class<TextView> clazz() {
        return TextView.class;
    }

   /* @Override
    protected int defStyleAttr() {
        return R.attr.decorTypefaceAsset;
    }*/

    @Override
    protected void apply(TextView view, TypedArray typedArray) {
        String typefacePath = typedArray.getString(R.styleable.FontDecorator_decorTypefaceAsset);
        if(typefacePath == null) return;
        view.setTypeface(Typeface.createFromAsset(
                view.getResources().getAssets(), typefacePath));
    }
}

================================================
FILE: decorators/src/main/java/com/mounacheikhna/decorators/OnActionBaseDecorator.java
================================================
package com.mounacheikhna.decorators;

import android.app.Activity;
import android.view.View;

import com.mounacheikhna.decor.AttrsDecorator;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;


/**
 * Created by cheikhna on 02/04/2015.
 */
public abstract class OnActionBaseDecorator extends AttrsDecorator<View> {

    protected Activity mContainerActivity;

    public OnActionBaseDecorator(Activity activity) {
        mContainerActivity = activity;
    }

    @Override
    protected Class<View> clazz() {
        return View.class;
    }

    protected boolean onAction(String methodName) {
        Method mHandler = null;
        try {
            if(mContainerActivity != null) {
                mHandler = mContainerActivity.getClass().getMethod(methodName);
            }
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }

        if (mHandler == null) return false;
        try {
            mHandler.invoke(mContainerActivity);
            return true;
        } catch (IllegalAccessException e) {
            e.printStackTrace();
            throw new IllegalStateException("Could not execute non public method of the activity", e);
        } catch (InvocationTargetException e) {
            e.printStackTrace();
            throw new IllegalStateException("Could not execute method of the activity", e);
        }
    }

}


================================================
FILE: decorators/src/main/java/com/mounacheikhna/decorators/OnLongClickDecorator.java
================================================
package com.mounacheikhna.decorators;

import android.app.Activity;
import android.content.res.TypedArray;
import android.view.View;
import android.view.View.OnLongClickListener;

/**
 * Created by cheikhna on 02/04/2015.
 */
public class OnLongClickDecorator extends OnActionBaseDecorator {

    public OnLongClickDecorator(Activity activity) {
        super(activity);
    }

    @Override
    protected int[] styleable() {
        return R.styleable.OnLongClickDecorator;
    }

    @Override
    protected void apply(View view, final TypedArray typedArray) {
        view.setOnLongClickListener(new OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                onAction(typedArray.getString(R.styleable.OnLongClickDecorator_decorOnLongClick));
                return true;
            }
        });
    }

}


================================================
FILE: decorators/src/main/java/com/mounacheikhna/decorators/OnTouchDecorator.java
================================================
package com.mounacheikhna.decorators;

import android.app.Activity;
import android.content.res.TypedArray;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;

/**
 * Created by cheikhna on 17/02/2015.
 */
public class OnTouchDecorator extends OnActionBaseDecorator {

    public OnTouchDecorator(Activity activity) {
        super(activity);
    }


    @Override
    protected int[] styleable() {
        return R.styleable.OnTouchDecorator;
    }

    @Override
    protected void apply(View view, final TypedArray typedArray) {
        view.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                return onAction(typedArray.getString(R.styleable.OnTouchDecorator_decorOnTouch));
            }
        });
    }

}


================================================
FILE: decorators/src/main/java/com/mounacheikhna/decorators/ReloadTextDecorator.java
================================================
package com.mounacheikhna.decorators;

import android.content.res.TypedArray;
import android.widget.TextView;
import com.mounacheikhna.decor.AttrsDecorator;

/**
 * Created by m.cheikhna on 11/08/2016.
 */
public class ReloadTextDecorator extends AttrsDecorator<TextView> {

    @Override
    protected int[] styleable() {
        return R.styleable.ReloadTextDecorator;
    }

    @Override
    protected Class<TextView> clazz() {
        return TextView.class;
    }

    @Override
    protected void apply(TextView view, TypedArray typedArray) {
        //TODO: the problem is to find a redo-able thing here
        //maybe having just a callback -> then you cant trigger it
        //i need a way to watch change to something and reload in that case

        //or suppose we have every time our StringsTextView
        //then in BaseActivity reload that goes through all strings and refreshes

    }
}


================================================
FILE: decorators/src/main/java/com/mounacheikhna/decorators/SearchAnimateDecorator.java
================================================
package com.mounacheikhna.decorators;

import android.annotation.TargetApi;
import android.content.res.TypedArray;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.os.Build;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.ImageView;

import com.mounacheikhna.decor.AttrsDecorator;

/**
 * Created by mounacheikhna on 01/04/2015.
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public class SearchAnimateDecorator extends AttrsDecorator<ImageView> {

    private boolean expanded = false;
    private ImageView mIv;
    private AnimatedVectorDrawable mSearchToBar;
    private AnimatedVectorDrawable mBarToSearch;
    private Interpolator mInterp;
    private int mDuration;
    private float mOffset;


    @Override
    protected int[] styleable() {
        return R.styleable.SearchAnimateDecorator;
    }

    @Override
    protected Class<ImageView> clazz() {
        return ImageView.class;
    }

    @Override
    protected void apply(ImageView view, TypedArray typedArray) {
        boolean shouldAnimate = typedArray.getBoolean(R.styleable.SearchAnimateDecorator_decorAnimateSearch, false);
        if(!shouldAnimate) return;

        mIv = view;
        mSearchToBar = (AnimatedVectorDrawable) view.getContext().getResources().getDrawable(R.drawable.anim_search_to_bar);
        mBarToSearch = (AnimatedVectorDrawable) view.getContext().getResources().getDrawable(R.drawable.anim_bar_to_search);
        mInterp = AnimationUtils.loadInterpolator(view.getContext(), android.R.interpolator.linear_out_slow_in);
        mDuration = view.getContext().getResources().getInteger(R.integer.duration_bar);
        // iv is sized to hold the search+bar so when only showing the search icon, translate the
        // whole view left by half the difference to keep it centered
        mOffset = -71f * (int) view.getContext().getResources().getDisplayMetrics().scaledDensity;
        view.setTranslationX(mOffset);
        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                animate(v);
            }
        });
    }

    //TODO: do a version of this for pre-lollipop or dont allow the use of it
    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public void animate(View view) {
        if (!expanded) {
            mIv.setImageDrawable(mSearchToBar);
            mSearchToBar.start();
            mIv.animate().translationX(0f).setDuration(mDuration).setInterpolator(mInterp);
            //text.animate().alpha(1f).setStartDelay(duration - 100).setDuration(100).setInterpolator(interp);
        } else {
            mIv.setImageDrawable(mBarToSearch);
            mBarToSearch.start();
            mIv.animate().translationX(mOffset).setDuration(mDuration).setInterpolator(mInterp);
            //text.setAlpha(0f);
        }
        expanded = !expanded;
    }

}


================================================
FILE: decorators/src/main/java/com/mounacheikhna/decorators/ShimmerDecorator.java
================================================
package com.mounacheikhna.decorators;

import android.content.res.TypedArray;
import android.widget.TextView;

import com.mounacheikhna.decor.AttrsDecorator;

/**
 * Created by cheikhna on 15/04/2015.
 */
public class ShimmerDecorator extends AttrsDecorator<TextView> {

    @Override
    protected int[] styleable() {
        return R.styleable.SearchAnimateDecorator;
    }

    @Override
    protected Class<TextView> clazz() {
        return TextView.class;
    }

    @Override
    protected void apply(TextView view, TypedArray typedArray) {
        //TODO: implement
    }
}


================================================
FILE: decorators/src/main/java/com/mounacheikhna/decorators/utils/BlurUtils.java
================================================
package com.mounacheikhna.decorators.utils;

import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;

/**
 * Created by cheikhna on 04/04/2015.
 */
public class BlurUtils {
    private static final float SCALE_RATIO = 5f;
    private static final float DEFAULT_BLUR_RADIUS = 5.f;

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    public static Bitmap blurBitmap(Bitmap bitmap, Context context){
        int width = bitmap.getWidth(), height = bitmap.getHeight();
        Bitmap b = Bitmap.createScaledBitmap(Bitmap.createScaledBitmap(bitmap,(int)(width/SCALE_RATIO), (int)(height/SCALE_RATIO), false), width, height, false);
        return blurBitmap(b, DEFAULT_BLUR_RADIUS, context);
    }


    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    private static Bitmap blurBitmap(Bitmap src, float blurRadius, Context context) {
        RenderScript rs = RenderScript.create(context);
        Bitmap.Config conf = Bitmap.Config.ARGB_8888;
        Bitmap blurredBitmap = Bitmap.createBitmap(src.getWidth(), src.getHeight(), conf);

        final Allocation input = Allocation.createFromBitmap(rs, src, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
        final Allocation output = Allocation.createTyped(rs, input.getType());

        final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
        script.setRadius(blurRadius);
        script.setInput(input);
        script.forEach(output);
        output.copyTo(blurredBitmap);
        return blurredBitmap;
    }

}


================================================
FILE: decorators/src/main/res/anim-v21/anim_bar_fill.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<objectAnimator
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:propertyName="trimPathStart"
    android:valueFrom="1"
    android:valueTo="0"
    android:valueType="floatType"
    android:duration="@integer/duration_bar"
    android:interpolator="@android:interpolator/linear_out_slow_in" />

================================================
FILE: decorators/src/main/res/anim-v21/anim_search_empty.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<objectAnimator
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:propertyName="trimPathStart"
    android:valueFrom="0"
    android:valueTo="1"
    android:valueType="floatType"
    android:duration="@integer/duration_search"
    android:interpolator="@android:interpolator/fast_out_slow_in" />

================================================
FILE: decorators/src/main/res/drawable-v21/anim_bar_to_search.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/search_vector_drawable" >
    <target
        android:name="search"
        android:animation="@anim/anim_bar_fill"
        />
    <target
        android:name="bar"
        android:animation="@anim/anim_search_empty"
        />
</animated-vector>


================================================
FILE: decorators/src/main/res/drawable-v21/anim_search_to_bar.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<animated-vector
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/search_vector_drawable">

    <target
        android:name="search"
        android:animation="@anim/anim_search_empty" />

    <target
        android:name="bar"
        android:animation="@anim/anim_bar_fill" />

</animated-vector>


================================================
FILE: decorators/src/main/res/drawable-v21/search_vector_drawable.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="150dp"
    android:height="24dp"
    android:viewportWidth="150"
    android:viewportHeight="24">
    <path
        android:name="search"
        android:pathData="@string/path_search"
        android:strokeWidth="2"
        android:strokeColor="#ffffff"
        android:strokeAlpha="0.8"
        android:strokeLineCap="round" />
    <path
        android:name="bar"
        android:pathData="M0,23 L149,23"
        android:strokeWidth="2"
        android:strokeColor="#ffffff"
        android:strokeAlpha="0.8"
        android:strokeLineCap="square" />
</vector>

================================================
FILE: decorators/src/main/res/values/attrs.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <!-- all attributes here prefixed with decor to avoid conflicts with other apps & lib attributes -->

    <declare-styleable name="FontDecorator">
        <attr name="decorTypefaceAsset" format="string" />
    </declare-styleable>

    <declare-styleable name="ReloadTextDecorator">
        <attr name="decorReload" format="boolean" />
    </declare-styleable>

    <declare-styleable name="ErrorDecorator">
        <attr name="decorErrorText" format="string" />
        <attr name="decorErrorIcon" format="reference" />
    </declare-styleable>

    <attr name="decorRound" format="reference" />
    <attr name="decorCornerRadius" format="dimension" />

    <declare-styleable name="OnTouchDecorator">
        <attr name="decorOnTouch" format="string"/>
    </declare-styleable>

    <declare-styleable name="ColorFilterDecorator">
        <attr name="decorColorFilter" format="color" />
    </declare-styleable>

    <attr name="decorCircular" format="boolean" />

    <declare-styleable name="OnLongClickDecorator">
        <attr name="decorOnLongClick" format="string" />
    </declare-styleable>

    <declare-styleable name="LayoutManagerDecorator">
        <attr name="decorLayoutManager" format="string"/>
        <attr name="decorLayoutManagerOrientation" format="string" />
    </declare-styleable>

    <declare-styleable name="BlurDecorator">
        <attr name="decorBlur" format="boolean" />
    </declare-styleable>

    <attr name="decorColorDescendents" format="boolean|reference" />

    <declare-styleable name="SearchAnimateDecorator">
        <attr name="decorAnimateSearch" format="boolean|reference" />
    </declare-styleable>

    <attr name="decorOptimise" format="boolean" />

    <declare-styleable name="ShimmerDecorator">
        <attr name="decorShimmer" format="boolean" />
    </declare-styleable>

    <declare-styleable name="AutofitDecorator">
        <attr name="decorAutofitText" format="boolean|reference" />
        <attr name="decorSizeToFit" format="float|reference" />
        <attr name="decorMinTextSize" format="reference" />
        <attr name="decorPrecision" format="float|reference" />
    </declare-styleable>

</resources>

================================================
FILE: decorators/src/main/res/values/integers.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <integer name="duration_bar">800</integer>
    <integer name="duration_search">800</integer>
</resources>

================================================
FILE: decorators/src/main/res/values/strings.xml
================================================
<resources>
    <string name="app_name">Decorators</string>
    <string name="path_search">"M141,17 A9,9 0 1,1 142,16 L149,23"</string>
</resources>


================================================
FILE: deploy.gradle
================================================

apply plugin: 'maven'
apply plugin: 'signing'


def isReleaseBuild() {
    return VERSION_NAME.contains("SNAPSHOT") == false
}

def getReleaseRepositoryUrl() {
    return "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}

def getSnapshotRepositoryUrl() {
    return "https://oss.sonatype.org/content/repositories/snapshots/"
}

def getRepositoryUsername() {
    return hasProperty('sonatypeUsername') ? sonatypeUsername : ""
}

def getRepositoryPassword() {
    return hasProperty('sonatypePassword') ? sonatypePassword : ""
}

afterEvaluate { project ->
    uploadArchives {
        repositories {
            mavenDeployer {
                beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

                pom.groupId = GROUP
                pom.version = VERSION_NAME
                pom.artifactId = POM_ARTIFACT_ID

                repository(url: getReleaseRepositoryUrl()) {
                    authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
                }
                snapshotRepository(url: getSnapshotRepositoryUrl()) {
                    authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
                }

                pom.project {
                    name POM_NAME
                    packaging POM_PACKAGING
                    description POM_DESCRIPTION
                    url POM_URL

                    scm {
                        url POM_SCM_URL
                        connection POM_SCM_CONNECTION
                        developerConnection POM_SCM_DEV_CONNECTION
                    }

                    licenses {
                        license {
                            name POM_LICENCE_NAME
                            url POM_LICENCE_URL
                            distribution POM_LICENCE_DIST
                        }
                    }

                    developers {
                        developer {
                            id POM_DEVELOPER_ID
                            name POM_DEVELOPER_NAME
                            email POM_DEVELOPER_EMAIL
                        }
                    }
                }
            }
        }
    }

    signing {
        required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
        sign configurations.archives
    }

    task androidJavadocs(type: Javadoc) {
        source = android.sourceSets.main.java.srcDirs
        classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
    }

    task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
        classifier = 'javadoc'
        from androidJavadocs.destinationDir
    }

    task androidSourcesJar(type: Jar) {
        classifier = 'sources'
        from android.sourceSets.main.java.srcDirs
    }

    artifacts {
        archives androidSourcesJar
        archives androidJavadocsJar
    }

}

================================================
FILE: gradle/wrapper/gradle-wrapper.properties
================================================
#Mon Jan 26 23:14:25 CET 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip


================================================
FILE: gradle.properties
================================================
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Settings specified in this file will override any Gradle settings
# configured through the IDE.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

VERSION_NAME=0.2.4
VERSION_CODE=5
GROUP=com.mounacheikhna

POM_PACKAGING=aar
POM_URL=https://github.com/chemouna/Decor
POM_DESCRIPTION=Android layout decorator : Injecting custom attributes in layout files, Using decorators to get rid of unnecessary class explosion with custom views
POM_SCM_URL=https://github.com/chemouna/Decor
POM_SCM_CONNECTION=scm:git@github.com:chemouna/Decor.git
POM_SCM_DEV_CONNECTION=scm:git@github.com:chemouna/Decor.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=chemouna
POM_DEVELOPER_NAME=Mouna Cheikhna
POM_DEVELOPER_EMAIL=cheikhnamouna@gmail.com

ANDROID_BUILD_MIN_SDK_VERSION=14
ANDROID_BUILD_TARGET_SDK_VERSION=28
ANDROID_BUILD_SDK_VERSION=28
ANDROID_BUILD_TOOLS_VERSION=29.0.0
ANDROID_SUPPORT_VERSION=28.0.0


================================================
FILE: gradlew
================================================
#!/usr/bin/env bash

##############################################################################
##
##  Gradle start up script for UN*X
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
    echo "$*"
}

die ( ) {
    echo
    echo "$*"
    echo
    exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
  CYGWIN* )
    cygwin=true
    ;;
  Darwin* )
    darwin=true
    ;;
  MINGW* )
    msys=true
    ;;
esac

# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
    [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
        PRG="$link"
    else
        PRG=`dirname "$PRG"`"/$link"
    fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
        # IBM's JDK on AIX uses strange locations for the executables
        JAVACMD="$JAVA_HOME/jre/sh/java"
    else
        JAVACMD="$JAVA_HOME/bin/java"
    fi
    if [ ! -x "$JAVACMD" ] ; then
        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
    fi
else
    JAVACMD="java"
    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
    MAX_FD_LIMIT=`ulimit -H -n`
    if [ $? -eq 0 ] ; then
        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
            MAX_FD="$MAX_FD_LIMIT"
        fi
        ulimit -n $MAX_FD
        if [ $? -ne 0 ] ; then
            warn "Could not set maximum file descriptor limit: $MAX_FD"
        fi
    else
        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
    fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

    # We build the pattern for arguments to be converted via cygpath
    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
    SEP=""
    for dir in $ROOTDIRSRAW ; do
        ROOTDIRS="$ROOTDIRS$SEP$dir"
        SEP="|"
    done
    OURCYGPATTERN="(^($ROOTDIRS))"
    # Add a user-defined pattern to the cygpath arguments
    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
    fi
    # Now convert the arguments - kludge to limit ourselves to /bin/sh
    i=0
    for arg in "$@" ; do
        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option

        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
        else
            eval `echo args$i`="\"$arg\""
        fi
        i=$((i+1))
    done
    case $i in
        (0) set -- ;;
        (1) set -- "$args0" ;;
        (2) set -- "$args0" "$args1" ;;
        (3) set -- "$args0" "$args1" "$args2" ;;
        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
    esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
    JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"


================================================
FILE: gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem  Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega


================================================
FILE: samples/build.gradle
================================================
//apply plugin: "android-sdk-manager"
apply plugin: 'com.android.application'

repositories {
    mavenCentral()
}


android {

    compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
    }

    /*lintOptions {
        disable 'MissingPrefix'
    }*/
}

dependencies {

    compile project(':decor')
    compile project(':decorators')

    /*compile 'com.mounacheikhna:decor:0.2.4'
    compile 'com.mounacheikhna:decorators:0.2.4'*/

    compile "com.android.support:support-v4:+"
}


================================================
FILE: samples/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.mounacheikhna.decor.samples"
          android:versionCode="1"
          android:versionName="1.0" >
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <activity android:name="com.mounacheikhna.decor.samples.SampleActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>


================================================
FILE: samples/src/main/assets/ubuntu-font-license-1.0.txt
================================================
Version 1.0

Preamble

This 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.

Definitions

"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.

"Original Version" refers to the collection of Font Software components as received under this licence.

"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.

"Copyright Holder(s)" refers to all individuals and companies who have a copyright ownership of the Font Software.

"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.

To "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.

Permission & Conditions

This licence does not grant any rights under trademark law and all such rights are reserved.

Permission 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:

Each 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.
The font name complies with the following:
The Original Version must retain its name, unmodified.
Modified Versions which are Substantially Changed must be renamed to avoid use of the name of the Original Version or similar names entirely.
Modified Versions which are not Substantially Changed must be renamed to both
retain the name of the Original Version and
add 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.
The 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
as required by this licence,
to acknowledge the contribution(s) of the Copyright Holder(s) or
with their explicit written permission.
The 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.
Termination

This licence becomes null and void if any of the above conditions are not met.

Disclaimer

THE 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.

Ubuntu Font Licence Version 1.0 (plain text)


================================================
FILE: samples/src/main/java/com/mounacheikhna/decor/samples/CustomImageView.java
================================================
package com.mounacheikhna.decor.samples;

import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ImageView;

/**
 * Created by cheikhna on 12/04/2015.
 */
public class CustomImageView extends ImageView {

    public CustomImageView(Context context) {
        super(context);
    }

    public CustomImageView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomImageView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public CustomImageView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

}


================================================
FILE: samples/src/main/java/com/mounacheikhna/decor/samples/CustomTextView.java
================================================
package com.mounacheikhna.decor.samples;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

public class CustomTextView extends TextView {

    public CustomTextView(Context context) {
        super(context);
    }

    public CustomTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomTextView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

}


================================================
FILE: samples/src/main/java/com/mounacheikhna/decor/samples/SampleActivity.java
================================================
package com.mounacheikhna.decor.samples;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.widget.Toast;

import com.mounacheikhna.decor.DecorContextWrapper;
import com.mounacheikhna.decorators.Decorators;

public class SampleActivity extends FragmentActivity /*ActionBarActivity*/ /*Activity*/ {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

    public void onIvTouch() {
        Toast.makeText(this, " Touch detected ", Toast.LENGTH_SHORT).show();
    }

    public void onRobotLongClick() {
        Toast.makeText(this, " Long click detected ", Toast.LENGTH_SHORT).show();
    }

    @Override
    protected void attachBaseContext(Context newBase) {
        super.attachBaseContext(DecorContextWrapper.wrap(newBase)
                .with(Decorators.getAll()));
    }

}

================================================
FILE: samples/src/main/java/com/mounacheikhna/decor/samples/SampleApp.java
================================================
package com.mounacheikhna.decor.samples;

import android.app.Application;
import android.content.Context;
import com.mounacheikhna.decor.DecorContextWrapper;
import com.mounacheikhna.decorators.Decorators;

public class SampleApp extends Application {

  @Override
  protected void attachBaseContext(Context newBase) {
    super.attachBaseContext(DecorContextWrapper.wrap(newBase)
        .with(Decorators.getAll()));
  }

}


================================================
FILE: samples/src/main/java/com/mounacheikhna/decor/samples/SampleFragment.java
================================================
package com.mounacheikhna.decor.samples;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;

public class SampleFragment extends Fragment /*android.app.Fragment*/ {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.main_frag, container, false);

        ViewStub stubWithDecorAttr = (ViewStub) view.findViewById(R.id.stub_with_decor_attr);
        stubWithDecorAttr.inflate();
        return view;
    }

}
    

================================================
FILE: samples/src/main/java/com/mounacheikhna/decor/samples/StringReloadableTextView.java
================================================
package com.mounacheikhna.decor.samples;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

/**
 * Created by m.cheikhna on 11/08/2016.
 */
public class StringReloadableTextView extends TextView {

    public StringReloadableTextView(Context context) {
        super(context);
    }

    public StringReloadableTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public StringReloadableTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

}


================================================
FILE: samples/src/main/res/layout/api_dependent_layout.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<merge />

================================================
FILE: samples/src/main/res/layout/main.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <fragment
        android:name="com.mounacheikhna.decor.samples.SampleFragment"
        android:id="@+id/sample_frg"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:layout="@layout/main_frag"/>

</FrameLayout>


================================================
FILE: samples/src/main/res/layout/main_frag.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="12dp"
    app:decorColorDescendents="true"
    tools:ignore="MissingPrefix">

    <include layout="@layout/api_dependent_layout" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Hi, I'm a TextView"
        android:layout_marginBottom="8dp" />

    <EditText
        android:id="@+id/edittext"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/textview_example"
        style="@style/decoratedEditText"/>

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="And I'm a Button"
        app:decorTypefaceAsset="Ubuntu-M.ttf" />

    <ImageView
        android:id="@+id/iv"
        android:layout_width="200dp"
        android:layout_height="140dp"
        android:src="@drawable/tb3"
        app:decorOnTouch="onIvTouch"
        app:decorCircular="true"
        tools:background="@android:color/holo_green_dark"/>

    <ImageView
        android:id="@+id/colorRobot"
        android:layout_width="90dp"
        android:layout_height="90dp"
        android:src="@drawable/ic_launcher"
        app:decorColorFilter="@color/material_blue_grey_800"
        app:decorOnLongClick="onRobotLongClick"/>

    <!--<TextView
        android:id="@+id/tv_with_theme_attr"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="I'm a textview with a decor attribute set in theme attr"/>-->

    <com.mounacheikhna.decor.samples.CustomImageView
        android:id="@+id/customIv"
        android:layout_width="90dp"
        android:layout_height="90dp"
        android:src="@drawable/ic_launcher"
        app:decorColorFilter="@color/material_blue_grey_800"/>

    <ViewStub
        android:id="@+id/stub_with_decor_attr"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout="@layout/stub_with_custom_attributes"/>

</LinearLayout>

================================================
FILE: samples/src/main/res/layout/stub_with_custom_attributes.xml
================================================
<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/text_with_custom_attr"
    app:decorTypefaceAsset="Ubuntu-M.ttf"
    tools:ignore="MissingPrefix"/>


================================================
FILE: samples/src/main/res/layout-v21/api_dependent_layout.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/search"
    android:layout_gravity="center"
    android:layout_width="150dp"
    android:layout_height="24dp"
    android:src="@drawable/search_vector_drawable"
    app:decorAnimateSearch="true"
    tools:showIn="@layout/main_frag" />

================================================
FILE: samples/src/main/res/values/attrs.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>

</resources>


================================================
FILE: samples/src/main/res/values/strings.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_label">Pretty samples</string>
    <string name="textview_example">Hi, I\'m a TextView with a different font</string>
    <string name="text_without_decor_attr">Test stub without decor attribute</string>
    <string name="text_with_custom_attr">Text with decor attribute</string>
</resources>

================================================
FILE: samples/src/main/res/values/styles.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="AppTheme" parent="android:style/Theme.Holo.Light">
        <!--<item name="decorTypefaceAsset">"Ubuntu-M.ttf"</item>-->
    </style>

    <style name="decoratedEditText">
        <item name="decorErrorIcon">@drawable/ic_error_et</item>
        <item name="decorErrorText">"Error"</item>
        <item name="decorTypefaceAsset">"Ubuntu-M.ttf"</item>
    </style>

</resources>

================================================
FILE: settings.gradle
================================================
include ':decor' , ':decorators', ':samples'
Download .txt
gitextract_girl4kdg/

├── .circleci/
│   └── config.yml
├── .gitignore
├── LICENSE
├── NOTICE
├── README.md
├── bors.toml
├── build.gradle
├── decor/
│   ├── .gitignore
│   ├── build.gradle
│   ├── gradle.properties
│   ├── proguard-rules.pro
│   └── src/
│       ├── androidTest/
│       │   └── java/
│       │       └── com/
│       │           └── mounacheikhna/
│       │               └── decor/
│       │                   └── ApplicationTest.java
│       ├── main/
│       │   ├── AndroidManifest.xml
│       │   ├── java/
│       │   │   └── com/
│       │   │       └── mounacheikhna/
│       │   │           └── decor/
│       │   │               ├── AttrsDecorator.java
│       │   │               ├── DecorActivityFactory.java
│       │   │               ├── DecorContextWrapper.java
│       │   │               ├── DecorFactory.java
│       │   │               ├── DecorLayoutInflater.java
│       │   │               ├── Decorator.java
│       │   │               └── ReflectionUtils.java
│       │   └── res/
│       │       ├── layout/
│       │       │   └── test_layout.xml
│       │       └── values/
│       │           ├── attrs.xml
│       │           └── strings.xml
│       └── test/
│           └── java/
│               └── com/
│                   └── mounacheikhna/
│                       └── decor/
│                           ├── AttrsDecoratorTest.java
│                           ├── DecorFactoryTest.java
│                           └── TestAttrsDecorator.java
├── decorators/
│   ├── .gitignore
│   ├── build.gradle
│   ├── gradle.properties
│   ├── proguard-rules.pro
│   └── src/
│       ├── androidTest/
│       │   └── java/
│       │       └── com/
│       │           └── mounacheikhna/
│       │               └── decorators/
│       │                   └── ApplicationTest.java
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           │   └── com/
│           │       └── mounacheikhna/
│           │           └── decorators/
│           │               ├── AutofitDecorator.java
│           │               ├── BlurDecorator.java
│           │               ├── ColorFilterDecorator.java
│           │               ├── Decorators.java
│           │               ├── ErrorDecorator.java
│           │               ├── FontDecorator.java
│           │               ├── OnActionBaseDecorator.java
│           │               ├── OnLongClickDecorator.java
│           │               ├── OnTouchDecorator.java
│           │               ├── ReloadTextDecorator.java
│           │               ├── SearchAnimateDecorator.java
│           │               ├── ShimmerDecorator.java
│           │               └── utils/
│           │                   └── BlurUtils.java
│           └── res/
│               ├── anim-v21/
│               │   ├── anim_bar_fill.xml
│               │   └── anim_search_empty.xml
│               ├── drawable-v21/
│               │   ├── anim_bar_to_search.xml
│               │   ├── anim_search_to_bar.xml
│               │   └── search_vector_drawable.xml
│               └── values/
│                   ├── attrs.xml
│                   ├── integers.xml
│                   └── strings.xml
├── deploy.gradle
├── gradle/
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── samples/
│   ├── build.gradle
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── assets/
│           │   └── ubuntu-font-license-1.0.txt
│           ├── java/
│           │   └── com/
│           │       └── mounacheikhna/
│           │           └── decor/
│           │               └── samples/
│           │                   ├── CustomImageView.java
│           │                   ├── CustomTextView.java
│           │                   ├── SampleActivity.java
│           │                   ├── SampleApp.java
│           │                   ├── SampleFragment.java
│           │                   └── StringReloadableTextView.java
│           └── res/
│               ├── layout/
│               │   ├── api_dependent_layout.xml
│               │   ├── main.xml
│               │   ├── main_frag.xml
│               │   └── stub_with_custom_attributes.xml
│               ├── layout-v21/
│               │   └── api_dependent_layout.xml
│               └── values/
│                   ├── attrs.xml
│                   ├── strings.xml
│                   └── styles.xml
└── settings.gradle
Download .txt
SYMBOL INDEX (151 symbols across 31 files)

FILE: decor/src/androidTest/java/com/mounacheikhna/decor/ApplicationTest.java
  class ApplicationTest (line 9) | public class ApplicationTest extends ApplicationTestCase<Application> {
    method ApplicationTest (line 10) | public ApplicationTest() {

FILE: decor/src/main/java/com/mounacheikhna/decor/AttrsDecorator.java
  class AttrsDecorator (line 17) | public abstract class AttrsDecorator<T extends View> implements Decorator {
    method apply (line 21) | @Override
    method obtainAttributes (line 43) | TypedArray obtainAttributes(Context context, AttributeSet attributeSet) {
    method styleable (line 48) | protected abstract int[] styleable();
    method defStyleAttr (line 50) | protected int defStyleAttr() {
    method clazz (line 59) | protected abstract Class<T> clazz();
    method apply (line 68) | protected abstract void apply(T view, TypedArray typedArray);

FILE: decor/src/main/java/com/mounacheikhna/decor/DecorActivityFactory.java
  type DecorActivityFactory (line 10) | public interface DecorActivityFactory {
    method onActivityCreateView (line 32) | View onActivityCreateView(View parent, View view, String name, Context...

FILE: decor/src/main/java/com/mounacheikhna/decor/DecorContextWrapper.java
  class DecorContextWrapper (line 14) | public class DecorContextWrapper extends ContextWrapper  {
    method DecorContextWrapper (line 22) | public DecorContextWrapper(Context base) {
    method wrap (line 32) | public static DecorContextWrapper wrap(Context base) {
    method with (line 36) | public ContextWrapper with(Decorator... decorators) {
    method getSystemService (line 41) | @Override

FILE: decor/src/main/java/com/mounacheikhna/decor/DecorFactory.java
  class DecorFactory (line 12) | public class DecorFactory {
    method DecorFactory (line 16) | public DecorFactory(Collection<Decorator> decorators) {
    method onViewCreated (line 20) | public View onViewCreated(View view,  String name,  View parent,  Cont...
    method onViewCreated (line 30) | public View onViewCreated(View view, Context context, AttributeSet att...

FILE: decor/src/main/java/com/mounacheikhna/decor/DecorLayoutInflater.java
  class DecorLayoutInflater (line 18) | public class DecorLayoutInflater extends LayoutInflater implements Decor...
    method DecorLayoutInflater (line 30) | protected DecorLayoutInflater(Context context, Collection<Decorator> d...
    method DecorLayoutInflater (line 37) | protected DecorLayoutInflater(LayoutInflater original, Context newCont...
    method cloneInContext (line 44) | @Override
    method initLayoutFactories (line 49) | private void initLayoutFactories(final boolean isCloned) {
    method inflate (line 64) | @Override
    method setPrivateFactoryInternal (line 70) | private void setPrivateFactoryInternal() {
    method setFactory (line 91) | @Override
    method setFactory2 (line 101) | @Override
    method onCreateView (line 117) | @Override
    method onCreateView (line 130) | @Override
    method onActivityCreateView (line 148) | @Override
    class WrapperFactory (line 161) | private static class WrapperFactory implements Factory {
      method WrapperFactory (line 167) | public WrapperFactory(Factory factory, DecorLayoutInflater inflater,...
      method onCreateView (line 173) | @Override
    class WrapperFactory2 (line 194) | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
      method WrapperFactory2 (line 199) | public WrapperFactory2(Factory2 mFactory2, DecorFactory mDecorFactor...
      method onCreateView (line 205) | @Override
      method onCreateView (line 213) | @Override
    class PrivateWrapperFactory2 (line 225) | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
      method PrivateWrapperFactory2 (line 230) | public PrivateWrapperFactory2(Factory2 factory2, DecorLayoutInflater...
      method onCreateView (line 235) | @Override
    method createCustomViewInternal (line 261) | private View createCustomViewInternal(View parent, View view, String n...

FILE: decor/src/main/java/com/mounacheikhna/decor/Decorator.java
  type Decorator (line 11) | public interface Decorator {
    method apply (line 21) | public void apply( View view,  View parent,  String name,  Context con...

FILE: decor/src/main/java/com/mounacheikhna/decor/ReflectionUtils.java
  class ReflectionUtils (line 8) | class ReflectionUtils {
    method getField (line 10) | static Field getField(Class clazz, String fieldName) {
    method getValue (line 20) | static Object getValue(Field field, Object obj) {
    method setValue (line 28) | static void setValue(Field field, Object obj, Object value) {
    method getMethod (line 35) | static Method getMethod(Class clazz, String methodName) {
    method invokeMethod (line 46) | static void invokeMethod(Object object, Method method, Object... args) {

FILE: decor/src/test/java/com/mounacheikhna/decor/AttrsDecoratorTest.java
  class AttrsDecoratorTest (line 35) | @RunWith(RobolectricTestRunner.class)
    method setUp (line 46) | @Before
    method decorNotAppliedOnWidgetOfAnotherType (line 53) | @Test
    method decorNotAppliedOnWidgetButWithoutAttr (line 61) | @Test
    method decorNotAppliedOnWidgetWithAttrWithoutValue (line 69) | @Test
    method decorAppliedWithAttrValue (line 80) | @Test
    method spyWithTypedArray (line 93) | private void spyWithTypedArray(TypedArray typedArray) {
    method mockTypedArray (line 103) | private TypedArray mockTypedArray(int length, boolean valueToReturn) {

FILE: decor/src/test/java/com/mounacheikhna/decor/DecorFactoryTest.java
  class DecorFactoryTest (line 25) | @RunWith(RobolectricTestRunner.class)
    method setUp (line 37) | @Before
    method addDecoratorDoesApplyIt (line 45) | @Test
    method NoDecoratorAppliedToNullView (line 52) | @Test

FILE: decor/src/test/java/com/mounacheikhna/decor/TestAttrsDecorator.java
  class TestAttrsDecorator (line 9) | public class TestAttrsDecorator extends AttrsDecorator<TextView> {
    method styleable (line 13) | @Override
    method clazz (line 23) | @Override
    method apply (line 28) | @Override
    method getDecorStrValue (line 33) | public String getDecorStrValue() {

FILE: decorators/src/androidTest/java/com/mounacheikhna/decorators/ApplicationTest.java
  class ApplicationTest (line 9) | public class ApplicationTest extends ApplicationTestCase<Application> {
    method ApplicationTest (line 10) | public ApplicationTest() {

FILE: decorators/src/main/java/com/mounacheikhna/decorators/AutofitDecorator.java
  class AutofitDecorator (line 24) | public class AutofitDecorator extends AttrsDecorator<TextView> {
    method styleable (line 48) | @Override
    method clazz (line 53) | @Override
    method apply (line 58) | @Override
    method setSizeToFit (line 88) | public void setSizeToFit(boolean sizeToFit) {
    method setRawTextSize (line 93) | private void setRawTextSize(float size) {
    method setRawMinTextSize (line 100) | private void setRawMinTextSize(float minSize) {
    method setPrecision (line 113) | public void setPrecision(float precision) {
    method getPrecision (line 124) | public float getPrecision() {
    method refitText (line 133) | private void refitText() {
    method getTextSize (line 179) | private static float getTextSize(String text, TextPaint paint,
    method setTextSize (line 238) | public void setTextSize(int unit, float size) {
    method getLineCount (line 253) | private static int getLineCount(String text, TextPaint paint, float si...

FILE: decorators/src/main/java/com/mounacheikhna/decorators/BlurDecorator.java
  class BlurDecorator (line 16) | public class BlurDecorator extends AttrsDecorator<View> {
    method styleable (line 18) | @Override
    method clazz (line 23) | @Override
    method apply (line 28) | @Override

FILE: decorators/src/main/java/com/mounacheikhna/decorators/ColorFilterDecorator.java
  class ColorFilterDecorator (line 12) | public class ColorFilterDecorator extends AttrsDecorator<ImageView> {
    method styleable (line 14) | @Override
    method clazz (line 20) | @Override
    method apply (line 25) | @Override

FILE: decorators/src/main/java/com/mounacheikhna/decorators/Decorators.java
  class Decorators (line 12) | public final class Decorators {
    method getAll (line 18) | public static Decorator[] getAll() {

FILE: decorators/src/main/java/com/mounacheikhna/decorators/ErrorDecorator.java
  class ErrorDecorator (line 12) | public class ErrorDecorator extends AttrsDecorator<EditText> {
    method styleable (line 14) | @Override
    method clazz (line 19) | @Override
    method apply (line 24) | @Override

FILE: decorators/src/main/java/com/mounacheikhna/decorators/FontDecorator.java
  class FontDecorator (line 10) | public class FontDecorator extends AttrsDecorator<TextView> {
    method styleable (line 12) | @Override
    method clazz (line 17) | @Override
    method apply (line 27) | @Override

FILE: decorators/src/main/java/com/mounacheikhna/decorators/OnActionBaseDecorator.java
  class OnActionBaseDecorator (line 15) | public abstract class OnActionBaseDecorator extends AttrsDecorator<View> {
    method OnActionBaseDecorator (line 19) | public OnActionBaseDecorator(Activity activity) {
    method clazz (line 23) | @Override
    method onAction (line 28) | protected boolean onAction(String methodName) {

FILE: decorators/src/main/java/com/mounacheikhna/decorators/OnLongClickDecorator.java
  class OnLongClickDecorator (line 11) | public class OnLongClickDecorator extends OnActionBaseDecorator {
    method OnLongClickDecorator (line 13) | public OnLongClickDecorator(Activity activity) {
    method styleable (line 17) | @Override
    method apply (line 22) | @Override

FILE: decorators/src/main/java/com/mounacheikhna/decorators/OnTouchDecorator.java
  class OnTouchDecorator (line 12) | public class OnTouchDecorator extends OnActionBaseDecorator {
    method OnTouchDecorator (line 14) | public OnTouchDecorator(Activity activity) {
    method styleable (line 19) | @Override
    method apply (line 24) | @Override

FILE: decorators/src/main/java/com/mounacheikhna/decorators/ReloadTextDecorator.java
  class ReloadTextDecorator (line 10) | public class ReloadTextDecorator extends AttrsDecorator<TextView> {
    method styleable (line 12) | @Override
    method clazz (line 17) | @Override
    method apply (line 22) | @Override

FILE: decorators/src/main/java/com/mounacheikhna/decorators/SearchAnimateDecorator.java
  class SearchAnimateDecorator (line 17) | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    method styleable (line 29) | @Override
    method clazz (line 34) | @Override
    method apply (line 39) | @Override
    method animate (line 62) | @TargetApi(Build.VERSION_CODES.LOLLIPOP)

FILE: decorators/src/main/java/com/mounacheikhna/decorators/ShimmerDecorator.java
  class ShimmerDecorator (line 11) | public class ShimmerDecorator extends AttrsDecorator<TextView> {
    method styleable (line 13) | @Override
    method clazz (line 18) | @Override
    method apply (line 23) | @Override

FILE: decorators/src/main/java/com/mounacheikhna/decorators/utils/BlurUtils.java
  class BlurUtils (line 15) | public class BlurUtils {
    method blurBitmap (line 19) | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    method blurBitmap (line 27) | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)

FILE: samples/src/main/java/com/mounacheikhna/decor/samples/CustomImageView.java
  class CustomImageView (line 12) | public class CustomImageView extends ImageView {
    method CustomImageView (line 14) | public CustomImageView(Context context) {
    method CustomImageView (line 18) | public CustomImageView(Context context, AttributeSet attrs) {
    method CustomImageView (line 22) | public CustomImageView(Context context, AttributeSet attrs, int defSty...
    method CustomImageView (line 26) | @TargetApi(Build.VERSION_CODES.LOLLIPOP)

FILE: samples/src/main/java/com/mounacheikhna/decor/samples/CustomTextView.java
  class CustomTextView (line 7) | public class CustomTextView extends TextView {
    method CustomTextView (line 9) | public CustomTextView(Context context) {
    method CustomTextView (line 13) | public CustomTextView(Context context, AttributeSet attrs) {
    method CustomTextView (line 17) | public CustomTextView(Context context, AttributeSet attrs, int defStyl...

FILE: samples/src/main/java/com/mounacheikhna/decor/samples/SampleActivity.java
  class SampleActivity (line 11) | public class SampleActivity extends FragmentActivity /*ActionBarActivity...
    method onCreate (line 13) | @Override
    method onIvTouch (line 19) | public void onIvTouch() {
    method onRobotLongClick (line 23) | public void onRobotLongClick() {
    method attachBaseContext (line 27) | @Override

FILE: samples/src/main/java/com/mounacheikhna/decor/samples/SampleApp.java
  class SampleApp (line 8) | public class SampleApp extends Application {
    method attachBaseContext (line 10) | @Override

FILE: samples/src/main/java/com/mounacheikhna/decor/samples/SampleFragment.java
  class SampleFragment (line 10) | public class SampleFragment extends Fragment /*android.app.Fragment*/ {
    method onCreateView (line 12) | @Override

FILE: samples/src/main/java/com/mounacheikhna/decor/samples/StringReloadableTextView.java
  class StringReloadableTextView (line 10) | public class StringReloadableTextView extends TextView {
    method StringReloadableTextView (line 12) | public StringReloadableTextView(Context context) {
    method StringReloadableTextView (line 16) | public StringReloadableTextView(Context context, AttributeSet attrs) {
    method StringReloadableTextView (line 20) | public StringReloadableTextView(Context context, AttributeSet attrs, i...
Condensed preview — 77 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (116K chars).
[
  {
    "path": ".circleci/config.yml",
    "chars": 652,
    "preview": "version: 2\njobs:\n  build:\n    docker:\n      - image: circleci/android:api-28\n\n    working_directory: ~/repo\n\n    environ"
  },
  {
    "path": ".gitignore",
    "chars": 481,
    "preview": "# 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/\n"
  },
  {
    "path": "LICENSE",
    "chars": 11358,
    "preview": "\n                                 Apache License\n                           Version 2.0, January 2004\n                  "
  },
  {
    "path": "NOTICE",
    "chars": 215,
    "preview": "Decor\nCopyright 2015 Apache License Version 2.0\n\nThis project includes Code from Pretty, written by Madis Pink,The code "
  },
  {
    "path": "README.md",
    "chars": 4943,
    "preview": "Decor\n======\n\n<a href='http://android-arsenal.com/details/1/1773'><img src='https://img.shields.io/badge/Android%20Arsen"
  },
  {
    "path": "bors.toml",
    "chars": 79,
    "preview": "status = [\n  \"ci/circleci: build\"\n]\nrequired_approvals = 0\ntimeout_sec = 14400\n"
  },
  {
    "path": "build.gradle",
    "chars": 627,
    "preview": "\nbuildscript {\n    repositories {\n        jcenter()\n        mavenCentral()\n        google()\n        maven {\n            "
  },
  {
    "path": "decor/.gitignore",
    "chars": 7,
    "preview": "/build\n"
  },
  {
    "path": "decor/build.gradle",
    "chars": 1565,
    "preview": "//apply plugin: \"android-sdk-manager\"\napply plugin: 'com.android.library'\n\nandroid {\n\n    compileSdkVersion Integer.pars"
  },
  {
    "path": "decor/gradle.properties",
    "chars": 153,
    "preview": "# SubProject Library Gradle Properties\n# See parent properties for global properties\n\nPOM_NAME=Decor Main Library\nPOM_AR"
  },
  {
    "path": "decor/proguard-rules.pro",
    "chars": 666,
    "preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /U"
  },
  {
    "path": "decor/src/androidTest/java/com/mounacheikhna/decor/ApplicationTest.java",
    "chars": 354,
    "preview": "package com.mounacheikhna.decor;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * <a hr"
  },
  {
    "path": "decor/src/main/AndroidManifest.xml",
    "chars": 232,
    "preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.mounacheikhna.decor\">\n\n    <applic"
  },
  {
    "path": "decor/src/main/java/com/mounacheikhna/decor/AttrsDecorator.java",
    "chars": 2495,
    "preview": "package com.mounacheikhna.decor;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport android."
  },
  {
    "path": "decor/src/main/java/com/mounacheikhna/decor/DecorActivityFactory.java",
    "chars": 1402,
    "preview": "package com.mounacheikhna.decor;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.view."
  },
  {
    "path": "decor/src/main/java/com/mounacheikhna/decor/DecorContextWrapper.java",
    "chars": 1355,
    "preview": "package com.mounacheikhna.decor;\n\nimport android.content.Context;\nimport android.content.ContextWrapper;\nimport android."
  },
  {
    "path": "decor/src/main/java/com/mounacheikhna/decor/DecorFactory.java",
    "chars": 834,
    "preview": "package com.mounacheikhna.decor;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.view."
  },
  {
    "path": "decor/src/main/java/com/mounacheikhna/decor/DecorLayoutInflater.java",
    "chars": 11468,
    "preview": "package com.mounacheikhna.decor;\n\nimport android.annotation.TargetApi;\nimport android.content.Context;\nimport android.os"
  },
  {
    "path": "decor/src/main/java/com/mounacheikhna/decor/Decorator.java",
    "chars": 808,
    "preview": "package com.mounacheikhna.decor;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.view."
  },
  {
    "path": "decor/src/main/java/com/mounacheikhna/decor/ReflectionUtils.java",
    "chars": 1543,
    "preview": "package com.mounacheikhna.decor;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.InvocationTargetException;\nim"
  },
  {
    "path": "decor/src/main/res/layout/test_layout.xml",
    "chars": 307,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<TextView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:ap"
  },
  {
    "path": "decor/src/main/res/values/attrs.xml",
    "chars": 183,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <declare-styleable name=\"DecorExample\">\n        <attr name=\"decor"
  },
  {
    "path": "decor/src/main/res/values/strings.xml",
    "chars": 68,
    "preview": "<resources>\n    <string name=\"app_name\">Decor</string>\n</resources>\n"
  },
  {
    "path": "decor/src/test/java/com/mounacheikhna/decor/AttrsDecoratorTest.java",
    "chars": 4219,
    "preview": "package com.mounacheikhna.decor;\n\nimport android.content.Context;\nimport android.content.res.Resources;\nimport android.c"
  },
  {
    "path": "decor/src/test/java/com/mounacheikhna/decor/DecorFactoryTest.java",
    "chars": 1688,
    "preview": "package com.mounacheikhna.decor;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.view."
  },
  {
    "path": "decor/src/test/java/com/mounacheikhna/decor/TestAttrsDecorator.java",
    "chars": 792,
    "preview": "package com.mounacheikhna.decor;\n\nimport android.content.res.TypedArray;\nimport android.widget.TextView;\n\n/**\n * Created"
  },
  {
    "path": "decorators/.gitignore",
    "chars": 7,
    "preview": "/build\n"
  },
  {
    "path": "decorators/build.gradle",
    "chars": 1071,
    "preview": "//apply plugin: \"android-sdk-manager\"\napply plugin: 'com.android.library'\n\nandroid {\n\n    compileSdkVersion Integer.pars"
  },
  {
    "path": "decorators/gradle.properties",
    "chars": 74,
    "preview": "\nPOM_NAME=Decor's Decorators\nPOM_ARTIFACT_ID=decorators\nPOM_PACKAGING=aar\n"
  },
  {
    "path": "decorators/proguard-rules.pro",
    "chars": 666,
    "preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /U"
  },
  {
    "path": "decorators/src/androidTest/java/com/mounacheikhna/decorators/ApplicationTest.java",
    "chars": 359,
    "preview": "package com.mounacheikhna.decorators;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * "
  },
  {
    "path": "decorators/src/main/AndroidManifest.xml",
    "chars": 225,
    "preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.mounacheikhna.decorators\">\n\n    <a"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/AutofitDecorator.java",
    "chars": 8651,
    "preview": "package com.mounacheikhna.decorators;\n\n/**\n * Created by cheikhna on 09/04/2015.\n */\n\nimport android.content.Context;\nim"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/BlurDecorator.java",
    "chars": 2031,
    "preview": "package com.mounacheikhna.decorators;\n\nimport android.content.res.TypedArray;\nimport android.os.Build;\nimport android.vi"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/ColorFilterDecorator.java",
    "chars": 737,
    "preview": "package com.mounacheikhna.decorators;\n\nimport android.content.res.TypedArray;\nimport android.widget.ImageView;\n\nimport c"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/Decorators.java",
    "chars": 644,
    "preview": "package com.mounacheikhna.decorators;\n\nimport com.mounacheikhna.decor.Decorator;\n\n/**\n * Created by cheikhna on 11/04/20"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/ErrorDecorator.java",
    "chars": 828,
    "preview": "package com.mounacheikhna.decorators;\n\nimport android.content.res.TypedArray;\nimport android.graphics.drawable.Drawable;"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/FontDecorator.java",
    "chars": 889,
    "preview": "package com.mounacheikhna.decorators;\n\nimport android.content.res.TypedArray;\nimport android.graphics.Typeface;\nimport a"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/OnActionBaseDecorator.java",
    "chars": 1410,
    "preview": "package com.mounacheikhna.decorators;\n\nimport android.app.Activity;\nimport android.view.View;\n\nimport com.mounacheikhna."
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/OnLongClickDecorator.java",
    "chars": 861,
    "preview": "package com.mounacheikhna.decorators;\n\nimport android.app.Activity;\nimport android.content.res.TypedArray;\nimport androi"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/OnTouchDecorator.java",
    "chars": 856,
    "preview": "package com.mounacheikhna.decorators;\n\nimport android.app.Activity;\nimport android.content.res.TypedArray;\nimport androi"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/ReloadTextDecorator.java",
    "chars": 906,
    "preview": "package com.mounacheikhna.decorators;\n\nimport android.content.res.TypedArray;\nimport android.widget.TextView;\nimport com"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/SearchAnimateDecorator.java",
    "chars": 2958,
    "preview": "package com.mounacheikhna.decorators;\n\nimport android.annotation.TargetApi;\nimport android.content.res.TypedArray;\nimpor"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/ShimmerDecorator.java",
    "chars": 582,
    "preview": "package com.mounacheikhna.decorators;\n\nimport android.content.res.TypedArray;\nimport android.widget.TextView;\n\nimport co"
  },
  {
    "path": "decorators/src/main/java/com/mounacheikhna/decorators/utils/BlurUtils.java",
    "chars": 1762,
    "preview": "package com.mounacheikhna.decorators.utils;\n\nimport android.annotation.TargetApi;\nimport android.content.Context;\nimport"
  },
  {
    "path": "decorators/src/main/res/anim-v21/anim_bar_fill.xml",
    "chars": 358,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<objectAnimator\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n  "
  },
  {
    "path": "decorators/src/main/res/anim-v21/anim_search_empty.xml",
    "chars": 359,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<objectAnimator\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n  "
  },
  {
    "path": "decorators/src/main/res/drawable-v21/anim_bar_to_search.xml",
    "chars": 395,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<animated-vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    a"
  },
  {
    "path": "decorators/src/main/res/drawable-v21/anim_search_to_bar.xml",
    "chars": 385,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<animated-vector\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
  },
  {
    "path": "decorators/src/main/res/drawable-v21/search_vector_drawable.xml",
    "chars": 688,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:wi"
  },
  {
    "path": "decorators/src/main/res/values/attrs.xml",
    "chars": 2230,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <!-- all attributes here prefixed with decor to avoid conflicts "
  },
  {
    "path": "decorators/src/main/res/values/integers.xml",
    "chars": 160,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <integer name=\"duration_bar\">800</integer>\n    <integer name=\"dur"
  },
  {
    "path": "decorators/src/main/res/values/strings.xml",
    "chars": 149,
    "preview": "<resources>\n    <string name=\"app_name\">Decorators</string>\n    <string name=\"path_search\">\"M141,17 A9,9 0 1,1 142,16 L1"
  },
  {
    "path": "deploy.gradle",
    "chars": 2943,
    "preview": "\napply plugin: 'maven'\napply plugin: 'signing'\n\n\ndef isReleaseBuild() {\n    return VERSION_NAME.contains(\"SNAPSHOT\") == "
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "chars": 232,
    "preview": "#Mon Jan 26 23:14:25 CET 2015\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_"
  },
  {
    "path": "gradle.properties",
    "chars": 1715,
    "preview": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Settings specified in this file will override any "
  },
  {
    "path": "gradlew",
    "chars": 5080,
    "preview": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start "
  },
  {
    "path": "gradlew.bat",
    "chars": 2404,
    "preview": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@r"
  },
  {
    "path": "samples/build.gradle",
    "chars": 689,
    "preview": "//apply plugin: \"android-sdk-manager\"\napply plugin: 'com.android.application'\n\nrepositories {\n    mavenCentral()\n}\n\n\nand"
  },
  {
    "path": "samples/src/main/AndroidManifest.xml",
    "chars": 711,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n          pa"
  },
  {
    "path": "samples/src/main/assets/ubuntu-font-license-1.0.txt",
    "chars": 4585,
    "preview": "Version 1.0\n\nPreamble\n\nThis licence allows the licensed fonts to be used, studied, modified and redistributed freely. Th"
  },
  {
    "path": "samples/src/main/java/com/mounacheikhna/decor/samples/CustomImageView.java",
    "chars": 830,
    "preview": "package com.mounacheikhna.decor.samples;\n\nimport android.annotation.TargetApi;\nimport android.content.Context;\nimport an"
  },
  {
    "path": "samples/src/main/java/com/mounacheikhna/decor/samples/CustomTextView.java",
    "chars": 497,
    "preview": "package com.mounacheikhna.decor.samples;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport andro"
  },
  {
    "path": "samples/src/main/java/com/mounacheikhna/decor/samples/SampleActivity.java",
    "chars": 960,
    "preview": "package com.mounacheikhna.decor.samples;\n\nimport android.content.Context;\nimport android.os.Bundle;\nimport android.suppo"
  },
  {
    "path": "samples/src/main/java/com/mounacheikhna/decor/samples/SampleApp.java",
    "chars": 425,
    "preview": "package com.mounacheikhna.decor.samples;\n\nimport android.app.Application;\nimport android.content.Context;\nimport com.mou"
  },
  {
    "path": "samples/src/main/java/com/mounacheikhna/decor/samples/SampleFragment.java",
    "chars": 665,
    "preview": "package com.mounacheikhna.decor.samples;\n\nimport android.os.Bundle;\nimport android.support.v4.app.Fragment;\nimport andro"
  },
  {
    "path": "samples/src/main/java/com/mounacheikhna/decor/samples/StringReloadableTextView.java",
    "chars": 593,
    "preview": "package com.mounacheikhna.decor.samples;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport andro"
  },
  {
    "path": "samples/src/main/res/layout/api_dependent_layout.xml",
    "chars": 48,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<merge />"
  },
  {
    "path": "samples/src/main/res/layout/main.xml",
    "chars": 519,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<FrameLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    "
  },
  {
    "path": "samples/src/main/res/layout/main_frag.xml",
    "chars": 2403,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmln"
  },
  {
    "path": "samples/src/main/res/layout/stub_with_custom_attributes.xml",
    "chars": 387,
    "preview": "<TextView\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/r"
  },
  {
    "path": "samples/src/main/res/layout-v21/api_dependent_layout.xml",
    "chars": 471,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ImageView xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:android="
  },
  {
    "path": "samples/src/main/res/values/attrs.xml",
    "chars": 65,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n</resources>\n"
  },
  {
    "path": "samples/src/main/res/values/strings.xml",
    "chars": 365,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <string name=\"app_label\">Pretty samples</string>\n    <string name"
  },
  {
    "path": "samples/src/main/res/values/styles.xml",
    "chars": 444,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <style name=\"AppTheme\" parent=\"android:style/Theme.Holo.Light\">\n"
  },
  {
    "path": "settings.gradle",
    "chars": 45,
    "preview": "include ':decor' , ':decorators', ':samples'\n"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the chemouna/Decor GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 77 files (103.3 KB), approximately 26.4k tokens, and a symbol index with 151 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!