Skip to content
Fole is a simple library to collapse and expand a TextView.
Java Ruby
Branch: master
Clone or download
Latest commit a57cd6e Oct 31, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Migrate to circleci. Oct 24, 2018
fastlane Fix apk path. Oct 31, 2018
fole Test animations. Oct 31, 2018
gradle/wrapper Update gradle. Oct 30, 2018
sample Add animations to sample project. Oct 31, 2018
.gitignore first commit Jan 16, 2016
Gemfile Migrate to circleci. Oct 24, 2018
Gemfile.lock Migrate to circleci. Oct 24, 2018
LICENSE.txt Add license and update readme. May 11, 2017
README.md Add animations to the README file. Oct 25, 2018
build.gradle Update gradle. Oct 30, 2018
fole-sample.gif Update demo gif. May 15, 2017
gradle.properties first commit Jan 16, 2016
gradlew first commit Jan 16, 2016
settings.gradle

README.md

Fole Tweet

Fole is a simple library that handles a toggle for you, to expand and collapse a TextView.

Please, star this repo if you find it useful. 🙃


DemoInstallingBasic UsageAnimations


Demo

Installing

    repositories {
        // ...
        maven { url 'https://jitpack.io' }
    }

    dependencies {
        implementation 'com.github.bffcorreia:fole:1.0.0'
    }

Basic Usage

    Fole.with(yourTextView).text("Your text...").maxLines(4).toggleView(yourToggleView);
    Fole.with(yourTextView).text("Your text...").maxChars(50).toggleView(yourToggleView);

Ellipsis Placeholder

    Fole.with(yourTextView).maxLines(4).ellipsisPlaceholder("###").toggleView(yourToggleView);

Callback

If you want to know when the TextView expands or collapses just add a FoleCallback.

    FoleCallback callback = new FoleCallback() {
          @Override public void onTextExpand() {
            // Handle onTextExpand!
          }
    
          @Override public void onTextCollapse() {
             // Handle onTextCollapse!
          }
        };
    Fole.with(yourTextView).maxLines(4).toggleView(yourToggleView, callback);

Animations

To animate the TextView when it extends or collapses, simply add your animation.

    Animation animation = AnimationUtils.loadAnimation(context, android.R.anim.fade_in);
    Fole.with(yourTextView)
        .maxLines(4)
        .animation(animation)
        .toggleView(yourToggleView);

If you want to use different animations:

    Animation expandAnimation = AnimationUtils.loadAnimation(context, android.R.anim.fade_in);
    Animation collapseAnimation = AnimationUtils.loadAnimation(context, android.R.anim.slide_in_left);
    Fole.with(yourTextView)
        .maxLines(4)
        .expandAnimation(expandAnimation)
        .collapseAnimation(collapseAnimation)
        .toggleView(yourToggleView);

License

Copyright 2016 Bruno Correia

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.
You can’t perform that action at this time.