// Path: phial-overlay/src/main/java/com/mindcoders/phial/OverlayCallback.java
// public interface OverlayCallback {
// 
//     /**
//      * Called to close phial debug window
//      */
//     void finish();
// 
// 
//     /**
//      * Finds view in application view hierarchy
//      *
//      * @param id view id.
//      * @return view or null if view is missing
//      */
//     @Nullable
//     View findViewById(int id);
// }
// 
// Path: phial-overlay/src/main/java/com/mindcoders/phial/PageView.java
// public interface PageView {
// 
//     /**
//      * Called when device back button has been pressed
//      * @return true if the event was consumed; false otherwise.
//      */
//     boolean onBackPressed();
// 
// }
// 
// Path: phial-overlay/src/main/java/com/mindcoders/phial/internal/util/Precondition.java
// public final class Precondition {
//     private Precondition() {
//         //to hide-
//     }
// 
//     public static <T> T notNull(T item, String message) {
//         if (item == null) {
//             throw new IllegalArgumentException(message);
//         }
// 
//         return item;
//     }
// 
//     public static void calledFromTools(View view) {
//         if (!view.isInEditMode()) {
//             throw new IllegalArgumentException("should be called only from AndroidStudioTools");
//         }
//     }
// 
//     public static void notImplemented(String what, Context context) {
//         Toast.makeText(context, what + " is NOT Implemented yet", Toast.LENGTH_SHORT).show();
//     }
// 
//     public static void isTrue(boolean condition, String message) {
//         if (!condition) {
//             throw new IllegalArgumentException(message);
//         }
//     }
// 
//     public static <T> void notEmpty(T[] array, String message) {
//         if (array == null || array.length == 0) {
//             throw new IllegalArgumentException(message);
//         }
//     }
// 
//     public static void notEmpty(int[] array, String message) {
//         if (array == null || array.length == 0) {
//             throw new IllegalArgumentException(message);
//         }
//     }
// }
// 
// Path: phial-overlay/src/main/java/com/mindcoders/phial/internal/util/SimpleTextWatcher.java
// public class SimpleTextWatcher implements TextWatcher {
//     @Override
//     public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//         //optional
//     }
// 
//     @Override
//     public void onTextChanged(CharSequence s, int start, int before, int count) {
//         //optional
//     }
// 
//     @Override
//     public void afterTextChanged(Editable s) {
//         //optional
//     }
// }


import android.content.Context;
import android.support.annotation.NonNull;
import android.text.Editable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ListView;
import android.widget.TextView;
import com.mindcoders.phial.OverlayCallback;
import com.mindcoders.phial.PageView;
import com.mindcoders.phial.internal.util.Precondition;
import com.mindcoders.phial.internal.util.SimpleTextWatcher;
import java.util.ArrayList;
import java.util.List;
                ((TextView) view).setText(dataToFill.get(i));
            }
        }

        overlayCallback.finish();
    }

    private void saveOption(String optionName) {
        if (optionName.isEmpty()) {
            return;
        }

        final List<Integer> ids = manager.getTargetIds();
        final List<String> values = new ArrayList<>(ids.size());
        for (int i = 0; i < ids.size(); i++) {
            final View view = overlayCallback.findViewById(ids.get(i));
            final String value = readValueOrDefault(view);
            values.add(value);
        }
        manager.saveOption(optionName, values);
    }

    private String readValueOrDefault(View view) {
        if (!(view instanceof TextView)) {
            return AutoFiller.EMPTY_FIELD;
        }

        return ((TextView) view).getText().toString();
    }

// Path: phial-overlay/src/main/java/com/mindcoders/phial/OverlayCallback.java
// public interface OverlayCallback {
// 
//     /**
//      * Called to close phial debug window
//      */
//     void finish();
// 
// 
//     /**
//      * Finds view in application view hierarchy
//      *
//      * @param id view id.
//      * @return view or null if view is missing
//      */
//     @Nullable
//     View findViewById(int id);
// }
// 
// Path: phial-overlay/src/main/java/com/mindcoders/phial/PageView.java
// public interface PageView {
// 
//     /**
//      * Called when device back button has been pressed
//      * @return true if the event was consumed; false otherwise.
//      */
//     boolean onBackPressed();
// 
// }
// 
// Path: phial-overlay/src/main/java/com/mindcoders/phial/internal/util/Precondition.java
// public final class Precondition {
//     private Precondition() {
//         //to hide-
//     }
// 
//     public static <T> T notNull(T item, String message) {
//         if (item == null) {
//             throw new IllegalArgumentException(message);
//         }
// 
//         return item;
//     }
// 
//     public static void calledFromTools(View view) {
//         if (!view.isInEditMode()) {
//             throw new IllegalArgumentException("should be called only from AndroidStudioTools");
//         }
//     }
// 
//     public static void notImplemented(String what, Context context) {
//         Toast.makeText(context, what + " is NOT Implemented yet", Toast.LENGTH_SHORT).show();
//     }
// 
//     public static void isTrue(boolean condition, String message) {
//         if (!condition) {
//             throw new IllegalArgumentException(message);
//         }
//     }
// 
//     public static <T> void notEmpty(T[] array, String message) {
//         if (array == null || array.length == 0) {
//             throw new IllegalArgumentException(message);
//         }
//     }
// 
//     public static void notEmpty(int[] array, String message) {
//         if (array == null || array.length == 0) {
//             throw new IllegalArgumentException(message);
//         }
//     }
// }
// 
// Path: phial-overlay/src/main/java/com/mindcoders/phial/internal/util/SimpleTextWatcher.java
// public class SimpleTextWatcher implements TextWatcher {
//     @Override
//     public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//         //optional
//     }
// 
//     @Override
//     public void onTextChanged(CharSequence s, int start, int before, int count) {
//         //optional
//     }
// 
//     @Override
//     public void afterTextChanged(Editable s) {
//         //optional
//     }
// }


// Path: phial-autofill/src/main/java/com/mindcoders/phial/autofill/FillView.java
import android.content.Context;
import android.support.annotation.NonNull;
import android.text.Editable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ListView;
import android.widget.TextView;
import com.mindcoders.phial.OverlayCallback;
import com.mindcoders.phial.PageView;
import com.mindcoders.phial.internal.util.Precondition;
import com.mindcoders.phial.internal.util.SimpleTextWatcher;
import java.util.ArrayList;
import java.util.List;

                ((TextView) view).setText(dataToFill.get(i));
            }
        }

        overlayCallback.finish();
    }

    private void saveOption(String optionName) {
        if (optionName.isEmpty()) {
            return;
        }

        final List<Integer> ids = manager.getTargetIds();
        final List<String> values = new ArrayList<>(ids.size());
        for (int i = 0; i < ids.size(); i++) {
            final View view = overlayCallback.findViewById(ids.get(i));
            final String value = readValueOrDefault(view);
            values.add(value);
        }
        manager.saveOption(optionName, values);
    }

    private String readValueOrDefault(View view) {
        if (!(view instanceof TextView)) {
            return AutoFiller.EMPTY_FIELD;
        }

        return ((TextView) view).getText().toString();
    }

    private static class ButtonEnabler extends SimpleTextWatcher {