Exemple #1
0
 protected override void OnPause()
 {
     base.OnPause();
     hv.ViewTreeObserver.RemoveGlobalOnLayoutListener(ngl);
     ngl.Dispose();
     ngl = null;
 }
Exemple #2
0
 protected override void OnResume()
 {
     base.OnResume();
     ngl = new OnGlobalLayoutListener(delegate
     {
         hv.FullScroll(FocusSearchDirection.Right);
     }
                                      );
     hv.ViewTreeObserver.AddOnGlobalLayoutListener(ngl);
 }
Exemple #3
0
 protected override void OnPause()
 {
     base.OnPause();
     btnSave.Click           -= btnSave_Click;
     btnCreate.Click         -= btnCreate_Click;
     btnBarCodeScanner.Click -= btnBarCodeScanner_Click;
     hv.ViewTreeObserver.RemoveGlobalOnLayoutListener(ngl);
     ngl.Dispose();
     ngl = null;
 }
Exemple #4
0
 protected override void OnResume()
 {
     base.OnResume();
     btnSave.Click           += btnSave_Click;
     btnCreate.Click         += btnCreate_Click;
     btnBarCodeScanner.Click += btnBarCodeScanner_Click;
     ngl = new OnGlobalLayoutListener(delegate
     {
         hv.FullScroll(FocusSearchDirection.Right);
     }
                                      );
     hv.ViewTreeObserver.AddOnGlobalLayoutListener(ngl);
 }
        public KeyboardUtil(Activity act, View contentView)
        {
            this.decorView   = act.Window.DecorView;
            this.contentView = contentView;

            onGlobalLayoutListener = new OnGlobalLayoutListener(this.decorView, this.contentView);

            //only required on newer android versions. it was working on API level 19
            if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat)
            {
                decorView.ViewTreeObserver.AddOnGlobalLayoutListener(onGlobalLayoutListener);
            }
        }
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            if (e.PropertyName == HybridWebView.UriProperty.PropertyName)
            {
                JivoDelegate = MainActivity.jivoSdk.JivoDelegate;

                DisplayMetrics dm = new DisplayMetrics();
                ((Activity)JivoDelegate).GetSystemService(Context.WindowService).JavaCast <IWindowManager>().DefaultDisplay.GetMetrics(dm);
                float density = dm.Density;


                OnGlobalLayoutListener list = new OnGlobalLayoutListener(Control, density);
                Control.ViewTreeObserver.AddOnGlobalLayoutListener(list);


                progr = new ProgressDialog(Control.Context);
                progr.SetTitle("JivoSite");
                progr.SetMessage("Загрузка...");

                WebSettings webSettings = Control.Settings;
                webSettings.JavaScriptEnabled = true;
                webSettings.DomStorageEnabled = true;
                webSettings.DatabaseEnabled   = true;

                //пробрасываем JivoInterface в Javascript
                Control.AddJavascriptInterface(new JivoInterface(Control, JivoDelegate), "JivoInterface");
                Control.SetWebViewClient(new MyWebViewClient(JivoDelegate, progr));

                Control.LoadUrl(/*string.Format("file:///android_asset/Content/{0}", Element.Uri)*/ Element.Uri);

                //Control.AddJavascriptInterface(new JSBridge(this), "jsBridge");
                //Control.LoadUrl(/*string.Format("file:///android_asset/Content/{0}", Element.Uri)*/Element.Uri);
                //InjectJS(JavaScriptFunction);
            }

            if (e.PropertyName == HybridWebView.UriScriptProperty.PropertyName)
            {
                Control.LoadUrl(/*string.Format("file:///android_asset/Content/{0}", Element.Uri)*/ Element.UriScript);
            }
        }