/** * Register a WebView to the current MaterialViewPagerAnimator * Listen to ObservableScrollViewCallbacks so give to $[observableScrollViewCallbacks] your ObservableScrollViewCallbacks if you already use one * For loadmore or anything else * * @param activity current context * @param webView the scrollable * @param observableScrollViewCallbacks use it if you want to get a callback of the RecyclerView */ public static void RegisterWebView(Activity activity, ObservableWebView webView, IObservableScrollViewCallbacks observableScrollViewCallbacks) { if (activity != null && _hashMap.ContainsKey(activity)) { MaterialViewPagerAnimator animator; if (_hashMap.TryGetValue(activity, out animator) && animator != null) { animator.RegisterWebView(webView, observableScrollViewCallbacks); } } }
public override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); mWebView = view.FindViewById<ObservableWebView>(Resources.Id.webView); //must be called before loadUrl() MaterialViewPagerHelper.PreLoadInjectHeader(mWebView); mWebView.SetWebViewClient(); //have to inject header when WebView page loaded mWebView.setWebViewClient(new WebViewClient() { @Override
public ObservableWebViewCallbacks(MaterialViewPagerAnimator materialViewPagerAnimator, ObservableWebView webView, IObservableScrollViewCallbacks observableScrollViewCallbacks) { _animator = materialViewPagerAnimator; _webView = webView; _observableScrollViewCallbacks = observableScrollViewCallbacks; }
/** * Register a WebView to the current MaterialViewPagerAnimator * Listen to ObservableScrollViewCallbacks so give to $[observableScrollViewCallbacks] your ObservableScrollViewCallbacks if you already use one * For loadmore or anything else * * @param webView the scrollable * @param observableScrollViewCallbacks use it if you want to get a callback of the RecyclerView */ public void RegisterWebView(ObservableWebView webView, IObservableScrollViewCallbacks observableScrollViewCallbacks) { if (webView != null) { if (!ScrollViewList.Any()) OnMaterialScrolled(webView, webView.GetCurrentScrollY()); ScrollViewList.Add(webView); //add to the scrollable list webView.SetScrollViewCallbacks(new ObservableWebViewCallbacks(this, webView, observableScrollViewCallbacks)); SetScrollOffset(webView, -LastYOffset); } }