Android Open Source - iLitIt_Android Delayed Observer






From Project

Back to project page iLitIt_Android.

License

The source code is released under:

GNU General Public License

If you think the Android project iLitIt_Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package de.unifreiburg.es.iLitIt;
/* www  .j ava 2  s . c o  m*/
import android.os.Handler;
import android.os.Looper;

/**
* Created by phil on 11/19/14.
*/
public class DelayedObserver<E> implements ObservableLinkedList.Observer<E> {
    protected static Handler mHandler;
    protected Runnable mAction;
    private long mDelay;

    public final static long DEFAULT_DELAY = 500;
    public E mObject;
    public ObservableLinkedList<E> mList;

    public DelayedObserver(long delay, Runnable r) {
        if (mHandler==null)
            mHandler = new Handler(Looper.getMainLooper());
        mAction = r;
        mDelay = delay;
    }

    @Override
    public void listChanged(ObservableLinkedList<E> list, E object) {
        mList = list;
        mObject = object;

        mHandler.removeCallbacks(mAction, null);
        mHandler.postDelayed(mAction, mDelay);
    }
}




Java Source Code List

de.unifreiburg.es.iLitIt.CigAnnotationWriter.java
de.unifreiburg.es.iLitIt.CigIntentBroadcaster.java
de.unifreiburg.es.iLitIt.CigaretteEvent.java
de.unifreiburg.es.iLitIt.DelayedObserver.java
de.unifreiburg.es.iLitIt.HeatMapFragment.java
de.unifreiburg.es.iLitIt.HomescreenFragment.java
de.unifreiburg.es.iLitIt.JournalFragment.java
de.unifreiburg.es.iLitIt.LighterBluetoothService.java
de.unifreiburg.es.iLitIt.MainActivity.java
de.unifreiburg.es.iLitIt.ObservableLinkedList.java
de.unifreiburg.es.iLitIt.SettingsFragment.java
de.unifreiburg.es.iLitIt.StatsHelper.java