Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webview can't working correctly #75

Closed
t2314862168 opened this issue Mar 28, 2016 · 1 comment
Closed

webview can't working correctly #75

t2314862168 opened this issue Mar 28, 2016 · 1 comment

Comments

@t2314862168
Copy link

@ozodrukh
when i use RevealFrameLayout contain WebView,and when web load url data show CircularReveal , it can't work correctly ,most of time can't see the CircularReveal ,can you help me !
my xml code is below :

<io.codetail.widget.RevealFrameLayout
        android:id="@+id/animator"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <WebView
            android:id="@+id/webview"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <com.wang.avi.AVLoadingIndicatorView
            android:id="@+id/avi"
            android:layout_width="80dp"
            android:layout_height="80dp"
            android:layout_gravity="center"
            android:visibility="visible"
            app:indicator="BallSpinFadeLoader"
            app:indicator_color="@color/colorPrimary" />
    </io.codetail.widget.RevealFrameLayout>

and my activity code is:

private void initAnimData() {
        // get the center for the clipping circle
        cx = (mWebView.getLeft() + mWebView.getRight()) / 2;
        cy = (mWebView.getTop() + mWebView.getBottom()) / 2;
        // get the final radius for the clipping circle
        dx = Math.max(cx, mWebView.getWidth() - cx);
        dy = Math.max(cy, mWebView.getHeight() - cy);
        finalRadius = (float) Math.hypot(dx, dy);

        animator = ViewAnimationUtils.createCircularReveal(mWebView, cx, cy, 0, finalRadius);
        animator.setInterpolator(new AccelerateDecelerateInterpolator());
        animator.setDuration(1000);
    }

    private void startAnim() {
        if (hasRunAnim) {
            return;
        }
        animator.start();
        hasRunAnim = true;
    }

// used by  mWebView.setWebChromeClient(new MyWebViewClient());
 private class MyWebViewClient extends WebChromeClient {

        @Override
        public void onProgressChanged(WebView view, int newProgress) {
            if (newProgress >= 30) {
                startAnim();
                if (newProgress >= 60) {
                    mAviView.setVisibility(View.INVISIBLE);
                }
            }
            super.onProgressChanged(view, newProgress);
        }

    }
@t2314862168 t2314862168 changed the title webview cna webview can't working correctly Mar 28, 2016
@ozodrukh
Copy link
Owner

duplicate #51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants