// Path: lib/src/main/java/com/mindbodyonline/ironhide/PageObjects/PageObject.java
// public class PageObject {
// 
//     public static final int DEFAULT_PAUSE_TIME = 2000;
// 
//     /**
//      * Pause the test run for {@link PageObject#DEFAULT_PAUSE_TIME} milliseconds
//      * @return A generic of the passed in type
//      */
//     public <T extends PageObject> T pause(Class<T> type) {
//         return pause(type, DEFAULT_PAUSE_TIME);
//     }
// 
//     /**
//      * Pause the test run for a given amount of time(in milliseconds).
//      * @param timeInMillis Time, in milliseconds, to pause for.
//      * @return A generic of the passed in type.                     
//      */
//     public <T extends PageObject> T pause(Class<T> type, int timeInMillis) {
//         try {
//             Thread.sleep(timeInMillis);
//             return type.newInstance();
//         } catch (InstantiationException | IllegalAccessException | InterruptedException e) {
//             e.printStackTrace();
//         }
//         return null;
//     }
// }
// 
// Path: lib/src/main/java/com/mindbodyonline/ironhide/Infrastructure/Extensions/BaseViewMatchers.java
// public static Matcher<View> hasIndex(final int index) {
//     return checkHasIndex(index);
// }
// 
// Path: lib/src/main/java/com/mindbodyonline/ironhide/Infrastructure/Extensions/BaseViewMatchers.java
// public static Matcher<View> instanceOf(final Class<?> type) {
//     return checkInstanceOf(type);
// }


import android.view.View;
import com.mindbodyonline.ironhide.PageObjects.PageObject;
import org.hamcrest.Matcher;
import static android.support.test.espresso.matcher.ViewMatchers.isDescendantOfA;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static com.mindbodyonline.ironhide.Infrastructure.Extensions.BaseViewMatchers.hasIndex;
import static com.mindbodyonline.ironhide.Infrastructure.Extensions.BaseViewMatchers.instanceOf;
import static org.hamcrest.Matchers.allOf;
package com.mindbodyonline.ironhide.Infrastructure.IronhideViews;





/**
 * Simple element that allows to interact with ListViews that have children added dynamically.
 * Enables access to ListItems inside a dynamic ListView that does not use an adapter.
 * This element is rarely used, as these types of ListViews are considered bad practice
 *
 * @param <T> The model the current element will return when interacted with
 */
public class DynamicListAdapter<T extends PageObject> {

    private final Class<T> type;
    private final Matcher<View> childMatcher;

    /**
     * A generically typed DynamicListAdapter with selector:
     *  {@link com.mindbodyonline.ironhide.Infrastructure.Extensions.BaseViewMatchers#instanceOf(Class)}
     * @param itemType the class type to use for {@link com.mindbodyonline.ironhide.Infrastructure.Extensions.BaseViewMatchers#instanceOf(Class)}
     */
    public DynamicListAdapter(Class<T> type, Class itemType) {
// Path: lib/src/main/java/com/mindbodyonline/ironhide/PageObjects/PageObject.java
// public class PageObject {
// 
//     public static final int DEFAULT_PAUSE_TIME = 2000;
// 
//     /**
//      * Pause the test run for {@link PageObject#DEFAULT_PAUSE_TIME} milliseconds
//      * @return A generic of the passed in type
//      */
//     public <T extends PageObject> T pause(Class<T> type) {
//         return pause(type, DEFAULT_PAUSE_TIME);
//     }
// 
//     /**
//      * Pause the test run for a given amount of time(in milliseconds).
//      * @param timeInMillis Time, in milliseconds, to pause for.
//      * @return A generic of the passed in type.                     
//      */
//     public <T extends PageObject> T pause(Class<T> type, int timeInMillis) {
//         try {
//             Thread.sleep(timeInMillis);
//             return type.newInstance();
//         } catch (InstantiationException | IllegalAccessException | InterruptedException e) {
//             e.printStackTrace();
//         }
//         return null;
//     }
// }
// 
// Path: lib/src/main/java/com/mindbodyonline/ironhide/Infrastructure/Extensions/BaseViewMatchers.java
// public static Matcher<View> hasIndex(final int index) {
//     return checkHasIndex(index);
// }
// 
// Path: lib/src/main/java/com/mindbodyonline/ironhide/Infrastructure/Extensions/BaseViewMatchers.java
// public static Matcher<View> instanceOf(final Class<?> type) {
//     return checkInstanceOf(type);
// }


// Path: lib/src/main/java/com/mindbodyonline/ironhide/Infrastructure/IronhideViews/DynamicListAdapter.java
import android.view.View;
import com.mindbodyonline.ironhide.PageObjects.PageObject;
import org.hamcrest.Matcher;
import static android.support.test.espresso.matcher.ViewMatchers.isDescendantOfA;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static com.mindbodyonline.ironhide.Infrastructure.Extensions.BaseViewMatchers.hasIndex;
import static com.mindbodyonline.ironhide.Infrastructure.Extensions.BaseViewMatchers.instanceOf;
import static org.hamcrest.Matchers.allOf;

package com.mindbodyonline.ironhide.Infrastructure.IronhideViews;





/**
 * Simple element that allows to interact with ListViews that have children added dynamically.
 * Enables access to ListItems inside a dynamic ListView that does not use an adapter.
 * This element is rarely used, as these types of ListViews are considered bad practice
 *
 * @param <T> The model the current element will return when interacted with
 */
public class DynamicListAdapter<T extends PageObject> {

    private final Class<T> type;
    private final Matcher<View> childMatcher;

    /**
     * A generically typed DynamicListAdapter with selector:
     *  {@link com.mindbodyonline.ironhide.Infrastructure.Extensions.BaseViewMatchers#instanceOf(Class)}
     * @param itemType the class type to use for {@link com.mindbodyonline.ironhide.Infrastructure.Extensions.BaseViewMatchers#instanceOf(Class)}
     */
    public DynamicListAdapter(Class<T> type, Class itemType) {
        this(type, instanceOf(itemType));