/*
 * Copyright 2016 Philip Cohn-Cort
 *
 * 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.
 */
package com.fuzz.indicator.text;

import android.support.annotation.NonNull;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.Spanned;
import android.widget.TextView;

import com.fuzz.indicator.IndicatorViewHolder;
import com.fuzz.indicator.OffSetters;

/**
 * Simple indicator implementation for TextViews.
 *
 * @author Philip Cohn-Cort (Fuzz)
 */
public class LayeredTextViewHolder extends IndicatorViewHolder<TextView> {

    public LayeredTextViewHolder(@NonNull TextView child) {
        super(child);
    }

    @Override
    public void offsetContentBy(int orientation, float percentage) {
        CharSequence text = itemView.getText();
        if (text instanceof Spanned) {
            Spannable spannable;
            if (text instanceof Spannable) {
                spannable = (Spannable) text;
            } else {
                // The SpannableString constructor will copy over pre-existing spans,
                // so no need to worry about losing state.
                spannable = new SpannableString(text);
            }
            OffSetters.offsetSpansBy(spannable, orientation, percentage);
            itemView.setText(spannable);
        }
    }
}

/*
 * Copyright 2016 Philip Cohn-Cort
 *
 * 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.
 */
package com.fuzz.indicator.text;

import android.support.annotation.NonNull;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.Spanned;
import android.widget.TextView;

import com.fuzz.indicator.IndicatorViewHolder;
import com.fuzz.indicator.OffSetters;
import com.fuzz.indicator.OffsetEvent;
import com.fuzz.indicator.ViewPagerOffsetEvent;

/**
 * Simple indicator implementation for TextViews.
 *
 * @author Philip Cohn-Cort (Fuzz)
 */
public class LayeredTextViewHolder extends IndicatorViewHolder<TextView> {

    public LayeredTextViewHolder(@NonNull TextView child) {
        super(child);
    }

    @Override
    public void offsetContentBy(int orientation, float percentage) {
        CharSequence text = itemView.getText();
        if (text instanceof Spanned) {
            Spannable spannable;
            if (text instanceof Spannable) {
                spannable = (Spannable) text;
            } else {
                // The SpannableString constructor will copy over pre-existing spans,
                // so no need to worry about losing state.
                spannable = new SpannableString(text);
            }
            OffSetters.offsetSpansBy(spannable, orientation, percentage);
            itemView.setText(spannable);
        }
    }

    @Override
    public void offsetContentBy(OffsetEvent event) {
        if (event instanceof ViewPagerOffsetEvent) {
            ViewPagerOffsetEvent ev = (ViewPagerOffsetEvent) event;
            offsetContentBy(ev.orientation(), ev.fraction());
        }
    }
}

Add missing method implementation