ExpandableTextView 1.0.1: Interpolators

ExpandableTextView 1.0.1 is a small update which adds support for time interpolators. A time interpolator defines the rate of change of an animation. This allows animations to have non-linear motion, such as acceleration and deceleration.

OvershootInterpolator demo

Add dependency

	repositories {
	    jcenter()
	}

or

	repositories {
	    mavenCentral()
	}

or

	repositories {
	    maven {
	        url "https://dl.bintray.com/blogcat/maven"
	    }
	}

Library dependency

	dependencies {
	    compile ('at.blogc:expandabletextview:1.0.1')
	}

Usage

final ExpandableTextView expandableTextView = (ExpandableTextView) this.findViewById(R.id.expandableTextView);
final Button buttonToggle = (Button) this.findViewById(R.id.button_toggle);

// set interpolators for both expanding and collapsing animations
expandableTextView.setInterpolator(new OvershootInterpolator());

// or set them separately
expandableTextView.setExpandInterpolator(new OvershootInterpolator());
expandableTextView.setCollapseInterpolator(new OvershootInterpolator());

// toggle the ExpandableTextView
buttonToggle.setOnClickListener(new View.OnClickListener()
{
    @Override
    public void onClick(final View v)
    {
        expandableTextView.toggle();
        buttonToggle.setText(expandableTextView.isExpanded() ? R.string.collapse : R.string.expand);
    }
});