private void DestroyBasic() { try { RewardedVideo?.Destroy(); MAdapter = null; ImageUser = null; ImageBlog = null; MRecycler = null; TxtUsername = null; TxtTime = null; TxtTitle = null; TxtViews = null; TxtHtml = null; BtnMore = null; ArticleData = null; MAdapter = null; MRecycler = null; TxtComment = null; ArticlesId = null; Instance = null; ReplyFragment = null; DataWebHtml = null; RewardedVideo = null; } catch (Exception e) { Console.WriteLine(e); } }
private void DestroyBasic() { try { RewardedVideo?.Destroy(); MAdapter = null !; ImageUser = null !; ImageBlog = null !; MRecycler = null !; TxtUsername = null !; TxtTime = null !; TxtTitle = null !; TxtViews = null !; TxtHtml = null !; BtnMore = null !; ArticleData = null !; MAdapter = null !; MRecycler = null !; TxtComment = null !; ArticlesId = null !; Instance = null !; ReplyFragment = null !; DataWebHtml = null !; RewardedVideo = null !; } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void Initialize(ArticlesAdapterViewHolder holder, ArticleDataObject item) { try { var colorImage = Color.ParseColor(Methods.FunString.RandomColor()); Glide.With(ActivityContext) .Load(item.Thumbnail) .Apply(RequestOptions.CenterCropTransform().Placeholder(new ColorDrawable(colorImage)).Fallback(new ColorDrawable(colorImage)).SetPriority(Priority.High)) .Into(holder.Image); Glide.With(ActivityContext) .Load(item.Author.Avatar) .Apply(RequestOptions.CircleCropTransform()) .Into(holder.UserImageProfile); holder.Category.SetBackgroundColor(colorImage); CategoriesController cat = new CategoriesController(); string id = item.CategoryLink.Split('/').Last(); holder.Category.Text = cat.Get_Translate_Categories_Communities(id, item.CategoryName, "Blog"); holder.Description.Text = Methods.FunString.DecodeString(item.Description); holder.Title.Text = Methods.FunString.DecodeString(item.Title); holder.Username.Text = WoWonderTools.GetNameFinal(item.Author); holder.ViewMore.Text = ActivityContext.GetText(Resource.String.Lbl_ReadMore) + " >"; //READ MORE > holder.Time.Text = item.Posted; } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void Initialize(ArticlesAdapterViewHolder holder, ArticleDataObject item) { try { var colorImage = Color.ParseColor(Methods.FunString.RandomColor()); Glide.With(ActivityContext) .Load(item.Thumbnail) .Apply(RequestOptions.CenterCropTransform().Placeholder(new ColorDrawable(colorImage)).Fallback(new ColorDrawable(colorImage)).SetPriority(Priority.High)) .Into(holder.Image); holder.Category.SetBackgroundColor(colorImage); holder.Category.Text = item.CategoryName; //wael Get form settings holder.Description.Text = Methods.FunString.DecodeString(item.Description); holder.Title.Text = Methods.FunString.DecodeString(item.Title); holder.ViewMore.Text = ActivityContext.GetText(Resource.String.Lbl_ReadMore) + " >"; //READ MORE > holder.Time.Text = Methods.Time.TimeAgo(int.Parse(item.CreatedAt), false); } catch (Exception e) { Console.WriteLine(e); } }
private void GetDataArticles() { try { ArticleData = JsonConvert.DeserializeObject <ArticleDataObject>(Intent.GetStringExtra("ArticleObject")); if (ArticleData != null) { GlideImageLoader.LoadImage(this, ArticleData.Thumbnail, ImageBlog, ImageStyle.CenterCrop, ImagePlaceholders.Drawable); SupportActionBar.Title = Methods.FunString.DecodeString(ArticleData.Title); TxtTitle.Text = Methods.FunString.DecodeString(ArticleData.Title); TxtViews.Text = ArticleData.View + " " + GetText(Resource.String.Lbl_Views); string style = AppSettings.SetTabDarkTheme ? "<style type='text/css'>body{color: #fff; background-color: #444;}</style>" : "<style type='text/css'>body{color: #444; background-color: #fff;}</style>"; string imageFullWidthStyle = "<style>img{display: inline;height: auto;max-width: 100%;}</style>"; string content; if (Build.VERSION.SdkInt >= BuildVersionCodes.N) { content = Html.FromHtml(ArticleData.Content, FromHtmlOptions.ModeCompact).ToString(); } else { // This method is deprecated but need to use for old os devices #pragma warning disable CS0618 // Type or member is obsolete content = Html.FromHtml(ArticleData.Content).ToString(); #pragma warning restore CS0618 // Type or member is obsolete } DataWebHtml = "<!DOCTYPE html>"; DataWebHtml += $"<head><title></title>{style}{imageFullWidthStyle}</head>"; DataWebHtml += "<body>" + content + "</body>"; DataWebHtml += "</html>"; TxtHtml.SetWebViewClient(new MyWebViewClient(this)); TxtHtml.Settings.LoadsImagesAutomatically = true; TxtHtml.Settings.JavaScriptEnabled = true; TxtHtml.Settings.JavaScriptCanOpenWindowsAutomatically = true; TxtHtml.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.NarrowColumns); TxtHtml.Settings.DomStorageEnabled = true; TxtHtml.Settings.AllowFileAccess = true; TxtHtml.Settings.DefaultTextEncodingName = "utf-8"; TxtHtml.Settings.UseWideViewPort = (true); TxtHtml.Settings.LoadWithOverviewMode = (true); TxtHtml.Settings.SetSupportZoom(false); TxtHtml.Settings.BuiltInZoomControls = (false); TxtHtml.Settings.DisplayZoomControls = (false); int fontSize = (int)TypedValue.ApplyDimension(ComplexUnitType.Sp, 18, Resources.DisplayMetrics); TxtHtml.Settings.DefaultFontSize = fontSize; TxtHtml.LoadDataWithBaseURL(null, DataWebHtml, "text/html", "UTF-8", null); } } catch (Exception e) { Console.WriteLine(e); } }
// GET: Article public ActionResult Index() { ArticleDataObject article = articleService.GetFirst(); if (article == null) { article = new ArticleDataObject(); } ViewData["Article"] = article; return(View()); }
private void GetDataArticles() { try { ArticleData = JsonConvert.DeserializeObject <ArticleDataObject>(Intent.GetStringExtra("ArticleObject")); if (ArticleData != null) { GlideImageLoader.LoadImage(this, ArticleData.Author.Avatar, ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); GlideImageLoader.LoadImage(this, ArticleData.Thumbnail, ImageBlog, ImageStyle.CenterCrop, ImagePlaceholders.Drawable); TxtUsername.Text = WoWonderTools.GetNameFinal(ArticleData.Author); TxtTitle.Text = Methods.FunString.DecodeString(ArticleData.Title); TxtViews.Text = ArticleData.View + " " + GetText(Resource.String.Lbl_Views); string style = AppSettings.SetTabDarkTheme ? "<style type='text/css'>body{color: #fff; background-color: #282828;}</style>" : "<style type='text/css'>body{color: #444; background-color: #FFFAFA;}</style>"; var content = Html.FromHtml(ArticleData.Content, FromHtmlOptions.ModeCompact).ToString(); DataWebHtml = "<!DOCTYPE html>"; DataWebHtml += "<head><title></title>" + style + "</head>"; DataWebHtml += "<body>" + content + "</body>"; DataWebHtml += "</html>"; TxtHtml.SetWebViewClient(new MyWebViewClient(this)); TxtHtml.Settings.LoadsImagesAutomatically = true; TxtHtml.Settings.JavaScriptEnabled = true; TxtHtml.Settings.JavaScriptCanOpenWindowsAutomatically = true; //TxtHtml.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.NarrowColumns); TxtHtml.Settings.DomStorageEnabled = true; TxtHtml.Settings.AllowFileAccess = true; TxtHtml.Settings.DefaultTextEncodingName = "utf-8"; TxtHtml.LoadDataWithBaseURL(null, DataWebHtml, "text/html", "UTF-8", null); TxtTime.Text = Methods.Time.TimeAgo(Convert.ToInt32(ArticleData.Posted)); if (Methods.CheckConnectivity()) { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Article.GetBlogById(ArticlesId) }); } } } catch (Exception e) { Console.WriteLine(e); } }
private void GetDataArticles() { try { ArticleData = JsonConvert.DeserializeObject <ArticleDataObject>(Intent.GetStringExtra("ArticleObject")); if (ArticleData != null) { GlideImageLoader.LoadImage(this, ArticleData.Thumbnail, ImageBlog, ImageStyle.CenterCrop, ImagePlaceholders.Drawable); SupportActionBar.Title = Methods.FunString.DecodeString(ArticleData.Title); TxtTitle.Text = Methods.FunString.DecodeString(ArticleData.Title); TxtViews.Text = ArticleData.View + " " + GetText(Resource.String.Lbl_Views); string style = AppSettings.SetTabDarkTheme ? "<style type='text/css'>body{color: #fff; background-color: #444;}</style>" : "<style type='text/css'>body{color: #444; background-color: #fff;}</style>"; var content = Html.FromHtml(ArticleData.Content, FromHtmlOptions.ModeCompact).ToString(); string data = "<!DOCTYPE html>"; data += "<head><title></title>" + style + "</head>"; data += "<body>" + content + "</body>"; data += "</html>"; TxtHtml.SetWebViewClient(new WebViewClient()); TxtHtml.Settings.LoadsImagesAutomatically = true; TxtHtml.Settings.JavaScriptEnabled = true; TxtHtml.Settings.JavaScriptCanOpenWindowsAutomatically = true; TxtHtml.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.NarrowColumns); TxtHtml.Settings.DomStorageEnabled = true; TxtHtml.Settings.AllowFileAccess = true; TxtHtml.Settings.DefaultTextEncodingName = "utf-8"; TxtHtml.LoadDataWithBaseURL(null, data, "text/html", "UTF-8", null); } } catch (Exception e) { Console.WriteLine(e); } }
private void GetDataArticles() { try { ArticleData = JsonConvert.DeserializeObject <ArticleDataObject>(Intent?.GetStringExtra("ArticleObject") ?? ""); if (ArticleData != null) { GlideImageLoader.LoadImage(this, ArticleData.Author.Avatar, ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); GlideImageLoader.LoadImage(this, ArticleData.Thumbnail, ImageBlog, ImageStyle.CenterCrop, ImagePlaceholders.Drawable); TxtUsername.Text = WoWonderTools.GetNameFinal(ArticleData.Author); TxtTitle.Text = Methods.FunString.DecodeString(ArticleData.Title); TxtViews.Text = ArticleData.View + " " + GetText(Resource.String.Lbl_Views); string style = AppSettings.SetTabDarkTheme ? "<style type='text/css'>body{color: #fff; background-color: #282828;}</style>" : "<style type='text/css'>body{color: #444; background-color: #FFFAFA;}</style>"; string imageFullWidthStyle = "<style>img{display: inline;height: auto;max-width: 100%;}</style>"; // This method is deprecated but need to use for old os devices #pragma warning disable CS0618 // Type or member is obsolete string content = Build.VERSION.SdkInt >= BuildVersionCodes.N ? Html.FromHtml(ArticleData.Content, FromHtmlOptions.ModeCompact)?.ToString() : Html.FromHtml(ArticleData.Content)?.ToString(); #pragma warning restore CS0618 // Type or member is obsolete DataWebHtml = "<!DOCTYPE html>"; DataWebHtml += "<head><title></title>" + style + imageFullWidthStyle + "</head>"; DataWebHtml += "<body>" + content + "</body>"; DataWebHtml += "</html>"; // <meta name='viewport' content='width=device-width, user-scalable=no' /> TxtHtml.SetWebViewClient(new MyWebViewClient(this)); TxtHtml.Settings.LoadsImagesAutomatically = true; TxtHtml.Settings.JavaScriptEnabled = true; TxtHtml.Settings.JavaScriptCanOpenWindowsAutomatically = true; TxtHtml.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.TextAutosizing); TxtHtml.Settings.DomStorageEnabled = true; TxtHtml.Settings.AllowFileAccess = true; TxtHtml.Settings.DefaultTextEncodingName = "utf-8"; TxtHtml.Settings.UseWideViewPort = true; TxtHtml.Settings.LoadWithOverviewMode = true; TxtHtml.Settings.SetSupportZoom(false); TxtHtml.Settings.BuiltInZoomControls = false; TxtHtml.Settings.DisplayZoomControls = false; int fontSize = (int)TypedValue.ApplyDimension(ComplexUnitType.Sp, 18, Resources?.DisplayMetrics); TxtHtml.Settings.DefaultFontSize = fontSize; TxtHtml.LoadDataWithBaseURL(null, DataWebHtml, "text/html", "UTF-8", null); bool success = int.TryParse(ArticleData.Posted, out var number); if (success) { TxtTime.Text = Methods.Time.TimeAgo(number, false); } else { TxtTime.Text = ArticleData.Posted; } if (Methods.CheckConnectivity()) { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Article.GetBlogById(ArticlesId) }); } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public ActionResult SaveArticle(ArticleDataObject article) { articleService.Update(article); return(RedirectToAction("Index", "Article")); }
private ArticleDataObject getArticle() { ArticleDataObject article = this.articleService.GetFirst(); return(article); }