{"id":17066075,"url":"https://github.com/d-clock/scratchview","last_synced_at":"2025-07-19T07:14:58.953Z","repository":{"id":94744099,"uuid":"63754907","full_name":"D-clock/ScratchView","owner":"D-clock","description":"This is a android custom view , like a scratch card effect!","archived":false,"fork":false,"pushed_at":"2016-09-15T15:50:55.000Z","size":702,"stargazers_count":316,"open_issues_count":5,"forks_count":58,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-08T04:17:07.058Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/D-clock.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-20T06:07:14.000Z","updated_at":"2025-01-15T07:35:12.000Z","dependencies_parsed_at":"2023-06-07T02:31:03.273Z","dependency_job_id":null,"html_url":"https://github.com/D-clock/ScratchView","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/D-clock/ScratchView","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/D-clock%2FScratchView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/D-clock%2FScratchView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/D-clock%2FScratchView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/D-clock%2FScratchView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/D-clock","download_url":"https://codeload.github.com/D-clock/ScratchView/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/D-clock%2FScratchView/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265900169,"owners_count":23845915,"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-10-14T11:05:52.659Z","updated_at":"2025-07-19T07:14:58.898Z","avatar_url":"https://github.com/D-clock.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ScratchView\n\nThis is a android custom view , like a scratch card effect!\n\n## Last Update\n\n- 采纳[DearZack童鞋的优化思路](https://github.com/D-clock/ScratchView/issues/3)，把计算擦除面积比例的操作放在手指离开屏幕时，以降低对CPU的占用。\n\n## Articles\n\n- [ScratchView：一步步打造万能的 Android 刮奖效果控件](http://www.jianshu.com/p/2514a08d8217)\n\n## Demo screen\n\n![ScratchView](screen/scratch-demo-screen.gif) \n\n## Import\n\nGradle\n\n```\n\ndependencies {\n    compile 'com.clock.scratch:Scratch:1.0.0'\n}\n\n```\n\nMaven\n\n```\n\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.clock.scratch\u003c/groupId\u003e\n  \u003cartifactId\u003eScratch\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.0\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n\n```\n\n## How to use\n\n- Create a contains of content view and ScratchView FrameLayout，let ScratchView displayed in the top.\n\n```xml\n\n\t \u003cFrameLayout\n        android:layout_width=\"200dp\"\n        android:layout_height=\"200dp\"\n        android:layout_gravity=\"center_horizontal\"\n        android:layout_marginTop=\"8dp\"\u003e\n\n\t\t\u003c!-- content view --\u003e\n        \u003cImageView\n            android:layout_width=\"150dp\"\n            android:layout_height=\"150dp\"\n            android:layout_gravity=\"center\"\n            android:src=\"@mipmap/lufy\" /\u003e\n\n\t\t\u003c!-- scratch view --\u003e\n        \u003ccom.clock.scratch.ScratchView\n            android:id=\"@+id/scratch_view\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\" /\u003e\n    \u003c/FrameLayout\u003e\n\n```\n\n- Key Properties and Java API\n\n| Properties | Java API |\n|------------|----------|\n| scratch:maskColor | setMaskColor(int color) |\n| scratch:watermark | setWatermark(int resId) |\n| scratch:eraseSize | setEraserSize(float eraserSize) |\n| scratch:maxPercent | setMaxPercent(int max) |\n\nMore use , you need see the demo code...\n\n## License\n\n    Copyright 2016 D_clock爱吃葱花\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.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd-clock%2Fscratchview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd-clock%2Fscratchview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd-clock%2Fscratchview/lists"}