// Path: project/app/src/main/java/com/achep/acdisplay/ui/animations/ProgressBarAnimation.java
// public class ProgressBarAnimation extends Animation {
// 
//     private final ProgressBar mProgressBar;
//     private int from;
//     private int to;
// 
//     public ProgressBarAnimation(ProgressBar progressBar, int from, int to) {
//         super();
//         mProgressBar = progressBar;
//         this.from = from;
//         this.to = to;
//     }
// 
//     @Override
//     protected void applyTransformation(float interpolatedTime, Transformation t) {
//         super.applyTransformation(interpolatedTime, t);
//         int value = (int) (from + (to - from) * interpolatedTime);
//         if (mProgressBar.getProgress() != value) {
//             mProgressBar.setProgress(value);
//         }
//     }
// 
//     public void setRange(int from, int to) {
//         this.from = from;
//         this.to = to;
//     }
// 
// }
// 
// Path: project/app/src/main/java/com/achep/base/async/WeakHandler.java
// public abstract class WeakHandler<A> extends Handler {
// 
//     private static final String TAG = "WeakHandler";
//     @NonNull
//     private WeakReference<A> mWeakRef;
// 
//     public WeakHandler(@NonNull A object) {
//         mWeakRef = new WeakReference<>(object);
//     }
// 
//     @Override
//     public void handleMessage(Message msg) {
//         super.handleMessage(msg);
//         A object = mWeakRef.get();
//         if (object == null) {
//             if (DEBUG) Log.e(TAG, "Weak reference has died!"
//                     + " class=" + mWeakRef.getClass()
//                     + " message=" + msg.toString());
//             return;
//         }
// 
//         onHandleMassage(object, msg);
//     }
// 
//     protected abstract void onHandleMassage(@NonNull A object, Message msg);
// 
// }
// 
// Path: project/app/src/main/java/com/achep/base/interfaces/ISubscriptable.java
// public interface ISubscriptable<T> {
// 
//     /**
//      * Register a listener to something. Don't forget to
//      * {@link #unregisterListener(Object) unregister} it later!
//      *
//      * @see #unregisterListener(Object)
//      */
//     void registerListener(@NonNull T listener);
// 
//     /**
//      * @see #registerListener(Object)
//      */
//     void unregisterListener(@NonNull T listener);
// 
// }
// 
// Path: project/app/src/main/java/com/achep/base/tests/Check.java
// public abstract class Check {
// 
//     private static Check sCheck;
// 
//     public static Check getInstance() {
//         if (sCheck == null) {
//             sCheck = new CheckImpl();
//         }
//         return sCheck;
//     }
// 
//     public abstract void isTrue(boolean bool);
// 
//     public abstract void isFalse(boolean bool);
// 
//     public abstract void isNull(@Nullable Object object);
// 
//     public abstract void isNonNull(@Nullable Object object);
// 
//     public abstract void isInMainThread();
// }
// 
// Path: project/app/src/main/java/com/achep/base/utils/MathUtils.java
// public class MathUtils {
// 
//     public static float range(float a, float min, float max) {
//         return a < min ? min : a > max ? max : a;
//     }
// 
//     public static int bool(boolean a) {
//         return a ? 1 : 0;
//     }
// 
// }


