[
  {
    "path": ".gitignore",
    "content": "*.iml\n.gradle\n/local.properties\n/.idea\n.DS_Store\n/build\n/captures\n"
  },
  {
    "path": "LICENSE",
    "content": "Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2015 Kaopiz Software Co., Ltd.\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n\n"
  },
  {
    "path": "README.md",
    "content": "# KProgressHUD\n[![Apache License](https://img.shields.io/badge/license-Apache-blue.svg)](http://opensource.org/licenses/Apache-2.0)\n[ ![Download](https://api.bintray.com/packages/kaopiz/KProgressHUD/KProgressHUD/images/download.svg) ](https://bintray.com/kaopiz/KProgressHUD/KProgressHUD/_latestVersion)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-KProgressHUD-green.svg?style=true)](https://android-arsenal.com/details/1/2975)\n\nAn implement of ProgressHUD for Android, similar to MBProgressHUD, SVProgressHUD.\nInspired by [MBProgressHUD](https://github.com/jdg/MBProgressHUD) for iOS.\n\n![](https://raw.githubusercontent.com/Kaopiz/KProgressHUD/master/demo/screenshots/screencast.gif)\n\n<!---\n[![](https://raw.githubusercontent.com/Kaopiz/KProgressHUD/master/demo/screenshoots/thumb01.png)](https://github.com/Kaopiz/KProgressHUD/blob/master/demo/screenshoots/image01.png?raw=true)\n[![](https://raw.githubusercontent.com/Kaopiz/KProgressHUD/master/demo/screenshoots/thumb02.png)](https://github.com/Kaopiz/KProgressHUD/blob/master/demo/screenshoots/image02.png?raw=true)\n[![](https://raw.githubusercontent.com/Kaopiz/KProgressHUD/master/demo/screenshoots/thumb03.png)](https://github.com/Kaopiz/KProgressHUD/blob/master/demo/screenshoots/image03.png?raw=true)\n[![](https://raw.githubusercontent.com/Kaopiz/KProgressHUD/master/demo/screenshoots/thumb04.png)](https://github.com/Kaopiz/KProgressHUD/blob/master/demo/screenshoots/image04.png?raw=true)\n[![](https://raw.githubusercontent.com/Kaopiz/KProgressHUD/master/demo/screenshoots/thumb05.png)](https://github.com/Kaopiz/KProgressHUD/blob/master/demo/screenshoots/image05.png?raw=true)\n[![](https://raw.githubusercontent.com/Kaopiz/KProgressHUD/master/demo/screenshoots/thumb06.png)](https://github.com/Kaopiz/KProgressHUD/blob/master/demo/screenshoots/image06.png?raw=true)\n[![](https://raw.githubusercontent.com/Kaopiz/KProgressHUD/master/demo/screenshoots/thumb07.png)](https://github.com/Kaopiz/KProgressHUD/blob/master/demo/screenshoots/image07.png?raw=true)\n[![](https://raw.githubusercontent.com/Kaopiz/KProgressHUD/master/demo/screenshoots/thumb08.png)](https://github.com/Kaopiz/KProgressHUD/blob/master/demo/screenshoots/image08.png?raw=true)\n-->\n\n## Compatibility\n\nAndroid 2.3 and later\n\n## Adding KProgressHUD to your project\n\n### Gradle\nInclude this in your module `build.gradle`\n\n```\ndependencies {\n    // Other dependencies\n    compile 'com.kaopiz:kprogresshud:1.0.2'\n}\n```\n\n### Source code\nYou can download and import the `kprogresshud` folder as module to your project.\n\n## Usage\n\nThe usage of KProgressHUD is pretty straight forward. You create the HUD, customize its style and show it on the UI thread. Then fire a background thread to work on long-running tasks. When done, call `dismiss()` to close it (if you use a determinate style, the HUD will automatically dismiss if progress reach its max).\n\nIndeterminate HUD\n```java\nKProgressHUD.create(MainActivity.this)\n\t.setStyle(KProgressHUD.Style.SPIN_INDETERMINATE)\n\t.setLabel(\"Please wait\")\n\t.setDetailsLabel(\"Downloading data\");\n\t.setCancellable(true)\n\t.setAnimationSpeed(2)\n\t.setDimAmount(0.5f)\n\t.show();\n```\n\nDeterminate HUD\n```java\nKProgressHUD hud = KProgressHUD.create(MainActivity.this)\n\t\t\t\t\t.setStyle(KProgressHUD.Style.ANNULAR_DETERMINATE)\n\t\t\t\t\t.setLabel(\"Please wait\")\n\t\t\t\t\t.setMaxProgress(100)\n\t\t\t\t\t.show();\nhud.setProgress(90);\n```\n\nAlternatively, you can create a custom view and pass to the HUD to display it.\n```java\nImageView imageView = new ImageView(this);\nimageView.setImageResource(R.mipmap.ic_launcher);\nKProgressHUD.create(MainActivity.this)\n\t.setCustomView(imageView)\n    .setLabel(\"This is a custom view\")\n\t.show();\n```\nThe custom view can implement `Determinate` or `Indeterminate`, which make the HUD treats this view like the default determinate or indeterminate implementations, not required.\n\nSee [**Javadocs**](http://kaopiz.github.io/KProgressHUD/) or [**sample app**](https://github.com/Kaopiz/KProgressHUD/tree/master/demo/src/main) for more information.\n\n## Contributing\n1. Fork it ( https://github.com/Kaopiz/KProgressHUD/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## Contributor\n* [tuanna-hsp](https://github.com/tuanna-hsp)\n* [nafuto](https://github.com/nafuto)\n\n## License\n```\n   Copyright 2015 Kaopiz Software Co., Ltd.\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n```\n"
  },
  {
    "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:1.5.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        jcenter()\n    }\n}\n\ntask clean(type: Delete) {\n    delete rootProject.buildDir\n}\n"
  },
  {
    "path": "demo/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "demo/build.gradle",
    "content": "apply plugin: 'com.android.application'\n\nandroid {\n    compileSdkVersion 23\n    buildToolsVersion \"23.0.2\"\n\n    defaultConfig {\n        applicationId \"com.kaopiz.progresshud\"\n        minSdkVersion 8\n        targetSdkVersion 23\n        versionCode 1\n        versionName \"1.0\"\n    }\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n}\n\ndependencies {\n    compile fileTree(include: ['*.jar'], dir: 'libs')\n    testCompile 'junit:junit:4.12'\n    compile 'com.android.support:appcompat-v7:23.1.1'\n    compile project(':kprogresshud')\n}\n"
  },
  {
    "path": "demo/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 E:\\Android\\sdk/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n"
  },
  {
    "path": "demo/src/androidTest/java/com/kaopiz/progresshud/demo/ApplicationTest.java",
    "content": "package com.kaopiz.progresshud.demo;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * <a href=\"http://d.android.com/tools/testing/testing_android.html\">Testing Fundamentals</a>\n */\npublic class ApplicationTest extends ApplicationTestCase<Application> {\n    public ApplicationTest() {\n        super(Application.class);\n    }\n}"
  },
  {
    "path": "demo/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest package=\"com.kaopiz.progresshud\"\n          xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <application\n        android:allowBackup=\"true\"\n        android:icon=\"@mipmap/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:supportsRtl=\"true\"\n        android:theme=\"@style/AppTheme\">\n        <activity android:name=\".demo.MainActivity\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\"/>\n                <category android:name=\"android.intent.category.LAUNCHER\"/>\n            </intent-filter>\n        </activity>\n    </application>\n\n</manifest>\n"
  },
  {
    "path": "demo/src/main/java/com/kaopiz/progresshud/demo/MainActivity.java",
    "content": "/*\n * Copyright (c) 2015 Kaopiz Software Co., Ltd\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\npackage com.kaopiz.progresshud.demo;\n\nimport android.os.Bundle;\nimport android.os.Handler;\nimport android.support.v7.app.AppCompatActivity;\nimport android.view.View;\nimport android.widget.Button;\nimport android.widget.ImageView;\n\nimport com.kaopiz.kprogresshud.KProgressHUD;\nimport com.kaopiz.progresshud.R;\n\npublic class MainActivity extends AppCompatActivity implements View.OnClickListener {\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n\n        Button indeterminate = (Button) findViewById(R.id.indeterminate);\n        indeterminate.setOnClickListener(this);\n\n        Button labelIndeterminate = (Button) findViewById(R.id.label_indeterminate);\n        labelIndeterminate.setOnClickListener(this);\n\n        Button detailIndeterminate = (Button) findViewById(R.id.detail_indeterminate);\n        detailIndeterminate.setOnClickListener(this);\n\n        Button determinate = (Button) findViewById(R.id.determinate);\n        determinate.setOnClickListener(this);\n\n        Button annularDeterminate = (Button) findViewById(R.id.annular_determinate);\n        annularDeterminate.setOnClickListener(this);\n\n        Button barDeterminate = (Button) findViewById(R.id.bar_determinate);\n        barDeterminate.setOnClickListener(this);\n\n        Button customView = (Button) findViewById(R.id.custom_view);\n        customView.setOnClickListener(this);\n\n        Button dimBackground = (Button) findViewById(R.id.dim_background);\n        dimBackground.setOnClickListener(this);\n\n        Button customColor = (Button) findViewById(R.id.custom_color_animate);\n        customColor.setOnClickListener(this);\n    }\n\n    private KProgressHUD hud;\n\n    @Override\n    public void onClick(View v) {\n        switch (v.getId()) {\n            case R.id.indeterminate:\n                hud = KProgressHUD.create(this)\n                        .setStyle(KProgressHUD.Style.SPIN_INDETERMINATE);\n                scheduleDismiss();\n                break;\n            case R.id.label_indeterminate:\n                hud = KProgressHUD.create(this)\n                        .setStyle(KProgressHUD.Style.SPIN_INDETERMINATE)\n                        .setLabel(\"Please wait\")\n                        .setCancellable(true);\n                scheduleDismiss();\n                break;\n            case R.id.detail_indeterminate:\n                hud = KProgressHUD.create(this)\n                        .setStyle(KProgressHUD.Style.SPIN_INDETERMINATE)\n                        .setLabel(\"Please wait\")\n                        .setDetailsLabel(\"Downloading data\");\n                scheduleDismiss();\n                break;\n            case R.id.determinate:\n                hud = KProgressHUD.create(MainActivity.this)\n                        .setStyle(KProgressHUD.Style.PIE_DETERMINATE)\n                        .setLabel(\"Please wait\");\n                simulateProgressUpdate();\n                break;\n            case R.id.annular_determinate:\n                hud = KProgressHUD.create(MainActivity.this)\n                        .setStyle(KProgressHUD.Style.ANNULAR_DETERMINATE)\n                        .setLabel(\"Please wait\");\n                simulateProgressUpdate();\n                break;\n            case R.id.bar_determinate:\n                hud = KProgressHUD.create(MainActivity.this)\n                        .setStyle(KProgressHUD.Style.BAR_DETERMINATE)\n                        .setLabel(\"Please wait\");\n                simulateProgressUpdate();\n                break;\n            case R.id.custom_view:\n                ImageView imageView = new ImageView(this);\n                imageView.setImageResource(R.mipmap.ic_launcher);\n                hud = KProgressHUD.create(this)\n                        .setCustomView(imageView)\n                        .setLabel(\"This is a custom view\");\n                scheduleDismiss();\n                break;\n            case R.id.dim_background:\n                hud = KProgressHUD.create(this)\n                        .setStyle(KProgressHUD.Style.SPIN_INDETERMINATE)\n                        .setDimAmount(0.5f);\n                scheduleDismiss();\n                break;\n            case R.id.custom_color_animate:\n                //noinspection deprecation\n                hud = KProgressHUD.create(this)\n                        .setStyle(KProgressHUD.Style.SPIN_INDETERMINATE)\n                        .setWindowColor(getResources().getColor(R.color.colorPrimary))\n                        .setAnimationSpeed(2);\n                scheduleDismiss();\n                break;\n        }\n\n        hud.show();\n    }\n\n    private void simulateProgressUpdate() {\n        hud.setMaxProgress(100);\n        final Handler handler = new Handler();\n        handler.postDelayed(new Runnable() {\n            int currentProgress;\n            @Override\n            public void run() {\n                currentProgress += 1;\n                hud.setProgress(currentProgress);\n                if (currentProgress < 100) {\n                    handler.postDelayed(this, 50);\n                }\n            }\n        }, 100);\n    }\n\n    private void scheduleDismiss() {\n        Handler handler = new Handler();\n        handler.postDelayed(new Runnable() {\n            @Override\n            public void run() {\n                hud.dismiss();\n            }\n        }, 2000);\n    }\n}\n"
  },
  {
    "path": "demo/src/main/res/layout/activity_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScrollView\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\"com.kaopiz.progresshud.demo.MainActivity\">\n\n    <LinearLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:orientation=\"vertical\"\n        android:paddingBottom=\"@dimen/activity_vertical_margin\"\n        android:paddingLeft=\"@dimen/activity_horizontal_margin\"\n        android:paddingRight=\"@dimen/activity_horizontal_margin\"\n        android:paddingTop=\"@dimen/activity_vertical_margin\">\n\n        <Button\n            android:id=\"@+id/indeterminate\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"60dp\"\n            android:text=\"Indeterminate\"/>\n\n        <Button\n            android:id=\"@+id/label_indeterminate\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"60dp\"\n            android:text=\"With label and cancellable\"/>\n\n        <Button\n            android:id=\"@+id/detail_indeterminate\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"60dp\"\n            android:text=\"With details\"/>\n\n        <Button\n            android:id=\"@+id/determinate\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"60dp\"\n            android:text=\"Determinate\"/>\n\n        <Button\n            android:id=\"@+id/annular_determinate\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"60dp\"\n            android:text=\"Annular determinate\"/>\n\n        <Button\n            android:id=\"@+id/bar_determinate\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"60dp\"\n            android:text=\"Bar determinate\"/>\n\n        <Button\n            android:id=\"@+id/custom_view\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"60dp\"\n            android:text=\"Custom view\"/>\n\n        <Button\n            android:id=\"@+id/dim_background\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"60dp\"\n            android:text=\"Dim background\"/>\n\n        <Button\n            android:id=\"@+id/custom_color_animate\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"60dp\"\n            android:text=\"Custom color and speed\"/>\n    </LinearLayout>\n</ScrollView>\n\n"
  },
  {
    "path": "demo/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": "demo/src/main/res/values/dimens.xml",
    "content": "<resources>\n    <!-- Default screen margins, per the Android Design guidelines. -->\n    <dimen name=\"activity_horizontal_margin\">16dp</dimen>\n    <dimen name=\"activity_vertical_margin\">16dp</dimen>\n</resources>\n"
  },
  {
    "path": "demo/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">KProgressHUD</string>\n</resources>\n"
  },
  {
    "path": "demo/src/main/res/values/styles.xml",
    "content": "<resources>\n\n    <!-- Base application theme. -->\n    <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar\">\n        <!-- Customize your theme here. -->\n        <item name=\"colorPrimary\">@color/colorPrimary</item>\n        <item name=\"colorPrimaryDark\">@color/colorPrimaryDark</item>\n        <item name=\"colorAccent\">@color/colorAccent</item>\n    </style>\n\n</resources>\n"
  },
  {
    "path": "demo/src/main/res/values-w820dp/dimens.xml",
    "content": "<resources>\n    <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as screen margins) for screens with more than 820dp of available width. This\n         would include 7\" and 10\" devices in landscape (~960dp and ~1280dp respectively). -->\n    <dimen name=\"activity_horizontal_margin\">64dp</dimen>\n</resources>\n"
  },
  {
    "path": "demo/src/test/java/com/kaopiz/progresshud/ExampleUnitTest.java",
    "content": "package com.kaopiz.progresshud;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * To work on unit tests, switch the Test Artifact in the Build Variants view.\n */\npublic class ExampleUnitTest {\n    @Test\n    public void addition_isCorrect() throws Exception {\n        assertEquals(4, 2 + 2);\n    }\n}"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "#Wed Oct 21 11:34:03 PDT 2015\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-2.8-all.zip\n"
  },
  {
    "path": "gradle.properties",
    "content": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will override*\n# any settings specified in this file.\n\n# For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/build_environment.html\n\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\n# Default value: -Xmx10248m -XX:MaxPermSize=256m\n# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8\n\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\n# org.gradle.parallel=true"
  },
  {
    "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": "kprogresshud/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "kprogresshud/build.gradle",
    "content": "buildscript {\n    repositories {\n        jcenter()\n    }\n    dependencies {\n        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'\n        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'\n    }\n}\n\n\napply plugin: 'com.android.library'\n\nproject.archivesBaseName = 'kprogresshud'\n\nandroid {\n    compileSdkVersion 23\n    buildToolsVersion \"23.0.2\"\n\n    defaultConfig {\n        minSdkVersion 8\n        targetSdkVersion 23\n        versionCode 1\n        versionName \"1.0\"\n    }\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n}\n\ndependencies {\n    compile fileTree(dir: 'libs', include: ['*.jar'])\n    testCompile 'junit:junit:4.12'\n}\n\n\napply plugin: 'com.github.dcendents.android-maven'\napply plugin: 'com.jfrog.bintray'\n\next {\n    bintrayRepo = 'KProgressHUD'\n    bintrayName = 'KProgressHUD'\n\n    publishedGroupId = 'com.kaopiz'\n    libraryName = 'kprogresshud'\n    artifact = 'kprogresshud'\n\n    libraryDescription = 'A customizable ProgressHUD for Android'\n\n    siteUrl = 'http://kaopiz.github.io/KProgressHUD/'\n    gitUrl = 'https://github.com/Kaopiz/KProgressHUD'\n\n    libraryVersion = '1.0.2'\n\n    developerId = 'kaopiz'\n    developerName = 'Kaopiz Software Co., Ltd.'\n    developerEmail = 'contact@kaopiz.com'\n\n    licenseName = 'The Apache Software License, Version 2.0'\n    licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'\n    allLicenses = [\"Apache-2.0\"]\n}\n\ngroup = publishedGroupId\nversion = libraryVersion\n\ntask sourcesJar(type: Jar) {\n    from android.sourceSets.main.java.srcDirs\n    classifier = 'sources'\n}\n\ntask javadoc(type: Javadoc) {\n    source = android.sourceSets.main.java.srcDirs\n    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))\n}\n\ntask javadocJar(type: Jar, dependsOn: javadoc) {\n    classifier = 'javadoc'\n    from javadoc.destinationDir\n}\nartifacts {\n    archives javadocJar\n    archives sourcesJar\n}\n\n// Bintray\nProperties properties = new Properties()\nproperties.load(project.rootProject.file('local.properties').newDataInputStream())\n\nbintray {\n    user = properties.getProperty(\"bintray.user\")\n    key = properties.getProperty(\"bintray.apikey\")\n\n    configurations = ['archives']\n    pkg {\n        repo = bintrayRepo\n        name = bintrayName\n        userOrg = 'kaopiz'\n        desc = libraryDescription\n        websiteUrl = siteUrl\n        vcsUrl = gitUrl\n        licenses = allLicenses\n        publish = true\n        publicDownloadNumbers = true\n        version {\n            desc = libraryDescription\n            gpg {\n                sign = true //Determines whether to GPG sign the files. The default is false\n                passphrase = properties.getProperty(\"bintray.gpg.password\")\n                //Optional. The passphrase for GPG signing'\n            }\n        }\n    }\n}\n\ninstall {\n    repositories.mavenInstaller {\n        // This generates POM.xml with proper parameters\n        pom {\n            project {\n                packaging 'aar'\n                groupId 'com.kaopiz'\n                artifactId 'kprogresshud'\n\n                // Add your description here\n                name libraryName\n                description libraryDescription\n                url siteUrl\n\n                // Set your license\n                licenses {\n                    license {\n                        name licenseName\n                        url licenseUrl\n                    }\n                }\n                developers {\n                    developer {\n                        id developerId\n                        name developerName\n                        email developerEmail\n                    }\n                }\n                scm {\n                    connection gitUrl\n                    developerConnection gitUrl\n                    url siteUrl\n\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "kprogresshud/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 E:\\Android\\sdk/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n"
  },
  {
    "path": "kprogresshud/src/androidTest/java/com/kaopiz/kprogresshud/ApplicationTest.java",
    "content": "package com.kaopiz.kprogresshud;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * <a href=\"http://d.android.com/tools/testing/testing_android.html\">Testing Fundamentals</a>\n */\npublic class ApplicationTest extends ApplicationTestCase<Application> {\n    public ApplicationTest() {\n        super(Application.class);\n    }\n}"
  },
  {
    "path": "kprogresshud/src/main/AndroidManifest.xml",
    "content": "<manifest package=\"com.kaopiz.kprogresshud\"\n          xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <application\n        android:allowBackup=\"true\"\n        android:supportsRtl=\"true\" />\n</manifest>\n"
  },
  {
    "path": "kprogresshud/src/main/java/com/kaopiz/kprogresshud/AnnularView.java",
    "content": "/*\n *    Copyright 2015 Kaopiz Software Co., Ltd.\n *\n *    Licensed under the Apache License, Version 2.0 (the \"License\");\n *    you may not use this file except in compliance with the License.\n *    You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n *    Unless required by applicable law or agreed to in writing, software\n *    distributed under the License is distributed on an \"AS IS\" BASIS,\n *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *    See the License for the specific language governing permissions and\n *    limitations under the License.\n */\n\npackage com.kaopiz.kprogresshud;\n\nimport android.content.Context;\nimport android.graphics.Canvas;\nimport android.graphics.Color;\nimport android.graphics.Paint;\nimport android.graphics.RectF;\nimport android.util.AttributeSet;\nimport android.view.View;\n\nclass AnnularView extends View implements Determinate {\n\n    private Paint mWhitePaint;\n    private Paint mGreyPaint;\n    private RectF mBound;\n    private int mMax = 100;\n    private int mProgress = 0;\n\n    public AnnularView(Context context) {\n        super(context);\n        init(context);\n    }\n\n    public AnnularView(Context context, AttributeSet attrs) {\n        super(context, attrs);\n        init(context);\n    }\n\n    public AnnularView(Context context, AttributeSet attrs, int defStyleAttr) {\n        super(context, attrs, defStyleAttr);\n        init(context);\n    }\n\n    private void init(Context context){\n        mWhitePaint = new Paint(Paint.ANTI_ALIAS_FLAG);\n        mWhitePaint.setStyle(Paint.Style.STROKE);\n        mWhitePaint.setStrokeWidth(Helper.dpToPixel(3, getContext()));\n        mWhitePaint.setColor(Color.WHITE);\n\n        mGreyPaint = new Paint(Paint.ANTI_ALIAS_FLAG);\n        mGreyPaint.setStyle(Paint.Style.STROKE);\n        mGreyPaint.setStrokeWidth(Helper.dpToPixel(3, getContext()));\n        mGreyPaint.setColor(context.getResources().getColor(R.color.kprogresshud_grey_color));\n\n        mBound = new RectF();\n    }\n\n    @Override\n    protected void onSizeChanged(int w, int h, int oldw, int oldh) {\n        super.onSizeChanged(w, h, oldw, oldh);\n        int padding = Helper.dpToPixel(4, getContext());\n        mBound.set(padding, padding, w - padding, h - padding);\n    }\n\n    @Override\n    protected void onDraw(Canvas canvas) {\n        super.onDraw(canvas);\n        float mAngle = mProgress * 360f / mMax;\n        canvas.drawArc(mBound, 270, mAngle, false, mWhitePaint);\n        canvas.drawArc(mBound, 270 + mAngle, 360 - mAngle, false, mGreyPaint);\n    }\n\n    @Override\n    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {\n        super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n        int dimension = Helper.dpToPixel(40, getContext());\n        setMeasuredDimension(dimension, dimension);\n    }\n\n    @Override\n    public void setMax(int max) {\n        this.mMax = max;\n    }\n\n    @Override\n    public void setProgress(int progress) {\n        mProgress = progress;\n        invalidate();\n    }\n}\n"
  },
  {
    "path": "kprogresshud/src/main/java/com/kaopiz/kprogresshud/BackgroundLayout.java",
    "content": "/*\n *    Copyright 2015 Kaopiz Software Co., Ltd.\n *\n *    Licensed under the Apache License, Version 2.0 (the \"License\");\n *    you may not use this file except in compliance with the License.\n *    You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n *    Unless required by applicable law or agreed to in writing, software\n *    distributed under the License is distributed on an \"AS IS\" BASIS,\n *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *    See the License for the specific language governing permissions and\n *    limitations under the License.\n */\n\npackage com.kaopiz.kprogresshud;\n\nimport android.content.Context;\nimport android.graphics.Canvas;\nimport android.graphics.Paint;\nimport android.graphics.RectF;\nimport android.util.AttributeSet;\nimport android.widget.FrameLayout;\n\nclass BackgroundLayout extends FrameLayout {\n\n    private float mCornerRadius;\n    private Paint mPaint;\n    private RectF mRect;\n\n    public BackgroundLayout(Context context) {\n        super(context);\n        init();\n    }\n\n    public BackgroundLayout(Context context, AttributeSet attrs) {\n        super(context, attrs);\n        init();\n    }\n\n    public BackgroundLayout(Context context, AttributeSet attrs, int defStyleAttr) {\n        super(context, attrs, defStyleAttr);\n        init();\n    }\n\n    @SuppressWarnings(\"deprecation\")\n    private void init() {\n        setBaseColor(getContext().getResources().getColor(R.color.kprogresshud_default_color));\n        // Remove background, we will drawing background using base color\n        setBackgroundColor(getContext().getResources().getColor(android.R.color.transparent));\n    }\n\n    public void setCornerRadius(float radius) {\n        mCornerRadius = Helper.dpToPixel(radius, getContext());\n    }\n\n    public void setBaseColor(int color) {\n        mPaint = new Paint();\n        //noinspection deprecation\n        mPaint.setColor(color);\n        mPaint.setStyle(Paint.Style.FILL);\n    }\n\n    @Override\n    protected void onSizeChanged(int w, int h, int oldw, int oldh) {\n        super.onSizeChanged(w, h, oldw, oldh);\n        mRect = new RectF(0, 0, w, h);\n    }\n\n    @Override\n    protected void onDraw(Canvas canvas) {\n        super.onDraw(canvas);\n        canvas.drawRoundRect(mRect, mCornerRadius, mCornerRadius, mPaint);\n    }\n}\n"
  },
  {
    "path": "kprogresshud/src/main/java/com/kaopiz/kprogresshud/BarView.java",
    "content": "/*\n *    Copyright 2015 Kaopiz Software Co., Ltd.\n *\n *    Licensed under the Apache License, Version 2.0 (the \"License\");\n *    you may not use this file except in compliance with the License.\n *    You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n *    Unless required by applicable law or agreed to in writing, software\n *    distributed under the License is distributed on an \"AS IS\" BASIS,\n *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *    See the License for the specific language governing permissions and\n *    limitations under the License.\n */\n\npackage com.kaopiz.kprogresshud;\n\nimport android.content.Context;\nimport android.graphics.Canvas;\nimport android.graphics.Color;\nimport android.graphics.Paint;\nimport android.graphics.RectF;\nimport android.util.AttributeSet;\nimport android.view.View;\n\nclass BarView extends View implements Determinate {\n\n    private Paint mOuterPaint;\n    private Paint mInnerPaint;\n    private RectF mBound;\n    private RectF mInBound;\n    private int mMax = 100;\n    private int mProgress = 0;\n    private float mRadius;\n    private float mBoundGap;\n\n    public BarView(Context context) {\n        super(context);\n        init();\n    }\n\n    public BarView(Context context, AttributeSet attrs) {\n        super(context, attrs);\n        init();\n    }\n\n    public BarView(Context context, AttributeSet attrs, int defStyleAttr) {\n        super(context, attrs, defStyleAttr);\n        init();\n    }\n\n    private void init() {\n        mOuterPaint = new Paint(Paint.ANTI_ALIAS_FLAG);\n        mOuterPaint.setStyle(Paint.Style.STROKE);\n        mOuterPaint.setStrokeWidth(Helper.dpToPixel(2, getContext()));\n        mOuterPaint.setColor(Color.WHITE);\n\n        mInnerPaint = new Paint(Paint.ANTI_ALIAS_FLAG);\n        mInnerPaint.setStyle(Paint.Style.FILL);\n        mInnerPaint.setColor(Color.WHITE);\n\n        mBoundGap = Helper.dpToPixel(5, getContext());\n        mInBound = new RectF(mBoundGap, mBoundGap,\n                (getWidth() - mBoundGap) * mProgress / mMax, getHeight() - mBoundGap);\n\n        mRadius = Helper.dpToPixel(10, getContext());\n        mBound = new RectF();\n    }\n\n    @Override\n    protected void onSizeChanged(int w, int h, int oldw, int oldh) {\n        super.onSizeChanged(w, h, oldw, oldh);\n        int padding = Helper.dpToPixel(2, getContext());\n        mBound.set(padding, padding, w - padding, h - padding);\n    }\n\n    @Override\n    protected void onDraw(Canvas canvas) {\n        super.onDraw(canvas);\n        canvas.drawRoundRect(mBound, mRadius, mRadius, mOuterPaint);\n        canvas.drawRoundRect(mInBound, mRadius, mRadius, mInnerPaint);\n    }\n\n    @Override\n    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {\n        super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n        int widthDimension = Helper.dpToPixel(100, getContext());\n        int heightDimension = Helper.dpToPixel(20, getContext());\n        setMeasuredDimension(widthDimension, heightDimension);\n    }\n\n    @Override\n    public void setMax(int max) {\n        this.mMax = max;\n    }\n\n    @Override\n    public void setProgress(int progress) {\n        this.mProgress = progress;\n        mInBound.set(mBoundGap, mBoundGap,\n                (getWidth() - mBoundGap) * mProgress / mMax, getHeight() - mBoundGap);\n        invalidate();\n    }\n}\n"
  },
  {
    "path": "kprogresshud/src/main/java/com/kaopiz/kprogresshud/Determinate.java",
    "content": "/*\n *    Copyright 2015 Kaopiz Software Co., Ltd.\n *\n *    Licensed under the Apache License, Version 2.0 (the \"License\");\n *    you may not use this file except in compliance with the License.\n *    You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n *    Unless required by applicable law or agreed to in writing, software\n *    distributed under the License is distributed on an \"AS IS\" BASIS,\n *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *    See the License for the specific language governing permissions and\n *    limitations under the License.\n */\n\npackage com.kaopiz.kprogresshud;\n\n/**\n * If a view implements this interface passed to the HUD as a custom view, its progress\n * can be updated by calling setMax() and setProgress() on the HUD.\n * This interface only provides convenience, how progress work depends on the view implementation.\n */\npublic interface Determinate {\n    void setMax(int max);\n    void setProgress(int progress);\n}\n"
  },
  {
    "path": "kprogresshud/src/main/java/com/kaopiz/kprogresshud/Helper.java",
    "content": "/*\n *    Copyright 2015 Kaopiz Software Co., Ltd.\n *\n *    Licensed under the Apache License, Version 2.0 (the \"License\");\n *    you may not use this file except in compliance with the License.\n *    You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n *    Unless required by applicable law or agreed to in writing, software\n *    distributed under the License is distributed on an \"AS IS\" BASIS,\n *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *    See the License for the specific language governing permissions and\n *    limitations under the License.\n */\n\npackage com.kaopiz.kprogresshud;\n\nimport android.content.Context;\n\nclass Helper {\n\n    private static float scale;\n\n    public static int dpToPixel(float dp, Context context) {\n        if (scale == 0) {\n            scale = context.getResources().getDisplayMetrics().density;\n        }\n        return (int) (dp * scale);\n    }\n}\n"
  },
  {
    "path": "kprogresshud/src/main/java/com/kaopiz/kprogresshud/Indeterminate.java",
    "content": "/*\n *    Copyright 2015 Kaopiz Software Co., Ltd.\n *\n *    Licensed under the Apache License, Version 2.0 (the \"License\");\n *    you may not use this file except in compliance with the License.\n *    You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n *    Unless required by applicable law or agreed to in writing, software\n *    distributed under the License is distributed on an \"AS IS\" BASIS,\n *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *    See the License for the specific language governing permissions and\n *    limitations under the License.\n */\n\npackage com.kaopiz.kprogresshud;\n\n/**\n * If a view implements this interface passed to the HUD as a custom view, its animation\n * speed can be change by calling setAnimationSpeed() on the HUD.\n * This interface only provides convenience, how animation speed work depends on the view implementation.\n */\npublic interface Indeterminate {\n    void setAnimationSpeed(float scale);\n}\n"
  },
  {
    "path": "kprogresshud/src/main/java/com/kaopiz/kprogresshud/KProgressHUD.java",
    "content": "/*\n *    Copyright 2015 Kaopiz Software Co., Ltd.\n *\n *    Licensed under the Apache License, Version 2.0 (the \"License\");\n *    you may not use this file except in compliance with the License.\n *    You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n *    Unless required by applicable law or agreed to in writing, software\n *    distributed under the License is distributed on an \"AS IS\" BASIS,\n *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *    See the License for the specific language governing permissions and\n *    limitations under the License.\n */\n\npackage com.kaopiz.kprogresshud;\n\nimport android.app.Dialog;\nimport android.content.Context;\nimport android.graphics.drawable.ColorDrawable;\nimport android.os.Bundle;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.view.Window;\nimport android.view.WindowManager;\nimport android.widget.FrameLayout;\nimport android.widget.TextView;\n\npublic class KProgressHUD {\n\n    public enum Style {\n        SPIN_INDETERMINATE, PIE_DETERMINATE, ANNULAR_DETERMINATE, BAR_DETERMINATE\n    }\n\n    // To avoid redundant APIs, all HUD functions will be forward to\n    // a custom dialog\n    private ProgressDialog mProgressDialog;\n    private float mDimAmount;\n    private int mWindowColor;\n    private float mCornerRadius;\n    private boolean mCancellable;\n    private Context mContext;\n\n    private int mAnimateSpeed;\n    private String mLabel;\n    private String mDetailsLabel;\n\n    private int mMaxProgress;\n    private boolean mIsAutoDismiss;\n\n    public KProgressHUD(Context context) {\n        mContext = context;\n        mProgressDialog = new ProgressDialog(context);\n        mDimAmount = 0;\n        //noinspection deprecation\n        mWindowColor = context.getResources().getColor(R.color.kprogresshud_default_color);\n        mAnimateSpeed = 1;\n        mCornerRadius = 10;\n        mIsAutoDismiss = true;\n\n        setStyle(Style.SPIN_INDETERMINATE);\n    }\n\n    /**\n     * Create a new HUD. Have the same effect as the constructor.\n     * For convenient only.\n     * @param context Activity context that the HUD bound to\n     * @return An unique HUD instance\n     */\n    public static KProgressHUD create(Context context) {\n        return new KProgressHUD(context);\n    }\n\n    /**\n     * Specify the HUD style (not needed if you use a custom view)\n     * @param style One of the KProgressHUD.Style values\n     * @return Current HUD\n     */\n    public KProgressHUD setStyle(Style style) {\n        View view = null;\n        switch (style) {\n            case SPIN_INDETERMINATE:\n                view = new SpinView(mContext);\n                break;\n            case PIE_DETERMINATE:\n                view = new PieView(mContext);\n                break;\n            case ANNULAR_DETERMINATE:\n                view = new AnnularView(mContext);\n                break;\n            case BAR_DETERMINATE:\n                view = new BarView(mContext);\n                break;\n            // No custom view style here, because view will be added later\n        }\n        mProgressDialog.setView(view);\n        return this;\n    }\n\n    /**\n     * Specify the dim area around the HUD, like in Dialog\n     * @param dimAmount May take value from 0 to 1.\n     *                  0 means no dimming, 1 mean darkness\n     * @return Current HUD\n     */\n    public KProgressHUD setDimAmount(float dimAmount) {\n        if (dimAmount >= 0 && dimAmount <= 1) {\n            mDimAmount = dimAmount;\n        }\n        return this;\n    }\n\n    /**\n     * Specify the HUD background color\n     * @param color ARGB color\n     * @return Current HUD\n     */\n    public KProgressHUD setWindowColor(int color) {\n        mWindowColor = color;\n        return this;\n    }\n\n    /**\n     * Specify corner radius of the HUD (default is 10)\n     * @param radius Corner radius in dp\n     * @return Current HUD\n     */\n    public KProgressHUD setCornerRadius(float radius) {\n        mCornerRadius = radius;\n        return this;\n    }\n\n    /**\n     * Change animate speed relative to default. Only have effect when use with indeterminate style\n     * @param scale 1 is default, 2 means double speed, 0.5 means half speed..etc.\n     * @return Current HUD\n     */\n    public KProgressHUD setAnimationSpeed(int scale) {\n        mAnimateSpeed = scale;\n        return this;\n    }\n\n    /**\n     * Optional label to be displayed on the HUD\n     * @return Current HUD\n     */\n    public KProgressHUD setLabel(String label) {\n        mLabel = label;\n        return this;\n    }\n\n    /**\n     * Optional detail description to be displayed on the HUD\n     * @return Current HUD\n     */\n    public KProgressHUD setDetailsLabel(String detailsLabel) {\n        mDetailsLabel = detailsLabel;\n        return this;\n    }\n\n    /**\n     * Max value for use in one of the determinate styles\n     * @return Current HUD\n     */\n    public KProgressHUD setMaxProgress(int maxProgress) {\n        mMaxProgress = maxProgress;\n        return this;\n    }\n\n    /**\n     * Set current progress. Only have effect when use with a determinate style, or a custom\n     * view which implements Determinate interface.\n     */\n    public void setProgress(int progress) {\n        mProgressDialog.setProgress(progress);\n    }\n\n    /**\n     * Provide a custom view to be displayed.\n     * @param view Must not be null\n     * @return Current HUD\n     */\n    public KProgressHUD setCustomView(View view) {\n        if (view != null) {\n            mProgressDialog.setView(view);\n        } else {\n            throw new RuntimeException(\"Custom view must not be null!\");\n        }\n        return this;\n    }\n\n    /**\n     * Specify whether this HUD can be cancelled by using back button (default is false)\n     * @return Current HUD\n     */\n    public KProgressHUD setCancellable(boolean isCancellable) {\n        mCancellable = isCancellable;\n        return this;\n    }\n\n    /**\n     * Specify whether this HUD closes itself if progress reaches max. Default is true.\n     * @return Current HUD\n     */\n    public KProgressHUD setAutoDismiss(boolean isAutoDismiss) {\n        mIsAutoDismiss = isAutoDismiss;\n        return this;\n    }\n\n    public KProgressHUD show() {\n        if (!isShowing()) {\n            mProgressDialog.show();\n        }\n        return this;\n    }\n\n    public boolean isShowing() {\n        return mProgressDialog != null && mProgressDialog.isShowing();\n    }\n\n    public void dismiss() {\n        if (mProgressDialog != null && mProgressDialog.isShowing()) {\n            mProgressDialog.dismiss();\n        }\n    }\n\n    private class ProgressDialog extends Dialog {\n\n        private Determinate mDeterminateView;\n        private Indeterminate mIndeterminateView;\n        private View mView;\n\n        public ProgressDialog(Context context) {\n            super(context);\n        }\n\n        @Override\n        protected void onCreate(Bundle savedInstanceState) {\n            super.onCreate(savedInstanceState);\n            requestWindowFeature(Window.FEATURE_NO_TITLE);\n            setContentView(R.layout.kprogresshud_hud);\n\n            Window window = getWindow();\n            window.setBackgroundDrawable(new ColorDrawable(0));\n            window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);\n            WindowManager.LayoutParams layoutParams = window.getAttributes();\n            layoutParams.dimAmount = mDimAmount;\n            window.setAttributes(layoutParams);\n\n            setCanceledOnTouchOutside(false);\n            setCancelable(mCancellable);\n\n            initViews();\n        }\n\n        private void initViews() {\n            BackgroundLayout background = (BackgroundLayout) findViewById(R.id.background);\n            background.setBaseColor(mWindowColor);\n            background.setCornerRadius(mCornerRadius);\n\n            FrameLayout containerFrame = (FrameLayout) findViewById(R.id.container);\n            int wrapParam = ViewGroup.LayoutParams.WRAP_CONTENT;\n            ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(wrapParam, wrapParam);\n            containerFrame.addView(mView, params);\n\n            if (mDeterminateView != null) {\n                mDeterminateView.setMax(mMaxProgress);\n            }\n            if (mIndeterminateView != null) {\n                mIndeterminateView.setAnimationSpeed(mAnimateSpeed);\n            }\n\n            if (mLabel != null) {\n                TextView labelText = (TextView) findViewById(R.id.label);\n                labelText.setText(mLabel);\n                labelText.setVisibility(View.VISIBLE);\n            }\n            if (mDetailsLabel != null) {\n                TextView detailsText = (TextView) findViewById(R.id.details_label);\n                detailsText.setText(mDetailsLabel);\n                detailsText.setVisibility(View.VISIBLE);\n            }\n        }\n\n        public void setProgress(int progress) {\n            if (mDeterminateView != null) {\n                mDeterminateView.setProgress(progress);\n                if (mIsAutoDismiss && progress >= mMaxProgress) {\n                    dismiss();\n                }\n            }\n        }\n\n        public void setView(View view) {\n            if (view != null) {\n                if (view instanceof Determinate) {\n                    mDeterminateView = (Determinate) view;\n                }\n                if (view instanceof Indeterminate) {\n                    mIndeterminateView = (Indeterminate) view;\n                }\n                mView = view;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "kprogresshud/src/main/java/com/kaopiz/kprogresshud/PieView.java",
    "content": "/*\n *    Copyright 2015 Kaopiz Software Co., Ltd.\n *\n *    Licensed under the Apache License, Version 2.0 (the \"License\");\n *    you may not use this file except in compliance with the License.\n *    You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n *    Unless required by applicable law or agreed to in writing, software\n *    distributed under the License is distributed on an \"AS IS\" BASIS,\n *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *    See the License for the specific language governing permissions and\n *    limitations under the License.\n */\n\npackage com.kaopiz.kprogresshud;\n\nimport android.content.Context;\nimport android.graphics.Canvas;\nimport android.graphics.Color;\nimport android.graphics.Paint;\nimport android.graphics.RectF;\nimport android.util.AttributeSet;\nimport android.view.View;\n\nclass PieView extends View implements Determinate {\n\n    private Paint mWhitePaint;\n    private Paint mGreyPaint;\n    private RectF mBound;\n    private int mMax = 100;\n    private int mProgress = 0;\n\n    public PieView(Context context) {\n        super(context);\n        init();\n    }\n\n    public PieView(Context context, AttributeSet attrs) {\n        super(context, attrs);\n        init();\n    }\n\n    public PieView(Context context, AttributeSet attrs, int defStyleAttr) {\n        super(context, attrs, defStyleAttr);\n        init();\n    }\n\n    private void init(){\n        mWhitePaint = new Paint(Paint.ANTI_ALIAS_FLAG);\n        mWhitePaint.setStyle(Paint.Style.FILL_AND_STROKE);\n        mWhitePaint.setStrokeWidth(Helper.dpToPixel(0.1f, getContext()));\n        mWhitePaint.setColor(Color.WHITE);\n\n        mGreyPaint = new Paint(Paint.ANTI_ALIAS_FLAG);\n        mGreyPaint.setStyle(Paint.Style.STROKE);\n        mGreyPaint.setStrokeWidth(Helper.dpToPixel(2, getContext()));\n        mGreyPaint.setColor(Color.WHITE);\n\n        mBound = new RectF();\n    }\n\n    @Override\n    protected void onSizeChanged(int w, int h, int oldw, int oldh) {\n        super.onSizeChanged(w, h, oldw, oldh);\n        int padding = Helper.dpToPixel(4, getContext());\n        mBound.set(padding, padding, w - padding, h - padding);\n    }\n\n    @Override\n    protected void onDraw(Canvas canvas) {\n        super.onDraw(canvas);\n        float mAngle = mProgress * 360f / mMax;\n        canvas.drawArc(mBound, 270, mAngle, true, mWhitePaint);\n        int padding = Helper.dpToPixel(4, getContext());\n        canvas.drawCircle(getWidth()/2, getHeight()/2, getWidth()/2-padding, mGreyPaint);\n    }\n\n    @Override\n    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {\n        super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n        int dimension = Helper.dpToPixel(40, getContext());\n        setMeasuredDimension(dimension, dimension);\n    }\n\n    @Override\n    public void setMax(int max) {\n        this.mMax = max;\n    }\n\n    @Override\n    public void setProgress(int progress) {\n        this.mProgress = progress;\n        invalidate();\n    }\n}\n"
  },
  {
    "path": "kprogresshud/src/main/java/com/kaopiz/kprogresshud/SpinView.java",
    "content": "/*\n *    Copyright 2015 Kaopiz Software Co., Ltd.\n *\n *    Licensed under the Apache License, Version 2.0 (the \"License\");\n *    you may not use this file except in compliance with the License.\n *    You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n *    Unless required by applicable law or agreed to in writing, software\n *    distributed under the License is distributed on an \"AS IS\" BASIS,\n *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *    See the License for the specific language governing permissions and\n *    limitations under the License.\n */\n\npackage com.kaopiz.kprogresshud;\n\nimport android.content.Context;\nimport android.graphics.Canvas;\nimport android.util.AttributeSet;\nimport android.widget.ImageView;\n\nclass SpinView extends ImageView implements Indeterminate {\n\n    private float mRotateDegrees;\n    private int mFrameTime;\n    private boolean mNeedToUpdateView;\n    private Runnable mUpdateViewRunnable;\n\n    public SpinView(Context context) {\n        super(context);\n        init();\n    }\n\n    public SpinView(Context context, AttributeSet attrs) {\n        super(context, attrs);\n        init();\n    }\n\n    private void init() {\n        setImageResource(R.drawable.kprogresshud_spinner);\n        mFrameTime = 1000 / 12;\n        mUpdateViewRunnable = new Runnable() {\n            @Override\n            public void run() {\n                mRotateDegrees += 30;\n                mRotateDegrees = mRotateDegrees < 360 ? mRotateDegrees : mRotateDegrees - 360;\n                invalidate();\n                if (mNeedToUpdateView) {\n                    postDelayed(this, mFrameTime);\n                }\n            }\n        };\n    }\n\n    @Override\n    public void setAnimationSpeed(float scale) {\n        mFrameTime = (int) (1000 / 12 / scale);\n    }\n\n    @Override\n    protected void onDraw(Canvas canvas) {\n        canvas.rotate(mRotateDegrees, getWidth() / 2, getHeight() / 2);\n        super.onDraw(canvas);\n    }\n\n    @Override\n    protected void onAttachedToWindow() {\n        super.onAttachedToWindow();\n        mNeedToUpdateView = true;\n        post(mUpdateViewRunnable);\n    }\n\n    @Override\n    protected void onDetachedFromWindow() {\n        mNeedToUpdateView = false;\n        super.onDetachedFromWindow();\n    }\n}\n"
  },
  {
    "path": "kprogresshud/src/main/res/layout/kprogresshud_hud.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<com.kaopiz.kprogresshud.BackgroundLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:id=\"@+id/background\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    android:padding=\"16dp\"\n    android:background=\"@android:color/transparent\">\n\n    <LinearLayout\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:gravity=\"center_horizontal\"\n        android:orientation=\"vertical\">\n\n        <FrameLayout\n            android:id=\"@+id/container\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\" />\n\n        <TextView\n            android:id=\"@+id/label\"\n            android:visibility=\"gone\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:textColor=\"@android:color/white\"\n            android:textSize=\"16sp\"\n            android:layout_marginTop=\"8dp\"\n            android:layout_marginBottom=\"4dp\"/>\n\n        <TextView\n            android:id=\"@+id/details_label\"\n            android:visibility=\"gone\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:textColor=\"@android:color/white\"\n            android:textSize=\"13sp\"/>\n    </LinearLayout>\n</com.kaopiz.kprogresshud.BackgroundLayout>"
  },
  {
    "path": "kprogresshud/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"kprogresshud_default_color\">#b1000000</color>\n    <color name=\"kprogresshud_grey_color\">#449E9E9E</color>\n</resources>"
  },
  {
    "path": "kprogresshud/src/test/java/com/kaopiz/kprogresshud/ExampleUnitTest.java",
    "content": "package com.kaopiz.kprogresshud;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * To work on unit tests, switch the Test Artifact in the Build Variants view.\n */\npublic class ExampleUnitTest {\n    @Test\n    public void addition_isCorrect() throws Exception {\n        assertEquals(4, 2 + 2);\n    }\n}"
  },
  {
    "path": "settings.gradle",
    "content": "include ':demo', ':kprogresshud'\n"
  }
]