예제 #1
0
        public override void OnPause()
        {
            base.OnPause();
            var webViewContainer = RootLayout.FindViewById <RelativeLayout>(Resource.Id.webViewContainer);

            X5WebViewHelper.AttachedWebView(WebViewKey, webViewContainer);
        }
예제 #2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            RootLayout = inflater.Inflate(Resource.Layout.HomeMainVw, container, false);
            var barTableTextView = RootLayout.FindViewById <TextView>(Resource.Id.BarTitle);

            barTableTextView.Text = "我的";
            PageUrl          = "/User";
            PageId           = "我的个人中心";
            ParentWebViewKey = "";
            ParentPageId     = "";
            ParentPageUrl    = "";
            var pageParam = new PageParam()
            {
                PageUrl       = PageUrl,
                PageId        = PageId,
                ParentPageId  = "",
                ParentPageUrl = ""
            };

            if (AnalyticAgreement.PageParam.ContainsKey(pageParam.PageId))
            {
                AnalyticAgreement.PageParam[pageParam.PageId] = pageParam;
            }
            else
            {
                AnalyticAgreement.PageParam.Add(pageParam.PageId, pageParam);
            }
            if (X5WebViewHelper.PageActivity.ContainsKey(pageParam.PageId))
            {
                X5WebViewHelper.PageActivity[pageParam.PageId] = this.Activity;
            }
            else
            {
                X5WebViewHelper.PageActivity.Add(PageId, this.Activity);
            }
            //webView设置
            pageParam.WebViewKey = X5WebViewHelper.WebViewInit(PageId);
            WebViewKey           = pageParam.WebViewKey;


            //var router = "{ path: '" + pageParam.PageUrl + "', params: { PageId: '" + PageId + "' }}";
            if (string.IsNullOrWhiteSpace(pageParam.OpenParam))
            {
                pageParam.OpenParam = "";
            }
            pageParam.OpenParam = pageParam.OpenParam.Replace("'", "```").Replace("\"", "~~~");
            var router = pageParam.PageUrl + "/" + pageParam.OpenParam;

            AnalyticAgreement.AgreementProvider.ExecuteJavaScript(pageParam.PageId, $@"window.AppBridge.Router.push(""{router}"")");
            AnalyticAgreement.AgreementProvider.ExecuteJavaScript(pageParam.PageId, $@"window.AppBridge.SetPageId(""{pageParam.ParentPageId}"",""{pageParam.PageId}"")");

            //隐藏导航条
            var rlTitle = RootLayout.FindViewById <RelativeLayout>(Resource.Id.rlTitle);

            rlTitle.Visibility = ViewStates.Gone;
            //隐藏返回按钮
            var btnReturn = RootLayout.FindViewById <LinearLayout>(Resource.Id.btnReturn);

            btnReturn.Visibility = ViewStates.Gone;
            //隐藏右侧按钮
            var txtRight = RootLayout.FindViewById <TextView>(Resource.Id.txtRight);

            txtRight.Visibility = ViewStates.Gone;

            return(RootLayout);
        }
예제 #3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            RootLayout = inflater.Inflate(Resource.Layout.HomeMainVw, container, false);
            var barTableTextView = RootLayout.FindViewById <TextView>(Resource.Id.BarTitle);

            barTableTextView.Text = "LCL";
            PageUrl          = "/LCL";
            PageId           = "ÎÒµÄÊ×Ò³";
            ParentWebViewKey = "";
            ParentPageId     = "";
            ParentPageUrl    = "";
            var pageParam = new PageParam()
            {
                PageUrl       = PageUrl,
                PageId        = PageId,
                ParentPageId  = "",
                ParentPageUrl = ""
            };

            if (AnalyticAgreement.PageParam.ContainsKey(pageParam.PageId))
            {
                AnalyticAgreement.PageParam[pageParam.PageId] = pageParam;
            }
            else
            {
                AnalyticAgreement.PageParam.Add(pageParam.PageId, pageParam);
            }
            if (X5WebViewHelper.PageActivity.ContainsKey(pageParam.PageId))
            {
                X5WebViewHelper.PageActivity[pageParam.PageId] = this.Activity;
            }
            else
            {
                X5WebViewHelper.PageActivity.Add(PageId, this.Activity);
            }
            //webViewÉèÖÃ
            pageParam.WebViewKey = X5WebViewHelper.WebViewInit(PageId);
            WebViewKey           = pageParam.WebViewKey;

            //var router = "{ path: '" + pageParam.PageUrl + "', params: { PageId: '" + PageId + "' }}";
            if (string.IsNullOrWhiteSpace(pageParam.OpenParam))
            {
                pageParam.OpenParam = "";
            }
            pageParam.OpenParam = pageParam.OpenParam.Replace("'", "```").Replace("\"", "~~~");
            var router = pageParam.PageUrl + "/" + pageParam.OpenParam;
            var js     = $@"window.AppBridge.Router.push(""{router}"")";

            AnalyticAgreement.AgreementProvider.ExecuteJavaScript(pageParam.PageId, js);
            AnalyticAgreement.AgreementProvider.ExecuteJavaScript(pageParam.PageId, $@"window.AppBridge.SetPageId(""{pageParam.ParentPageId}"",""{pageParam.PageId}"")");


            //Òþ²Øµ¼º½Ìõ
            var rlTitle = RootLayout.FindViewById <RelativeLayout>(Resource.Id.rlTitle);

            rlTitle.Visibility = ViewStates.Gone;
            //Òþ²Ø·µ»Ø°´Å¥
            var btnReturn = RootLayout.FindViewById <LinearLayout>(Resource.Id.btnReturn);

            btnReturn.Visibility = ViewStates.Gone;
            //Òþ²ØÓҲఴť
            var txtRight = RootLayout.FindViewById <TextView>(Resource.Id.txtRight);

            txtRight.Visibility = ViewStates.Gone;
            //ÓҲఴťÃû×Ö
            txtRight.Text = "ÏûÏ¢";
            //ÓҲఴťÏìÓ¦
            var btnRight = RootLayout.FindViewById <LinearLayout>(Resource.Id.btnRight);

            btnRight.Click += (sender, args) =>
            {
                //var intent = new Intent(this.Activity, typeof(ChatMain));
                //intent.PutExtra("pram", "1");
                //StartActivity(intent);
                new ChatMain(PageId);
            };

            return(RootLayout);
        }