Ejemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            RequestWindowFeature(WindowFeatures.NoTitle);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            /**/
            var j = this.Intent.GetStringExtra("ItemRow");

            item = JsonConvert.DeserializeObject <Item>(j);

            ColorDrawable color = new ColorDrawable(Color.OrangeRed);

            var actionBar = FindViewById <LinearLayout>(Resource.Id.actonBar);

            actionBar.SetBackgroundDrawable(color);

            FindViewById <TextView>(Resource.Id.txtTitle).Text = item.Descrip;
            //back
            ImageButton btnBack = this.FindViewById <ImageButton>(Resource.Id.btnBack);

            btnBack.Click += (s1, e1) =>
            {
                this.Finish();
                // wv.GoBack();
            };
            btnBack.SetBackgroundResource(Resource.Drawable.back);
            //scan
            ImageButton btnScan = this.FindViewById <ImageButton>(Resource.Id.btnScan);

            btnScan.Click += (s1, e1) =>
            {
                CallWebViewSendData();
            };

            btnScan.SetBackgroundResource(Resource.Drawable.Barcode2);

            Information info = new Information()
            {
                user_id = "A110018", user_name = "Roger Roan"
            };
            String content = JsonConvert.SerializeObject(info, Formatting.None);

            MobileBarcodeScanner.Initialize(Application);

            wv = this.FindViewById <WebView>(Resource.Id.webview);

            refresher = FindViewById <CustomSwipeRefreshLayout>(Resource.Id.refresher);

            refresher.setCanChildScrollUpCallback(this);

            refresher.SetColorScheme(Resource.Color.xam_dark_blue,
                                     Resource.Color.xam_purple,
                                     Resource.Color.xam_gray,
                                     Resource.Color.xam_green);

            wv.Settings.JavaScriptEnabled = true;

            wv.AddJavascriptInterface(new JsInteration(this), "control");

            wv.Settings.SetSupportZoom(true);
            wv.Settings.BuiltInZoomControls = true;


            wv.Settings.UseWideViewPort      = true;
            wv.Settings.LoadWithOverviewMode = true;

            WebChromeClient wc = new WebChromeClient();

            wv.SetWebChromeClient(wc);

            MyWebViewClient wvc = new MyWebViewClient(refresher);

            wv.SetWebViewClient(wvc);

            wv.LoadUrl(item.Link);

            refresher.Refresh += delegate
            {
                wv.Reload();
            };
        }
Ejemplo n.º 2
0
 public MyWebViewClient(CustomSwipeRefreshLayout refresher)
 {
     this._refresher = refresher;
 }