A simple and flexible Checked TextView or Checkable TextView

Overview

CheckableTextView


Checkable TextView [KOTLIN]

A simple and flexible Checked TextView or Checkable TextView written in Kotlin


Android Arsenal GitHub license GitHub code size in bytes Version


What's New

Animation Demo

Normal
(duration = 250 ms)

Custom Duration
(duration = 2000 ms)

Sorry for flicker in slow motion video demo . You know android studio screen recorder sucks sometimes 😅

Custom Interpolators

custom interpolator support added

Interpolator Demo

BounceInterpolator
with fall down animation

AnticipateOvershootInterpolator
with translate animation



Installation

  1. Add it in your root build.gradle at the end of repositories:
	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
  1. Add the dependency in app gradle
	dependencies {
	        implementation 'com.github.JDevZone:CheckableTextView:{latest_version}'
	}

Basic usage

<com.devzone.checkabletextview.CheckableTextView
            app:ctv_TextStyle="@style/TextAppearance.General"
            app:ctv_IconTint="@color/colorAccent"
            app:ctv_IconChecked="true"
            app:ctv_Icon="@drawable/ic_cancel_custom_vector"
            app:ctv_Text="@string/app_name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

Change State Programatically

You can change checked state as follows :

checkedTV.setChecked(isChecked)

Default value shouldNotifyListeners is false

or

checkedTV.setChecked(isChecked,shouldNotifyListeners)

First Boolean parameter isChecked sets the current state Second Boolean parameter shouldNotifyListeners determines if onCheckChange method should be called or not.

Get Current State

checkedTV.isChecked()

No Fancy enums, Just true for checked state and false for unchecked is returned

Listen State Changes

You can listen to state changes by registering a listener like as follows :

checkedTV.setOnCheckChangeListener()

and get callback in implemented method :

override fun onCheckChange(view: View, isChecked: Boolean) {
        // checkedTV returned as view
        // isChecked current state of the view
    }

Set Custom Interpolator

checkedTV.setAnimInterpolator(BounceInterpolator())

Experimental

checkedTV.setClickEnabled(isClickable: Boolean)

Pass isClickable true for enable and false for disable clicks

currently restricted to RestrictTo.Scope.LIBRARY you can use it simply Suppressing Lint Warnings (if have any) as @SuppressLint("RestrictedApi")

Customisation

Here are the attributes you can specify through XML or related setters:

  • ctv_Text - Set text.
  • ctv_TextSize - Set text size.
  • ctv_TextColor - Set text color.
  • ctv_TextStyle - Set text style.
  • ctv_Icon - Set custom icon.
  • ctv_IconTint - Set icon tint.
  • ctv_IconChecked - Set TextView (CheckableTextView) state checked.
  • ctv_TextGravity - Set text gravity.
  • ctv_AnimType - Set check animation type currently three available (scale,translate and fall_down).
  • ctv_AnimDuration - Set duration for check animation.
  • ctv_AnimFirstTime - Animate CheckableTextView for very first time.

📄 License

Checkable TextView is released under the MIT license. See LICENSE for details.

You might also like...
A library to show emoji in TextView, EditText (like WhatsApp) for Android
A library to show emoji in TextView, EditText (like WhatsApp) for Android

Discontinued This projected is discontinued. Please consider using other alternative, i.e EmojiCompat. Contact me if you want to continue working on a

A TextView that automatically resizes text to fit perfectly within its bounds.
A TextView that automatically resizes text to fit perfectly within its bounds.

