{"id":19508651,"url":"https://github.com/commit451/translationviewdraghelper","last_synced_at":"2025-07-02T06:03:47.520Z","repository":{"id":57718431,"uuid":"58876071","full_name":"Commit451/TranslationViewDragHelper","owner":"Commit451","description":"ViewDragHelper that accounts for view translations","archived":false,"fork":false,"pushed_at":"2024-01-22T05:53:01.000Z","size":155,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-26T02:52:39.538Z","etag":null,"topics":["android","translation"],"latest_commit_sha":null,"homepage":null,"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/Commit451.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-05-15T17:58:25.000Z","updated_at":"2022-02-16T07:36:00.000Z","dependencies_parsed_at":"2025-04-26T03:03:16.928Z","dependency_job_id":null,"html_url":"https://github.com/Commit451/TranslationViewDragHelper","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/Commit451/TranslationViewDragHelper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commit451%2FTranslationViewDragHelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commit451%2FTranslationViewDragHelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commit451%2FTranslationViewDragHelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commit451%2FTranslationViewDragHelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Commit451","download_url":"https://codeload.github.com/Commit451/TranslationViewDragHelper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commit451%2FTranslationViewDragHelper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263083562,"owners_count":23411162,"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","translation"],"created_at":"2024-11-10T23:08:34.583Z","updated_at":"2025-07-02T06:03:47.471Z","avatar_url":"https://github.com/Commit451.png","language":"Kotlin","readme":"# TranslationViewDragHelper\nA version of [ViewDragHelper](https://developer.android.com/reference/androidx/customview/widget/ViewDragHelper) which accounts for X and Y translations.\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.commit451/translationviewdraghelper/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.commit451/translationviewdraghelper)\n\n## Gradle\n```groovy\ndependencies {\n    implementation(\"com.commit451:translationviewdraghelper:latest.release.here\")\n}\n```\n\n# Usage\nIf you have ever used a `ViewDragHelper` before, you may have noticed that if you were to translate your views using `View.setX()` or `View.setY()`, your helper would no longer correctly allow you to drag the views. This library seeks to correct this. Usage is identical to `ViewDragHelper` usage:\n```kotlin\nval callback = TranslationViewDragHelper.Callback {\n    override fun tryCaptureView(child: View, pointerId: Int): Boolean {\n        // Any children can be captured\n        return true\n    }\n    \n    override fun clampViewPositionHorizontal(child: View, left: Int, dx: Int): Int {\n        // allow full movement along horizontal axis\n        return left\n    }\n    \n    override fun clampViewPositionVertical(child: View, top: Int, dy: Int): Int {\n        // allow full movement along vertical axis\n        return top\n    }\n}\n\nval viewDragHelper = TranslationViewDragHelper.create(\n    viewGroup,\n    1.0f,\n    callback\n)\n```\nSee the sample [custom view](https://github.com/Commit451/TranslationViewDragHelper/blob/master/app/src/main/java/com/commit451/betterviewdraghelper/sample/AllowsForDragFrameLayout.java) for a more complete example\n\n# Basis\nThe current version of this helper is derived from `ViewDragHelper` source from `1.0.0` of the `androidx.customview` library. Due to private constructor access on ViewDragHelper, the source has to be copied out into the `TranslationViewDragHelper`. You can check to see if anything has changed [here](https://android.googlesource.com/platform/frameworks/support/+log/a9ac247af2afd4115c3eb6d16c05bc92737d6305/customview/src/main/java/androidx/customview/widget/ViewDragHelper.java)\n\nLicense\n--------\n\n    Copyright 2024 Commit 451\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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommit451%2Ftranslationviewdraghelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommit451%2Ftranslationviewdraghelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommit451%2Ftranslationviewdraghelper/lists"}