Search in sources :

Example 6 with LoadingLayout

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

the class PullToRefreshBase method createLoadingLayout.

protected LoadingLayout createLoadingLayout(Context context, Mode mode, TypedArray attrs) {
    LoadingLayout layout = mLoadingAnimationStyle.createLoadingLayout(context, mode, getPullToRefreshScrollDirection(), attrs);
    layout.setVisibility(View.INVISIBLE);
    return layout;
}
Also used : LoadingLayout(com.handmark.pulltorefresh.library.internal.LoadingLayout) RotateLoadingLayout(com.handmark.pulltorefresh.library.internal.RotateLoadingLayout) FlipLoadingLayout(com.handmark.pulltorefresh.library.internal.FlipLoadingLayout)

Example 7 with LoadingLayout

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

the class PullToRefreshListView method onReset.

@Override
protected void onReset() {
    /**
		 * If the extras are not enabled, just call up to super and return.
		 */
    if (!mListViewExtrasEnabled) {
        super.onReset();
        return;
    }
    final LoadingLayout originalLoadingLayout, listViewLoadingLayout;
    final int scrollToHeight, selection;
    final boolean scrollLvToEdge;
    switch(getCurrentMode()) {
        case MANUAL_REFRESH_ONLY:
        case PULL_FROM_END:
            originalLoadingLayout = getFooterLayout();
            listViewLoadingLayout = mFooterLoadingView;
            selection = mRefreshableView.getCount() - 1;
            scrollToHeight = getFooterSize();
            scrollLvToEdge = Math.abs(mRefreshableView.getLastVisiblePosition() - selection) <= 1;
            break;
        case PULL_FROM_START:
        default:
            originalLoadingLayout = getHeaderLayout();
            listViewLoadingLayout = mHeaderLoadingView;
            scrollToHeight = -getHeaderSize();
            selection = 0;
            scrollLvToEdge = Math.abs(mRefreshableView.getFirstVisiblePosition() - selection) <= 1;
            break;
    }
    // flip so that the original one is showing instead
    if (listViewLoadingLayout.getVisibility() == VISIBLE) {
        // Set our Original View to Visible
        originalLoadingLayout.showInvisibleViews();
        // Hide the ListView Header/Footer
        listViewLoadingLayout.setVisibility(GONE);
        /**
			 * Scroll so the View is at the same Y as the ListView
			 * header/footer, but only scroll if: we've pulled to refresh, it's
			 * positioned correctly
			 */
        if (scrollLvToEdge && getState() != State.MANUAL_REFRESHING) {
            mRefreshableView.setSelection(selection);
            setHeaderScroll(scrollToHeight);
        }
    }
    // Finally, call up to super
    super.onReset();
}
Also used : LoadingLayout(com.handmark.pulltorefresh.library.internal.LoadingLayout)

Example 8 with LoadingLayout

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

the class PullToRefreshBase method createLoadingLayout.

protected LoadingLayout createLoadingLayout(Context context, Mode mode, TypedArray attrs) {
    LoadingLayout layout = mLoadingAnimationStyle.createLoadingLayout(context, mode, getPullToRefreshScrollDirection(), attrs);
    layout.setVisibility(View.INVISIBLE);
    return layout;
}
Also used : LoadingLayout(com.handmark.pulltorefresh.library.internal.LoadingLayout) RotateLoadingLayout(com.handmark.pulltorefresh.library.internal.RotateLoadingLayout) FlipLoadingLayout(com.handmark.pulltorefresh.library.internal.FlipLoadingLayout)

Example 9 with LoadingLayout

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

the class PullToRefreshListView method onReset.

@Override
protected void onReset() {
    /**
         * If the extras are not enabled, just call up to super and return.
         */
    if (!mListViewExtrasEnabled) {
        super.onReset();
        return;
    }
    final LoadingLayout originalLoadingLayout, listViewLoadingLayout;
    final int scrollToHeight, selection;
    final boolean scrollLvToEdge;
    switch(getCurrentMode()) {
        case MANUAL_REFRESH_ONLY:
        case PULL_FROM_END:
            originalLoadingLayout = getFooterLayout();
            listViewLoadingLayout = mFooterLoadingView;
            selection = mRefreshableView.getCount() - 1;
            scrollToHeight = getFooterSize();
            scrollLvToEdge = Math.abs(mRefreshableView.getLastVisiblePosition() - selection) <= 1;
            break;
        case PULL_FROM_START:
        default:
            originalLoadingLayout = getHeaderLayout();
            listViewLoadingLayout = mHeaderLoadingView;
            scrollToHeight = -getHeaderSize();
            selection = 0;
            scrollLvToEdge = Math.abs(mRefreshableView.getFirstVisiblePosition() - selection) <= 1;
            break;
    }
    // flip so that the original one is showing instead
    if (listViewLoadingLayout.getVisibility() == View.VISIBLE) {
        // Set our Original View to Visible
        originalLoadingLayout.showInvisibleViews();
        // Hide the ListView Header/Footer
        listViewLoadingLayout.setVisibility(View.GONE);
        /**
             * Scroll so the View is at the same Y as the ListView
             * header/footer, but only scroll if: we've pulled to refresh, it's
             * positioned correctly
             */
        if (scrollLvToEdge && getState() != State.MANUAL_REFRESHING) {
            mRefreshableView.setSelection(selection);
            setHeaderScroll(scrollToHeight);
        }
    }
    // Finally, call up to super
    super.onReset();
}
Also used : LoadingLayout(com.handmark.pulltorefresh.library.internal.LoadingLayout)

Example 10 with LoadingLayout

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

the class PullToRefreshBase method createLoadingLayout.

protected LoadingLayout createLoadingLayout(Context context, Mode mode, TypedArray attrs) {
    LoadingLayout layout = mLoadingAnimationStyle.createLoadingLayout(context, mode, getPullToRefreshScrollDirection(), attrs);
    layout.setVisibility(View.INVISIBLE);
    return layout;
}
Also used : LoadingLayout(com.handmark.pulltorefresh.library.internal.LoadingLayout) RotateLoadingLayout(com.handmark.pulltorefresh.library.internal.RotateLoadingLayout) FlipLoadingLayout(com.handmark.pulltorefresh.library.internal.FlipLoadingLayout)

Aggregations

LoadingLayout (com.handmark.pulltorefresh.library.internal.LoadingLayout)16 ListAdapter (android.widget.ListAdapter)6 FlipLoadingLayout (com.handmark.pulltorefresh.library.internal.FlipLoadingLayout)4 RotateLoadingLayout (com.handmark.pulltorefresh.library.internal.RotateLoadingLayout)4