[
  {
    "path": ".github/FUNDING.yml",
    "content": "github: Baseflow\ncustom: https://baseflow.com/contact\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/a-regression.md",
    "content": "---\n\nname: 🔙 Regression\nabout: Report unexpected behavior that worked previously\n---\n\n## 🔙 Regression\n\n<!--- Summary description of the regression --->\n\n### Old (and correct) behavior\n\n### Current behavior\n\n### Reproduction steps\n\n### Configuration\n\n**Version:** 1.x\n\n**Platform:** :robot: Android 9.x"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/b-bug-report.md",
    "content": "---\n\nname: 🐛 Bug Report\nabout: Create a report to help us fix bugs and make improvements\n---\n\n## 🐛 Bug Report\n\n<!--- Summary description of the bug --->\n\n### Expected behavior\n\n### Reproduction steps\n\n### Configuration\n\n**Version:** 1.x\n\n**Platform:** :robot: Android 9.x"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/c-feature-request.md",
    "content": "---\n\nname: 🚀 Feature Request\nabout: Want to see something new included in the Framework? Submit it!\n---\n\n## 🚀 Feature Requests\n\n<!--- Summary description of the feature --->\n\n### Contextualize the feature\n<!--- Where does it fit in the framework and why it's being included there. --->\n\n### Describe the feature\n<!--- Use as much detail as possible here! --->\n\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/d-enhancement-proposal.md",
    "content": "---\n\nname: 🏗 Enhancement Proposal\nabout: Proposals for code cleanup, refactor and improvements in general\n---\n\n## 🏗 Enhancement Proposal\n\n<!--- A clear and concise description for your idea --->\n\n### Pitch\n\n<!--- How will this refactor improve contributors' lives? Input as many details as possible! --->\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/e-question.md",
    "content": "---\n\nname: 💬 Questions and Help\nabout: If you have questions, please use this for support\n---\n\n## 💬 Questions and Help\n\nFor questions or help we recommend checking:\n\n- [Stack Overflow](https://stackoverflow.com/)"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "content": "### :sparkles: What kind of change does this PR introduce? (Bug fix, feature, docs update...)\n\n\n### :arrow_heading_down: What is the current behavior?\n\n\n### :new: What is the new behavior (if this is a feature change)?\n\n\n### :boom: Does this PR introduce a breaking change?\n\n\n### :bug: Recommendations for testing\n\n\n### :memo: Links to relevant issues/docs\n\n\n### :thinking: Checklist before submitting\n\n- [ ] All projects build\n- [ ] Follows style guide lines \n- [ ] Relevant documentation was updated\n- [ ] Rebased onto current develop\n"
  },
  {
    "path": ".gitignore",
    "content": "#Android generated\nbin\ngen\n\n#Eclipse\n.project\n.classpath\n.settings\n\n#IntelliJ IDEA\n.idea\n*.iml\n*.ipr\n*.iws\nout\n\n#Maven\ntarget\nrelease.properties\npom.xml.*\n\n#Ant\nbuild.xml\nlocal.properties\nproguard.cfg\n\n#OSX\n.DS_Store\n\n#Gradle\n.gradle\nbuild\n\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, we as\ncontributors and maintainers pledge to making participation in our project and\nour community a harassment-free experience for everyone, regardless of age, body\nsize, disability, ethnicity, gender identity and expression, level of experience,\nnationality, personal appearance, race, religion, or sexual identity and\norientation.\n\n## Our Standards\n\nExamples of behavior that contributes to creating a positive environment\ninclude:\n\n* Using welcoming and inclusive language\n* Being respectful of differing viewpoints and experiences\n* Gracefully accepting constructive criticism\n* Focusing on what is best for the community\n* Showing empathy towards other community members\n\nExamples of unacceptable behavior by participants include:\n\n* The use of sexualized language or imagery and unwelcome sexual attention or\nadvances\n* Trolling, insulting/derogatory comments, and personal or political attacks\n* Public or private harassment\n* Publishing others' private information, such as a physical or electronic\n  address, without explicit permission\n* Other conduct which could reasonably be considered inappropriate in a\n  professional setting\n\n## Our Responsibilities\n\nProject maintainers are responsible for clarifying the standards of acceptable\nbehavior and are expected to take appropriate and fair corrective action in\nresponse to any instances of unacceptable behavior.\n\nProject maintainers have the right and responsibility to remove, edit, or\nreject comments, commits, code, wiki edits, issues, and other contributions\nthat are not aligned to this Code of Conduct, or to ban temporarily or\npermanently any contributor for other behaviors that they deem inappropriate,\nthreatening, offensive, or harmful.\n\n## Scope\n\nThis Code of Conduct applies both within project spaces and in public spaces\nwhen an individual is representing the project or its community. Examples of\nrepresenting a project or community include using an official project e-mail\naddress, posting via an official social media account, or acting as an appointed\nrepresentative at an online or offline event. Representation of a project may be\nfurther defined and clarified by project maintainers.\n\n## Enforcement\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be\nreported by contacting the project team at [mvvmcross@gmail.com](mailto:mvvmcross@gmail). All\ncomplaints will be reviewed and investigated and will result in a response that\nis deemed necessary and appropriate to the circumstances. The project team is\nobligated to maintain confidentiality with regard to the reporter of an incident.\nFurther details of specific enforcement policies may be posted separately.\n\nProject maintainers who do not follow or enforce the Code of Conduct in good\nfaith may face temporary or permanent repercussions as determined by other\nmembers of the project's leadership.\n\n## Attribution\n\nThis Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,\navailable at [http://contributor-covenant.org/version/1/4][version]\n\n[homepage]: http://contributor-covenant.org\n[version]: http://contributor-covenant.org/version/1/4/\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing to PhotoView\n\n## Finding an issue to work on\n\nIf you'd like to work on something that isn't in a current issue, especially if it would be a big change, please open a new issue for discussion!\n"
  },
  {
    "path": "LICENSE",
    "content": "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "# PhotoView\nPhotoView aims to help produce an easily usable implementation of a zooming Android ImageView.\n\n[![](https://jitpack.io/v/chrisbanes/PhotoView.svg)](https://jitpack.io/#chrisbanes/PhotoView)\n\n[![](https://user-images.githubusercontent.com/12352397/85141529-94648e80-b24f-11ea-9a14-a845fb43b181.gif)\n\n## Dependency\n\nAdd this in your root `build.gradle` file (**not** your module `build.gradle` file):\n\n```gradle\nallprojects {\n    repositories {\n        maven { url \"https://www.jitpack.io\" }\n    }\n}\n\nbuildscript {\n    repositories {\n        maven { url \"https://www.jitpack.io\" }\n    }\t\n}\n```\n\nThen, add the library to your module `build.gradle`\n```gradle\ndependencies {\n    implementation 'com.github.chrisbanes:PhotoView:latest.release.here'\n}\n```\n\n## Features\n- Out of the box zooming, using multi-touch and double-tap.\n- Scrolling, with smooth scrolling fling.\n- Works perfectly when used in a scrolling parent (such as ViewPager).\n- Allows the application to be notified when the displayed Matrix has changed. Useful for when you need to update your UI based on the current zoom/scroll position.\n- Allows the application to be notified when the user taps on the Photo.\n\n## Usage\nThere is a [sample](https://github.com/chrisbanes/PhotoView/tree/master/sample) provided which shows how to use the library in a more advanced way, but for completeness, here is all that is required to get PhotoView working:\n```xml\n<com.github.chrisbanes.photoview.PhotoView\n    android:id=\"@+id/photo_view\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"/>\n```\n```java\nPhotoView photoView = (PhotoView) findViewById(R.id.photo_view);\nphotoView.setImageResource(R.drawable.image);\n```\nThat's it!\n\n## Issues With ViewGroups\nThere are some ViewGroups (ones that utilize onInterceptTouchEvent) that throw exceptions when a PhotoView is placed within them, most notably [ViewPager](http://developer.android.com/reference/android/support/v4/view/ViewPager.html) and [DrawerLayout](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html). This is a framework issue that has not been resolved. In order to prevent this exception (which typically occurs when you zoom out), take a look at [HackyDrawerLayout](https://github.com/chrisbanes/PhotoView/blob/master/sample/src/main/java/com/github/chrisbanes/photoview/sample/HackyDrawerLayout.java) and you can see the solution is to simply catch the exception. Any ViewGroup which uses onInterceptTouchEvent will also need to be extended and exceptions caught. Use the [HackyDrawerLayout](https://github.com/chrisbanes/PhotoView/blob/master/sample/src/main/java/com/github/chrisbanes/photoview/sample/HackyDrawerLayout.java) as a template of how to do so. The basic implementation is:\n```java\npublic class HackyProblematicViewGroup extends ProblematicViewGroup {\n\n    public HackyProblematicViewGroup(Context context) {\n        super(context);\n    }\n\n    @Override\n    public boolean onInterceptTouchEvent(MotionEvent ev) {\n        try {\n            return super.onInterceptTouchEvent(ev);\n        } catch (IllegalArgumentException e) {\n\t\t\t\t\t\t//uncomment if you really want to see these errors\n            //e.printStackTrace();\n            return false;\n        }\n    }\n}\n```\n\n## Usage with Fresco\nDue to the complex nature of Fresco, this library does not currently support Fresco. See [this project](https://github.com/ongakuer/PhotoDraweeView) as an alternative solution.\n\n## Subsampling Support\nThis library aims to keep the zooming implementation simple. If you are looking for an implementation that supports subsampling, check out [this project](https://github.com/davemorrissey/subsampling-scale-image-view)\n\nLicense\n--------\n\n    Copyright 2018 Chris Banes\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n"
  },
  {
    "path": "build.gradle",
    "content": "buildscript {\n    ext.kotlin_version = '1.3.72'\n    repositories {\n        google()\n        jcenter()\n    }\n\n    dependencies {\n        classpath 'com.android.tools.build:gradle:4.1.2'\n        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'\n        classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version\"\n    }\n}\n\nallprojects {\n    repositories {\n        google()\n        jcenter()\n    }\n}\n\next {\n    sdkVersion = 29\n    minSdkVersion = 16\n}\n"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-6.8-bin.zip\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\n"
  },
  {
    "path": "gradle.properties",
    "content": "android.useAndroidX=true\nandroid.enableJetifier=true"
  },
  {
    "path": "gradlew",
    "content": "#!/usr/bin/env sh\n\n#\n# Copyright 2015 the original author or authors.\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#      https://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\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\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\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\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='\"-Xmx64m\" \"-Xms64m\"'\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\nnonstop=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\n  NONSTOP* )\n    nonstop=true\n    ;;\nesac\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\" -a \"$nonstop\" = \"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 or MSYS, switch paths to Windows format before running java\nif [ \"$cygwin\" = \"true\" -o \"$msys\" = \"true\" ] ; 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=`expr $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# Escape application args\nsave () {\n    for i do printf %s\\\\n \"$i\" | sed \"s/'/'\\\\\\\\''/g;1s/^/'/;\\$s/\\$/' \\\\\\\\/\" ; done\n    echo \" \"\n}\nAPP_ARGS=`save \"$@\"`\n\n# Collect all arguments for the java command, following the shell quoting and substitution rules\neval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS \"\\\"-Dorg.gradle.appname=$APP_BASE_NAME\\\"\" -classpath \"\\\"$CLASSPATH\\\"\" org.gradle.wrapper.GradleWrapperMain \"$APP_ARGS\"\n\nexec \"$JAVACMD\" \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@rem\r\n@rem Copyright 2015 the original author or authors.\r\n@rem\r\n@rem Licensed under the Apache License, Version 2.0 (the \"License\");\r\n@rem you may not use this file except in compliance with the License.\r\n@rem You may obtain a copy of the License at\r\n@rem\r\n@rem      https://www.apache.org/licenses/LICENSE-2.0\r\n@rem\r\n@rem Unless required by applicable law or agreed to in writing, software\r\n@rem distributed under the License is distributed on an \"AS IS\" BASIS,\r\n@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n@rem See the License for the specific language governing permissions and\r\n@rem limitations under the License.\r\n@rem\r\n\r\n@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@rem  Gradle startup script for Windows\r\n@rem\r\n@rem ##########################################################################\r\n\r\n@rem Set local scope for the variables with windows NT shell\r\nif \"%OS%\"==\"Windows_NT\" setlocal\r\n\r\nset DIRNAME=%~dp0\r\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\r\nset APP_BASE_NAME=%~n0\r\nset APP_HOME=%DIRNAME%\r\n\r\n@rem Resolve any \".\" and \"..\" in APP_HOME to make it shorter.\r\nfor %%i in (\"%APP_HOME%\") do set APP_HOME=%%~fi\r\n\r\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r\nset DEFAULT_JVM_OPTS=\"-Xmx64m\" \"-Xms64m\"\r\n\r\n@rem Find java.exe\r\nif defined JAVA_HOME goto findJavaFromJavaHome\r\n\r\nset JAVA_EXE=java.exe\r\n%JAVA_EXE% -version >NUL 2>&1\r\nif \"%ERRORLEVEL%\" == \"0\" goto init\r\n\r\necho.\r\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:findJavaFromJavaHome\r\nset JAVA_HOME=%JAVA_HOME:\"=%\r\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\r\n\r\nif exist \"%JAVA_EXE%\" goto init\r\n\r\necho.\r\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:init\r\n@rem Get command-line arguments, handling Windows variants\r\n\r\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\r\n\r\n:win9xME_args\r\n@rem Slurp the command line arguments.\r\nset CMD_LINE_ARGS=\r\nset _SKIP=2\r\n\r\n:win9xME_args_slurp\r\nif \"x%~1\" == \"x\" goto execute\r\n\r\nset CMD_LINE_ARGS=%*\r\n\r\n:execute\r\n@rem Setup the command line\r\n\r\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\r\n\r\n@rem Execute Gradle\r\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\r\n\r\n:end\r\n@rem End local scope for the variables with windows NT shell\r\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\r\n\r\n:fail\r\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r\nrem the _cmd.exe /c_ return code!\r\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\r\nexit /b 1\r\n\r\n:mainEnd\r\nif \"%OS%\"==\"Windows_NT\" endlocal\r\n\r\n:omega\r\n"
  },
  {
    "path": "photoview/build.gradle",
    "content": "apply plugin: 'com.android.library'\napply plugin: 'maven-publish'\n\nandroid {\n    compileSdkVersion rootProject.ext.sdkVersion\n\n    defaultConfig {\n        minSdkVersion rootProject.ext.minSdkVersion\n        targetSdkVersion rootProject.ext.sdkVersion\n        versionCode 1\n        versionName \"1.0\"\n    }\n}\n\ndependencies {\n    implementation \"androidx.appcompat:appcompat:1.1.0\"\n}\n\nafterEvaluate {\n    publishing {\n        publications {\n            release(MavenPublication) {\n                from components.release\n\n                group = 'com.github.chrisbanes'\n                artifactId = 'PhotoView'\n                version = '2.3.0'\n\n                // Adds javadocs and sources as separate jars.\n                artifact androidJavadocsJar\n                artifact(sourceJar)\n\n                pom {\n                    name = 'PhotoView'\n                    description = 'A simple ImageView that support zooming, both by Multi-touch gestures and double-tap.'\n                    url = 'https://github.com/Baseflow/PhotoView'\n                    licenses {\n                        license {\n                            name = 'The Apache License, Version 2.0'\n                            url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'\n                        }\n                    }\n                    developers {\n                        developer {\n                            id = 'chrisbanes'\n                            name = 'Chris Banes'\n                        }\n                    }\n                    scm {\n                        connection = 'scm:git@github.com/chrisbanes/PhotoView.git'\n                        developerConnection = 'scm:git@github.com/chrisbanes/PhotoView.git'\n                        url = 'https://github.com/chrisbanes/PhotoView'\n                    }\n                }\n            }\n        }\n    }\n}\n\ntask androidJavadocs(type: Javadoc) {\n    source = android.sourceSets.main.java.srcDirs\n    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))\n    android.libraryVariants.all { variant ->\n        if (variant.name == 'release') {\n            owner.classpath += variant.javaCompileProvider.get().classpath\n        }\n    }\n    exclude '**/R.html', '**/R.*.html', '**/index.html'\n}\n\ntask androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {\n    archiveClassifier.set('javadoc')\n    from androidJavadocs.destinationDir\n}\n\ntask sourceJar(type: Jar) {\n    from android.sourceSets.main.java.srcDirs\n    classifier \"sources\"\n}"
  },
  {
    "path": "photoview/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest package=\"com.github.chrisbanes.photoview\">\n\n</manifest>\n"
  },
  {
    "path": "photoview/src/main/java/com/github/chrisbanes/photoview/Compat.java",
    "content": "/*\n Copyright 2011, 2012 Chris Banes.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\npackage com.github.chrisbanes.photoview;\n\nimport android.annotation.TargetApi;\nimport android.os.Build.VERSION;\nimport android.os.Build.VERSION_CODES;\nimport android.view.View;\n\nclass Compat {\n\n    private static final int SIXTY_FPS_INTERVAL = 1000 / 60;\n\n    public static void postOnAnimation(View view, Runnable runnable) {\n        if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {\n            postOnAnimationJellyBean(view, runnable);\n        } else {\n            view.postDelayed(runnable, SIXTY_FPS_INTERVAL);\n        }\n    }\n\n    @TargetApi(16)\n    private static void postOnAnimationJellyBean(View view, Runnable runnable) {\n        view.postOnAnimation(runnable);\n    }\n}\n"
  },
  {
    "path": "photoview/src/main/java/com/github/chrisbanes/photoview/CustomGestureDetector.java",
    "content": "/*\n Copyright 2011, 2012 Chris Banes.\n <p/>\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 <p/>\n http://www.apache.org/licenses/LICENSE-2.0\n <p/>\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 */\npackage com.github.chrisbanes.photoview;\n\nimport android.content.Context;\nimport android.view.MotionEvent;\nimport android.view.ScaleGestureDetector;\nimport android.view.VelocityTracker;\nimport android.view.ViewConfiguration;\n\n/**\n * Does a whole lot of gesture detecting.\n */\nclass CustomGestureDetector {\n\n    private static final int INVALID_POINTER_ID = -1;\n\n    private int mActivePointerId = INVALID_POINTER_ID;\n    private int mActivePointerIndex = 0;\n    private final ScaleGestureDetector mDetector;\n\n    private VelocityTracker mVelocityTracker;\n    private boolean mIsDragging;\n    private float mLastTouchX;\n    private float mLastTouchY;\n    private final float mTouchSlop;\n    private final float mMinimumVelocity;\n    private OnGestureListener mListener;\n\n    CustomGestureDetector(Context context, OnGestureListener listener) {\n        final ViewConfiguration configuration = ViewConfiguration\n                .get(context);\n        mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();\n        mTouchSlop = configuration.getScaledTouchSlop();\n\n        mListener = listener;\n        ScaleGestureDetector.OnScaleGestureListener mScaleListener = new ScaleGestureDetector.OnScaleGestureListener() {\n            private float lastFocusX, lastFocusY = 0;\n\n            @Override\n            public boolean onScale(ScaleGestureDetector detector) {\n                float scaleFactor = detector.getScaleFactor();\n\n                if (Float.isNaN(scaleFactor) || Float.isInfinite(scaleFactor))\n                    return false;\n             \n                if (scaleFactor >= 0) {\n                    mListener.onScale(scaleFactor,\n                            detector.getFocusX(),\n                            detector.getFocusY(),\n                            detector.getFocusX() - lastFocusX,\n                            detector.getFocusY() - lastFocusY\n                    );\n                    lastFocusX = detector.getFocusX();\n                    lastFocusY = detector.getFocusY();\n                }\n                return true;\n            }\n\n            @Override\n            public boolean onScaleBegin(ScaleGestureDetector detector) {\n                lastFocusX = detector.getFocusX();\n                lastFocusY = detector.getFocusY();\n                return true;\n            }\n\n            @Override\n            public void onScaleEnd(ScaleGestureDetector detector) {\n                // NO-OP\n            }\n        };\n        mDetector = new ScaleGestureDetector(context, mScaleListener);\n    }\n\n    private float getActiveX(MotionEvent ev) {\n        try {\n            return ev.getX(mActivePointerIndex);\n        } catch (Exception e) {\n            return ev.getX();\n        }\n    }\n\n    private float getActiveY(MotionEvent ev) {\n        try {\n            return ev.getY(mActivePointerIndex);\n        } catch (Exception e) {\n            return ev.getY();\n        }\n    }\n\n    public boolean isScaling() {\n        return mDetector.isInProgress();\n    }\n\n    public boolean isDragging() {\n        return mIsDragging;\n    }\n\n    public boolean onTouchEvent(MotionEvent ev) {\n        try {\n            mDetector.onTouchEvent(ev);\n            return processTouchEvent(ev);\n        } catch (IllegalArgumentException e) {\n            // Fix for support lib bug, happening when onDestroy is called\n            return true;\n        }\n    }\n\n    private boolean processTouchEvent(MotionEvent ev) {\n        final int action = ev.getAction();\n        switch (action & MotionEvent.ACTION_MASK) {\n            case MotionEvent.ACTION_DOWN:\n                mActivePointerId = ev.getPointerId(0);\n\n                mVelocityTracker = VelocityTracker.obtain();\n                if (null != mVelocityTracker) {\n                    mVelocityTracker.addMovement(ev);\n                }\n\n                mLastTouchX = getActiveX(ev);\n                mLastTouchY = getActiveY(ev);\n                mIsDragging = false;\n                break;\n            case MotionEvent.ACTION_MOVE:\n                final float x = getActiveX(ev);\n                final float y = getActiveY(ev);\n                final float dx = x - mLastTouchX, dy = y - mLastTouchY;\n\n                if (!mIsDragging) {\n                    // Use Pythagoras to see if drag length is larger than\n                    // touch slop\n                    mIsDragging = Math.sqrt((dx * dx) + (dy * dy)) >= mTouchSlop;\n                }\n\n                if (mIsDragging) {\n                    mListener.onDrag(dx, dy);\n                    mLastTouchX = x;\n                    mLastTouchY = y;\n\n                    if (null != mVelocityTracker) {\n                        mVelocityTracker.addMovement(ev);\n                    }\n                }\n                break;\n            case MotionEvent.ACTION_CANCEL:\n                mActivePointerId = INVALID_POINTER_ID;\n                // Recycle Velocity Tracker\n                if (null != mVelocityTracker) {\n                    mVelocityTracker.recycle();\n                    mVelocityTracker = null;\n                }\n                break;\n            case MotionEvent.ACTION_UP:\n                mActivePointerId = INVALID_POINTER_ID;\n                if (mIsDragging) {\n                    if (null != mVelocityTracker) {\n                        mLastTouchX = getActiveX(ev);\n                        mLastTouchY = getActiveY(ev);\n\n                        // Compute velocity within the last 1000ms\n                        mVelocityTracker.addMovement(ev);\n                        mVelocityTracker.computeCurrentVelocity(1000);\n\n                        final float vX = mVelocityTracker.getXVelocity(), vY = mVelocityTracker\n                                .getYVelocity();\n\n                        // If the velocity is greater than minVelocity, call\n                        // listener\n                        if (Math.max(Math.abs(vX), Math.abs(vY)) >= mMinimumVelocity) {\n                            mListener.onFling(mLastTouchX, mLastTouchY, -vX,\n                                    -vY);\n                        }\n                    }\n                }\n\n                // Recycle Velocity Tracker\n                if (null != mVelocityTracker) {\n                    mVelocityTracker.recycle();\n                    mVelocityTracker = null;\n                }\n                break;\n            case MotionEvent.ACTION_POINTER_UP:\n                final int pointerIndex = Util.getPointerIndex(ev.getAction());\n                final int pointerId = ev.getPointerId(pointerIndex);\n                if (pointerId == mActivePointerId) {\n                    // This was our active pointer going up. Choose a new\n                    // active pointer and adjust accordingly.\n                    final int newPointerIndex = pointerIndex == 0 ? 1 : 0;\n                    mActivePointerId = ev.getPointerId(newPointerIndex);\n                    mLastTouchX = ev.getX(newPointerIndex);\n                    mLastTouchY = ev.getY(newPointerIndex);\n                }\n                break;\n        }\n\n        mActivePointerIndex = ev\n                .findPointerIndex(mActivePointerId != INVALID_POINTER_ID ? mActivePointerId\n                        : 0);\n        return true;\n    }\n}\n"
  },
  {
    "path": "photoview/src/main/java/com/github/chrisbanes/photoview/OnGestureListener.java",
    "content": "/*\n Copyright 2011, 2012 Chris Banes.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\npackage com.github.chrisbanes.photoview;\n\ninterface OnGestureListener {\n\n    void onDrag(float dx, float dy);\n\n    void onFling(float startX, float startY, float velocityX,\n                 float velocityY);\n\n    void onScale(float scaleFactor, float focusX, float focusY);\n\n    void onScale(float scaleFactor, float focusX, float focusY, float dx, float dy);\n}"
  },
  {
    "path": "photoview/src/main/java/com/github/chrisbanes/photoview/OnMatrixChangedListener.java",
    "content": "package com.github.chrisbanes.photoview;\n\nimport android.graphics.RectF;\n\n/**\n * Interface definition for a callback to be invoked when the internal Matrix has changed for\n * this View.\n */\npublic interface OnMatrixChangedListener {\n\n    /**\n     * Callback for when the Matrix displaying the Drawable has changed. This could be because\n     * the View's bounds have changed, or the user has zoomed.\n     *\n     * @param rect - Rectangle displaying the Drawable's new bounds.\n     */\n    void onMatrixChanged(RectF rect);\n}\n"
  },
  {
    "path": "photoview/src/main/java/com/github/chrisbanes/photoview/OnOutsidePhotoTapListener.java",
    "content": "package com.github.chrisbanes.photoview;\n\nimport android.widget.ImageView;\n\n/**\n * Callback when the user tapped outside of the photo\n */\npublic interface OnOutsidePhotoTapListener {\n\n    /**\n     * The outside of the photo has been tapped\n     */\n    void onOutsidePhotoTap(ImageView imageView);\n}\n"
  },
  {
    "path": "photoview/src/main/java/com/github/chrisbanes/photoview/OnPhotoTapListener.java",
    "content": "package com.github.chrisbanes.photoview;\n\nimport android.widget.ImageView;\n\n/**\n * A callback to be invoked when the Photo is tapped with a single\n * tap.\n */\npublic interface OnPhotoTapListener {\n\n    /**\n     * A callback to receive where the user taps on a photo. You will only receive a callback if\n     * the user taps on the actual photo, tapping on 'whitespace' will be ignored.\n     *\n     * @param view ImageView the user tapped.\n     * @param x    where the user tapped from the of the Drawable, as percentage of the\n     *             Drawable width.\n     * @param y    where the user tapped from the top of the Drawable, as percentage of the\n     *             Drawable height.\n     */\n    void onPhotoTap(ImageView view, float x, float y);\n}\n"
  },
  {
    "path": "photoview/src/main/java/com/github/chrisbanes/photoview/OnScaleChangedListener.java",
    "content": "package com.github.chrisbanes.photoview;\n\n\n/**\n * Interface definition for callback to be invoked when attached ImageView scale changes\n */\npublic interface OnScaleChangedListener {\n\n    /**\n     * Callback for when the scale changes\n     *\n     * @param scaleFactor the scale factor (less than 1 for zoom out, greater than 1 for zoom in)\n     * @param focusX      focal point X position\n     * @param focusY      focal point Y position\n     */\n    void onScaleChange(float scaleFactor, float focusX, float focusY);\n}\n"
  },
  {
    "path": "photoview/src/main/java/com/github/chrisbanes/photoview/OnSingleFlingListener.java",
    "content": "package com.github.chrisbanes.photoview;\n\nimport android.view.MotionEvent;\n\n/**\n * A callback to be invoked when the ImageView is flung with a single\n * touch\n */\npublic interface OnSingleFlingListener {\n\n    /**\n     * A callback to receive where the user flings on a ImageView. You will receive a callback if\n     * the user flings anywhere on the view.\n     *\n     * @param e1        MotionEvent the user first touch.\n     * @param e2        MotionEvent the user last touch.\n     * @param velocityX distance of user's horizontal fling.\n     * @param velocityY distance of user's vertical fling.\n     */\n    boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY);\n}\n"
  },
  {
    "path": "photoview/src/main/java/com/github/chrisbanes/photoview/OnViewDragListener.java",
    "content": "package com.github.chrisbanes.photoview;\n\n/**\n * Interface definition for a callback to be invoked when the photo is experiencing a drag event\n */\npublic interface OnViewDragListener {\n\n    /**\n     * Callback for when the photo is experiencing a drag event. This cannot be invoked when the\n     * user is scaling.\n     *\n     * @param dx The change of the coordinates in the x-direction\n     * @param dy The change of the coordinates in the y-direction\n     */\n    void onDrag(float dx, float dy);\n}\n"
  },
  {
    "path": "photoview/src/main/java/com/github/chrisbanes/photoview/OnViewTapListener.java",
    "content": "package com.github.chrisbanes.photoview;\n\nimport android.view.View;\n\npublic interface OnViewTapListener {\n\n    /**\n     * A callback to receive where the user taps on a ImageView. You will receive a callback if\n     * the user taps anywhere on the view, tapping on 'whitespace' will not be ignored.\n     *\n     * @param view - View the user tapped.\n     * @param x    - where the user tapped from the left of the View.\n     * @param y    - where the user tapped from the top of the View.\n     */\n    void onViewTap(View view, float x, float y);\n}\n"
  },
  {
    "path": "photoview/src/main/java/com/github/chrisbanes/photoview/PhotoView.java",
    "content": "/*\n Copyright 2011, 2012 Chris Banes.\n <p>\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 <p>\n http://www.apache.org/licenses/LICENSE-2.0\n <p>\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 */\npackage com.github.chrisbanes.photoview;\n\nimport android.content.Context;\nimport android.graphics.Matrix;\nimport android.graphics.RectF;\nimport android.graphics.drawable.Drawable;\nimport android.net.Uri;\nimport android.util.AttributeSet;\nimport android.view.GestureDetector;\n\nimport androidx.appcompat.widget.AppCompatImageView;\n\n/**\n * A zoomable ImageView. See {@link PhotoViewAttacher} for most of the details on how the zooming\n * is accomplished\n */\n@SuppressWarnings(\"unused\")\npublic class PhotoView extends AppCompatImageView {\n\n    private PhotoViewAttacher attacher;\n    private ScaleType pendingScaleType;\n\n    public PhotoView(Context context) {\n        this(context, null);\n    }\n\n    public PhotoView(Context context, AttributeSet attr) {\n        this(context, attr, 0);\n    }\n\n    public PhotoView(Context context, AttributeSet attr, int defStyle) {\n        super(context, attr, defStyle);\n        init();\n    }\n\n    private void init() {\n        attacher = new PhotoViewAttacher(this);\n        //We always pose as a Matrix scale type, though we can change to another scale type\n        //via the attacher\n        super.setScaleType(ScaleType.MATRIX);\n        //apply the previously applied scale type\n        if (pendingScaleType != null) {\n            setScaleType(pendingScaleType);\n            pendingScaleType = null;\n        }\n    }\n\n    /**\n     * Get the current {@link PhotoViewAttacher} for this view. Be wary of holding on to references\n     * to this attacher, as it has a reference to this view, which, if a reference is held in the\n     * wrong place, can cause memory leaks.\n     *\n     * @return the attacher.\n     */\n    public PhotoViewAttacher getAttacher() {\n        return attacher;\n    }\n\n    @Override\n    public ScaleType getScaleType() {\n        return attacher.getScaleType();\n    }\n\n    @Override\n    public Matrix getImageMatrix() {\n        return attacher.getImageMatrix();\n    }\n\n    @Override\n    public void setOnLongClickListener(OnLongClickListener l) {\n        attacher.setOnLongClickListener(l);\n    }\n\n    @Override\n    public void setOnClickListener(OnClickListener l) {\n        attacher.setOnClickListener(l);\n    }\n\n    @Override\n    public void setScaleType(ScaleType scaleType) {\n        if (attacher == null) {\n            pendingScaleType = scaleType;\n        } else {\n            attacher.setScaleType(scaleType);\n        }\n    }\n\n    @Override\n    public void setImageDrawable(Drawable drawable) {\n        super.setImageDrawable(drawable);\n        // setImageBitmap calls through to this method\n        if (attacher != null) {\n            attacher.update();\n        }\n    }\n\n    @Override\n    public void setImageResource(int resId) {\n        super.setImageResource(resId);\n        if (attacher != null) {\n            attacher.update();\n        }\n    }\n\n    @Override\n    public void setImageURI(Uri uri) {\n        super.setImageURI(uri);\n        if (attacher != null) {\n            attacher.update();\n        }\n    }\n\n    @Override\n    protected boolean setFrame(int l, int t, int r, int b) {\n        boolean changed = super.setFrame(l, t, r, b);\n        if (changed) {\n            attacher.update();\n        }\n        return changed;\n    }\n\n    public void setRotationTo(float rotationDegree) {\n        attacher.setRotationTo(rotationDegree);\n    }\n\n    public void setRotationBy(float rotationDegree) {\n        attacher.setRotationBy(rotationDegree);\n    }\n\n    public boolean isZoomable() {\n        return attacher.isZoomable();\n    }\n\n    public void setZoomable(boolean zoomable) {\n        attacher.setZoomable(zoomable);\n    }\n\n    public RectF getDisplayRect() {\n        return attacher.getDisplayRect();\n    }\n\n    public void getDisplayMatrix(Matrix matrix) {\n        attacher.getDisplayMatrix(matrix);\n    }\n\n    @SuppressWarnings(\"UnusedReturnValue\") public boolean setDisplayMatrix(Matrix finalRectangle) {\n        return attacher.setDisplayMatrix(finalRectangle);\n    }\n\n    public void getSuppMatrix(Matrix matrix) {\n        attacher.getSuppMatrix(matrix);\n    }\n\n    public boolean setSuppMatrix(Matrix matrix) {\n        return attacher.setDisplayMatrix(matrix);\n    }\n\n    public float getMinimumScale() {\n        return attacher.getMinimumScale();\n    }\n\n    public float getMediumScale() {\n        return attacher.getMediumScale();\n    }\n\n    public float getMaximumScale() {\n        return attacher.getMaximumScale();\n    }\n\n    public float getScale() {\n        return attacher.getScale();\n    }\n\n    public void setAllowParentInterceptOnEdge(boolean allow) {\n        attacher.setAllowParentInterceptOnEdge(allow);\n    }\n\n    public void setMinimumScale(float minimumScale) {\n        attacher.setMinimumScale(minimumScale);\n    }\n\n    public void setMediumScale(float mediumScale) {\n        attacher.setMediumScale(mediumScale);\n    }\n\n    public void setMaximumScale(float maximumScale) {\n        attacher.setMaximumScale(maximumScale);\n    }\n\n    public void setScaleLevels(float minimumScale, float mediumScale, float maximumScale) {\n        attacher.setScaleLevels(minimumScale, mediumScale, maximumScale);\n    }\n\n    public void setOnMatrixChangeListener(OnMatrixChangedListener listener) {\n        attacher.setOnMatrixChangeListener(listener);\n    }\n\n    public void setOnPhotoTapListener(OnPhotoTapListener listener) {\n        attacher.setOnPhotoTapListener(listener);\n    }\n\n    public void setOnOutsidePhotoTapListener(OnOutsidePhotoTapListener listener) {\n        attacher.setOnOutsidePhotoTapListener(listener);\n    }\n\n    public void setOnViewTapListener(OnViewTapListener listener) {\n        attacher.setOnViewTapListener(listener);\n    }\n\n    public void setOnViewDragListener(OnViewDragListener listener) {\n        attacher.setOnViewDragListener(listener);\n    }\n\n    public void setScale(float scale) {\n        attacher.setScale(scale);\n    }\n\n    public void setScale(float scale, boolean animate) {\n        attacher.setScale(scale, animate);\n    }\n\n    public void setScale(float scale, float focalX, float focalY, boolean animate) {\n        attacher.setScale(scale, focalX, focalY, animate);\n    }\n\n    public void setZoomTransitionDuration(int milliseconds) {\n        attacher.setZoomTransitionDuration(milliseconds);\n    }\n\n    public void setOnDoubleTapListener(GestureDetector.OnDoubleTapListener onDoubleTapListener) {\n        attacher.setOnDoubleTapListener(onDoubleTapListener);\n    }\n\n    public void setOnScaleChangeListener(OnScaleChangedListener onScaleChangedListener) {\n        attacher.setOnScaleChangeListener(onScaleChangedListener);\n    }\n\n    public void setOnSingleFlingListener(OnSingleFlingListener onSingleFlingListener) {\n        attacher.setOnSingleFlingListener(onSingleFlingListener);\n    }\n}\n"
  },
  {
    "path": "photoview/src/main/java/com/github/chrisbanes/photoview/PhotoViewAttacher.java",
    "content": "/*\n Copyright 2011, 2012 Chris Banes.\n <p>\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 <p>\n http://www.apache.org/licenses/LICENSE-2.0\n <p>\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 */\npackage com.github.chrisbanes.photoview;\n\nimport android.content.Context;\nimport android.graphics.Matrix;\nimport android.graphics.Matrix.ScaleToFit;\nimport android.graphics.RectF;\nimport android.graphics.drawable.Drawable;\nimport android.view.GestureDetector;\nimport android.view.MotionEvent;\nimport android.view.View;\nimport android.view.View.OnLongClickListener;\nimport android.view.ViewParent;\nimport android.view.animation.AccelerateDecelerateInterpolator;\nimport android.view.animation.Interpolator;\nimport android.widget.ImageView;\nimport android.widget.ImageView.ScaleType;\nimport android.widget.OverScroller;\n\n/**\n * The component of {@link PhotoView} which does the work allowing for zooming, scaling, panning, etc.\n * It is made public in case you need to subclass something other than AppCompatImageView and still\n * gain the functionality that {@link PhotoView} offers\n */\npublic class PhotoViewAttacher implements View.OnTouchListener,\n    View.OnLayoutChangeListener {\n\n    private static float DEFAULT_MAX_SCALE = 3.0f;\n    private static float DEFAULT_MID_SCALE = 1.75f;\n    private static float DEFAULT_MIN_SCALE = 1.0f;\n    private static int DEFAULT_ZOOM_DURATION = 200;\n\n    private static final int HORIZONTAL_EDGE_NONE = -1;\n    private static final int HORIZONTAL_EDGE_LEFT = 0;\n    private static final int HORIZONTAL_EDGE_RIGHT = 1;\n    private static final int HORIZONTAL_EDGE_BOTH = 2;\n    private static final int VERTICAL_EDGE_NONE = -1;\n    private static final int VERTICAL_EDGE_TOP = 0;\n    private static final int VERTICAL_EDGE_BOTTOM = 1;\n    private static final int VERTICAL_EDGE_BOTH = 2;\n    private static int SINGLE_TOUCH = 1;\n\n    private Interpolator mInterpolator = new AccelerateDecelerateInterpolator();\n    private int mZoomDuration = DEFAULT_ZOOM_DURATION;\n    private float mMinScale = DEFAULT_MIN_SCALE;\n    private float mMidScale = DEFAULT_MID_SCALE;\n    private float mMaxScale = DEFAULT_MAX_SCALE;\n\n    private boolean mAllowParentInterceptOnEdge = true;\n    private boolean mBlockParentIntercept = false;\n\n    private ImageView mImageView;\n\n    // Gesture Detectors\n    private GestureDetector mGestureDetector;\n    private CustomGestureDetector mScaleDragDetector;\n\n    // These are set so we don't keep allocating them on the heap\n    private final Matrix mBaseMatrix = new Matrix();\n    private final Matrix mDrawMatrix = new Matrix();\n    private final Matrix mSuppMatrix = new Matrix();\n    private final RectF mDisplayRect = new RectF();\n    private final float[] mMatrixValues = new float[9];\n\n    // Listeners\n    private OnMatrixChangedListener mMatrixChangeListener;\n    private OnPhotoTapListener mPhotoTapListener;\n    private OnOutsidePhotoTapListener mOutsidePhotoTapListener;\n    private OnViewTapListener mViewTapListener;\n    private View.OnClickListener mOnClickListener;\n    private OnLongClickListener mLongClickListener;\n    private OnScaleChangedListener mScaleChangeListener;\n    private OnSingleFlingListener mSingleFlingListener;\n    private OnViewDragListener mOnViewDragListener;\n\n    private FlingRunnable mCurrentFlingRunnable;\n    private int mHorizontalScrollEdge = HORIZONTAL_EDGE_BOTH;\n    private int mVerticalScrollEdge = VERTICAL_EDGE_BOTH;\n    private float mBaseRotation;\n\n    private boolean mZoomEnabled = true;\n    private ScaleType mScaleType = ScaleType.FIT_CENTER;\n\n    private OnGestureListener onGestureListener = new OnGestureListener() {\n        @Override\n        public void onDrag(float dx, float dy) {\n            if (mScaleDragDetector.isScaling()) {\n                return; // Do not drag if we are already scaling\n            }\n            if (mOnViewDragListener != null) {\n                mOnViewDragListener.onDrag(dx, dy);\n            }\n            mSuppMatrix.postTranslate(dx, dy);\n            checkAndDisplayMatrix();\n\n            /*\n             * Here we decide whether to let the ImageView's parent to start taking\n             * over the touch event.\n             *\n             * First we check whether this function is enabled. We never want the\n             * parent to take over if we're scaling. We then check the edge we're\n             * on, and the direction of the scroll (i.e. if we're pulling against\n             * the edge, aka 'overscrolling', let the parent take over).\n             */\n            ViewParent parent = mImageView.getParent();\n            if (mAllowParentInterceptOnEdge && !mScaleDragDetector.isScaling() && !mBlockParentIntercept) {\n                if (mHorizontalScrollEdge == HORIZONTAL_EDGE_BOTH\n                        || (mHorizontalScrollEdge == HORIZONTAL_EDGE_LEFT && dx >= 1f)\n                        || (mHorizontalScrollEdge == HORIZONTAL_EDGE_RIGHT && dx <= -1f)\n                        || (mVerticalScrollEdge == VERTICAL_EDGE_TOP && dy >= 1f)\n                        || (mVerticalScrollEdge == VERTICAL_EDGE_BOTTOM && dy <= -1f)) {\n                    if (parent != null) {\n                        parent.requestDisallowInterceptTouchEvent(false);\n                    }\n                }\n            } else {\n                if (parent != null) {\n                    parent.requestDisallowInterceptTouchEvent(true);\n                }\n            }\n        }\n\n        @Override\n        public void onFling(float startX, float startY, float velocityX, float velocityY) {\n            mCurrentFlingRunnable = new FlingRunnable(mImageView.getContext());\n            mCurrentFlingRunnable.fling(getImageViewWidth(mImageView),\n                getImageViewHeight(mImageView), (int) velocityX, (int) velocityY);\n            mImageView.post(mCurrentFlingRunnable);\n        }\n\n        @Override\n        public void onScale(float scaleFactor, float focusX, float focusY) {\n            onScale(scaleFactor, focusX, focusY, 0, 0);\n        }\n\n        @Override\n        public void onScale(float scaleFactor, float focusX, float focusY, float dx, float dy) {\n            if (getScale() < mMaxScale || scaleFactor < 1f) {\n                if (mScaleChangeListener != null) {\n                    mScaleChangeListener.onScaleChange(scaleFactor, focusX, focusY);\n                }\n                mSuppMatrix.postScale(scaleFactor, scaleFactor, focusX, focusY);\n                mSuppMatrix.postTranslate(dx, dy);\n                checkAndDisplayMatrix();\n            }\n        }\n    };\n\n    public PhotoViewAttacher(ImageView imageView) {\n        mImageView = imageView;\n        imageView.setOnTouchListener(this);\n        imageView.addOnLayoutChangeListener(this);\n        if (imageView.isInEditMode()) {\n            return;\n        }\n        mBaseRotation = 0.0f;\n        // Create Gesture Detectors...\n        mScaleDragDetector = new CustomGestureDetector(imageView.getContext(), onGestureListener);\n        mGestureDetector = new GestureDetector(imageView.getContext(), new GestureDetector.SimpleOnGestureListener() {\n\n            // forward long click listener\n            @Override\n            public void onLongPress(MotionEvent e) {\n                if (mLongClickListener != null) {\n                    mLongClickListener.onLongClick(mImageView);\n                }\n            }\n\n            @Override\n            public boolean onFling(MotionEvent e1, MotionEvent e2,\n                float velocityX, float velocityY) {\n                if (mSingleFlingListener != null) {\n                    if (getScale() > DEFAULT_MIN_SCALE) {\n                        return false;\n                    }\n                    if (e1.getPointerCount() > SINGLE_TOUCH\n                        || e2.getPointerCount() > SINGLE_TOUCH) {\n                        return false;\n                    }\n                    return mSingleFlingListener.onFling(e1, e2, velocityX, velocityY);\n                }\n                return false;\n            }\n        });\n        mGestureDetector.setOnDoubleTapListener(new GestureDetector.OnDoubleTapListener() {\n            @Override\n            public boolean onSingleTapConfirmed(MotionEvent e) {\n                if (mOnClickListener != null) {\n                    mOnClickListener.onClick(mImageView);\n                }\n                final RectF displayRect = getDisplayRect();\n                final float x = e.getX(), y = e.getY();\n                if (mViewTapListener != null) {\n                    mViewTapListener.onViewTap(mImageView, x, y);\n                }\n                if (displayRect != null) {\n                    // Check to see if the user tapped on the photo\n                    if (displayRect.contains(x, y)) {\n                        float xResult = (x - displayRect.left)\n                            / displayRect.width();\n                        float yResult = (y - displayRect.top)\n                            / displayRect.height();\n                        if (mPhotoTapListener != null) {\n                            mPhotoTapListener.onPhotoTap(mImageView, xResult, yResult);\n                        }\n                        return true;\n                    } else {\n                        if (mOutsidePhotoTapListener != null) {\n                            mOutsidePhotoTapListener.onOutsidePhotoTap(mImageView);\n                        }\n                    }\n                }\n                return false;\n            }\n\n            @Override\n            public boolean onDoubleTap(MotionEvent ev) {\n                try {\n                    float scale = getScale();\n                    float x = ev.getX();\n                    float y = ev.getY();\n                    if (scale < getMediumScale()) {\n                        setScale(getMediumScale(), x, y, true);\n                    } else if (scale >= getMediumScale() && scale < getMaximumScale()) {\n                        setScale(getMaximumScale(), x, y, true);\n                    } else {\n                        setScale(getMinimumScale(), x, y, true);\n                    }\n                } catch (ArrayIndexOutOfBoundsException e) {\n                    // Can sometimes happen when getX() and getY() is called\n                }\n                return true;\n            }\n\n            @Override\n            public boolean onDoubleTapEvent(MotionEvent e) {\n                // Wait for the confirmed onDoubleTap() instead\n                return false;\n            }\n        });\n    }\n\n    public void setOnDoubleTapListener(GestureDetector.OnDoubleTapListener newOnDoubleTapListener) {\n        this.mGestureDetector.setOnDoubleTapListener(newOnDoubleTapListener);\n    }\n\n    public void setOnScaleChangeListener(OnScaleChangedListener onScaleChangeListener) {\n        this.mScaleChangeListener = onScaleChangeListener;\n    }\n\n    public void setOnSingleFlingListener(OnSingleFlingListener onSingleFlingListener) {\n        this.mSingleFlingListener = onSingleFlingListener;\n    }\n\n    @Deprecated\n    public boolean isZoomEnabled() {\n        return mZoomEnabled;\n    }\n\n    public RectF getDisplayRect() {\n        checkMatrixBounds();\n        return getDisplayRect(getDrawMatrix());\n    }\n\n    public boolean setDisplayMatrix(Matrix finalMatrix) {\n        if (finalMatrix == null) {\n            throw new IllegalArgumentException(\"Matrix cannot be null\");\n        }\n        if (mImageView.getDrawable() == null) {\n            return false;\n        }\n        mSuppMatrix.set(finalMatrix);\n        checkAndDisplayMatrix();\n        return true;\n    }\n\n    public void setBaseRotation(final float degrees) {\n        mBaseRotation = degrees % 360;\n        update();\n        setRotationBy(mBaseRotation);\n        checkAndDisplayMatrix();\n    }\n\n    public void setRotationTo(float degrees) {\n        mSuppMatrix.setRotate(degrees % 360);\n        checkAndDisplayMatrix();\n    }\n\n    public void setRotationBy(float degrees) {\n        mSuppMatrix.postRotate(degrees % 360);\n        checkAndDisplayMatrix();\n    }\n\n    public float getMinimumScale() {\n        return mMinScale;\n    }\n\n    public float getMediumScale() {\n        return mMidScale;\n    }\n\n    public float getMaximumScale() {\n        return mMaxScale;\n    }\n\n    public float getScale() {\n        return (float) Math.sqrt((float) Math.pow(getValue(mSuppMatrix, Matrix.MSCALE_X), 2) + (float) Math.pow\n            (getValue(mSuppMatrix, Matrix.MSKEW_Y), 2));\n    }\n\n    public ScaleType getScaleType() {\n        return mScaleType;\n    }\n\n    @Override\n    public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int\n        oldRight, int oldBottom) {\n        // Update our base matrix, as the bounds have changed\n        if (left != oldLeft || top != oldTop || right != oldRight || bottom != oldBottom) {\n            updateBaseMatrix(mImageView.getDrawable());\n        }\n    }\n\n    @Override\n    public boolean onTouch(View v, MotionEvent ev) {\n        boolean handled = false;\n        if (mZoomEnabled && Util.hasDrawable((ImageView) v)) {\n            switch (ev.getAction()) {\n                case MotionEvent.ACTION_DOWN:\n                    ViewParent parent = v.getParent();\n                    // First, disable the Parent from intercepting the touch\n                    // event\n                    if (parent != null) {\n                        parent.requestDisallowInterceptTouchEvent(true);\n                    }\n                    // If we're flinging, and the user presses down, cancel\n                    // fling\n                    cancelFling();\n                    break;\n                case MotionEvent.ACTION_CANCEL:\n                case MotionEvent.ACTION_UP:\n                    // If the user has zoomed less than min scale, zoom back\n                    // to min scale\n                    if (getScale() < mMinScale) {\n                        RectF rect = getDisplayRect();\n                        if (rect != null) {\n                            v.post(new AnimatedZoomRunnable(getScale(), mMinScale,\n                                rect.centerX(), rect.centerY()));\n                            handled = true;\n                        }\n                    } else if (getScale() > mMaxScale) {\n                        RectF rect = getDisplayRect();\n                        if (rect != null) {\n                            v.post(new AnimatedZoomRunnable(getScale(), mMaxScale,\n                                rect.centerX(), rect.centerY()));\n                            handled = true;\n                        }\n                    }\n                    break;\n            }\n            // Try the Scale/Drag detector\n            if (mScaleDragDetector != null) {\n                boolean wasScaling = mScaleDragDetector.isScaling();\n                boolean wasDragging = mScaleDragDetector.isDragging();\n                handled = mScaleDragDetector.onTouchEvent(ev);\n                boolean didntScale = !wasScaling && !mScaleDragDetector.isScaling();\n                boolean didntDrag = !wasDragging && !mScaleDragDetector.isDragging();\n                mBlockParentIntercept = didntScale && didntDrag;\n            }\n            // Check to see if the user double tapped\n            if (mGestureDetector != null && mGestureDetector.onTouchEvent(ev)) {\n                handled = true;\n            }\n\n        }\n        return handled;\n    }\n\n    public void setAllowParentInterceptOnEdge(boolean allow) {\n        mAllowParentInterceptOnEdge = allow;\n    }\n\n    public void setMinimumScale(float minimumScale) {\n        Util.checkZoomLevels(minimumScale, mMidScale, mMaxScale);\n        mMinScale = minimumScale;\n    }\n\n    public void setMediumScale(float mediumScale) {\n        Util.checkZoomLevels(mMinScale, mediumScale, mMaxScale);\n        mMidScale = mediumScale;\n    }\n\n    public void setMaximumScale(float maximumScale) {\n        Util.checkZoomLevels(mMinScale, mMidScale, maximumScale);\n        mMaxScale = maximumScale;\n    }\n\n    public void setScaleLevels(float minimumScale, float mediumScale, float maximumScale) {\n        Util.checkZoomLevels(minimumScale, mediumScale, maximumScale);\n        mMinScale = minimumScale;\n        mMidScale = mediumScale;\n        mMaxScale = maximumScale;\n    }\n\n    public void setOnLongClickListener(OnLongClickListener listener) {\n        mLongClickListener = listener;\n    }\n\n    public void setOnClickListener(View.OnClickListener listener) {\n        mOnClickListener = listener;\n    }\n\n    public void setOnMatrixChangeListener(OnMatrixChangedListener listener) {\n        mMatrixChangeListener = listener;\n    }\n\n    public void setOnPhotoTapListener(OnPhotoTapListener listener) {\n        mPhotoTapListener = listener;\n    }\n\n    public void setOnOutsidePhotoTapListener(OnOutsidePhotoTapListener mOutsidePhotoTapListener) {\n        this.mOutsidePhotoTapListener = mOutsidePhotoTapListener;\n    }\n\n    public void setOnViewTapListener(OnViewTapListener listener) {\n        mViewTapListener = listener;\n    }\n\n    public void setOnViewDragListener(OnViewDragListener listener) {\n        mOnViewDragListener = listener;\n    }\n\n    public void setScale(float scale) {\n        setScale(scale, false);\n    }\n\n    public void setScale(float scale, boolean animate) {\n        setScale(scale,\n            (mImageView.getRight()) / 2,\n            (mImageView.getBottom()) / 2,\n            animate);\n    }\n\n    public void setScale(float scale, float focalX, float focalY,\n        boolean animate) {\n        // Check to see if the scale is within bounds\n        if (scale < mMinScale || scale > mMaxScale) {\n            throw new IllegalArgumentException(\"Scale must be within the range of minScale and maxScale\");\n        }\n        if (animate) {\n            mImageView.post(new AnimatedZoomRunnable(getScale(), scale,\n                focalX, focalY));\n        } else {\n            mSuppMatrix.setScale(scale, scale, focalX, focalY);\n            checkAndDisplayMatrix();\n        }\n    }\n\n    /**\n     * Set the zoom interpolator\n     *\n     * @param interpolator the zoom interpolator\n     */\n    public void setZoomInterpolator(Interpolator interpolator) {\n        mInterpolator = interpolator;\n    }\n\n    public void setScaleType(ScaleType scaleType) {\n        if (Util.isSupportedScaleType(scaleType) && scaleType != mScaleType) {\n            mScaleType = scaleType;\n            update();\n        }\n    }\n\n    public boolean isZoomable() {\n        return mZoomEnabled;\n    }\n\n    public void setZoomable(boolean zoomable) {\n        mZoomEnabled = zoomable;\n        update();\n    }\n\n    public void update() {\n        if (mZoomEnabled) {\n            // Update the base matrix using the current drawable\n            updateBaseMatrix(mImageView.getDrawable());\n        } else {\n            // Reset the Matrix...\n            resetMatrix();\n        }\n    }\n\n    /**\n     * Get the display matrix\n     *\n     * @param matrix target matrix to copy to\n     */\n    public void getDisplayMatrix(Matrix matrix) {\n        matrix.set(getDrawMatrix());\n    }\n\n    /**\n     * Get the current support matrix\n     */\n    public void getSuppMatrix(Matrix matrix) {\n        matrix.set(mSuppMatrix);\n    }\n\n    private Matrix getDrawMatrix() {\n        mDrawMatrix.set(mBaseMatrix);\n        mDrawMatrix.postConcat(mSuppMatrix);\n        return mDrawMatrix;\n    }\n\n    public Matrix getImageMatrix() {\n        return mDrawMatrix;\n    }\n\n    public void setZoomTransitionDuration(int milliseconds) {\n        this.mZoomDuration = milliseconds;\n    }\n\n    /**\n     * Helper method that 'unpacks' a Matrix and returns the required value\n     *\n     * @param matrix     Matrix to unpack\n     * @param whichValue Which value from Matrix.M* to return\n     * @return returned value\n     */\n    private float getValue(Matrix matrix, int whichValue) {\n        matrix.getValues(mMatrixValues);\n        return mMatrixValues[whichValue];\n    }\n\n    /**\n     * Resets the Matrix back to FIT_CENTER, and then displays its contents\n     */\n    private void resetMatrix() {\n        mSuppMatrix.reset();\n        setRotationBy(mBaseRotation);\n        setImageViewMatrix(getDrawMatrix());\n        checkMatrixBounds();\n    }\n\n    private void setImageViewMatrix(Matrix matrix) {\n        mImageView.setImageMatrix(matrix);\n        // Call MatrixChangedListener if needed\n        if (mMatrixChangeListener != null) {\n            RectF displayRect = getDisplayRect(matrix);\n            if (displayRect != null) {\n                mMatrixChangeListener.onMatrixChanged(displayRect);\n            }\n        }\n    }\n\n    /**\n     * Helper method that simply checks the Matrix, and then displays the result\n     */\n    private void checkAndDisplayMatrix() {\n        if (checkMatrixBounds()) {\n            setImageViewMatrix(getDrawMatrix());\n        }\n    }\n\n    /**\n     * Helper method that maps the supplied Matrix to the current Drawable\n     *\n     * @param matrix - Matrix to map Drawable against\n     * @return RectF - Displayed Rectangle\n     */\n    private RectF getDisplayRect(Matrix matrix) {\n        Drawable d = mImageView.getDrawable();\n        if (d != null) {\n            mDisplayRect.set(0, 0, d.getIntrinsicWidth(),\n                d.getIntrinsicHeight());\n            matrix.mapRect(mDisplayRect);\n            return mDisplayRect;\n        }\n        return null;\n    }\n\n    /**\n     * Calculate Matrix for FIT_CENTER\n     *\n     * @param drawable - Drawable being displayed\n     */\n    private void updateBaseMatrix(Drawable drawable) {\n        if (drawable == null) {\n            return;\n        }\n        final float viewWidth = getImageViewWidth(mImageView);\n        final float viewHeight = getImageViewHeight(mImageView);\n        final int drawableWidth = drawable.getIntrinsicWidth();\n        final int drawableHeight = drawable.getIntrinsicHeight();\n        mBaseMatrix.reset();\n        final float widthScale = viewWidth / drawableWidth;\n        final float heightScale = viewHeight / drawableHeight;\n        if (mScaleType == ScaleType.CENTER) {\n            mBaseMatrix.postTranslate((viewWidth - drawableWidth) / 2F,\n                (viewHeight - drawableHeight) / 2F);\n\n        } else if (mScaleType == ScaleType.CENTER_CROP) {\n            float scale = Math.max(widthScale, heightScale);\n            mBaseMatrix.postScale(scale, scale);\n            mBaseMatrix.postTranslate((viewWidth - drawableWidth * scale) / 2F,\n                (viewHeight - drawableHeight * scale) / 2F);\n\n        } else if (mScaleType == ScaleType.CENTER_INSIDE) {\n            float scale = Math.min(1.0f, Math.min(widthScale, heightScale));\n            mBaseMatrix.postScale(scale, scale);\n            mBaseMatrix.postTranslate((viewWidth - drawableWidth * scale) / 2F,\n                (viewHeight - drawableHeight * scale) / 2F);\n\n        } else {\n            RectF mTempSrc = new RectF(0, 0, drawableWidth, drawableHeight);\n            RectF mTempDst = new RectF(0, 0, viewWidth, viewHeight);\n            if ((int) mBaseRotation % 180 != 0) {\n                mTempSrc = new RectF(0, 0, drawableHeight, drawableWidth);\n            }\n            switch (mScaleType) {\n                case FIT_CENTER:\n                    mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.CENTER);\n                    break;\n                case FIT_START:\n                    mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.START);\n                    break;\n                case FIT_END:\n                    mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.END);\n                    break;\n                case FIT_XY:\n                    mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.FILL);\n                    break;\n                default:\n                    break;\n            }\n        }\n        resetMatrix();\n    }\n\n    private boolean checkMatrixBounds() {\n        final RectF rect = getDisplayRect(getDrawMatrix());\n        if (rect == null) {\n            return false;\n        }\n        final float height = rect.height(), width = rect.width();\n        float deltaX = 0, deltaY = 0;\n        final int viewHeight = getImageViewHeight(mImageView);\n        if (height <= viewHeight) {\n            switch (mScaleType) {\n                case FIT_START:\n                    deltaY = -rect.top;\n                    break;\n                case FIT_END:\n                    deltaY = viewHeight - height - rect.top;\n                    break;\n                default:\n                    deltaY = (viewHeight - height) / 2 - rect.top;\n                    break;\n            }\n            mVerticalScrollEdge = VERTICAL_EDGE_BOTH;\n        } else if (rect.top > 0) {\n            mVerticalScrollEdge = VERTICAL_EDGE_TOP;\n            deltaY = -rect.top;\n        } else if (rect.bottom < viewHeight) {\n            mVerticalScrollEdge = VERTICAL_EDGE_BOTTOM;\n            deltaY = viewHeight - rect.bottom;\n        } else {\n            mVerticalScrollEdge = VERTICAL_EDGE_NONE;\n        }\n        final int viewWidth = getImageViewWidth(mImageView);\n        if (width <= viewWidth) {\n            switch (mScaleType) {\n                case FIT_START:\n                    deltaX = -rect.left;\n                    break;\n                case FIT_END:\n                    deltaX = viewWidth - width - rect.left;\n                    break;\n                default:\n                    deltaX = (viewWidth - width) / 2 - rect.left;\n                    break;\n            }\n            mHorizontalScrollEdge = HORIZONTAL_EDGE_BOTH;\n        } else if (rect.left > 0) {\n            mHorizontalScrollEdge = HORIZONTAL_EDGE_LEFT;\n            deltaX = -rect.left;\n        } else if (rect.right < viewWidth) {\n            deltaX = viewWidth - rect.right;\n            mHorizontalScrollEdge = HORIZONTAL_EDGE_RIGHT;\n        } else {\n            mHorizontalScrollEdge = HORIZONTAL_EDGE_NONE;\n        }\n        // Finally actually translate the matrix\n        mSuppMatrix.postTranslate(deltaX, deltaY);\n        return true;\n    }\n\n    private int getImageViewWidth(ImageView imageView) {\n        return imageView.getWidth() - imageView.getPaddingLeft() - imageView.getPaddingRight();\n    }\n\n    private int getImageViewHeight(ImageView imageView) {\n        return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();\n    }\n\n    private void cancelFling() {\n        if (mCurrentFlingRunnable != null) {\n            mCurrentFlingRunnable.cancelFling();\n            mCurrentFlingRunnable = null;\n        }\n    }\n\n    private class AnimatedZoomRunnable implements Runnable {\n\n        private final float mFocalX, mFocalY;\n        private final long mStartTime;\n        private final float mZoomStart, mZoomEnd;\n\n        public AnimatedZoomRunnable(final float currentZoom, final float targetZoom,\n            final float focalX, final float focalY) {\n            mFocalX = focalX;\n            mFocalY = focalY;\n            mStartTime = System.currentTimeMillis();\n            mZoomStart = currentZoom;\n            mZoomEnd = targetZoom;\n        }\n\n        @Override\n        public void run() {\n            float t = interpolate();\n            float scale = mZoomStart + t * (mZoomEnd - mZoomStart);\n            float deltaScale = scale / getScale();\n            onGestureListener.onScale(deltaScale, mFocalX, mFocalY);\n            // We haven't hit our target scale yet, so post ourselves again\n            if (t < 1f) {\n                Compat.postOnAnimation(mImageView, this);\n            }\n        }\n\n        private float interpolate() {\n            float t = 1f * (System.currentTimeMillis() - mStartTime) / mZoomDuration;\n            t = Math.min(1f, t);\n            t = mInterpolator.getInterpolation(t);\n            return t;\n        }\n    }\n\n    private class FlingRunnable implements Runnable {\n\n        private final OverScroller mScroller;\n        private int mCurrentX, mCurrentY;\n\n        public FlingRunnable(Context context) {\n            mScroller = new OverScroller(context);\n        }\n\n        public void cancelFling() {\n            mScroller.forceFinished(true);\n        }\n\n        public void fling(int viewWidth, int viewHeight, int velocityX,\n            int velocityY) {\n            final RectF rect = getDisplayRect();\n            if (rect == null) {\n                return;\n            }\n            final int startX = Math.round(-rect.left);\n            final int minX, maxX, minY, maxY;\n            if (viewWidth < rect.width()) {\n                minX = 0;\n                maxX = Math.round(rect.width() - viewWidth);\n            } else {\n                minX = maxX = startX;\n            }\n            final int startY = Math.round(-rect.top);\n            if (viewHeight < rect.height()) {\n                minY = 0;\n                maxY = Math.round(rect.height() - viewHeight);\n            } else {\n                minY = maxY = startY;\n            }\n            mCurrentX = startX;\n            mCurrentY = startY;\n            // If we actually can move, fling the scroller\n            if (startX != maxX || startY != maxY) {\n                mScroller.fling(startX, startY, velocityX, velocityY, minX,\n                    maxX, minY, maxY, 0, 0);\n            }\n        }\n\n        @Override\n        public void run() {\n            if (mScroller.isFinished()) {\n                return; // remaining post that should not be handled\n            }\n            if (mScroller.computeScrollOffset()) {\n                final int newX = mScroller.getCurrX();\n                final int newY = mScroller.getCurrY();\n                mSuppMatrix.postTranslate(mCurrentX - newX, mCurrentY - newY);\n                checkAndDisplayMatrix();\n                mCurrentX = newX;\n                mCurrentY = newY;\n                // Post On animation\n                Compat.postOnAnimation(mImageView, this);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "photoview/src/main/java/com/github/chrisbanes/photoview/Util.java",
    "content": "package com.github.chrisbanes.photoview;\n\nimport android.view.MotionEvent;\nimport android.widget.ImageView;\n\nclass Util {\n\n    static void checkZoomLevels(float minZoom, float midZoom,\n                                float maxZoom) {\n        if (minZoom >= midZoom) {\n            throw new IllegalArgumentException(\n                    \"Minimum zoom has to be less than Medium zoom. Call setMinimumZoom() with a more appropriate value\");\n        } else if (midZoom >= maxZoom) {\n            throw new IllegalArgumentException(\n                    \"Medium zoom has to be less than Maximum zoom. Call setMaximumZoom() with a more appropriate value\");\n        }\n    }\n\n    static boolean hasDrawable(ImageView imageView) {\n        return imageView.getDrawable() != null;\n    }\n\n    static boolean isSupportedScaleType(final ImageView.ScaleType scaleType) {\n        if (scaleType == null) {\n            return false;\n        }\n        switch (scaleType) {\n            case MATRIX:\n                throw new IllegalStateException(\"Matrix scale type is not supported\");\n        }\n        return true;\n    }\n\n    static int getPointerIndex(int action) {\n        return (action & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;\n    }\n}\n"
  },
  {
    "path": "sample/build.gradle",
    "content": "apply plugin: \"com.android.application\"\n\napply plugin: \"kotlin-android\"\n\nandroid {\n    compileSdkVersion rootProject.ext.sdkVersion\n\n    defaultConfig {\n        applicationId \"uk.co.senab.photoview.sample\"\n        minSdkVersion rootProject.ext.minSdkVersion\n        targetSdkVersion rootProject.ext.sdkVersion\n        versionCode 100\n        versionName \"1.0\"\n    }\n\n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_1_8\n        targetCompatibility JavaVersion.VERSION_1_8\n    }\n\n    lintOptions {\n        abortOnError false\n    }\n}\n\ntasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {\n    kotlinOptions {\n        jvmTarget = \"1.8\"\n    }\n}\n\ndependencies {\n    implementation \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version\"\n    implementation \"androidx.appcompat:appcompat:1.1.0\"\n    implementation \"androidx.recyclerview:recyclerview:1.1.0\"\n\n    implementation \"com.google.android.material:material:1.1.0\"\n\n    implementation \"com.squareup.picasso:picasso:2.5.2\"\n    implementation(\"io.coil-kt:coil:0.9.1\")\n\n    implementation project(\":photoview\")\n}\n"
  },
  {
    "path": "sample/src/main/AndroidManifest.xml",
    "content": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    package=\"com.github.chrisbanes.photoview.sample\">\n\n    <uses-permission android:name=\"android.permission.INTERNET\" />\n\n    <application\n        android:allowBackup=\"true\"\n        android:fullBackupContent=\"true\"\n        android:icon=\"@mipmap/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:theme=\"@style/AppTheme\"\n        tools:ignore=\"GoogleAppIndexingWarning\">\n\n        <activity android:name=\".LauncherActivity\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n        </activity>\n\n        <activity android:name=\".SimpleSampleActivity\" />\n\n        <activity android:name=\".ViewPagerActivity\" />\n\n        <activity android:name=\".RotationSampleActivity\" />\n\n        <activity android:name=\".PicassoSampleActivity\" />\n\n        <activity android:name=\".CoilSampleActivity\" />\n\n        <activity android:name=\".ActivityTransitionActivity\" />\n\n        <activity android:name=\".ActivityTransitionToActivity\" />\n\n        <activity android:name=\".ImmersiveActivity\" />\n    </application>\n\n</manifest>\n"
  },
  {
    "path": "sample/src/main/java/com/github/chrisbanes/photoview/sample/ActivityTransitionActivity.java",
    "content": "/*\n Copyright 2011, 2012 Chris Banes.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\npackage com.github.chrisbanes.photoview.sample;\n\nimport android.content.Intent;\nimport android.os.Build;\nimport android.os.Bundle;\nimport android.view.View;\nimport android.widget.Toast;\n\nimport androidx.appcompat.app.AppCompatActivity;\nimport androidx.core.app.ActivityOptionsCompat;\nimport androidx.recyclerview.widget.GridLayoutManager;\nimport androidx.recyclerview.widget.RecyclerView;\n\npublic class ActivityTransitionActivity extends AppCompatActivity {\n\n    @Override\n    public void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_transition);\n\n        RecyclerView list = findViewById(R.id.list);\n        list.setLayoutManager(new GridLayoutManager(this, 2));\n        ImageAdapter imageAdapter = new ImageAdapter(new ImageAdapter.Listener() {\n            @Override\n            public void onImageClicked(View view) {\n                transition(view);\n            }\n        });\n        list.setAdapter(imageAdapter);\n    }\n\n    private void transition(View view) {\n        if (Build.VERSION.SDK_INT < 21) {\n            Toast.makeText(ActivityTransitionActivity.this, \"21+ only, keep out\", Toast.LENGTH_SHORT).show();\n        } else {\n            Intent intent = new Intent(ActivityTransitionActivity.this, ActivityTransitionToActivity.class);\n            ActivityOptionsCompat options = ActivityOptionsCompat.\n                    makeSceneTransitionAnimation(ActivityTransitionActivity.this, view, getString(R.string.transition_test));\n            startActivity(intent, options.toBundle());\n        }\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/com/github/chrisbanes/photoview/sample/ActivityTransitionToActivity.java",
    "content": "package com.github.chrisbanes.photoview.sample;\n\nimport android.os.Bundle;\n\nimport androidx.annotation.Nullable;\nimport androidx.appcompat.app.AppCompatActivity;\n\n/**\n * Activity that gets transitioned to\n */\npublic class ActivityTransitionToActivity extends AppCompatActivity {\n\n    @Override\n    protected void onCreate(@Nullable Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_transition_to);\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/com/github/chrisbanes/photoview/sample/CoilSampleActivity.kt",
    "content": "package com.github.chrisbanes.photoview.sample\n\nimport android.os.Bundle\nimport androidx.appcompat.app.AppCompatActivity\nimport coil.api.load\nimport com.github.chrisbanes.photoview.PhotoView\n\nclass CoilSampleActivity : AppCompatActivity() {\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        setContentView(R.layout.activity_simple)\n\n        val photoView = findViewById<PhotoView>(R.id.iv_photo)\n        photoView.load(\"https://images.unsplash.com/photo-1577643816920-65b43ba99fba?ixlib=rb-1.2.1&auto=format&fit=crop&w=3300&q=80\") {\n            crossfade(true)\n        }\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/com/github/chrisbanes/photoview/sample/HackyDrawerLayout.java",
    "content": "package com.github.chrisbanes.photoview.sample;\n\nimport android.content.Context;\nimport android.view.MotionEvent;\n\nimport androidx.drawerlayout.widget.DrawerLayout;\n\n/**\n * Hacky fix for Issue #4 and\n * http://code.google.com/p/android/issues/detail?id=18990\n * <p/>\n * ScaleGestureDetector seems to mess up the touch events, which means that\n * ViewGroups which make use of onInterceptTouchEvent throw a lot of\n * IllegalArgumentException: pointerIndex out of range.\n * <p/>\n * There's not much I can do in my code for now, but we can mask the result by\n * just catching the problem and ignoring it.\n */\npublic class HackyDrawerLayout extends DrawerLayout {\n\n    public HackyDrawerLayout(Context context) {\n        super(context);\n    }\n\n    @Override\n    public boolean onInterceptTouchEvent(MotionEvent ev) {\n        try {\n            return super.onInterceptTouchEvent(ev);\n        } catch (IllegalArgumentException e) {\n            e.printStackTrace();\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/com/github/chrisbanes/photoview/sample/HackyViewPager.java",
    "content": "package com.github.chrisbanes.photoview.sample;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.view.MotionEvent;\n\nimport androidx.viewpager.widget.ViewPager;\n\n/**\n * Hacky fix for Issue #4 and\n * http://code.google.com/p/android/issues/detail?id=18990\n * <p/>\n * ScaleGestureDetector seems to mess up the touch events, which means that\n * ViewGroups which make use of onInterceptTouchEvent throw a lot of\n * IllegalArgumentException: pointerIndex out of range.\n * <p/>\n * There's not much I can do in my code for now, but we can mask the result by\n * just catching the problem and ignoring it.\n *\n * @author Chris Banes\n */\npublic class HackyViewPager extends ViewPager {\n\t\n    public HackyViewPager(Context context) {\n        super(context);\n    }\n\n    public HackyViewPager(Context context, AttributeSet attrs) {\n        super(context, attrs);\n    }\n\n    @Override\n    public boolean onInterceptTouchEvent(MotionEvent ev) {\n\t\ttry {\n\t\t\treturn super.onInterceptTouchEvent(ev);\n\t\t} catch (IllegalArgumentException e) {\n\t\t\treturn false;\n\t\t}\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/com/github/chrisbanes/photoview/sample/ImageAdapter.java",
    "content": "package com.github.chrisbanes.photoview.sample;\n\nimport android.view.View;\nimport android.view.ViewGroup;\n\nimport androidx.recyclerview.widget.RecyclerView;\n\n/**\n * Image adapter\n */\npublic class ImageAdapter extends RecyclerView.Adapter<ImageViewHolder> {\n\n    Listener mListener;\n\n    public ImageAdapter(Listener listener) {\n        mListener = listener;\n    }\n\n    @Override\n    public ImageViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {\n        ImageViewHolder holder = ImageViewHolder.inflate(parent);\n        holder.itemView.setOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View view) {\n                mListener.onImageClicked(view);\n            }\n        });\n        return holder;\n    }\n\n    @Override\n    public void onBindViewHolder(ImageViewHolder holder, int position) {\n\n    }\n\n    @Override\n    public int getItemCount() {\n        return 20;\n    }\n\n    public interface Listener {\n        void onImageClicked(View view);\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/com/github/chrisbanes/photoview/sample/ImageViewHolder.java",
    "content": "package com.github.chrisbanes.photoview.sample;\n\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.TextView;\n\nimport androidx.recyclerview.widget.RecyclerView;\n\n/**\n * Image in recyclerview\n */\npublic class ImageViewHolder extends RecyclerView.ViewHolder {\n\n    public static ImageViewHolder inflate(ViewGroup parent) {\n        View view = LayoutInflater.from(parent.getContext())\n                .inflate(R.layout.item_image, parent, false);\n        return new ImageViewHolder(view);\n    }\n\n    public TextView mTextTitle;\n\n    public ImageViewHolder(View view) {\n        super(view);\n        mTextTitle = view.findViewById(R.id.title);\n    }\n\n    private void bind(String title) {\n        mTextTitle.setText(title);\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/com/github/chrisbanes/photoview/sample/ImmersiveActivity.java",
    "content": "package com.github.chrisbanes.photoview.sample;\n\nimport android.os.Build;\nimport android.os.Bundle;\nimport android.util.Log;\nimport android.view.View;\nimport android.widget.ImageView;\n\nimport com.github.chrisbanes.photoview.OnPhotoTapListener;\nimport com.github.chrisbanes.photoview.PhotoView;\nimport com.squareup.picasso.Picasso;\n\nimport androidx.annotation.Nullable;\nimport androidx.appcompat.app.AppCompatActivity;\n\nimport static android.R.attr.uiOptions;\n\n/**\n * Shows immersive image viewer\n */\npublic class ImmersiveActivity extends AppCompatActivity {\n\n    @Override\n    protected void onCreate(@Nullable Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_immersive);\n\n        PhotoView photoView = findViewById(R.id.photo_view);\n        Picasso.with(this)\n                .load(\"http://pbs.twimg.com/media/Bist9mvIYAAeAyQ.jpg\")\n                .into(photoView);\n        photoView.setOnPhotoTapListener(new OnPhotoTapListener() {\n            @Override\n            public void onPhotoTap(ImageView view, float x, float y) {\n                //fullScreen();\n            }\n        });\n        fullScreen();\n    }\n\n    public void fullScreen() {\n\n        // BEGIN_INCLUDE (get_current_ui_flags)\n        // The UI options currently enabled are represented by a bitfield.\n        // getSystemUiVisibility() gives us that bitfield.\n        int uiOptions = getWindow().getDecorView().getSystemUiVisibility();\n        int newUiOptions = uiOptions;\n        // END_INCLUDE (get_current_ui_flags)\n        // BEGIN_INCLUDE (toggle_ui_flags)\n        boolean isImmersiveModeEnabled = isImmersiveModeEnabled();\n        if (isImmersiveModeEnabled) {\n            Log.i(\"TEST\", \"Turning immersive mode mode off. \");\n        } else {\n            Log.i(\"TEST\", \"Turning immersive mode mode on.\");\n        }\n\n        // Navigation bar hiding:  Backwards compatible to ICS.\n        if (Build.VERSION.SDK_INT >= 14) {\n            newUiOptions ^= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;\n        }\n\n        // Status bar hiding: Backwards compatible to Jellybean\n        if (Build.VERSION.SDK_INT >= 16) {\n            newUiOptions ^= View.SYSTEM_UI_FLAG_FULLSCREEN;\n        }\n\n        // Immersive mode: Backward compatible to KitKat.\n        // Note that this flag doesn't do anything by itself, it only augments the behavior\n        // of HIDE_NAVIGATION and FLAG_FULLSCREEN.  For the purposes of this sample\n        // all three flags are being toggled together.\n        // Note that there are two immersive mode UI flags, one of which is referred to as \"sticky\".\n        // Sticky immersive mode differs in that it makes the navigation and status bars\n        // semi-transparent, and the UI flag does not get cleared when the user interacts with\n        // the screen.\n        if (Build.VERSION.SDK_INT >= 18) {\n            newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;\n        }\n\n        getWindow().getDecorView().setSystemUiVisibility(newUiOptions);\n        //END_INCLUDE (set_ui_flags)\n    }\n\n    private boolean isImmersiveModeEnabled() {\n        return ((uiOptions | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) == uiOptions);\n    }\n\n}\n"
  },
  {
    "path": "sample/src/main/java/com/github/chrisbanes/photoview/sample/LauncherActivity.java",
    "content": "/*\n Copyright 2011, 2012 Chris Banes.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\npackage com.github.chrisbanes.photoview.sample;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport android.os.Bundle;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.TextView;\n\nimport androidx.appcompat.app.AppCompatActivity;\nimport androidx.appcompat.widget.Toolbar;\nimport androidx.recyclerview.widget.LinearLayoutManager;\nimport androidx.recyclerview.widget.RecyclerView;\n\npublic class LauncherActivity extends AppCompatActivity {\n\n    public static final String[] options = {\n            \"Simple Sample\",\n            \"ViewPager Sample\",\n            \"Rotation Sample\",\n            \"Picasso Sample\",\n            \"Coil Sample\",\n            \"Activity Transition Sample\",\n            \"Immersive Sample\"\n    };\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_launcher);\n        Toolbar toolbar = findViewById(R.id.toolbar);\n        toolbar.setTitle(R.string.app_name);\n        RecyclerView recyclerView = findViewById(R.id.list);\n        recyclerView.setLayoutManager(new LinearLayoutManager(this));\n        recyclerView.setAdapter(new ItemAdapter());\n    }\n\n\n    private static class ItemAdapter extends RecyclerView.Adapter<ItemViewHolder> {\n        @Override\n        public ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {\n            final ItemViewHolder holder = ItemViewHolder.newInstance(parent);\n            holder.itemView.setOnClickListener(v -> {\n                Class clazz;\n\n                switch (holder.getAdapterPosition()) {\n                    default:\n                    case 0:\n                        clazz = SimpleSampleActivity.class;\n                        break;\n                    case 1:\n                        clazz = ViewPagerActivity.class;\n                        break;\n                    case 2:\n                        clazz = RotationSampleActivity.class;\n                        break;\n                    case 3:\n                        clazz = PicassoSampleActivity.class;\n                        break;\n                    case 4:\n                        clazz = CoilSampleActivity.class;\n                        break;\n                    case 5:\n                        clazz = ActivityTransitionActivity.class;\n                        break;\n                    case 6:\n                        clazz = ImmersiveActivity.class;\n                }\n\n                Context context = holder.itemView.getContext();\n                context.startActivity(new Intent(context, clazz));\n            });\n            return holder;\n        }\n\n        @Override\n        public void onBindViewHolder(final ItemViewHolder holder, int position) {\n            holder.bind(options[position]);\n        }\n\n        @Override\n        public int getItemCount() {\n            return options.length;\n        }\n    }\n\n    private static class ItemViewHolder extends RecyclerView.ViewHolder {\n\n        public static ItemViewHolder newInstance(ViewGroup parent) {\n            View view = LayoutInflater.from(parent.getContext())\n                    .inflate(R.layout.item_sample, parent, false);\n            return new ItemViewHolder(view);\n        }\n\n        public TextView mTextTitle;\n\n        public ItemViewHolder(View view) {\n            super(view);\n            mTextTitle = view.findViewById(R.id.title);\n        }\n\n        private void bind(String title) {\n            mTextTitle.setText(title);\n        }\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/com/github/chrisbanes/photoview/sample/PicassoSampleActivity.java",
    "content": "package com.github.chrisbanes.photoview.sample;\n\nimport android.os.Bundle;\n\nimport com.github.chrisbanes.photoview.PhotoView;\nimport com.squareup.picasso.Picasso;\n\nimport androidx.appcompat.app.AppCompatActivity;\n\npublic class PicassoSampleActivity extends AppCompatActivity {\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_simple);\n\n        final PhotoView photoView = findViewById(R.id.iv_photo);\n\n        Picasso.with(this)\n                .load(\"https://images.unsplash.com/photo-1577643816920-65b43ba99fba?ixlib=rb-1.2.1&auto=format&fit=crop&w=3300&q=80\")\n                .into(photoView);\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/com/github/chrisbanes/photoview/sample/RotationSampleActivity.java",
    "content": "/*\n Copyright 2011, 2012 Chris Banes.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\npackage com.github.chrisbanes.photoview.sample;\n\nimport android.os.Bundle;\nimport android.os.Handler;\nimport android.view.MenuItem;\n\nimport com.github.chrisbanes.photoview.PhotoView;\n\nimport androidx.appcompat.app.AppCompatActivity;\nimport androidx.appcompat.widget.Toolbar;\n\npublic class RotationSampleActivity extends AppCompatActivity {\n\n    private PhotoView photo;\n    private final Handler handler = new Handler();\n    private boolean rotating = false;\n\n    @Override\n    public void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_rotation_sample);\n        Toolbar toolbar = findViewById(R.id.toolbar);\n        toolbar.inflateMenu(R.menu.rotation);\n        toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {\n            @Override\n            public boolean onMenuItemClick(MenuItem item) {\n                switch (item.getItemId()) {\n                    case R.id.action_rotate_10_right:\n                        photo.setRotationBy(10);\n                        return true;\n                    case R.id.action_rotate_10_left:\n                        photo.setRotationBy(-10);\n                        return true;\n                    case R.id.action_toggle_automatic_rotation:\n                        toggleRotation();\n                        return true;\n                    case R.id.action_reset_to_0:\n                        photo.setRotationTo(0);\n                        return true;\n                    case R.id.action_reset_to_90:\n                        photo.setRotationTo(90);\n                        return true;\n                    case R.id.action_reset_to_180:\n                        photo.setRotationTo(180);\n                        return true;\n                    case R.id.action_reset_to_270:\n                        photo.setRotationTo(270);\n                        return true;\n                }\n                return false;\n            }\n        });\n        photo = findViewById(R.id.iv_photo);\n        photo.setImageResource(R.drawable.wallpaper);\n    }\n\n    @Override\n    protected void onPause() {\n        super.onPause();\n        handler.removeCallbacksAndMessages(null);\n    }\n\n    private void toggleRotation() {\n        if (rotating) {\n            handler.removeCallbacksAndMessages(null);\n        } else {\n            rotateLoop();\n        }\n        rotating = !rotating;\n    }\n\n    private void rotateLoop() {\n        handler.postDelayed(new Runnable() {\n            @Override\n            public void run() {\n                photo.setRotationBy(1);\n                rotateLoop();\n            }\n        }, 15);\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/com/github/chrisbanes/photoview/sample/SimpleSampleActivity.java",
    "content": "/*\n Copyright 2011, 2012 Chris Banes.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\npackage com.github.chrisbanes.photoview.sample;\n\nimport android.graphics.Matrix;\nimport android.graphics.RectF;\nimport android.graphics.drawable.Drawable;\nimport android.os.Bundle;\nimport android.util.Log;\nimport android.view.MenuItem;\nimport android.view.MotionEvent;\nimport android.view.View;\nimport android.widget.ImageView;\nimport android.widget.TextView;\nimport android.widget.Toast;\n\nimport com.github.chrisbanes.photoview.OnMatrixChangedListener;\nimport com.github.chrisbanes.photoview.OnPhotoTapListener;\nimport com.github.chrisbanes.photoview.OnSingleFlingListener;\nimport com.github.chrisbanes.photoview.PhotoView;\n\nimport java.util.Random;\n\nimport androidx.appcompat.app.AppCompatActivity;\nimport androidx.appcompat.widget.Toolbar;\nimport androidx.core.content.ContextCompat;\n\npublic class SimpleSampleActivity extends AppCompatActivity {\n\n    static final String PHOTO_TAP_TOAST_STRING = \"Photo Tap! X: %.2f %% Y:%.2f %% ID: %d\";\n    static final String SCALE_TOAST_STRING = \"Scaled to: %.2ff\";\n    static final String FLING_LOG_STRING = \"Fling velocityX: %.2f, velocityY: %.2f\";\n\n    private PhotoView mPhotoView;\n    private TextView mCurrMatrixTv;\n\n    private Toast mCurrentToast;\n\n    private Matrix mCurrentDisplayMatrix = null;\n\n    @Override\n    public void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_simple_sample);\n\n        Toolbar toolbar = findViewById(R.id.toolbar);\n        toolbar.setTitle(\"Simple Sample\");\n        toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);\n        toolbar.setNavigationOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View v) {\n                onBackPressed();\n            }\n        });\n        toolbar.inflateMenu(R.menu.main_menu);\n        toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {\n            @Override\n            public boolean onMenuItemClick(MenuItem item) {\n                switch (item.getItemId()) {\n                    case R.id.menu_zoom_toggle:\n                        mPhotoView.setZoomable(!mPhotoView.isZoomable());\n                        item.setTitle(mPhotoView.isZoomable() ? R.string.menu_zoom_disable : R.string.menu_zoom_enable);\n                        return true;\n\n                    case R.id.menu_scale_fit_center:\n                        mPhotoView.setScaleType(ImageView.ScaleType.CENTER);\n                        return true;\n\n                    case R.id.menu_scale_fit_start:\n                        mPhotoView.setScaleType(ImageView.ScaleType.FIT_START);\n                        return true;\n\n                    case R.id.menu_scale_fit_end:\n                        mPhotoView.setScaleType(ImageView.ScaleType.FIT_END);\n                        return true;\n\n                    case R.id.menu_scale_fit_xy:\n                        mPhotoView.setScaleType(ImageView.ScaleType.FIT_XY);\n                        return true;\n\n                    case R.id.menu_scale_scale_center:\n                        mPhotoView.setScaleType(ImageView.ScaleType.CENTER);\n                        return true;\n\n                    case R.id.menu_scale_scale_center_crop:\n                        mPhotoView.setScaleType(ImageView.ScaleType.CENTER_CROP);\n                        return true;\n\n                    case R.id.menu_scale_scale_center_inside:\n                        mPhotoView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);\n                        return true;\n\n                    case R.id.menu_scale_random_animate:\n                    case R.id.menu_scale_random:\n                        Random r = new Random();\n\n                        float minScale = mPhotoView.getMinimumScale();\n                        float maxScale = mPhotoView.getMaximumScale();\n                        float randomScale = minScale + (r.nextFloat() * (maxScale - minScale));\n                        mPhotoView.setScale(randomScale, item.getItemId() == R.id.menu_scale_random_animate);\n\n                        showToast(String.format(SCALE_TOAST_STRING, randomScale));\n\n                        return true;\n                    case R.id.menu_matrix_restore:\n                        if (mCurrentDisplayMatrix == null)\n                            showToast(\"You need to capture display matrix first\");\n                        else\n                            mPhotoView.setDisplayMatrix(mCurrentDisplayMatrix);\n                        return true;\n                    case R.id.menu_matrix_capture:\n                        mCurrentDisplayMatrix = new Matrix();\n                        mPhotoView.getDisplayMatrix(mCurrentDisplayMatrix);\n                        return true;\n                }\n                return false;\n            }\n        });\n        mPhotoView = findViewById(R.id.iv_photo);\n        mCurrMatrixTv = findViewById(R.id.tv_current_matrix);\n\n        Drawable bitmap = ContextCompat.getDrawable(this, R.drawable.wallpaper);\n        mPhotoView.setImageDrawable(bitmap);\n\n        // Lets attach some listeners, not required though!\n        mPhotoView.setOnMatrixChangeListener(new MatrixChangeListener());\n        mPhotoView.setOnPhotoTapListener(new PhotoTapListener());\n        mPhotoView.setOnSingleFlingListener(new SingleFlingListener());\n    }\n\n    private class PhotoTapListener implements OnPhotoTapListener {\n\n        @Override\n        public void onPhotoTap(ImageView view, float x, float y) {\n            float xPercentage = x * 100f;\n            float yPercentage = y * 100f;\n\n            showToast(String.format(PHOTO_TAP_TOAST_STRING, xPercentage, yPercentage, view == null ? 0 : view.getId()));\n        }\n    }\n\n    private void showToast(CharSequence text) {\n        if (mCurrentToast != null) {\n            mCurrentToast.cancel();\n        }\n\n        mCurrentToast = Toast.makeText(SimpleSampleActivity.this, text, Toast.LENGTH_SHORT);\n        mCurrentToast.show();\n    }\n\n    private class MatrixChangeListener implements OnMatrixChangedListener {\n\n        @Override\n        public void onMatrixChanged(RectF rect) {\n            mCurrMatrixTv.setText(rect.toString());\n        }\n    }\n\n    private class SingleFlingListener implements OnSingleFlingListener {\n\n        @Override\n        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {\n            Log.d(\"PhotoView\", String.format(FLING_LOG_STRING, velocityX, velocityY));\n            return true;\n        }\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/com/github/chrisbanes/photoview/sample/ViewPagerActivity.java",
    "content": "/*\n Copyright 2011, 2012 Chris Banes.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\npackage com.github.chrisbanes.photoview.sample;\n\nimport android.os.Bundle;\n\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.view.ViewGroup.LayoutParams;\n\nimport com.github.chrisbanes.photoview.PhotoView;\n\nimport androidx.appcompat.app.AppCompatActivity;\nimport androidx.viewpager.widget.PagerAdapter;\nimport androidx.viewpager.widget.ViewPager;\n\npublic class ViewPagerActivity extends AppCompatActivity {\n\n    @Override\n    public void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_view_pager);\n        ViewPager viewPager = findViewById(R.id.view_pager);\n        viewPager.setAdapter(new SamplePagerAdapter());\n    }\n\n    static class SamplePagerAdapter extends PagerAdapter {\n\n        private static final int[] sDrawables = {R.drawable.wallpaper, R.drawable.wallpaper, R.drawable.wallpaper,\n            R.drawable.wallpaper, R.drawable.wallpaper, R.drawable.wallpaper};\n\n        @Override\n        public int getCount() {\n            return sDrawables.length;\n        }\n\n        @Override\n        public View instantiateItem(ViewGroup container, int position) {\n            PhotoView photoView = new PhotoView(container.getContext());\n            photoView.setImageResource(sDrawables[position]);\n            // Now just add PhotoView to ViewPager and return it\n            container.addView(photoView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);\n            return photoView;\n        }\n\n        @Override\n        public void destroyItem(ViewGroup container, int position, Object object) {\n            container.removeView((View) object);\n        }\n\n        @Override\n        public boolean isViewFromObject(View view, Object object) {\n            return view == object;\n        }\n\n    }\n}\n"
  },
  {
    "path": "sample/src/main/res/drawable/ic_arrow_back_white_24dp.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"24dp\"\n        android:height=\"24dp\"\n        android:viewportWidth=\"24.0\"\n        android:viewportHeight=\"24.0\">\n    <path\n        android:fillColor=\"#FFFFFFFF\"\n        android:pathData=\"M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z\"/>\n</vector>\n"
  },
  {
    "path": "sample/src/main/res/layout/activity_immersive.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<FrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:id=\"@+id/root\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\">\n\n    <com.github.chrisbanes.photoview.PhotoView\n        android:id=\"@+id/photo_view\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\" />\n\n</FrameLayout>"
  },
  {
    "path": "sample/src/main/res/layout/activity_launcher.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\">\n\n    <androidx.appcompat.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\n    <androidx.recyclerview.widget.RecyclerView\n        android:id=\"@+id/list\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\" />\n\n</LinearLayout>"
  },
  {
    "path": "sample/src/main/res/layout/activity_rotation_sample.xml",
    "content": "<androidx.coordinatorlayout.widget.CoordinatorLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\">\n\n    <com.google.android.material.appbar.AppBarLayout\n        android:id=\"@+id/appbar\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\">\n\n        <androidx.appcompat.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\n    </com.google.android.material.appbar.AppBarLayout>\n\n    <com.github.chrisbanes.photoview.PhotoView\n        android:id=\"@+id/iv_photo\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:src=\"@drawable/wallpaper\"/>\n\n</androidx.coordinatorlayout.widget.CoordinatorLayout>"
  },
  {
    "path": "sample/src/main/res/layout/activity_simple.xml",
    "content": "<com.github.chrisbanes.photoview.PhotoView\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:id=\"@+id/iv_photo\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"/>"
  },
  {
    "path": "sample/src/main/res/layout/activity_simple_sample.xml",
    "content": "<FrameLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\">\n\n    <com.google.android.material.appbar.AppBarLayout\n        android:id=\"@+id/appbar\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\">\n\n        <androidx.appcompat.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\n    </com.google.android.material.appbar.AppBarLayout>\n\n    <com.github.chrisbanes.photoview.PhotoView\n        android:id=\"@+id/iv_photo\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"/>\n\n    <TextView\n        android:id=\"@+id/tv_current_matrix\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_gravity=\"bottom|center_horizontal\"\n        android:background=\"#60000000\"\n        android:gravity=\"center\"\n        android:textColor=\"@android:color/white\"/>\n\n</FrameLayout>"
  },
  {
    "path": "sample/src/main/res/layout/activity_transition.xml",
    "content": "<androidx.recyclerview.widget.RecyclerView\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:id=\"@+id/list\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"/>"
  },
  {
    "path": "sample/src/main/res/layout/activity_transition_to.xml",
    "content": "<com.github.chrisbanes.photoview.PhotoView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:id=\"@+id/iv_photo\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:layout_gravity=\"center\"\n    android:src=\"@drawable/wallpaper\"\n    android:transitionName=\"@string/transition_test\" />"
  },
  {
    "path": "sample/src/main/res/layout/activity_view_pager.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<com.github.chrisbanes.photoview.sample.HackyViewPager\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:id=\"@+id/view_pager\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\" />"
  },
  {
    "path": "sample/src/main/res/layout/item_image.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ImageView\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    android:scaleType=\"centerCrop\"\n    android:src=\"@drawable/wallpaper\"/>"
  },
  {
    "path": "sample/src/main/res/layout/item_sample.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<FrameLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:minHeight=\"?attr/listPreferredItemHeight\"\n    android:background=\"?attr/selectableItemBackground\">\n\n    <View\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"1dp\"\n        android:background=\"@android:color/white\"/>\n\n    <TextView\n        android:id=\"@+id/title\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_gravity=\"center_vertical\"\n        android:textSize=\"20sp\"\n        android:layout_margin=\"16dp\"\n        tools:text=\"Hello there\"/>\n\n    <View\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"1dp\"\n        android:layout_gravity=\"bottom\"\n        android:background=\"@android:color/white\"/>\n\n</FrameLayout>"
  },
  {
    "path": "sample/src/main/res/menu/main_menu.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n      xmlns:tools=\"http://schemas.android.com/tools\"\n      tools:ignore=\"UnusedAttribute\">\n\n    <item\n        android:id=\"@+id/menu_zoom_toggle\"\n        android:title=\"@string/menu_zoom_disable\"/>\n    <item\n        android:id=\"@+id/menu_scale_fit_center\"\n        android:title=\"@string/menu_scale_fit_center\"/>\n    <item\n        android:id=\"@+id/menu_scale_fit_start\"\n        android:title=\"@string/menu_scale_fit_start\"/>\n    <item\n        android:id=\"@+id/menu_scale_fit_end\"\n        android:title=\"@string/menu_scale_fit_end\"/>\n    <item\n        android:id=\"@+id/menu_scale_fit_xy\"\n        android:title=\"@string/menu_scale_fit_xy\"/>\n    <item\n        android:id=\"@+id/menu_scale_scale_center\"\n        android:title=\"@string/menu_scale_center\"/>\n    <item\n        android:id=\"@+id/menu_scale_scale_center_crop\"\n        android:title=\"@string/menu_scale_center_crop\"/>\n    <item\n        android:id=\"@+id/menu_scale_scale_center_inside\"\n        android:title=\"@string/menu_scale_center_inside\"/>\n    <item\n        android:id=\"@+id/menu_scale_random_animate\"\n        android:title=\"@string/menu_zoom_random_animate\"/>\n    <item\n        android:id=\"@+id/menu_scale_random\"\n        android:title=\"@string/menu_zoom_random\"/>\n    <item\n        android:id=\"@+id/menu_matrix_restore\"\n        android:title=\"@string/menu_matrix_restore\"/>\n    <item\n        android:id=\"@+id/menu_matrix_capture\"\n        android:title=\"@string/menu_matrix_capture\"/>\n\n</menu>"
  },
  {
    "path": "sample/src/main/res/menu/rotation.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <item\n        android:id=\"@+id/action_rotate_10_right\"\n        android:title=\"Rotate 10° Right\"/>\n\n    <item\n        android:id=\"@+id/action_rotate_10_left\"\n        android:title=\"Rotate 10° Left\"/>\n\n    <item\n        android:id=\"@+id/action_toggle_automatic_rotation\"\n        android:title=\"Toggle Automatic Rotation\"/>\n\n    <item\n        android:id=\"@+id/action_reset_to_0\"\n        android:title=\"Reset to 0\"/>\n\n    <item\n        android:id=\"@+id/action_reset_to_90\"\n        android:title=\"Reset to 90\"/>\n\n    <item\n        android:id=\"@+id/action_reset_to_180\"\n        android:title=\"Reset to 180\"/>\n\n    <item\n        android:id=\"@+id/action_reset_to_270\"\n        android:title=\"Reset to 270\"/>\n</menu>"
  },
  {
    "path": "sample/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"green\">#AACE30</color>\n    <color name=\"blue\">#142D3E</color>\n    <color name=\"blue_dark\">#001425</color>\n</resources>"
  },
  {
    "path": "sample/src/main/res/values/strings.xml",
    "content": "<resources>\n\n    <string name=\"app_name\">PhotoView Sample</string>\n    <string name=\"menu_zoom_enable\">Enable Zoom</string>\n    <string name=\"menu_zoom_disable\">Disable Zoom</string>\n    <string name=\"menu_scale_fit_center\">Change to FIT_CENTER</string>\n    <string name=\"menu_scale_fit_start\">Change to FIT_START</string>\n    <string name=\"menu_scale_fit_end\">Change to FIT_END</string>\n    <string name=\"menu_scale_fit_xy\">Change to FIT_XY</string>\n    <string name=\"menu_scale_center\">Change to CENTER</string>\n    <string name=\"menu_scale_center_inside\">Change to CENTER_INSIDE</string>\n    <string name=\"menu_scale_center_crop\">Change to CENTER_CROP</string>\n    <string name=\"menu_zoom_random_animate\">Animate scale to random value</string>\n    <string name=\"menu_zoom_random\">Set scale to random value</string>\n    <string name=\"menu_matrix_restore\">Restore Display Matrix</string>\n    <string name=\"menu_matrix_capture\">Capture Display Matrix</string>\n    <string name=\"extract_visible_bitmap\">Extract visible bitmap</string>\n\n</resources>\n"
  },
  {
    "path": "sample/src/main/res/values/styles.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources xmlns:tools=\"http://schemas.android.com/tools\">\n    <!-- Base application theme. -->\n    <style name=\"AppTheme\" parent=\"Theme.AppCompat.NoActionBar\">\n        <!-- Customize your theme here. -->\n        <item name=\"colorPrimary\">@color/blue</item>\n        <item name=\"colorPrimaryDark\">@color/blue_dark</item>\n        <item name=\"colorAccent\">@color/green</item>\n\n        <!-- enable window content transitions -->\n        <item name=\"android:windowActivityTransitions\" tools:targetApi=\"lollipop\">true</item>\n    </style>\n</resources>"
  },
  {
    "path": "sample/src/main/res/values/transitions.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <string name=\"transition_test\">test</string>\n</resources>"
  },
  {
    "path": "settings.gradle",
    "content": "include 'photoview'\ninclude 'sample'\n"
  }
]