<commit_before>package org.commcare.views.media;

import android.animation.ObjectAnimator;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.animation.DecelerateInterpolator;
import android.widget.ProgressBar;

import org.commcare.dalvik.R;

/**
 * @author <NAME> (<EMAIL>)
 */
public class AudioPlaybackButton extends AudioPlaybackButtonBase {

    private ObjectAnimator animation;

    /**
     * Used by media inflater.
     */
    public AudioPlaybackButton(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    /**
     * @param URI audio to load when play button pressed
     */
    public AudioPlaybackButton(Context context, final String URI, boolean visible) {
        this(context, URI, null, visible);
    }

    /**
     * @param URI     audio to load when play button pressed
     * @param viewId  Id for the ListAdapter view that contains this button
     * @param visible Should the button be visible?
     */
    public AudioPlaybackButton(Context context, String URI,
                               ViewId viewId, boolean visible) {
        super(context, URI, viewId, visible);
    }

    @Override
    protected int getLayout() {
        return R.layout.small_audio_playback;
    }

    @Override
    protected void startProgressBar(int milliPosition, int milliDuration) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            ProgressBar progressBar = (ProgressBar)findViewById(R.id.circular_progress_bar);
            animation = ObjectAnimator.ofInt(progressBar, "progress", 0, 500);
            animation.setDuration(milliDuration);
            animation.setCurrentPlayTime(milliPosition);
            animation.setInterpolator(new DecelerateInterpolator());
            animation.start();
        }
    }

    @Override
    protected void resetProgressBar() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            ProgressBar progressBar = (ProgressBar)findViewById(R.id.circular_progress_bar);
            if (animation != null) {
                animation.removeAllListeners();
                animation.end();
                animation.cancel();
            }
            progressBar.clearAnimation();
            progressBar.setProgress(0);
        }
    }

    @Override
    protected void pauseProgressBar() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            animation.pause();
        }
    }
}
<commit_msg>Fix api warning and use linear progress animation<commit_after>package org.commcare.views.media;

import android.animation.ObjectAnimator;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.animation.LinearInterpolator;
import android.widget.ProgressBar;

import org.commcare.dalvik.R;

/**
 * @author <NAME> (<EMAIL>)
 */
public class AudioPlaybackButton extends AudioPlaybackButtonBase {

    private ObjectAnimator animation;

    /**
     * Used by media inflater.
     */
    public AudioPlaybackButton(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    /**
     * @param URI audio to load when play button pressed
     */
    public AudioPlaybackButton(Context context, final String URI, boolean visible) {
        this(context, URI, null, visible);
    }

    /**
     * @param URI     audio to load when play button pressed
     * @param viewId  Id for the ListAdapter view that contains this button
     * @param visible Should the button be visible?
     */
    public AudioPlaybackButton(Context context, String URI,
                               ViewId viewId, boolean visible) {
        super(context, URI, viewId, visible);
    }

    @Override
    protected int getLayout() {
        return R.layout.small_audio_playback;
    }

    @Override
    protected void startProgressBar(int milliPosition, int milliDuration) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            ProgressBar progressBar = (ProgressBar)findViewById(R.id.circular_progress_bar);
            animation = ObjectAnimator.ofInt(progressBar, "progress", 0, 500);
            animation.setDuration(milliDuration);
            animation.setCurrentPlayTime(milliPosition);
            animation.setInterpolator(new LinearInterpolator());
            animation.start();
        }
    }

    @Override
    protected void resetProgressBar() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            ProgressBar progressBar = (ProgressBar)findViewById(R.id.circular_progress_bar);
            if (animation != null) {
                animation.removeAllListeners();
                animation.end();
                animation.cancel();
            }
            progressBar.clearAnimation();
            progressBar.setProgress(0);
        }
    }

    @Override
    protected void pauseProgressBar() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            animation.cancel();
        }
    }
}

{'fraction_non_alphanumeric': 0.09247184350918791, 'fraction_numerical': 0.0019758940920766646, 'mean_word_length': 2.5698166431593794, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5524126', 'n_tokens_mistral': 1377, 'n_tokens_neox': 1345, 'n_words': 315}