Android Open Source - Reactor Favorite Food View Model






From Project

Back to project page Reactor.

License

The source code is released under:

MIT License

If you think the Android project Reactor 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 io.dwak.androidtracker.viewmodel;
/*from w  w  w.ja v  a  2  s. c  om*/
import io.dwak.tracker.ReactorDependency;

/**
 * Created by vishnu on 12/23/14.
 */
public class FavoriteFoodViewModel {
    public static String PIZZA = "PIZZA";
    public static String MANGOES = "MANGOES";
    private boolean mIsPizza;
    private String mFavoriteFood;
    private int mFavoritePercentage;

    private String mEditTextValue;
    private ReactorDependency mIsPizzaDep;
    private ReactorDependency mFavoriteFoodDep;
    private ReactorDependency mFavoritePercentageDep;
    private ReactorDependency mEditTextValueDep;

    public FavoriteFoodViewModel(String favoriteFood, int favoritePercentage) {
        mIsPizzaDep = new ReactorDependency();
        mFavoriteFoodDep = new ReactorDependency();
        mFavoritePercentageDep = new ReactorDependency();
        mEditTextValueDep = new ReactorDependency();
        mIsPizza = PIZZA.equals(favoriteFood);
        mFavoriteFood = favoriteFood;
        mFavoritePercentage = favoritePercentage;
        mEditTextValue = "";
    }

    public int getFavoritePercentage() {
        mFavoritePercentageDep.depend();
        return mFavoritePercentage;
    }

    public void setFavoritePercentage(int favoritePercentage) {
        mFavoritePercentage = favoritePercentage;
        mFavoritePercentageDep.changed();
    }

    public String getFavoriteFood() {
        mFavoriteFoodDep.depend();
        return mFavoriteFood;
    }

    public void setFavoriteFood(String favoriteFood) {
        mFavoriteFood = favoriteFood;
        mFavoriteFoodDep.changed();
    }

    public boolean isPizza() {
        mIsPizzaDep.depend();
        return mIsPizza;
    }

    public void setPizza(boolean isPizza) {
        mIsPizza = isPizza;
        mIsPizzaDep.changed();
    }

    public String getEditTextValue() {
        mEditTextValueDep.depend();
        return mEditTextValue;
    }

    public void setEditTextValue(String editTextValue) {
        mEditTextValue = editTextValue;
        mEditTextValueDep.changed();
    }
}




Java Source Code List

io.dwak.androidtracker.AndroidReactorApplication.java
io.dwak.androidtracker.ApplicationTest.java
io.dwak.androidtracker.MainActivity.java
io.dwak.androidtracker.viewmodel.FavoriteFoodViewModel.java
io.dwak.tracker.ApplicationTest.java
io.dwak.tracker.ReactorComputationFunction.java
io.dwak.tracker.ReactorComputation.java
io.dwak.tracker.ReactorDependency.java
io.dwak.tracker.Reactor.java
io.dwak.tracker.TrackerFlushCallbacks.java