Search in sources :

Example 1 with EmptyViewMethodAccessor

use of com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor in project Android-PullToRefresh by chrisbanes.

the class PullToRefreshAdapterViewBase method setEmptyView.

/**
	 * Sets the Empty View to be used by the Adapter View.
	 * <p/>
	 * We need it handle it ourselves so that we can Pull-to-Refresh when the
	 * Empty View is shown.
	 * <p/>
	 * Please note, you do <strong>not</strong> usually need to call this method
	 * yourself. Calling setEmptyView on the AdapterView will automatically call
	 * this method and set everything up. This includes when the Android
	 * Framework automatically sets the Empty View based on it's ID.
	 * 
	 * @param newEmptyView - Empty View to be used
	 */
public final void setEmptyView(View newEmptyView) {
    FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();
    if (null != newEmptyView) {
        // New view needs to be clickable so that Android recognizes it as a
        // target for Touch Events
        newEmptyView.setClickable(true);
        ViewParent newEmptyViewParent = newEmptyView.getParent();
        if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
            ((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
        }
        // We need to convert any LayoutParams so that it works in our
        // FrameLayout
        FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
        if (null != lp) {
            refreshableViewWrapper.addView(newEmptyView, lp);
        } else {
            refreshableViewWrapper.addView(newEmptyView);
        }
    }
    if (mRefreshableView instanceof EmptyViewMethodAccessor) {
        ((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
    } else {
        mRefreshableView.setEmptyView(newEmptyView);
    }
    mEmptyView = newEmptyView;
}
Also used : ViewParent(android.view.ViewParent) ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) EmptyViewMethodAccessor(com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor)

Example 2 with EmptyViewMethodAccessor

use of com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor in project PullToRefreshLibrary by harichen.

the class PullToRefreshAdapterViewBase method setEmptyView.

/**
	 * Sets the Empty View to be used by the Adapter View.
	 * <p/>
	 * We need it handle it ourselves so that we can Pull-to-Refresh when the
	 * Empty View is shown.
	 * <p/>
	 * Please note, you do <strong>not</strong> usually need to call this method
	 * yourself. Calling setEmptyView on the AdapterView will automatically call
	 * this method and set everything up. This includes when the Android
	 * Framework automatically sets the Empty View based on it's ID.
	 * 
	 * @param newEmptyView - Empty View to be used
	 */
public final void setEmptyView(View newEmptyView) {
    FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();
    if (null != newEmptyView) {
        // New view needs to be clickable so that Android recognizes it as a
        // target for Touch Events
        newEmptyView.setClickable(true);
        ViewParent newEmptyViewParent = newEmptyView.getParent();
        if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
            ((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
        }
        // We need to convert any LayoutParams so that it works in our
        // FrameLayout
        FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
        if (null != lp) {
            refreshableViewWrapper.addView(newEmptyView, lp);
        } else {
            refreshableViewWrapper.addView(newEmptyView);
        }
    }
    if (mRefreshableView instanceof EmptyViewMethodAccessor) {
        ((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
    } else {
        mRefreshableView.setEmptyView(newEmptyView);
    }
    mEmptyView = newEmptyView;
}
Also used : ViewParent(android.view.ViewParent) ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) EmptyViewMethodAccessor(com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor)

Example 3 with EmptyViewMethodAccessor

use of com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor in project RecyclerViewAnimator by dkmeteor.

the class PullToRefreshAdapterViewBase method setEmptyView.

/**
	 * Sets the Empty View to be used by the Adapter View.
	 * <p/>
	 * We need it handle it ourselves so that we can Pull-to-Refresh when the
	 * Empty View is shown.
	 * <p/>
	 * Please note, you do <strong>not</strong> usually need to call this method
	 * yourself. Calling setEmptyView on the AdapterView will automatically call
	 * this method and set everything up. This includes when the Android
	 * Framework automatically sets the Empty View based on it's ID.
	 * 
	 * @param newEmptyView - Empty View to be used
	 */
public final void setEmptyView(View newEmptyView) {
    FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();
    if (null != newEmptyView) {
        // New view needs to be clickable so that Android recognizes it as a
        // target for Touch Events
        newEmptyView.setClickable(true);
        ViewParent newEmptyViewParent = newEmptyView.getParent();
        if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
            ((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
        }
        // We need to convert any LayoutParams so that it works in our
        // FrameLayout
        FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
        if (null != lp) {
            refreshableViewWrapper.addView(newEmptyView, lp);
        } else {
            refreshableViewWrapper.addView(newEmptyView);
        }
    }
    if (mRefreshableView instanceof EmptyViewMethodAccessor) {
        ((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
    } else {
        mRefreshableView.setEmptyView(newEmptyView);
    }
    mEmptyView = newEmptyView;
}
Also used : ViewParent(android.view.ViewParent) ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) EmptyViewMethodAccessor(com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor)

Example 4 with EmptyViewMethodAccessor

use of com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor in project PullToRefresh-PinnedSection-ListView by tongcpp.

the class PullToRefreshAdapterViewBase method setEmptyView.

/**
	 * Sets the Empty View to be used by the Adapter View.
	 * <p/>
	 * We need it handle it ourselves so that we can Pull-to-Refresh when the
	 * Empty View is shown.
	 * <p/>
	 * Please note, you do <strong>not</strong> usually need to call this method
	 * yourself. Calling setEmptyView on the AdapterView will automatically call
	 * this method and set everything up. This includes when the Android
	 * Framework automatically sets the Empty View based on it's ID.
	 * 
	 * @param newEmptyView - Empty View to be used
	 */
public final void setEmptyView(View newEmptyView) {
    FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();
    if (null != newEmptyView) {
        // New view needs to be clickable so that Android recognizes it as a
        // target for Touch Events
        newEmptyView.setClickable(true);
        ViewParent newEmptyViewParent = newEmptyView.getParent();
        if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
            ((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
        }
        // We need to convert any LayoutParams so that it works in our
        // FrameLayout
        FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
        if (null != lp) {
            refreshableViewWrapper.addView(newEmptyView, lp);
        } else {
            refreshableViewWrapper.addView(newEmptyView);
        }
    }
    if (mRefreshableView instanceof EmptyViewMethodAccessor) {
        ((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
    } else {
        mRefreshableView.setEmptyView(newEmptyView);
    }
    mEmptyView = newEmptyView;
}
Also used : ViewParent(android.view.ViewParent) ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) EmptyViewMethodAccessor(com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor)

Example 5 with EmptyViewMethodAccessor

use of com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor in project StaggeredGridView by bulletnoid.

the class PullToRefreshAdapterViewBase method setEmptyView.

/**
	 * Sets the Empty View to be used by the Adapter View.
	 * <p/>
	 * We need it handle it ourselves so that we can Pull-to-Refresh when the
	 * Empty View is shown.
	 * <p/>
	 * Please note, you do <strong>not</strong> usually need to call this method
	 * yourself. Calling setEmptyView on the AdapterView will automatically call
	 * this method and set everything up. This includes when the Android
	 * Framework automatically sets the Empty View based on it's ID.
	 *
	 * @param newEmptyView - Empty View to be used
	 */
public final void setEmptyView(View newEmptyView) {
    FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();
    if (null != newEmptyView) {
        // New view needs to be clickable so that Android recognizes it as a
        // target for Touch Events
        newEmptyView.setClickable(true);
        ViewParent newEmptyViewParent = newEmptyView.getParent();
        if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
            ((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
        }
        // We need to convert any LayoutParams so that it works in our
        // FrameLayout
        FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
        if (null != lp) {
            refreshableViewWrapper.addView(newEmptyView, lp);
        } else {
            refreshableViewWrapper.addView(newEmptyView);
        }
    }
    if (mRefreshableView instanceof EmptyViewMethodAccessor) {
        ((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
    } else {
        mRefreshableView.setEmptyView(newEmptyView);
    }
    mEmptyView = newEmptyView;
}
Also used : ViewParent(android.view.ViewParent) ViewGroup(android.view.ViewGroup) EmptyViewMethodAccessor(com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor)

Aggregations

ViewGroup (android.view.ViewGroup)5 ViewParent (android.view.ViewParent)5 EmptyViewMethodAccessor (com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor)5 FrameLayout (android.widget.FrameLayout)4