{"id":16933137,"url":"https://github.com/saket/flick","last_synced_at":"2025-04-06T02:12:34.891Z","repository":{"id":57736693,"uuid":"143316210","full_name":"saket/flick","owner":"saket","description":"Flick dismiss all the things!","archived":false,"fork":false,"pushed_at":"2021-03-08T17:37:49.000Z","size":9084,"stargazers_count":466,"open_issues_count":1,"forks_count":20,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T01:12:25.705Z","etag":null,"topics":["flick","gestures"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/saket.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-02T15:54:51.000Z","updated_at":"2025-02-07T17:28:36.000Z","dependencies_parsed_at":"2022-08-24T14:57:21.809Z","dependency_job_id":null,"html_url":"https://github.com/saket/flick","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saket%2Fflick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saket%2Fflick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saket%2Fflick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saket%2Fflick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saket","download_url":"https://codeload.github.com/saket/flick/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423516,"owners_count":20936626,"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":["flick","gestures"],"created_at":"2024-10-13T20:48:42.407Z","updated_at":"2025-04-06T02:12:34.870Z","avatar_url":"https://github.com/saket.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flick\n\n![Flick in action](https://github.com/saket/Flick/blob/master/screenshots/flick_demo.gif)\n\nFlick is a tiny library for flick dismissing images (or anything actually). You can read the announcement [blog post](http://saket.me/?p=707) to learn how Flick was created.\n\n```\nimplementation 'me.saket:flick:1.7.0'\n```\n\n## Usage\n\nThe [sample project](https://github.com/saket/Flick/tree/master/sample/src/main/java/me/saket/flick/sample) contains best practices for using Flick. You can [download its APK from here](https://github.com/saket/Flick/releases) for trying it out on your phone.\n\n```xml\n\u003cme.saket.flick.FlickDismissLayout\n  android:layout_width=\"match_parent\"\n  android:layout_height=\"wrap_content\"\u003e\n\n  \u003cImageView\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"/\u003e\n\u003c/me.saket.flick.FlickDismissLayout\u003e\n```\n\nFlick requires you to manually provide the content dimensions instead of it relying on the content View's dimensions. This is useful for scalable `ImageViews`, where the height will always be set to match-parent, but the actual image may or may not be consuming the entire space.\n\n```kotlin\nval callbacks = object : FlickCallbacks {\n  override fun onMove(@FloatRange(from = -1.0, to = 1.0) moveRatio: Float) {\n    // The content is being moved around. Updating the\n    // background dimming is a good usecase for this callback.\n  }\n\n  override fun onFlickDismiss(animationDuration: Long) {\n    // The content was been flicked and the Activity should\n    // be dismissed once the flick animation is complete.\n    flickDismissLayout.postDelayed({ finish() }, animationDuration)\n  }\n}\nval contentSizeProvider = ContentSizeProvider2 { imageView.zoomedImageHeight() },\nflickDismissLayout.gestureListener = FlickGestureListener(context, contentSizeProvider, callbacks)\n```\n\n**Intercepting flicks**\n\nFor usecases where the content can be scrolled further in the direction of the gesture, Flick exposes a way for intercepting flick detection,\n\n```kotlin\n// Block flick gestures if the image can pan further.\ngestureListener.gestureInterceptor = { scrollY -\u003e\n  val isScrollingUpwards = scrollY \u003c 0\n  val directionInt = if (isScrollingUpwards) -1 else +1\n  val canPanFurther = imageView.canScrollVertically(directionInt)\n\n  when {\n    canPanFurther -\u003e InterceptResult.INTERCEPTED\n    else -\u003e InterceptResult.IGNORED\n  }\n}\n```\n\n## License\n\n```\nCopyright 2019 Saket Narayan.\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\n   http://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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaket%2Fflick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaket%2Fflick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaket%2Fflick/lists"}