Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sharish/ScratchView
https://github.com/sharish/ScratchView
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/sharish/ScratchView
- Owner: sharish
- License: apache-2.0
- Created: 2016-05-11T16:25:10.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-22T17:40:50.000Z (almost 2 years ago)
- Last Synced: 2024-11-05T16:12:05.154Z (about 1 month ago)
- Language: Java
- Size: 811 KB
- Stars: 1,116
- Watchers: 32
- Forks: 219
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-android-ui - ScratchView - 仿刮刮卡视图 (其他)
README
# ScratchView
Intro
------ScratchView repo is UX Design involving scratch cards like views which are scratched to reveal the information they conceal. There
are two types of ScratchView
* ScratchImageView
- A Child of ImageView which conceals the image. Scratching over the view will reveal the hidden image.
* ScratchTextView
- A Child of TextView which conceals the text. Scratching over the view will reveal the hidden text.
Demo Screen
------| ScratchImageView | ScratchTextView |
| ---------------------------- | ----------------------------- |
| ![ScratchImageView][scratch_image] | ![ScratchTextView][scratch_text] |### Useful Methods
Both the views have following three methods which are useful to reveal or determine whether revealed and listener during revealing the hidden text/image.
* ```isRevealed()``` - tells whether the text/image has been revealed.
* ```reveal()``` - reveals the image/text if not revealed yet.
* ```setRevealListener(IRevealListener)``` - a callback listener interface which gets called back when user reveals the text/image
through onReveal() method.Usage
--------### ScratchImageView
##### XML
```xml
```
##### JAVA
```java
ScratchImageView scratchImageView = new ScratchImageView(this);scratchImageView.setRevealListener(new ScratchImageView.IRevealListener() {
@Override
public void onRevealed(ScratchImageView tv) {
// on reveal
}@Override
public void onRevealPercentChangedListener(ScratchImageView siv, float percent) {
// on image percent reveal
}
});
```### ScratchTextView
##### XML
```xml
```
##### JAVA
```java
ScratchTextView scratchTextView = new ScratchTextView(this);scratchTextView.setRevealListener(new ScratchTextView.IRevealListener() {
@Override
public void onRevealed(ScratchTextView tv) {
//on reveal
}@Override
public void onRevealPercentChangedListener(ScratchTextView stv, float percent) {
// on text percent reveal
}
});
```Adding to your project
------------------------- Add the following configuration in your build.gradle file.
```gradle
repositories {
jcenter()
maven { url "https://jitpack.io" }
}dependencies {
compile 'com.github.cooltechworks:ScratchView:v1.1'
}
```Developed By
------------* Harish Sridharan -
License
--------
```
Copyright 2016 Harish SridharanLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```[scratch_image]:https://raw.githubusercontent.com/cooltechworks/ScratchView/2ec97c9a539d5976b68bf62ec07df8c727d72be2/screenshots/scratch_image_view_demo.gif
[scratch_text]:https://raw.githubusercontent.com/cooltechworks/ScratchView/master/screenshots/scratch_text_view_demo.gif