Example usage for android.webkit WebView getScale

List of usage examples for android.webkit WebView getScale

Introduction

In this page you can find the example usage for android.webkit WebView getScale.

Prototype

@Deprecated
@ViewDebug.ExportedProperty(category = "webview")
public float getScale() 

Source Link

Document

Gets the current scale of this WebView.

Usage

From source file:cn.bingoogolapple.refreshlayout.util.BGARefreshScrollingUtil.java

public static boolean isWebViewToBottom(WebView webView) {
    return webView != null && webView.getContentHeight()
            * webView.getScale() == (webView.getScrollY() + webView.getMeasuredHeight());
}

From source file:com.ranger.xyg.library.tkrefreshlayout.utils.ScrollingUtil.java

public static boolean isWebViewToBottom(WebView webview, int mTouchSlop) {
    return webview != null && ((webview.getContentHeight() * webview.getScale()
            - (webview.getHeight() + webview.getScrollY())) <= 2 * mTouchSlop);
}

From source file:com.lanma.customviewproject.utils.ScrollingUtil.java

/**
 * webView?// w w w . ja  v a  2  s .  c o m
 */
public static boolean isWebViewToBottom(WebView webView) {
    return webView != null && webView.getContentHeight()
            * webView.getScale() == (webView.getScrollY() + webView.getMeasuredHeight());
}

From source file:com.recyclerviewpulldownrefresh.view.refresh.AbPullToRefreshView.java

/**
 * ??/*www .  j a  v a  2  s  . c  o  m*/
 *
 * @return
 */
public boolean canChildScrollDown() {
    if (!mEnableLoadMore) {
        return false;
    }
    if (mTarget instanceof AdapterView<?>) {
        AdapterView<?> absListView = (AdapterView<?>) mTarget;
        View lastChild = absListView.getChildAt(absListView.getChildCount() - 1);
        if (lastChild == null) {
            return true;
        }
        // ??viewBottom?ViewmAdapterView?view,
        // ViewmAdapterView??
        if (lastChild.getBottom() <= getHeight()
                && absListView.getLastVisiblePosition() == absListView.getCount() - 1) {
            return true;
        }
    } else if (mTarget instanceof WebView) {
        WebView webview = (WebView) mTarget;
        return webview.getContentHeight() * webview.getScale() <= webview.getHeight() + webview.getScrollY();
    } else if (mTarget instanceof ScrollView) {
        ScrollView scrollView = (ScrollView) mTarget;
        View childView = scrollView.getChildAt(0);
        if (childView != null) {
            return childView.getMeasuredHeight() <= getHeight() + mScrollView.getScrollY();
        }
    } else if (mTarget instanceof RecyclerView) {
        int lastVisiblePosition = 0;
        View childView = null;

        RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();

        if (layoutManager instanceof LinearLayoutManager) {
            lastVisiblePosition = ((LinearLayoutManager) layoutManager).findLastVisibleItemPosition();
            childView = layoutManager.findViewByPosition(lastVisiblePosition);
        } else if (layoutManager instanceof GridLayoutManager) {
            lastVisiblePosition = ((GridLayoutManager) layoutManager).findLastVisibleItemPosition();
            childView = layoutManager.findViewByPosition(lastVisiblePosition);
        } else if (layoutManager instanceof StaggeredGridLayoutManager) {
            int[] spanPosition = new int[((StaggeredGridLayoutManager) layoutManager).getSpanCount()];
            ((StaggeredGridLayoutManager) layoutManager).findLastVisibleItemPositions(spanPosition);
            lastVisiblePosition = getLastVisibleItemPosition(spanPosition);
            childView = getLastVisibleItemBottomView(layoutManager, spanPosition, lastVisiblePosition);
        }
        if (null == childView) {
            return false;
        }

        if (lastVisiblePosition == layoutManager.getItemCount() - 1 && childView.getBottom()
                + layoutManager.getBottomDecorationHeight(childView) <= mTarget.getBottom()) {
            return true;
        }
    } else {
        return ViewCompat.canScrollVertically(mTarget, 1);
    }
    return false;
}