protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Id = Intent.GetIntExtra("id", 0); articlePresenter = new ArticlePresenter(this); handler = new Handler(); StatusBarCompat.SetOrdinaryToolBar(this); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Drawable.back_24dp); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); toolbar.SetNavigationOnClickListener(this); toolbar.SetOnMenuItemClickListener(this); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); swipeRefreshLayout.SetOnRefreshListener(this); scrollView = FindViewById <NestedScrollView>(Resource.Id.scrollView); txtTitle = FindViewById <TextView>(Resource.Id.txtTitle); imgAvatar = FindViewById <ImageView>(Resource.Id.llAvatar); txtAuthor = FindViewById <TextView>(Resource.Id.txtAuthor); txtPostdate = FindViewById <TextView>(Resource.Id.txtPostdate); txtBody = FindViewById <WebView>(Resource.Id.txtBody); txtBody.Settings.JavaScriptEnabled = true; txtBody.Settings.DomStorageEnabled = true; txtBody.Settings.LoadsImagesAutomatically = true; txtBody.Settings.DefaultTextEncodingName = "utf-8"; txtBody.SetWebViewClient(BodyWebViewClient.With(this)); txtBody.ScrollBarStyle = ScrollbarStyles.InsideOverlay; txtBody.Settings.SetSupportZoom(false); txtBody.Settings.BuiltInZoomControls = false; txtBody.Settings.CacheMode = CacheModes.CacheElseNetwork; txtBody.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn); var jsInterface = new WebViewJSInterface(this); txtBody.AddJavascriptInterface(jsInterface, "openlistner"); jsInterface.CallFromPageReceived += delegate(object sender, WebViewJSInterface.CallFromPageReceivedEventArgs e) { PhotoActivity.Start(this, e.Result.Split(','), e.Index); }; txtDigg = FindViewById <TextView>(Resource.Id.txtDigg); txtRead = FindViewById <TextView>(Resource.Id.txtRead); txtComments = FindViewById <TextView>(Resource.Id.txtComments); txtBookmark = FindViewById <TextView>(Resource.Id.txtBookmark); swipeRefreshLayout.Post(async() => { await articlePresenter.GetClientArticle(Id); }); shareAction = new ShareAction(this).SetDisplayList(SHARE_MEDIA.Weixin, SHARE_MEDIA.WeixinCircle, SHARE_MEDIA.WeixinFavorite, SHARE_MEDIA.Sina).SetShareboardclickCallback(this); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Id = Intent.GetIntExtra("id", 0); questionPresenter = new QuestionPresenter(this); handler = new Handler(); StatusBarCompat.SetOrdinaryToolBar(this); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Drawable.back_24dp); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); toolbar.SetNavigationOnClickListener(this); toolbar.SetOnMenuItemClickListener(this); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); swipeRefreshLayout.SetOnRefreshListener(this); txtTitle = FindViewById <TextView>(Resource.Id.txtTitle); imgIconName = FindViewById <ImageView>(Resource.Id.imgIconName); txtUserName = FindViewById <TextView>(Resource.Id.txtUserName); txtScore = FindViewById <TextView>(Resource.Id.txtScore); txtDateAdded = FindViewById <TextView>(Resource.Id.txtDateAdded); txtGold = FindViewById <TextView>(Resource.Id.txtGold); txtDealFlag = FindViewById <TextView>(Resource.Id.txtDealFlag); txtTag = FindViewById <TextView>(Resource.Id.txtTag); this.txtDealFlag.Selected = true; txtBody = FindViewById <WebView>(Resource.Id.txtBody); txtBody.Settings.JavaScriptEnabled = true; txtBody.Settings.DomStorageEnabled = true; txtBody.Settings.LoadsImagesAutomatically = true; txtBody.Settings.DefaultTextEncodingName = "utf-8"; txtBody.SetWebViewClient(BodyWebViewClient.With(this)); txtBody.ScrollBarStyle = ScrollbarStyles.InsideOverlay; txtBody.Settings.SetSupportZoom(false); txtBody.Settings.BuiltInZoomControls = false; txtBody.Settings.CacheMode = CacheModes.CacheElseNetwork; txtBody.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn); var jsInterface = new WebViewJSInterface(this); txtBody.AddJavascriptInterface(jsInterface, "openlistner"); jsInterface.CallFromPageReceived += delegate(object sender, WebViewJSInterface.CallFromPageReceivedEventArgs e) { PhotoActivity.Start(this, e.Result.Split(','), e.Index); }; txtDigg = FindViewById <TextView>(Resource.Id.txtDigg); txtRead = FindViewById <TextView>(Resource.Id.txtRead); txtBookmark = FindViewById <TextView>(Resource.Id.txtBookmark); txtComments = FindViewById <TextView>(Resource.Id.txtComments); txtComments.Text = Resources.GetString(Resource.String.answer); (txtComments.Parent as FrameLayout).Click += delegate { if (question != null && question.Qid > 0) { QuestionAnswersActivity.Start(this, question.Qid); } }; (txtBookmark.Parent as FrameLayout).Click += delegate { if (question != null && question.Qid > 0) { var linkurl = "https://q.cnblogs.com/q/" + question.Qid + "/"; var title = question.Title + "_²©ÎÊ_²©¿ÍÔ°"; BookmarkAddActivity.Start(this, linkurl, title, true); } }; swipeRefreshLayout.Post(async() => { await questionPresenter.GetClientQuestion(Id); }); shareAction = new ShareAction(this).SetDisplayList(SHARE_MEDIA.Weixin, SHARE_MEDIA.WeixinCircle, SHARE_MEDIA.WeixinFavorite, SHARE_MEDIA.Sina).SetShareboardclickCallback(this); }