Android Open Source - MVC App Model






From Project

Back to project page MVC.

License

The source code is released under:

Apache License

If you think the Android project MVC 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.musselwhizzle.mvc.models;
//  w w  w . j  a  v  a 2  s  .c  o m
import com.musselwhizzle.mvc.events.EventDispatcher;
import com.musselwhizzle.mvc.events.SimpleEvent;

public class AppModel extends EventDispatcher {

    public static class ChangeEvent extends SimpleEvent {
        public static final String ELAPSED_TIME_CHANGED = "elapsedTimeChanged";

        public ChangeEvent(String type) {
            super(type);
        }
    }

    private static AppModel instance;

    private long elapsedTime = 0;
    public long getElapsedTime() { return elapsedTime; }
    public void setElapsedTime(long elapsedTime) {
        this.elapsedTime = elapsedTime;
        notifyChange(ChangeEvent.ELAPSED_TIME_CHANGED);
    }

    private AppModel() {
        super();
    }

    public static AppModel getInstance() {
        if (instance == null) instance = new AppModel();
        return instance;
    }

    private void notifyChange(String type) {
        dispatchEvent(new ChangeEvent(type));
    }
}




Java Source Code List

com.musselwhizzle.mvc.activities.MainActivity.java
com.musselwhizzle.mvc.events.Dispatcher.java
com.musselwhizzle.mvc.events.EventDispatcher.java
com.musselwhizzle.mvc.events.EventListener.java
com.musselwhizzle.mvc.events.Event.java
com.musselwhizzle.mvc.events.SimpleEvent.java
com.musselwhizzle.mvc.models.AppModel.java
com.musselwhizzle.mvc.views.MainView.java
com.musselwhizzle.mvc.widgets.DigitObjectPool.java
com.musselwhizzle.mvc.widgets.Digit.java