import java.util.ArrayList;
import android.os.Message;
import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.view.animation.LinearInterpolator;
import android.widget.ProgressBar;
import com.achep.acdisplay.ui.animations.ProgressBarAnimation;
import com.achep.base.async.WeakHandler;
import com.achep.base.interfaces.ISubscriptable;
import com.achep.base.tests.Check;
import com.achep.base.utils.MathUtils;
        mTimeoutPausedAt = 0;
        mHandler.removeMessages(TIMEOUT);
        notifyListeners(EVENT_CLEARED);
    }

    private void internalTimeout() {
        checkThread();
        mTimeoutAt = 0;
        mTimeoutDuration = 0;
        Check.getInstance().isTrue(mTimeoutPausedAt == 0);
        notifyListeners(EVENT_TIMEOUT);
    }

    //-- GUI ------------------------------------------------------------------

    /**
     * @author Artem Chepurnoy
     */
    public static class Gui implements Timeout.OnTimeoutEventListener {

        private static final int MAX = 300;

        private final ProgressBarAnimation mProgressBarAnimation;
        private final ProgressBar mProgressBar;

        public Gui(@NonNull ProgressBar progressBar) {
            mProgressBar = progressBar;
            mProgressBar.setMax(MAX);
            mProgressBar.setProgress(MAX);
            mProgressBarAnimation = new ProgressBarAnimation(mProgressBar, MAX, 0);
// Path: project/app/src/main/java/com/achep/acdisplay/ui/animations/ProgressBarAnimation.java
// public class ProgressBarAnimation extends Animation {
// 
//     private final ProgressBar mProgressBar;
//     private int from;
//     private int to;
// 
//     public ProgressBarAnimation(ProgressBar progressBar, int from, int to) {
//         super();
//         mProgressBar = progressBar;
//         this.from = from;
//         this.to = to;
//     }
// 
//     @Override
//     protected void applyTransformation(float interpolatedTime, Transformation t) {
//         super.applyTransformation(interpolatedTime, t);
//         int value = (int) (from + (to - from) * interpolatedTime);
//         if (mProgressBar.getProgress() != value) {
//             mProgressBar.setProgress(value);
//         }
//     }
// 
//     public void setRange(int from, int to) {
//         this.from = from;
//         this.to = to;
//     }
// 
// }
// 
// Path: project/app/src/main/java/com/achep/base/async/WeakHandler.java
// public abstract class WeakHandler<A> extends Handler {
// 
//     private static final String TAG = "WeakHandler";
//     @NonNull
//     private WeakReference<A> mWeakRef;
// 
//     public WeakHandler(@NonNull A object) {
//         mWeakRef = new WeakReference<>(object);
//     }
// 
//     @Override
//     public void handleMessage(Message msg) {
//         super.handleMessage(msg);
//         A object = mWeakRef.get();
//         if (object == null) {
//             if (DEBUG) Log.e(TAG, "Weak reference has died!"
//                     + " class=" + mWeakRef.getClass()
//                     + " message=" + msg.toString());
//             return;
//         }
// 
//         onHandleMassage(object, msg);
//     }
// 
//     protected abstract void onHandleMassage(@NonNull A object, Message msg);
// 
// }
// 
// Path: project/app/src/main/java/com/achep/base/interfaces/ISubscriptable.java
// public interface ISubscriptable<T> {
// 
//     /**
//      * Register a listener to something. Don't forget to
//      * {@link #unregisterListener(Object) unregister} it later!
//      *
//      * @see #unregisterListener(Object)
//      */
//     void registerListener(@NonNull T listener);
// 
//     /**
//      * @see #registerListener(Object)
//      */
//     void unregisterListener(@NonNull T listener);
// 
// }
// 
// Path: project/app/src/main/java/com/achep/base/tests/Check.java
// public abstract class Check {
// 
//     private static Check sCheck;
// 
//     public static Check getInstance() {
//         if (sCheck == null) {
//             sCheck = new CheckImpl();
//         }
//         return sCheck;
//     }
// 
//     public abstract void isTrue(boolean bool);
// 
//     public abstract void isFalse(boolean bool);
// 
//     public abstract void isNull(@Nullable Object object);
// 
//     public abstract void isNonNull(@Nullable Object object);
// 
//     public abstract void isInMainThread();
// }
// 
// Path: project/app/src/main/java/com/achep/base/utils/MathUtils.java
// public class MathUtils {
// 
//     public static float range(float a, float min, float max) {
//         return a < min ? min : a > max ? max : a;
//     }
// 
//     public static int bool(boolean a) {
//         return a ? 1 : 0;
//     }
// 
// }


// Path: project/app/src/main/java/com/achep/acdisplay/Timeout.java
import java.util.ArrayList;
import android.os.Message;
import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.view.animation.LinearInterpolator;
import android.widget.ProgressBar;
import com.achep.acdisplay.ui.animations.ProgressBarAnimation;
import com.achep.base.async.WeakHandler;
import com.achep.base.interfaces.ISubscriptable;
import com.achep.base.tests.Check;
import com.achep.base.utils.MathUtils;

        mTimeoutPausedAt = 0;
        mHandler.removeMessages(TIMEOUT);
        notifyListeners(EVENT_CLEARED);
    }

    private void internalTimeout() {
        checkThread();
        mTimeoutAt = 0;
        mTimeoutDuration = 0;
        Check.getInstance().isTrue(mTimeoutPausedAt == 0);
        notifyListeners(EVENT_TIMEOUT);
    }

    //-- GUI ------------------------------------------------------------------

    /**
     * @author Artem Chepurnoy
     */
    public static class Gui implements Timeout.OnTimeoutEventListener {

        private static final int MAX = 300;

        private final ProgressBarAnimation mProgressBarAnimation;
        private final ProgressBar mProgressBar;

        public Gui(@NonNull ProgressBar progressBar) {
            mProgressBar = progressBar;
            mProgressBar.setMax(MAX);
            mProgressBar.setProgress(MAX);
            mProgressBarAnimation = new ProgressBarAnimation(mProgressBar, MAX, 0);
            mProgressBarAnimation.setInterpolator(new LinearInterpolator());