Run the gif during the webview load

1

Good night, I want to put a gif that appears until the page in webview is loaded completely ... the gif already has, I put a compile and I got the github code, my problem is that I am not able to run the gif before the web view. My plan is as follows, I want the gif to load until the webview page is 100% complete.

But I can not, does anyone help me?

code:

private WebView web;
    private ImageView gif;

    private String [] permissoesNecessarias = new String[]{
            Manifest.permission.SEND_SMS,
            Manifest.permission.INTERNET
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_web_mega_sena);

        PermissionAction.validaPermissoes(1, this, permissoesNecessarias);

        web = (WebView) findViewById(R.id.web_resultados);
        gif = (ImageView) findViewById(R.id.imageView4);

        web.setWebChromeClient(new WebChromeClient(){
            public void onProgressChanged(WebView view, int progress){

                if(progress == 100){
                    web.getSettings().setJavaScriptEnabled(true);
                    web.loadUrl("http://loterias.caixa.gov.br/wps/portal/loterias/landing/megasena#resultados");
                    Glide.with(getApplicationContext()).load(R.drawable.gif_loading).asGif().into(gif);
                }else{

                }
            }
        });

        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

Detail: After the webview uploaded, the gif appears next ...

    
asked by anonymous 11.09.2017 / 02:21

1 answer

1

I think I just put the following code before the else:

 gif.setVisibility(View.GONE);

This will cause the gif to disappear when you reach this line

    
13.09.2017 / 04:00