{"id":13643597,"url":"https://github.com/stfalcon-studio/FrescoImageViewer","last_synced_at":"2025-04-21T02:30:48.900Z","repository":{"id":140550561,"uuid":"66854128","full_name":"stfalcon-studio/FrescoImageViewer","owner":"stfalcon-studio","description":"Customizable Android full screen image viewer for Fresco library supporting \"pinch to zoom\" and \"swipe to dismiss\" gestures. Made by Stfalcon","archived":false,"fork":false,"pushed_at":"2022-09-21T09:37:40.000Z","size":5466,"stargazers_count":1813,"open_issues_count":39,"forks_count":289,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-04-08T04:14:59.969Z","etag":null,"topics":["android-library","fresco","pinch-to-zoom","swipe-to-dismiss","viewer","zoom"],"latest_commit_sha":null,"homepage":"http://stfalcon.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stfalcon-studio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-08-29T15:05:41.000Z","updated_at":"2025-02-27T07:54:13.000Z","dependencies_parsed_at":"2023-07-29T15:45:08.285Z","dependency_job_id":null,"html_url":"https://github.com/stfalcon-studio/FrescoImageViewer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stfalcon-studio%2FFrescoImageViewer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stfalcon-studio%2FFrescoImageViewer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stfalcon-studio%2FFrescoImageViewer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stfalcon-studio%2FFrescoImageViewer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stfalcon-studio","download_url":"https://codeload.github.com/stfalcon-studio/FrescoImageViewer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249986031,"owners_count":21356311,"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":["android-library","fresco","pinch-to-zoom","swipe-to-dismiss","viewer","zoom"],"created_at":"2024-08-02T01:01:49.885Z","updated_at":"2025-04-21T02:30:43.879Z","avatar_url":"https://github.com/stfalcon-studio.png","language":"Java","funding_links":[],"categories":["ImageView"],"sub_categories":[],"readme":"### This project is no longer supported. If you're able to switch from Fresco to any other library that works with the Android's ImageView, please migrate to the [StfalconImageViewer](https://github.com/stfalcon-studio/StfalconImageViewer) which is a better version of the FrescoImageViewer. Otherwise, you can still use the latest version of this library. Anyway, PRs are welcome!\n\n# FrescoImageViewer\n\n[![codebeat badge](https://codebeat.co/badges/60dbbc38-c85e-4680-b25b-6b04d859e904)](https://codebeat.co/projects/github-com-stfalcon-studio-frescoimageviewer-master) [ ![Download](https://api.bintray.com/packages/troy379/maven/FrescoImageViewer/images/download.svg) ](https://bintray.com/troy379/maven/FrescoImageViewer/_latestVersion)\n\nSimple customizable full screen image viewer for [Fresco library][frescoRepo] that includes \"pinch to zoom\" and \"swipe to dismiss\" gestures.\nBased on [PhotoDraweeView][photoDraweeViewRepo] by [ongakuer][coauthor].\n\n![alt tag](images/fresco_image_viewer_demo.gif)\n\n### Who we are\nNeed iOS and Android apps, MVP development or prototyping? Contact us via info@stfalcon.com. We develop software since 2009, and we're known experts in this field. Check out our [portfolio](https://stfalcon.com/en/portfolio) and see more libraries from [stfalcon-studio](https://stfalcon-studio.github.io/).\n\n## Requirements\n\n* Fresco v.0.12.0 and higher\n* SDK 14 and and higher\n\n## Demo Application\n\n[![Get it on Google Play](https://play.google.com/intl/en_us/badges/images/badge_new.png)](https://play.google.com/store/apps/details?id=com.stfalcon.frescoimageviewersample)\n\n## Usage\n\n#### Simple usage\nAll you need to show a viewer is pass the context, start position and List\u003cString\u003e or String[] into builder and call `show()`.\n```java\nnew ImageViewer.Builder(context, list)\n        .setStartPosition(startPosition)\n        .show();\n```\n\n#### Custom objects\nBut what if in your application images are represented not only with urls? For example, you have object with url and description? You'll have to convert it to list of Strings and only then pass it to viewer, right?\nNo, it's unnecessary! With `ImageViewer.Formatter` you can pass list of your custom images to viewer and simply write a rule for url extracting:\n```java\nList\u003cCustomImage\u003e images = getImages();\nnew ImageViewer.Builder\u003c\u003e(this, images)\n        .setFormatter(new ImageViewer.Formatter\u003cCustomImage\u003e() {\n            @Override\n            public String format(CustomImage customImage) {\n                return customImage.getUrl();\n            }\n        })\n        .show();\n```\nIf formatter isn't passed, `Object.toString()` will be used for image formatting as default behavior.\n\nPiece of cake! :cake: :wink:\n\n## Reminder\nDon't forget to initialize Fresco in your Application class:\n```java\nFresco.initialize(this);\n```\n\nAnd if you expect to open really large images, use configuration below for better performance:\n```java\nImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)\n    .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())\n    .setResizeAndRotateEnabledForNetwork(true)\n    .setDownsampleEnabled(true)\n    .build();\nFresco.initialize(this, config);\n```\n\n## Customizing\n\nYou can also customize a viewer to fit your needs.\n\n#### Background\nUse `setBackgroundColorRes(colorRes)` or `setBackgroundColor(colorInt)` to set color for fading background.\n\n#### Custom overlay view\nIf you need some content over the image (e.g. sharing or download button, description, numeration etc.) you can set your custom view using `setOverlayView(customView)` and bind it with viewer through `ImageViewer.OnImageChangeListener`.\n\n#### Custom drawee hierarchy\nOf course, according to Fresco flexibility, you can use your custom GenericDraweeHierarchy.\nTo do this you simply need to create GenericDraweeHierarchy**Builder** and pass it into builder:\n```java\nGenericDraweeHierarchyBuilder hierarchyBuilder = GenericDraweeHierarchyBuilder.newInstance(getResources())\n        .setFailureImage(R.drawable.failureDrawable)\n        .setProgressBarImage(R.drawable.progressBarDrawable)\n        .setPlaceholderImage(R.drawable.placeholderDrawable);\n\nbuilder.setCustomDraweeHierarchyBuilder(hierarchyBuilder)\n```\n\n:exclamation:**But there is a limitation**: default ScaleType in hierarchy is `ScaleType.FIT_CENTER`, so custom value will be ignored\n\n#### Custom image requests\nFor rare cases like post-processing or bitmap resizing you need to use your custom ImageRequestBuilder.\nCreate it with `ImageViewer.createImageRequestBuilder()` and after configuration pass it to viewer through `setCustomImageRequestBuilder(ImageRequestBuilder)`.\n```java\nbuilder.setCustomImageRequestBuilder(\n            ImageViewer.createImageRequestBuilder()\n                    .setPostprocessor(new GrayscalePostprocessor()));\n```\n\n#### Image margin\nSimply add margins between images with dimens with setImageMargin(context, dimen) or in `px` using `setImageMarginPx(marginPx)`.\n\n#### Container padding\nOverlay image hides part of image? Set container padding with dimens using `setContainerPadding(context, start, top, end, bottom)` or `setContainerPadding(context, dimean)` for all sides at once.\nFor setting padding in pixels, just use `setContainerPaddingPx(...)` method.\n\n#### Status bar visibility\nTo show/hide status bar in view property you can set `hideStatusBar(boolean)` in builder. The default value is `true`.\n\n#### Gestures disabling\nIf you need to disable some of gestures - do it using `allowSwipeToDismiss(boolean)` and `allowZooming(boolean)` accordingly.\n\nHere is an example that sets all the possible options:\n\n```java\nnew ImageViewer.Builder\u003c\u003e(this, images)\n        .setStartPosition(startPosition)\n        .hideStatusBar(false)\n        .allowZooming(true)\n        .allowSwipeToDismiss(true)\n        .setBackgroundColorRes(colorRes)\n        //.setBackgroundColor(color)\n        .setImageMargin(margin)\n        //.setImageMarginPx(marginPx)\n        .setContainerPadding(this, dimen)\n        //.setContainerPadding(this, dimenStart, dimenTop, dimenEnd, dimenBottom)\n        //.setContainerPaddingPx(padding)\n        //.setContainerPaddingPx(start, top, end, bottom)\n        .setCustomImageRequestBuilder(imageRequestBuilder)\n        .setCustomDraweeHierarchyBuilder(draweeHierarchyBuilder)\n        .setImageChangeListener(imageChangeListener)\n        .setOnDismissListener(onDismissListener)\n        .setOverlayView(overlayView)\n        .show();\n\n```\n\nWith this possibilities you can achieve something like this:\n\n![alt tag](images/fresco_image_viewer_customizing_demo.gif)\n\nYou can take a look at [sample project][sample] for more information.\n\n## Install\n\nDownload via **Gradle**:\n```gradle\ncompile 'com.github.stfalcon:frescoimageviewer:0.5.0'\n```\n\nor **Maven**:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.stfalcon\u003c/groupId\u003e\n  \u003cartifactId\u003efrescoimageviewer\u003c/artifactId\u003e\n  \u003cversion\u003e0.5.0\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n## Changelog\n[See the changelog](docs/CHANGELOG.md) to be aware of latest improvements and fixes.\n\n## License\n\n```\nCopyright (C) 2017 stfalcon.com\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n```\n\n[sample]: \u003chttps://github.com/stfalcon-studio/FrescoImageViewer/tree/master/sample\u003e\n[frescoRepo]: \u003chttps://github.com/facebook/fresco\u003e\n[photoDraweeViewRepo]: \u003chttps://github.com/ongakuer/PhotoDraweeView\u003e\n[coauthor]: \u003chttps://github.com/ongakuer\u003e\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstfalcon-studio%2FFrescoImageViewer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstfalcon-studio%2FFrescoImageViewer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstfalcon-studio%2FFrescoImageViewer/lists"}