コード例 #1
0
        private void bindControls()
        {
            FindViewById <TextView>(Resource.Id.head_title).Text = "文章详情";
            webView = FindViewById <PullableWebView>(Resource.Id.webview);
            ptrl    = FindViewById <PullToRefreshLayout>(Resource.Id.refresh_view);
            ptrl.setOnRefreshListener(this);
            webView.Settings.DefaultTextEncodingName  = "utf-8";
            webView.Settings.LoadsImagesAutomatically = true;
            webView.SetWebViewClient(new MyWebViewClient());
            webView.ScrollBarStyle             = ScrollbarStyles.InsideOverlay;
            webView.Settings.JavaScriptEnabled = false;
            webView.Settings.SetSupportZoom(false);
            webView.Settings.BuiltInZoomControls = false;
            webView.Settings.CacheMode           = CacheModes.CacheElseNetwork;
            webView.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn);
            btnBack        = FindViewById <Button>(Resource.Id.title_bar_back);
            btnBack.Click += delegate { Finish(); };
            Button btnViewComments = FindViewById <Button>(Resource.Id.footbar_comments);

            btnViewComments.Visibility = ViewStates.Gone;
            Button btnWriteComments = FindViewById <Button>(Resource.Id.footbar_write_comment);

            btnWriteComments.Visibility = ViewStates.Gone;
            CommonHelper.InitalBookMark(this, string.Format(@"http://kb.cnblogs.com/page/{0}/", article.Id), article.Title);
            CommonHelper.InitalShare(this, null, true, article.Author, article.Title, "", string.Format(@"http://kb.cnblogs.com/page/{0}/", article.Id));
            ptrl.AutoRefresh();
        }
コード例 #2
0
 private async void bindControls()
 {
     webView = FindViewById <PullableWebView>(Resource.Id.webview);
     ptrl    = FindViewById <PullToRefreshLayout>(Resource.Id.refresh_view);
     ptrl.setOnRefreshListener(this);
     webView.Settings.DefaultTextEncodingName  = "utf-8";
     webView.Settings.LoadsImagesAutomatically = true;
     webView.SetWebViewClient(new MyWebViewClient());
     webView.ScrollBarStyle             = ScrollbarStyles.InsideOverlay;
     webView.Settings.JavaScriptEnabled = false;
     webView.Settings.SetSupportZoom(false);
     webView.Settings.BuiltInZoomControls = false;
     webView.Settings.CacheMode           = CacheModes.CacheElseNetwork;
     webView.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn);
     btnBack        = FindViewById <Button>(Resource.Id.title_bar_back);
     btnBack.Click += delegate { Finish(); };
     await ptrl.AutoRefresh();
 }
コード例 #3
0
 private async void bindControls()
 {
     btnWriteComments        = FindViewById <Button>(Resource.Id.footbar_write_comment);
     btnWriteComments.Click += delegate
     {
         BottomSheetDialog bottomSheetDiaolog = new BottomSheetDialog(this);
         var      inflater     = GetSystemService(Context.LayoutInflaterService) as LayoutInflater;
         EditText textComments = FindViewById <EditText>(Resource.Id.text_comments);
         View     view         = inflater.Inflate(Resource.Layout.write_comments, null);
         TextView textCancel   = view.FindViewById <TextView>(Resource.Id.text_cancel);
         textCancel.Click += delegate { bottomSheetDiaolog.Dismiss(); };
         TextView textSend = view.FindViewById <TextView>(Resource.Id.text_send_comments);
         textSend.Click += async delegate
         {
             string content = textComments.Text;
             if (string.IsNullOrWhiteSpace(content))
             {
                 Msg.AppMsg.MakeText(this, "请输入评论内容", Msg.AppMsg.STYLE_INFO).Show();
                 return;
             }
             Dialog waitDialog = CommonHelper.CreateLoadingDialog(this, "正在发送评论数据,请稍后...");
             try
             {
                 waitDialog.Show();
                 if (await BlogService.AddArticleComments(CommonHelper.token, article.BlogApp, article.Id, content))
                 {
                     Msg.AppMsg.MakeText(this, GetString(Resource.String.publish_comments_success), Msg.AppMsg.STYLE_INFO).Show();
                     bottomSheetDiaolog.Dismiss();
                 }
                 else
                 {
                     Msg.AppMsg.MakeText(this, GetString(Resource.String.publish_comments_fail), Msg.AppMsg.STYLE_INFO).Show();
                 }
             }
             catch (Exception ex)
             {
                 Msg.AppMsg.MakeText(this, GetString(Resource.String.publish_comments_fail), Msg.AppMsg.STYLE_INFO).Show();
                 Log.Debug("error:", ex.Message);
             }
             finally
             {
                 waitDialog.Cancel();
             }
         };
         bottomSheetDiaolog.SetContentView(view);
         bottomSheetDiaolog.Show();
     };
     webView = FindViewById <PullableWebView>(Resource.Id.webview);
     ptrl    = FindViewById <PullToRefreshLayout>(Resource.Id.refresh_view);
     ptrl.setOnRefreshListener(this);
     webView.Settings.DefaultTextEncodingName  = "utf-8";
     webView.Settings.LoadsImagesAutomatically = true;
     webView.SetWebViewClient(new MyWebViewClient());
     webView.ScrollBarStyle             = ScrollbarStyles.InsideOverlay;
     webView.Settings.JavaScriptEnabled = false;
     webView.Settings.SetSupportZoom(false);
     webView.Settings.BuiltInZoomControls = false;
     webView.Settings.CacheMode           = CacheModes.CacheElseNetwork;
     webView.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn);
     //webView.Settings.UseWideViewPort = true;//设置此属性,可任意比例缩放
     btnViewComments        = FindViewById <Button>(Resource.Id.footbar_comments);
     btnViewComments.Click += delegate
     {
         Intent intent = new Intent(this, typeof(ArticleCommentsActivity));
         intent.PutExtra("current", JsonConvert.SerializeObject(article));
         StartActivity(intent);
     };
     CommonHelper.InitalShare(this, null, true, article.Author, article.Title, article.Avatar, article.Url);
     CommonHelper.InitalBookMark(this, article.Url, article.Title);
     await ptrl.AutoRefresh();
 }