So I have been working on using transitions with my webapp using
viewfipper. I am using two webview called mWebView and mWebView2. I also
have a viewFipper called flip. I have mWebView loading the first webpage.
My code looks like this:
mWebView.setWebViewClient(new FWebViewClient());
mWebView2.setWebViewClient(new SWebViewClient());
public class FWebViewClient extends WebViewClient {
//Tell mWebview how to handle URL loading.
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
mWebView2.loadUrl(url);
return true;
}
@Override
public void onLoadResource(WebView view, String url){
if(pg == null){
pg = new ProgressDialog(activity);
pg.setMessage("Loading ");
}
pg.show();
}
@Override
public void onPageFinished(WebView view, String url){
if(pg.isShowing())
pg.dismiss();
flip.setInAnimation(slide_in);
flip.setOutAnimation(slide_out);
flip.setDisplayedChild(1);
}
}
public class SWebViewClient extends WebViewClient {
//Tell mWebView2 how to hand URL loading.
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
mWebView.loadUrl(url);
return true;
}
@Override
public void onLoadResource(WebView view, String url){
if(pg == null){
pg = new ProgressDialog(activity);
pg.setMessage("Loading ");
}
pg.show();
}
@Override
public void onPageFinished(WebView view, String url){
if(pg.isShowing())
pg.dismiss();
flip.setInAnimation(slide_in);
flip.setOutAnimation(slide_out);
flip.setDisplayedChild(0);
}
}
I am thinking that when mWebView is shown and a link is clicked it will
load the url on mWebView2 and then flip with switch the view to mWebView2.
Then it should do the same thing to get back to mWebView. However, this is
not the case. When i click a link from view mWebView it loads the url to
mWebView then switches to mWebView2. Can anyone explain why this may be
happening?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en