[
  {
    "path": ".gitignore",
    "content": "*.iml\n.gradle\n/local.properties\n.DS_Store\n/captures\n.externalNativeBuild\n\n!gradle-wrapper.jar\n# Generated files\nbin/\ngen/\nout/\n\n# Gradle files\nbuild/\n\n# Local configuration file (sdk path, etc)\n/.idea/\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2017 ihsan BAL\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "Wiv\n--------\n\n[![CircleCI](https://circleci.com/gh/ihsanbal/Wiv/tree/master.svg?style=svg)](https://circleci.com/gh/ihsanbal/Wiv/tree/master)\n![API](https://img.shields.io/badge/API-16%2B-brightgreen.svg?style=square)\n\nLibrary of [Tweet-ui](https://docs.fabric.io/android/twitter/tweet-ui.html) TweetMediaView component.\n\n<p align=\"center\">\n    <img src=\"https://github.com/ihsanbal/Wiv/blob/master/resources/logo.jpg\" width=\"300\" height=\"300\"/>\n</p>\n\nUsage\n--------\n\n```java\n\nMediaView mediaView;\nArrayList<String> medias;\n\n//medias.add(\"http://datalook.io/app/uploads/NY.jpg\");\nmediaView.setOnMediaClickListener(new MediaView.OnMediaClickListener() {\n    @Override\n    public void onMediaClick(View view, int index) {\n        Snackbar.make(view, \"onClickIndex :\" + index, Snackbar.LENGTH_LONG).show();\n    }\n});\nmediaView.setMedias(medias);\n```\n\n```xml\n<com.ihsanbal.wiv.AspectRatioLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:layout_marginTop=\"?attr/actionBarSize\"\n        app:aspect_ratio=\"1\"\n        app:dimension_to_adjust=\"height\">\n\n        <com.ihsanbal.wiv.MediaView\n            android:id=\"@+id/media.view\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_margin=\"14dp\"\n            app:background_color=\"@android:color/white\"\n            app:corner_radii=\"15dp\"\n            app:divider_size=\"2dp\" />\n\n</com.ihsanbal.wiv.AspectRatioLayout>\n```\n\nDownload\n--------\n\nGradle:\n```groovy\nallprojects {\n\trepositories {\n\t\t...\n\t\tmaven { url 'https://jitpack.io' }\n\t}\n}\n\ndependencies {\n\tcompile 'com.github.ihsanbal:Wiv:1.0.0'\n}\n```\n\nMaven:\n```xml\n<repository>\n   <id>jitpack.io</id>\n   <url>https://jitpack.io</url>\n</repository>\n\n<dependency>\n   <groupId>com.github.ihsanbal</groupId>\n   <artifactId>Wiv</artifactId>\n   <version>1.0.0</version>\n</dependency>\n```\n\nScreenshots\n--------\n\n<p align=\"center\">\n    <img src=\"https://github.com/ihsanbal/Wiv/blob/master/resources/device-2017-05-31-144323.png\" width=\"280\" height=\"500\"/>\n    <img src=\"https://github.com/ihsanbal/Wiv/blob/master/resources/device-2017-05-31-144237.png\" width=\"280\" height=\"500\"/>\n    <img src=\"https://github.com/ihsanbal/Wiv/blob/master/resources/device-2017-05-31-144107.png\" width=\"280\" height=\"500\"/>\n</p>\n"
  },
  {
    "path": "app/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "app/build.gradle",
    "content": "apply plugin: 'com.android.application'\n\nandroid {\n    compileSdkVersion 25\n    //noinspection GradleDependency\n    buildToolsVersion \"25.0.1\"\n    defaultConfig {\n        applicationId \"ihsanbal.com.wiv\"\n        minSdkVersion 16\n        targetSdkVersion 25\n        versionCode 1\n        versionName \"1.0.0\"\n        testInstrumentationRunner \"android.support.test.runner.AndroidJUnitRunner\"\n    }\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n}\n\ndependencies {\n    compile fileTree(dir: 'libs', include: ['*.jar'])\n    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {\n        exclude group: 'com.android.support', module: 'support-annotations'\n    })\n    compile 'com.android.support:appcompat-v7:25.3.1'\n    compile 'com.android.support:design:25.3.1'\n\n//    compile project(':library')\n    compile 'com.github.ihsanbal:Wiv:1.0.0'\n    testCompile 'junit:junit:4.12'\n}\n"
  },
  {
    "path": "app/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /Users/ihsan/Library/Android/sdk/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n\n# Uncomment this to preserve the line number information for\n# debugging stack traces.\n#-keepattributes SourceFile,LineNumberTable\n\n# If you keep the line number information, uncomment this to\n# hide the original source file name.\n#-renamesourcefileattribute SourceFile\n"
  },
  {
    "path": "app/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"ihsanbal.com.wiv\">\n\n    <uses-permission android:name=\"android.permission.INTERNET\"/>\n\n    <application\n        android:allowBackup=\"true\"\n        android:icon=\"@mipmap/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:roundIcon=\"@mipmap/ic_launcher_round\"\n        android:supportsRtl=\"true\"\n        android:theme=\"@style/AppTheme\">\n        <activity\n            android:name=\".MainActivity\"\n            android:label=\"@string/app_name\"\n            android:theme=\"@style/AppTheme.NoActionBar\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n        </activity>\n    </application>\n\n</manifest>"
  },
  {
    "path": "app/src/main/java/ihsanbal/com/wiv/MainActivity.java",
    "content": "package ihsanbal.com.wiv;\n\nimport android.os.Bundle;\nimport android.support.design.widget.FloatingActionButton;\nimport android.support.design.widget.Snackbar;\nimport android.support.v7.app.AppCompatActivity;\nimport android.support.v7.widget.Toolbar;\nimport android.view.View;\n\nimport com.ihsanbal.wiv.MediaView;\n\nimport java.util.ArrayList;\n\npublic class MainActivity extends AppCompatActivity {\n\n    private ArrayList<String> medias = new ArrayList<>();\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);\n        setSupportActionBar(toolbar);\n        MediaView mediaView = (MediaView) findViewById(R.id.media_view);\n        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);\n        fab.setOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View view) {\n\n            }\n        });\n\n        medias.add(\"http://datalook.io/app/uploads/NY.jpg\");\n        medias.add(\"https://wallpaperbrowse.com/media/images/High-Definition-Ultra-HD-Wallpaper.jpg\");\n        medias.add(\"https://static.pexels.com/photos/17679/pexels-photo.jpg\");\n        mediaView.setOnMediaClickListener(new MediaView.OnMediaClickListener() {\n            @Override\n            public void onMediaClick(View view, int index) {\n                Snackbar.make(view, \"onClickIndex :\" + index, Snackbar.LENGTH_LONG).show();\n            }\n        });\n        mediaView.setMedias(medias);\n    }\n\n}\n"
  },
  {
    "path": "app/src/main/res/layout/activity_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<android.support.design.widget.CoordinatorLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:background=\"@android:color/white\"\n    tools:context=\"ihsanbal.com.wiv.MainActivity\">\n\n    <android.support.design.widget.AppBarLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:theme=\"@style/AppTheme.AppBarOverlay\">\n\n        <android.support.v7.widget.Toolbar\n            android:id=\"@+id/toolbar\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"?attr/actionBarSize\"\n            android:background=\"?attr/colorPrimary\"\n            app:popupTheme=\"@style/AppTheme.PopupOverlay\" />\n\n    </android.support.design.widget.AppBarLayout>\n\n    <com.ihsanbal.wiv.AspectRatioLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:layout_marginTop=\"?attr/actionBarSize\"\n        app:aspect_ratio=\"1\"\n        app:dimension_to_adjust=\"height\">\n\n        <com.ihsanbal.wiv.MediaView\n            android:id=\"@+id/media.view\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_margin=\"14dp\"\n            app:background_color=\"@android:color/white\"\n            app:corner_radii=\"15dp\"\n            app:divider_size=\"2dp\" />\n\n    </com.ihsanbal.wiv.AspectRatioLayout>\n\n    <android.support.design.widget.FloatingActionButton\n        android:id=\"@+id/fab\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_gravity=\"bottom|end\"\n        android:layout_margin=\"@dimen/fab_margin\"\n        app:srcCompat=\"@android:drawable/ic_dialog_email\" />\n\n</android.support.design.widget.CoordinatorLayout>\n"
  },
  {
    "path": "app/src/main/res/menu/menu_main.xml",
    "content": "<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    tools:context=\"ihsanbal.com.wiv.MainActivity\">\n    <item\n        android:id=\"@+id/action_settings\"\n        android:orderInCategory=\"100\"\n        android:title=\"@string/action_settings\"\n        app:showAsAction=\"never\" />\n</menu>\n"
  },
  {
    "path": "app/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"colorPrimary\">#3F51B5</color>\n    <color name=\"colorPrimaryDark\">#303F9F</color>\n    <color name=\"colorAccent\">#FF4081</color>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/dimens.xml",
    "content": "<resources>\n    <dimen name=\"fab_margin\">16dp</dimen>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">Wiv</string>\n    <string name=\"action_settings\">Settings</string>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/styles.xml",
    "content": "<resources>\n\n    <!-- Base application theme. -->\n    <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar\">\n        <!-- Customize your theme here. -->\n        <item name=\"colorPrimary\">@color/colorPrimary</item>\n        <item name=\"colorPrimaryDark\">@color/colorPrimaryDark</item>\n        <item name=\"colorAccent\">@color/colorAccent</item>\n    </style>\n\n    <style name=\"AppTheme.NoActionBar\">\n        <item name=\"windowActionBar\">false</item>\n        <item name=\"windowNoTitle\">true</item>\n    </style>\n\n    <style name=\"AppTheme.AppBarOverlay\" parent=\"ThemeOverlay.AppCompat.Dark.ActionBar\" />\n\n    <style name=\"AppTheme.PopupOverlay\" parent=\"ThemeOverlay.AppCompat.Light\" />\n\n</resources>\n"
  },
  {
    "path": "build.gradle",
    "content": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n    repositories {\n        jcenter()\n    }\n    dependencies {\n        classpath 'com.android.tools.build:gradle:2.3.0'\n\n        // NOTE: Do not place your application dependencies here; they belong\n        // in the individual module build.gradle files\n    }\n}\n\nallprojects {\n    repositories {\n        maven { url 'https://jitpack.io' }\n        jcenter()\n    }\n}\n\ntask clean(type: Delete) {\n    delete rootProject.buildDir\n}\n"
  },
  {
    "path": "circle.yml",
    "content": "machine:\n    environment:\n        ANDROID_HOME: /usr/local/android-sdk-linux\n    java:\n        version: oraclejdk8\n\ndependencies:\n  pre:\n    - echo y | android update sdk --no-ui --all --filter tools,platform-tools,build-tools-25.0.1,android-25,extra-google-m2repository,extra-google-google_play_services,extra-android-support,extra-android-m2repository\n  override:\n    - ./gradlew dependencies --daemon\n\ntest:\n  override:\n    - ./gradlew test\n\ndeployment:\n   testing:\n      branch: [development, master]\n      commands:\n       - ./gradlew assembleRelease"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "#Wed May 31 11:42:20 EEST 2017\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-3.3-all.zip\n"
  },
  {
    "path": "gradle.properties",
    "content": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will override*\n# any settings specified in this file.\n\n# For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/build_environment.html\n\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\norg.gradle.jvmargs=-Xmx1536m\n\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\n# org.gradle.parallel=true\n"
  },
  {
    "path": "gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto init\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto init\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:init\n@rem Get command-line arguments, handling Windowz variants\n\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\n\n:win9xME_args\n@rem Slurp the command line arguments.\nset CMD_LINE_ARGS=\nset _SKIP=2\n\n:win9xME_args_slurp\nif \"x%~1\" == \"x\" goto execute\n\nset CMD_LINE_ARGS=%*\ngoto execute\n\n:4NT_args\n@rem Get arguments from the 4NT Shell from JP Software\nset CMD_LINE_ARGS=%$\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "library/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "library/build.gradle",
    "content": "apply plugin: 'com.android.library'\n\nandroid {\n    compileSdkVersion 25\n    //noinspection GradleDependency\n    buildToolsVersion \"25.0.1\"\n\n    defaultConfig {\n        minSdkVersion 16\n        targetSdkVersion 25\n        versionCode 1\n        versionName \"1.0\"\n    }\n\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n}\n\ndependencies {\n    compile fileTree(dir: 'libs', include: ['*.jar'])\n\n    compile 'com.squareup.picasso:picasso:2.5.2'\n}\n"
  },
  {
    "path": "library/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /Users/ihsan/Library/Android/sdk/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n\n# Uncomment this to preserve the line number information for\n# debugging stack traces.\n#-keepattributes SourceFile,LineNumberTable\n\n# If you keep the line number information, uncomment this to\n# hide the original source file name.\n#-renamesourcefileattribute SourceFile\n"
  },
  {
    "path": "library/src/main/AndroidManifest.xml",
    "content": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n\n    package=\"com.ihsanbal.wiv\">\n\n    <application android:allowBackup=\"true\" android:label=\"@string/app_name\"\n        android:supportsRtl=\"true\">\n\n    </application>\n\n</manifest>\n"
  },
  {
    "path": "library/src/main/java/com/ihsanbal/wiv/AspectRatioLayout.java",
    "content": "package com.ihsanbal.wiv;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport android.util.AttributeSet;\nimport android.view.View;\nimport android.widget.FrameLayout;\n\n/**\n * @author ihsan on 31/05/2017.\n */\npublic class AspectRatioLayout extends FrameLayout {\n\n    private static final float DEFAULT_ASPECT_RATIO = 1.0f;\n    private static final int DEFAULT_ADJUST_DIMENSION = 0;\n\n    static final int ADJUST_DIMENSION_HEIGHT = 0;\n\n    protected double aspectRatio;\n    private int dimensionToAdjust;\n\n    public AspectRatioLayout(Context context) {\n        this(context, null);\n    }\n\n    public AspectRatioLayout(Context context, AttributeSet attrs) {\n        this(context, attrs, 0);\n    }\n\n    public AspectRatioLayout(Context context, AttributeSet attrs, int defStyle) {\n        super(context, attrs, defStyle);\n        initAttributes(attrs, defStyle);\n    }\n\n    private void initAttributes(AttributeSet attrs, int styleResId) {\n        final TypedArray a = getContext().getTheme().obtainStyledAttributes(attrs,\n                R.styleable.AspectRatioLayout, styleResId, 0);\n        try {\n            aspectRatio = a.getFloat(\n                    R.styleable.AspectRatioLayout_aspect_ratio,\n                    DEFAULT_ASPECT_RATIO);\n            dimensionToAdjust = a.getInt(\n                    R.styleable.AspectRatioLayout_dimension_to_adjust,\n                    DEFAULT_ADJUST_DIMENSION);\n        } finally {\n            a.recycle();\n        }\n    }\n\n    @Override\n    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {\n        int width, height;\n        final int horizontalPadding = getPaddingLeft() + getPaddingRight();\n        final int verticalPadding = getPaddingBottom() + getPaddingTop();\n\n        if (dimensionToAdjust == ADJUST_DIMENSION_HEIGHT) {\n            if (View.MeasureSpec.getMode(widthMeasureSpec) == View.MeasureSpec.EXACTLY) {\n                width = View.MeasureSpec.getSize(widthMeasureSpec) - horizontalPadding;\n            } else {\n                super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n                width = getMeasuredWidth() - horizontalPadding;\n            }\n            height = (int) (width / aspectRatio);\n        } else {\n            if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.EXACTLY) {\n                height = MeasureSpec.getSize(heightMeasureSpec) - verticalPadding;\n            } else {\n                super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n                height = getMeasuredHeight() - verticalPadding;\n            }\n            width = (int) (height * aspectRatio);\n        }\n\n        super.onMeasure(\n                View.MeasureSpec.makeMeasureSpec(width + horizontalPadding, View.MeasureSpec.EXACTLY),\n                View.MeasureSpec.makeMeasureSpec(height + verticalPadding, View.MeasureSpec.EXACTLY));\n    }\n}\n"
  },
  {
    "path": "library/src/main/java/com/ihsanbal/wiv/MediaView.java",
    "content": "package com.ihsanbal.wiv;\n\nimport android.annotation.SuppressLint;\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport android.graphics.Canvas;\nimport android.graphics.Color;\nimport android.graphics.Path;\nimport android.graphics.RectF;\nimport android.os.Build;\nimport android.text.TextUtils;\nimport android.util.AttributeSet;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.ImageView;\n\nimport com.squareup.picasso.Picasso;\n\nimport java.lang.ref.WeakReference;\nimport java.util.Collections;\nimport java.util.List;\n\npublic class MediaView extends ViewGroup implements View.OnClickListener {\n\n    static final int MAX_IMAGE_VIEW_COUNT = 4;\n    private static final CharSequence CONTENT_DESC = \"content_description\";\n\n    private static final int DEFAULT_DIVIDER_SIZE = 2;\n    private static final int DEFAULT_CORNER_RADII = 5;\n\n    private final OverlayImageView[] imageViews = new OverlayImageView[MAX_IMAGE_VIEW_COUNT];\n    private Picasso imageLoader;\n    private List<String> mediaEntities = Collections.emptyList();\n    private final Path path = new Path();\n    private final RectF rect = new RectF();\n    private int mediaDividerSize;\n    private int imageCount;\n    final float[] radii = new float[8];\n    int mediaBgColor;\n    int photoErrorResId;\n\n    boolean internalRoundedCornersEnabled;\n    private OnMediaClickListener onMediaClickListener;\n    private int roundedCornersRadii;\n\n    public MediaView(Context context) {\n        this(context, null);\n    }\n\n    public MediaView(Context context, AttributeSet attrs) {\n        this(context, attrs, 0);\n    }\n\n    public MediaView(Context context, AttributeSet attrs, int defStyle) {\n        super(context, attrs, defStyle);\n        if (!isInEditMode())\n            initAttributes(attrs, defStyle, Picasso.with(context));\n    }\n\n    private void initAttributes(AttributeSet attrs, int defStyle, Picasso loader) {\n        this.imageLoader = loader;\n        final TypedArray a = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.MediaView, defStyle, 0);\n        try {\n            roundedCornersRadii = a.getDimensionPixelSize(R.styleable.MediaView_corner_radii, DEFAULT_CORNER_RADII);\n            mediaDividerSize = a.getDimensionPixelSize(R.styleable.MediaView_divider_size, DEFAULT_DIVIDER_SIZE);\n            photoErrorResId = a.getResourceId(R.styleable.MediaView_place_holder, R.drawable.ic_place_holder);\n            mediaBgColor = a.getColor(R.styleable.MediaView_background_color, Color.WHITE);\n        } finally {\n            a.recycle();\n        }\n    }\n\n    public void setRoundedCornersRadii(int radii) {\n        this.radii[0] = radii;\n        this.radii[1] = radii;\n        this.radii[2] = radii;\n        this.radii[3] = radii;\n        this.radii[4] = radii;\n        this.radii[5] = radii;\n        this.radii[6] = radii;\n        this.radii[7] = radii;\n        requestLayout();\n    }\n\n    @Override\n    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {\n        if (imageCount > 0) {\n            layoutImages();\n        }\n    }\n\n    @Override\n    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {\n        final Size size;\n        if (imageCount > 0) {\n            size = measureImages(widthMeasureSpec, heightMeasureSpec);\n        } else {\n            size = Size.EMPTY;\n        }\n        setMeasuredDimension(size.width, size.height);\n    }\n\n    @Override\n    protected void onSizeChanged(int w, int h, int oldw, int oldh) {\n        super.onSizeChanged(w, h, oldw, oldh);\n\n        path.reset();\n        rect.set(0, 0, w, h);\n        path.addRoundRect(rect, radii, Path.Direction.CW);\n        path.close();\n    }\n\n    @Override\n    protected void dispatchDraw(Canvas canvas) {\n        if (internalRoundedCornersEnabled &&\n                Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {\n            final int saveState = canvas.save();\n            canvas.clipPath(path);\n            super.dispatchDraw(canvas);\n            canvas.restoreToCount(saveState);\n        } else {\n            super.dispatchDraw(canvas);\n        }\n    }\n\n    public void setOnMediaClickListener(OnMediaClickListener onMediaClickListener) {\n        this.onMediaClickListener = onMediaClickListener;\n    }\n\n    public interface OnMediaClickListener {\n        void onMediaClick(View view, int index);\n    }\n\n    @Override\n    public void onClick(View view) {\n        Integer mediaEntityIndex = (Integer) view.getTag();\n        if (onMediaClickListener != null && mediaEntities != null && !mediaEntities.isEmpty()) {\n            onMediaClickListener.onMediaClick(view, mediaEntityIndex);\n        }\n    }\n\n    public void setMedias(List<String> mediaEntities) {\n        this.mediaEntities = mediaEntities;\n        setRoundedCornersRadii(roundedCornersRadii);\n        clearImageViews();\n        initializeImageViews(mediaEntities);\n        internalRoundedCornersEnabled = true;\n        requestLayout();\n    }\n\n    Size measureImages(int widthMeasureSpec, int heightMeasureSpec) {\n        final int width = MeasureSpec.getSize(widthMeasureSpec);\n        final int height = MeasureSpec.getSize(heightMeasureSpec);\n        final int halfWidth = (width - mediaDividerSize) / 2;\n        final int halfHeight = (height - mediaDividerSize) / 2;\n        switch (imageCount) {\n            case 1:\n                measureImageView(0, width, height);\n                break;\n            case 2:\n                measureImageView(0, halfWidth, height);\n                measureImageView(1, halfWidth, height);\n                break;\n            case 3:\n                measureImageView(0, halfWidth, height);\n                measureImageView(1, halfWidth, halfHeight);\n                measureImageView(2, halfWidth, halfHeight);\n                break;\n            case 4:\n                measureImageView(0, halfWidth, halfHeight);\n                measureImageView(1, halfWidth, halfHeight);\n                measureImageView(2, halfWidth, halfHeight);\n                measureImageView(3, halfWidth, halfHeight);\n                break;\n            default:\n                break;\n        }\n        return Size.fromSize(width, height);\n    }\n\n    void measureImageView(int i, int width, int height) {\n        imageViews[i].measure(\n                MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),\n                MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));\n    }\n\n    void layoutImages() {\n        int width = getMeasuredWidth();\n        int height = getMeasuredHeight();\n        int halfWidth = (width - mediaDividerSize) / 2;\n        int halfHeight = (height - mediaDividerSize) / 2;\n        int middle = halfWidth + mediaDividerSize;\n        switch (imageCount) {\n            case 1:\n                layoutImage(0, 0, 0, width, height);\n                break;\n            case 2:\n                layoutImage(0, 0, 0, halfWidth, height);\n                layoutImage(1, halfWidth + mediaDividerSize, 0, width, height);\n                break;\n            case 3:\n                layoutImage(0, 0, 0, halfWidth, height);\n                layoutImage(1, middle, 0, width, halfHeight);\n                layoutImage(2, middle, halfHeight + mediaDividerSize, width, height);\n                break;\n            case 4:\n                layoutImage(0, 0, 0, halfWidth, halfHeight);\n                layoutImage(2, 0, halfHeight + mediaDividerSize, halfWidth, height);\n                layoutImage(1, middle, 0, width, halfHeight);\n                layoutImage(3, middle, halfHeight + mediaDividerSize, width, height);\n                break;\n            default:\n                break;\n        }\n    }\n\n    void layoutImage(int i, int left, int top, int right, int bottom) {\n        final ImageView view = imageViews[i];\n        if (view.getLeft() == left && view.getTop() == top && view.getRight() == right\n                && view.getBottom() == bottom) {\n            return;\n        }\n\n        view.layout(left, top, right, bottom);\n    }\n\n    void clearImageViews() {\n        for (int index = 0; index < imageCount; index++) {\n            final ImageView imageView = imageViews[index];\n            if (imageView != null) {\n                imageView.setVisibility(GONE);\n            }\n        }\n        imageCount = 0;\n    }\n\n    void initializeImageViews(List<String> mediaEntities) {\n        imageCount = Math.min(MAX_IMAGE_VIEW_COUNT, mediaEntities.size());\n\n        for (int index = 0; index < imageCount; index++) {\n            final OverlayImageView imageView = getOrCreateImageView(index);\n\n            final String mediaEntity = mediaEntities.get(index);\n            setAltText(imageView, \"media\");\n            setMediaImage(imageView, mediaEntity);\n            setOverlayImage(imageView);\n        }\n    }\n\n    OverlayImageView getOrCreateImageView(int index) {\n        OverlayImageView imageView = imageViews[index];\n        if (imageView == null) {\n            imageView = new OverlayImageView(getContext());\n            imageView.setLayoutParams(generateDefaultLayoutParams());\n            imageView.setOnClickListener(this);\n            imageViews[index] = imageView;\n            addView(imageView, index);\n        } else {\n            measureImageView(index, 0, 0);\n            layoutImage(index, 0, 0, 0, 0);\n        }\n\n        imageView.setVisibility(VISIBLE);\n        imageView.setBackgroundColor(mediaBgColor);\n        imageView.setTag(index);\n\n        return imageView;\n    }\n\n    @SuppressLint(\"PrivateResource\")\n    void setAltText(ImageView imageView, String description) {\n        if (!TextUtils.isEmpty(description)) {\n            imageView.setContentDescription(description);\n        } else {\n            imageView.setContentDescription(CONTENT_DESC);\n        }\n    }\n\n    @SuppressLint(\"PrivateResource\")\n    void setOverlayImage(OverlayImageView imageView) {\n        imageView.setOverlayDrawable(null);\n    }\n\n    void setMediaImage(ImageView imageView, String imagePath) {\n        if (imageLoader == null) return;\n        imageLoader.load(imagePath)\n                .fit()\n                .centerCrop()\n                .error(photoErrorResId)\n                .into(imageView, new PicassoCallback(imageView));\n    }\n\n    private static class PicassoCallback implements com.squareup.picasso.Callback {\n        final WeakReference<ImageView> imageViewWeakReference;\n\n        PicassoCallback(ImageView imageView) {\n            imageViewWeakReference = new WeakReference<>(imageView);\n        }\n\n        @Override\n        public void onSuccess() {\n            final ImageView imageView = imageViewWeakReference.get();\n            if (imageView != null) {\n                imageView.setBackgroundResource(android.R.color.transparent);\n            }\n        }\n\n        @Override\n        public void onError() { /* intentionally blank */ }\n    }\n\n    private static class Size {\n        static final Size EMPTY = new Size();\n        final int width;\n        final int height;\n\n        private Size() {\n            this(0, 0);\n        }\n\n        private Size(int width, int height) {\n            this.width = width;\n            this.height = height;\n        }\n\n        static Size fromSize(int w, int h) {\n            final int boundedWidth = Math.max(w, 0);\n            final int boundedHeight = Math.max(h, 0);\n            return boundedWidth != 0 || boundedHeight != 0 ?\n                    new Size(boundedWidth, boundedHeight) : EMPTY;\n        }\n    }\n\n}\n"
  },
  {
    "path": "library/src/main/java/com/ihsanbal/wiv/OverlayImageView.java",
    "content": "package com.ihsanbal.wiv;\n\nimport android.content.Context;\nimport android.graphics.Canvas;\nimport android.graphics.drawable.Drawable;\nimport android.util.AttributeSet;\nimport android.widget.ImageView;\n\n/**\n * An ImageView subclass that take a {@link android.graphics.drawable.Drawable} and draws it on top\n * the ImageView content.\n */\npublic class OverlayImageView extends ImageView {\n    Overlay overlay = new Overlay(null);\n\n    public OverlayImageView(Context context) {\n        super(context);\n    }\n\n    public OverlayImageView(Context context, AttributeSet attrs) {\n        super(context, attrs);\n    }\n\n    @Override\n    protected void onDraw(Canvas canvas) {\n        super.onDraw(canvas);\n        overlay.draw(canvas);\n    }\n\n    @Override\n    protected void drawableStateChanged() {\n        super.drawableStateChanged();\n        overlay.setDrawableState(getDrawableState());\n    }\n\n    @Override\n    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {\n        super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n        overlay.setDrawableBounds(getMeasuredWidth(), getMeasuredHeight());\n    }\n\n    @Override\n    protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {\n        super.onSizeChanged(width, height, oldWidth, oldHeight);\n        overlay.setDrawableBounds(width, height);\n    }\n\n    @Override\n    public void invalidateDrawable(Drawable drawable) {\n        if (drawable == overlay.drawable) {\n            invalidate();\n        } else {\n            super.invalidateDrawable(drawable);\n        }\n    }\n\n    /*\n     * Sets the drawable to be drawn on top the ImageView content.\n     *\n     * @param drawable The drawable\n     */\n    public void setOverlayDrawable(Drawable drawable) {\n        if (drawable != overlay.drawable) {\n            overlay.cleanupDrawable(this);\n            if (drawable != null) {\n                drawable.setCallback(this);\n            }\n\n            overlay = new Overlay(drawable);\n            overlay.setDrawableState(getDrawableState());\n            requestLayout();\n        }\n    }\n\n    /**\n     * Takes a {@link android.graphics.drawable.Drawable} and draws it on top the ImageView content.\n     * The overlay drawable will respect the view's current state so a selector can be passed in.\n     */\n    static protected class Overlay {\n        final Drawable drawable;\n\n        Overlay(Drawable drawable) {\n            this.drawable = drawable;\n        }\n\n        protected void cleanupDrawable(ImageView imageView) {\n            if (drawable != null) {\n                drawable.setCallback(null);\n                imageView.unscheduleDrawable(drawable);\n            }\n        }\n\n        protected void setDrawableBounds(int width, int height) {\n            if (drawable != null) {\n                drawable.setBounds(0, 0, width, height);\n            }\n        }\n\n        protected void setDrawableState(int[] state) {\n            if (drawable != null && drawable.isStateful()) {\n                drawable.setState(state);\n            }\n        }\n\n        protected void draw(Canvas canvas) {\n            if (drawable != null) {\n                drawable.draw(canvas);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "library/src/main/res/values/attrs.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <declare-styleable name=\"AspectRatioLayout\">\n        <attr name=\"aspect_ratio\" format=\"float\" />\n        <attr name=\"dimension_to_adjust\" format=\"enum\">\n            <enum name=\"height\" value=\"0\" />\n            <enum name=\"width\" value=\"1\" />\n        </attr>\n    </declare-styleable>\n\n    <declare-styleable name=\"MediaView\">\n        <attr name=\"divider_size\" format=\"dimension\" />\n        <attr name=\"place_holder\" format=\"integer\" />\n        <attr name=\"corner_radii\" format=\"dimension\" />\n        <attr name=\"background_color\" format=\"color\" />\n    </declare-styleable>\n</resources>"
  },
  {
    "path": "library/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">Library</string>\n</resources>\n"
  },
  {
    "path": "settings.gradle",
    "content": "include ':app', ':library'\n"
  }
]