{"id":13472588,"url":"https://github.com/Baseflow/PhotoView","last_synced_at":"2025-03-26T17:30:48.058Z","repository":{"id":3988606,"uuid":"5084750","full_name":"Baseflow/PhotoView","owner":"Baseflow","description":"Implementation of ImageView for Android that supports zooming, by various touch gestures.","archived":false,"fork":false,"pushed_at":"2022-03-25T09:53:49.000Z","size":16896,"stargazers_count":18826,"open_issues_count":217,"forks_count":3932,"subscribers_count":635,"default_branch":"master","last_synced_at":"2025-03-06T19:05:48.145Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://baseflow.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Baseflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"Baseflow","custom":"https://baseflow.com/contact"}},"created_at":"2012-07-17T16:39:00.000Z","updated_at":"2025-03-05T12:27:59.000Z","dependencies_parsed_at":"2022-07-10T02:46:05.843Z","dependency_job_id":null,"html_url":"https://github.com/Baseflow/PhotoView","commit_stats":null,"previous_names":["chrisbanes/photoview"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Baseflow%2FPhotoView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Baseflow%2FPhotoView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Baseflow%2FPhotoView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Baseflow%2FPhotoView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Baseflow","download_url":"https://codeload.github.com/Baseflow/PhotoView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245702142,"owners_count":20658551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T16:00:55.974Z","updated_at":"2025-03-26T17:30:47.716Z","avatar_url":"https://github.com/Baseflow.png","language":"Java","funding_links":["https://github.com/sponsors/Baseflow","https://baseflow.com/contact"],"categories":["Java"],"sub_categories":[],"readme":"# 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\u003ccom.github.chrisbanes.photoview.PhotoView\n    android:id=\"@+id/photo_view\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"/\u003e\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBaseflow%2FPhotoView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBaseflow%2FPhotoView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBaseflow%2FPhotoView/lists"}