Android Open Source - commit-android Base Model






From Project

Back to project page commit-android.

License

The source code is released under:

GNU General Public License

If you think the Android project commit-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 com.mauriciogiordano.commit.database;
/* ww  w .  ja v a  2 s . com*/
import java.util.ArrayList;
import java.util.List;

/**
 * Created by mauricio on 10/16/14.
 */
public class BaseModel {

    protected BaseModelListenerHandler baseModelListenerHandler;

    public static abstract class OnUpdateListener {
        public abstract void onUpdate(BaseModel object);
    }

    protected static class BaseModelListenerHandler {

        public List<OnUpdateListener> onUpdateListeners;

        private static BaseModelListenerHandler baseModelListenerHandler = null;

        public static BaseModelListenerHandler getInstance() {
            if(baseModelListenerHandler == null) {
                baseModelListenerHandler = new BaseModelListenerHandler();
            }

            return baseModelListenerHandler;
        }

        private BaseModelListenerHandler() {
            onUpdateListeners = new ArrayList<OnUpdateListener>();
        }

        protected void execOnUpdateListeners(BaseModel target) {
            int size = onUpdateListeners.size();

            for(int i = 0; i < size; i++) {
                onUpdateListeners.get(i).onUpdate(target);
            }
        }
    }

    public BaseModel() {
        baseModelListenerHandler = BaseModelListenerHandler.getInstance();
    }

    public void addOnUpdateListener(OnUpdateListener onUpdateListener) {
        baseModelListenerHandler.onUpdateListeners.add(onUpdateListener);
    }

    public void removeOnUpdateListener(OnUpdateListener onUpdateListener) {
        baseModelListenerHandler.onUpdateListeners.remove(onUpdateListener);
    }
}




Java Source Code List

com.mauriciogiordano.commit.CommitActivity.java
com.mauriciogiordano.commit.CommitAlarmIntent.java
com.mauriciogiordano.commit.CommitAlarmReceiver.java
com.mauriciogiordano.commit.CommitHelper.java
com.mauriciogiordano.commit.Constants.java
com.mauriciogiordano.commit.adapter.CommitAdapter.java
com.mauriciogiordano.commit.database.BaseModel.java
com.mauriciogiordano.commit.database.Commit.java
com.mauriciogiordano.commit.database.Commitment.java
com.mauriciogiordano.commit.database.DatabaseConfigUtil.java
com.mauriciogiordano.commit.database.DatabaseHelper.java
com.mauriciogiordano.commit.fragment.CommitFragment.java
com.mauriciogiordano.commit.fragment.CommitmentsFragment.java
com.mauriciogiordano.commit.view.CommitButton.java
com.mauriciogiordano.commit.view.CommitEditText.java
com.mauriciogiordano.commit.view.CommitTextView.java