AutoFitTextView A TextView that automatically resizes text to fit perfectly within its bounds. Usage dependencies { compile 'me.grantland:autofitt

Android experiment showing a sinking TextView
Android experiment showing a sinking TextView

Titanic is an Android experiment reproducing this effect.

A Custom TextView with trim text
A Custom TextView with trim text

ReadMoreTextView A Custom TextView with trim text Download To add the ReadMoreTextView library to your Android Studio project, simply add the followin

Advanced Android TextView

Advanced Android TextView Companion app for my Advanced Android TextView talk, demostrating: Animated CompoundDrawable Text shadow Custom font Non-bre

A TextView that simulates the effect from the app Secret where the characters fade in/out at different speeds.
A TextView that simulates the effect from the app Secret where the characters fade in/out at different speeds.

SecretTextView A TextView that simulates the effect from the app Secret where the characters fade in/out at different speeds. How To Use Use it just l

This is based on an open source autosizing textview for Android.

SizeAdjustingTextView This is based on an open source autosizing textview for Android I found a few weeks ago. The initial approach didn't resize mult

Lightweight android library for highlighting sections of a textview, with optional callbacks.
Lightweight android library for highlighting sections of a textview, with optional callbacks.

Linker Lightweight android library for highlighting Strings inside of a textview (ignoring case), with optional callbacks. Language: Java MinSDK: 17 J

Android slanted TextView.
Android slanted TextView.

SlantedTextView Android slanted TextView . 中文版 Preview Gradle compile 'com.haozhang.libary:android-slanted-textview:1.2' XML Layout com.haozhang.lib.

Comments
  • Ripple effect added & version bumped 😎

    Ripple effect added & version bumped 😎

    All version bumped to latest one New Ripple effect added which can be customized by attrs ctv_RippleAlpha ctv_RippleTint ctv_RippleFillEnabled

    and programmatically

    opened by JDevZone 0
Releases(v1.1.0)
Owner
null
Simple way to create linked text, such as @username or #hashtag, in Android TextView and EditText

Simple Linkable Text Simple way to create link text, such as @username or #hashtag, in Android TextView and EditText Installation Gradle Add dependenc

Aditya Pradana Sugiarto 76 Nov 29, 2022
TextView to display simple HTML

Project stopped This project has been stopped. 4.0 is the last release. Feel free to fork this project and take over maintaining. HtmlTextView for And

Sufficiently Secure 2.5k Dec 28, 2022
AutoLinkTextView is TextView that supports Hashtags (#), Mentions (@) , URLs (http://), Phone and Email automatically detecting and ability to handle clicks.

AutoLinkTextView Deprecated Please use the new version of AutoLinkTextView AutoLinkTextView is TextView that supports Hashtags (#), Mentions (@) , URL

Arman 1.1k Nov 23, 2022
Form validation and feedback library for Android. Provides .setText for more than just TextView and EditText widgets. Provides easy means to validate with dependencies.

android-formidable-validation Form validation and feedback library for Android. Provides .setText for more than just TextView and EditText widgets. Pr

Linden 147 Nov 20, 2022
A TextView that automatically fit its font and line count based on its available size and content

AutoFitTextView A TextView that automatically fit its font and line count based on its available size and content This code is heavily based on this S

null 899 Jan 2, 2023
Implementation of a TextView and all its direct/indirect subclasses with native support for the Roboto fonts, includes the brand new Roboto Slab fonts.

Android-RobotoTextView Implementation of a TextView and all its direct/indirect subclasses with native support for the Roboto fonts, includes the bran

Evgeny Shishkin 782 Nov 12, 2022
An extension of Android's TextView, EditText and Button that let's you use the font of your choice

AnyTextView (deprecated) Note: AnyTextView is no longer being maintained. I recommend replacing AnyTextView with the Calligraphy library instead. Frus

Hans Petter Eide 165 Nov 11, 2022
Customized and Expandable TextView

Customized and Expandable TextView Simple library to change the Textview as rectangle, circle and square shapes by adding one line of code in xml file

Raja Gopal 62 Sep 22, 2022
Animation effects to text, not really textview

HTextView Animation effects with custom font support to TextView see iOS Effects see Flutter Effects Screenshot type gif Scale Evaporate Fall Line Typ

hanks 5.5k Jan 5, 2023
Android's TextView that can expand/collapse like the Google Play's app description

ExpandableTextView ExpandableTextView is an Android library that allows developers to easily create an TextView which can expand/collapse just like th

Manabu S. 4k Dec 28, 2022