{"id":13645445,"url":"https://github.com/sharish/ScratchView","last_synced_at":"2025-04-21T14:30:59.636Z","repository":{"id":45348665,"uuid":"58561761","full_name":"sharish/ScratchView","owner":"sharish","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-22T17:40:50.000Z","size":830,"stargazers_count":1117,"open_issues_count":14,"forks_count":219,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-04-09T10:04:08.171Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/sharish.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-11T16:25:10.000Z","updated_at":"2025-02-27T02:41:58.000Z","dependencies_parsed_at":"2023-02-12T17:16:09.500Z","dependency_job_id":null,"html_url":"https://github.com/sharish/ScratchView","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharish%2FScratchView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharish%2FScratchView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharish%2FScratchView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharish%2FScratchView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sharish","download_url":"https://codeload.github.com/sharish/ScratchView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250070173,"owners_count":21369839,"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-08-02T01:02:35.304Z","updated_at":"2025-04-21T14:30:59.073Z","avatar_url":"https://github.com/sharish.png","language":"Java","readme":"# ScratchView\n\n\nIntro\n------\n\nScratchView repo is UX Design involving scratch cards like views which are scratched to reveal the information they conceal. There\nare two types of ScratchView \n* \u003ca href='https://github.com/cooltechworks/ScratchView/blob/master/views/src/main/java/com/cooltechworks/views/ScratchImageView.java'\u003e ScratchImageView \u003c/a\u003e\n    - A Child of ImageView which conceals the image. Scratching over the view will reveal the hidden image.\n  \n* \u003ca href='https://github.com/cooltechworks/ScratchView/blob/master/views/src/main/java/com/cooltechworks/views/ScratchTextView.java'\u003e ScratchTextView \u003c/a\u003e\n    - A Child of TextView which conceals the text. Scratching over the view will reveal the hidden text.\n    \nDemo Screen\n------    \n\n|     ScratchImageView                |        ScratchTextView              | \n| ----------------------------  | ----------------------------- | \n| ![ScratchImageView][scratch_image] | ![ScratchTextView][scratch_text]   |\n\n### Useful Methods\n\nBoth the views have following three methods which are useful to reveal or determine whether revealed and listener during revealing the hidden text/image.\n\n* ```isRevealed()``` - tells whether the text/image has been revealed.\n* ```reveal()``` - reveals the image/text if not revealed yet.\n* ```setRevealListener(IRevealListener)``` - a callback listener interface which gets called back when user reveals the text/image\nthrough onReveal() method.\n\nUsage\n--------\n\n### ScratchImageView\n\n##### XML\n\n```xml\n\u003ccom.cooltechworks.views.ScratchImageView\n  android:id=\"@+id/sample_image\"\n  android:layout_width=\"wrap_content\"\n  android:layout_height=\"wrap_content\"\n  android:background=\"@android:color/white\"\n  android:src=\"@drawable/img_sample2\"\n  /\u003e\n\n```\n\n##### JAVA\n\n```java\nScratchImageView scratchImageView = new ScratchImageView(this);\n\nscratchImageView.setRevealListener(new ScratchImageView.IRevealListener() {\n    @Override\n    public void onRevealed(ScratchImageView tv) {\n        // on reveal\n    }\n\n    @Override\n    public void onRevealPercentChangedListener(ScratchImageView siv, float percent) {\n        // on image percent reveal\n    }\n});\n```\n\n### ScratchTextView\n\n##### XML\n\n```xml\n\u003ccom.cooltechworks.views.ScratchTextView\n  android:layout_width=\"wrap_content\"\n  android:layout_height=\"wrap_content\"\n  android:gravity=\"center|end\"\n  android:text=\"@string/flat_200\"\n  android:textSize=\"15sp\"\n  android:textStyle=\"bold\" /\u003e\n\n```\n\n##### JAVA\n\n```java\nScratchTextView scratchTextView = new ScratchTextView(this);\n\nscratchTextView.setRevealListener(new ScratchTextView.IRevealListener() {\n    @Override\n    public void onRevealed(ScratchTextView tv) {\n        //on reveal\n    }\n\n\n    @Override\n    public void onRevealPercentChangedListener(ScratchTextView stv, float percent) {\n        // on text percent reveal\n    }\n});\n```\n\nAdding to your project\n------------------------\n\n- Add the following configuration in your build.gradle file.\n\n```gradle\nrepositories {\n    jcenter()\n    maven { url \"https://jitpack.io\" }\n}\n\ndependencies {\n    compile 'com.github.cooltechworks:ScratchView:v1.1'\n}\n```\n\nDeveloped By\n------------\n\n* Harish Sridharan - \u003charish.sridhar@gmail.com\u003e\n\n\nLicense\n--------\n```\nCopyright 2016 Harish Sridharan\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\n\n[scratch_image]:https://raw.githubusercontent.com/cooltechworks/ScratchView/2ec97c9a539d5976b68bf62ec07df8c727d72be2/screenshots/scratch_image_view_demo.gif\n[scratch_text]:https://raw.githubusercontent.com/cooltechworks/ScratchView/master/screenshots/scratch_text_view_demo.gif\n\n\n\n","funding_links":[],"categories":["其他"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharish%2FScratchView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharish%2FScratchView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharish%2FScratchView/lists"}