// Path: chapter9-criminalintent/app/src/main/java/com/olerass/pfexample/android/criminalintent/domain/crime/CrimeView.java
// public interface CrimeView {
//     void setDate(Date date);
//     void disableDateInteraction();
// 
//     void whenTitleChanged(DataEventListener<String> listener);
//     void whenSolvedChanged(DataEventListener<Boolean> listener);
// }
// 
// Path: chapter9-criminalintent/app/src/main/java/com/olerass/pfexample/android/criminalintent/domain/event/DataEvent.java
// public class DataEvent<T> {
//     private List<DataEventListener<T>> listeners = new ArrayList<>();
// 
//     public void addListener(DataEventListener<T> listener) {
//         listeners.add(listener);
//     }
// 
//     public void dispatch(T data) {
//         for (DataEventListener<T> listener : listeners) {
//             listener.onDispatch(data);
//         }
//     }
// }
// 
// Path: chapter9-criminalintent/app/src/main/java/com/olerass/pfexample/android/criminalintent/domain/event/DataEventListener.java
// public interface DataEventListener<T> {
//     void onDispatch(T data);
// }


import android.text.Editable;
import android.text.TextWatcher;
import android.text.format.DateFormat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import com.olerass.pfexample.android.criminalintent.R;
import com.olerass.pfexample.android.criminalintent.domain.crime.CrimeView;
import com.olerass.pfexample.android.criminalintent.domain.event.DataEvent;
import com.olerass.pfexample.android.criminalintent.domain.event.DataEventListener;
import java.util.Date;
    public void whenTitleChanged(DataEventListener<String> listener) {
        titleChanged.addListener(listener);
    }

    @Override
    public void whenSolvedChanged(DataEventListener<Boolean> listener) {
        solvedChanged.addListener(listener);
    }

    private void initializeTitleField() {
        titleField = (EditText)view.findViewById(R.id.crime_title);
        titleField.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                titleChanged.dispatch(s.toString());
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        });
    }

    private void initializeSolvedCheckBox() {
// Path: chapter9-criminalintent/app/src/main/java/com/olerass/pfexample/android/criminalintent/domain/crime/CrimeView.java
// public interface CrimeView {
//     void setDate(Date date);
//     void disableDateInteraction();
// 
//     void whenTitleChanged(DataEventListener<String> listener);
//     void whenSolvedChanged(DataEventListener<Boolean> listener);
// }
// 
// Path: chapter9-criminalintent/app/src/main/java/com/olerass/pfexample/android/criminalintent/domain/event/DataEvent.java
// public class DataEvent<T> {
//     private List<DataEventListener<T>> listeners = new ArrayList<>();
// 
//     public void addListener(DataEventListener<T> listener) {
//         listeners.add(listener);
//     }
// 
//     public void dispatch(T data) {
//         for (DataEventListener<T> listener : listeners) {
//             listener.onDispatch(data);
//         }
//     }
// }
// 
// Path: chapter9-criminalintent/app/src/main/java/com/olerass/pfexample/android/criminalintent/domain/event/DataEventListener.java
// public interface DataEventListener<T> {
//     void onDispatch(T data);
// }


// Path: chapter8-criminalintent-challenges/app/src/main/java/com/olerass/pfexample/android/criminalintent/platform/FragmentCrimeView.java
import android.text.Editable;
import android.text.TextWatcher;
import android.text.format.DateFormat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import com.olerass.pfexample.android.criminalintent.R;
import com.olerass.pfexample.android.criminalintent.domain.crime.CrimeView;
import com.olerass.pfexample.android.criminalintent.domain.event.DataEvent;
import com.olerass.pfexample.android.criminalintent.domain.event.DataEventListener;
import java.util.Date;

    public void whenTitleChanged(DataEventListener<String> listener) {
        titleChanged.addListener(listener);
    }

    @Override
    public void whenSolvedChanged(DataEventListener<Boolean> listener) {
        solvedChanged.addListener(listener);
    }

    private void initializeTitleField() {
        titleField = (EditText)view.findViewById(R.id.crime_title);
        titleField.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                titleChanged.dispatch(s.toString());
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        });
    }

    private void initializeSolvedCheckBox() {
        solvedCheckBox = (CheckBox)view.findViewById(R.id.crime_solved);