ScratchView


Source link: https://github.com/sharish/ScratchView

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

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
<com.cooltechworks.views.ScratchImageView
android:id="@+id/sample_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:src="@drawable/img_sample2"
/> 
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
<com.cooltechworks.views.ScratchTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|end"
android:text="@string/flat_200"
android:textSize="15sp"
android:textStyle="bold" /> 
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.
repositories {

  jcenter()
  maven {
 url "https://jitpack.io" 
}
 
}
  dependencies {

  compile 'com.github.cooltechworks:ScratchView:v1.1' 
}

Developed By

License

Copyright 2016 Harish Sridharan  Licensed 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 at
  http://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. 

Resources

Realm is a mobile database that runs directly inside phones, tablets or wearables.

This repository holds the library to allow Sync client under Android Realm Object Server to encrypt the token saved in SharedPreferences, once the user is authenticated. The encryption uses the Android KeyStore available to generate and uses RSA and AES keys for encryption operations.

StripeCardEntry makes a simple and elegant credit card entry UI of Stripe and ports this to the Android Platform. In a nutshell StripeCardEntry has:

  • Support for Visa, Mastercard & American Express cards.
  • Number validation using Luhn algorithm ensures the user will not enter an invalid number.
  • Date validation ensures the user can only enter a valid expiry date.

An example project with SonarQube integration for proper code review and code structuring.

A woooow splash which like clouds disappear in the sky.

PermissionAcceptor allows to handle runtime permission in Marshmallow (Android 6.0).

Simple builder in plain Java to create requests to the Amazon Product Advertising API.

Amazon challenges all developers that want to use their Advertising API. Especially the creation of the request URL is pretty complex. Therefor I've created this URL Builder, which allows you to create the request URL without having to read the Product Advertisement API documentation or study the used hashing algorithms.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes