// Path: sample-android/src/main/java/com/example/sample_android/action/Add.java
// @AutoValue
// public abstract class Add implements Action {
//    
//     public static Add create(String text) {
//         return new AutoValue_Add(text);
//     }
// 
//     public abstract String text();
// }
// 
// Path: sample-android/src/main/java/com/example/sample_android/action/Edit.java
// @AutoValue
// public abstract class Edit implements UpdateItem {
//     
//     public static Edit create(int id, String text) {
//         return new AutoValue_Edit(id, text);
//     }
//     
//     public abstract int id();
//     
//     public abstract String text();
// }
// 
// Path: sample-android/src/main/java/com/example/sample_android/state/TodoItem.java
// @AutoValue
// public abstract class TodoItem {
//     
//     public static TodoItem create(int id, String text, boolean done) {
//         return new AutoValue_TodoItem(id, text, done);
//     }
//     
//     public abstract int id();
// 
//     public abstract String text();
//    
//     public abstract boolean done();
// }
// 
// Path: sample-android/src/main/java/com/example/sample_android/store/MainStore.java
// public class MainStore extends SimpleStore<TodoList> {
// 
//     private final Dispatcher<Action, Action> dispatcher;
//     private final Dispatcher<Thunk<Action, Action>, Void> thunkDispatcher;
//     private final ReplayMiddleware<TodoList, Action, Action> replayMiddleware;
//     private final MonitorMiddleware<TodoList, Action, Action> monitorMiddleware;
// 
//     public MainStore(Context context) {
//         super(TodoList.initial());
//         Reducer<Action, TodoList> reducer = TodoListReducers.reducer();
//         replayMiddleware = new ReplayMiddleware<>(this, reducer);
//         monitorMiddleware = new MonitorMiddleware<>(this, new MonitorMiddleware.Config("10.0.2.2", 8000));
//         dispatcher = Dispatcher.forStore(this, reducer)
//                 .chain(new LogMiddleware<Action, Action>("ACTION"),
//                         replayMiddleware,
//                         monitorMiddleware,
//                         new PersistenceMiddleware<Action, Action>(this, new Datastore(context)));
//         thunkDispatcher = new ThunkDispatcher<>(dispatcher)
//                 .chain(new LogMiddleware<Thunk<Action, Action>, Void>("THUNK_ACTION"));
//     }
// 
//     public Action dispatch(Action action) {
//         return dispatcher.dispatch(action);
//     }
// 
//     public void dispatch(Thunk<Action, Action> thunk) {
//         thunkDispatcher.dispatch(thunk);
//     }
// 
//     public ReplayMiddleware<TodoList, Action, Action> getReplayMiddleware() {
//         return replayMiddleware;
//     }
// }


import android.app.Dialog;
import androidx.lifecycle.ViewModelProviders;
import android.content.DialogInterface;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import androidx.appcompat.app.AlertDialog;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import com.example.sample_android.action.Add;
import com.example.sample_android.action.Edit;
import com.example.sample_android.state.TodoItem;
import com.example.sample_android.store.MainStore;
package com.example.sample_android;



public class TodoItemDialogFragment extends DialogFragment {

    public static TodoItemDialogFragment newInstance() {
        return newInstance(-1);
    }

    public static TodoItemDialogFragment newInstance(int id) {
        Bundle args = new Bundle();
        args.putInt("id", id);
        TodoItemDialogFragment fragment = new TodoItemDialogFragment();
        fragment.setArguments(args);
        return fragment;
    }

// Path: sample-android/src/main/java/com/example/sample_android/action/Add.java
// @AutoValue
// public abstract class Add implements Action {
//    
//     public static Add create(String text) {
//         return new AutoValue_Add(text);
//     }
// 
//     public abstract String text();
// }
// 
// Path: sample-android/src/main/java/com/example/sample_android/action/Edit.java
// @AutoValue
// public abstract class Edit implements UpdateItem {
//     
//     public static Edit create(int id, String text) {
//         return new AutoValue_Edit(id, text);
//     }
//     
//     public abstract int id();
//     
//     public abstract String text();
// }
// 
// Path: sample-android/src/main/java/com/example/sample_android/state/TodoItem.java
// @AutoValue
// public abstract class TodoItem {
//     
//     public static TodoItem create(int id, String text, boolean done) {
//         return new AutoValue_TodoItem(id, text, done);
//     }
//     
//     public abstract int id();
// 
//     public abstract String text();
//    
//     public abstract boolean done();
// }
// 
// Path: sample-android/src/main/java/com/example/sample_android/store/MainStore.java
// public class MainStore extends SimpleStore<TodoList> {
// 
//     private final Dispatcher<Action, Action> dispatcher;
//     private final Dispatcher<Thunk<Action, Action>, Void> thunkDispatcher;
//     private final ReplayMiddleware<TodoList, Action, Action> replayMiddleware;
//     private final MonitorMiddleware<TodoList, Action, Action> monitorMiddleware;
// 
//     public MainStore(Context context) {
//         super(TodoList.initial());
//         Reducer<Action, TodoList> reducer = TodoListReducers.reducer();
//         replayMiddleware = new ReplayMiddleware<>(this, reducer);
//         monitorMiddleware = new MonitorMiddleware<>(this, new MonitorMiddleware.Config("10.0.2.2", 8000));
//         dispatcher = Dispatcher.forStore(this, reducer)
//                 .chain(new LogMiddleware<Action, Action>("ACTION"),
//                         replayMiddleware,
//                         monitorMiddleware,
//                         new PersistenceMiddleware<Action, Action>(this, new Datastore(context)));
//         thunkDispatcher = new ThunkDispatcher<>(dispatcher)
//                 .chain(new LogMiddleware<Thunk<Action, Action>, Void>("THUNK_ACTION"));
//     }
// 
//     public Action dispatch(Action action) {
//         return dispatcher.dispatch(action);
//     }
// 
//     public void dispatch(Thunk<Action, Action> thunk) {
//         thunkDispatcher.dispatch(thunk);
//     }
// 
//     public ReplayMiddleware<TodoList, Action, Action> getReplayMiddleware() {
//         return replayMiddleware;
//     }
// }


// Path: sample-android/src/main/java/com/example/sample_android/TodoItemDialogFragment.java
import android.app.Dialog;
import androidx.lifecycle.ViewModelProviders;
import android.content.DialogInterface;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import androidx.appcompat.app.AlertDialog;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import com.example.sample_android.action.Add;
import com.example.sample_android.action.Edit;
import com.example.sample_android.state.TodoItem;
import com.example.sample_android.store.MainStore;

package com.example.sample_android;



public class TodoItemDialogFragment extends DialogFragment {

    public static TodoItemDialogFragment newInstance() {
        return newInstance(-1);
    }

    public static TodoItemDialogFragment newInstance(int id) {
        Bundle args = new Bundle();
        args.putInt("id", id);
        TodoItemDialogFragment fragment = new TodoItemDialogFragment();
        fragment.setArguments(args);
        return fragment;
    }

    MainStore store;