protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); Window?.SetSoftInputMode(SoftInput.AdjustResize); SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base); Methods.App.FullScreenApp(this); // Create your application here SetContentView(Resource.Layout.Native_Reply_Comment_Layout); Instance = this; CommentId = Intent?.GetStringExtra("CommentId") ?? string.Empty; CommentObject = JsonConvert.DeserializeObject <CommentObjectExtra>(Intent?.GetStringExtra("CommentObject") ?? ""); //Get Value And Set Toolbar InitComponent(); SetRecyclerViewAdapters(); LoadDataPost(); AdsGoogle.Ad_Interstitial(this); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void CommentReplyPostClick(CommentReplyClickEventArgs e) { try { if (TypeClass == "Reply") { var txtComment = ReplyCommentActivity.GetInstance().TxtComment; if (txtComment != null) { txtComment.Text = ""; txtComment.Text = "@" + e.CommentObject.Publisher.Username + " "; } } else { var intent = new Intent(MainContext, typeof(ReplyCommentActivity)); intent.PutExtra("CommentId", e.CommentObject.Id); intent.PutExtra("CommentObject", JsonConvert.SerializeObject(e.CommentObject)); MainContext.StartActivity(intent); } } catch (Exception exception) { Console.WriteLine(exception); } }
public void CommentReplyPostClick(CommentReplyClickEventArgs e) { try { switch (TypeClass) { case "Reply": { var txtComment = ReplyCommentActivity.GetInstance().TxtComment; if (txtComment != null) { txtComment.Text = ""; txtComment.Text = "@" + e.CommentObject.Publisher.Username + " "; } break; } default: { var intent = new Intent(MainContext, typeof(ReplyCommentActivity)); intent.PutExtra("CommentId", e.CommentObject.Id); intent.PutExtra("CommentObject", JsonConvert.SerializeObject(e.CommentObject)); MainContext.StartActivity(intent); break; } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
public void OnInput(MaterialDialog p0, ICharSequence p1) { try { if (p1.Length() > 0) { var strName = p1.ToString(); if (!Methods.CheckConnectivity()) { Toast.MakeText(MainContext, MainContext.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } else { if (TypeClass == "Comment") { //TypeClass var adapterGlobal = CommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.CommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { dataGlobal.Text = strName; var index = adapterGlobal.CommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.NotifyItemChanged(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.EditCommentAsync(CommentObject.Id, strName) }); } else if (TypeClass == "Reply") { //TypeClass var adapterGlobal = ReplyCommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.ReplyCommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { dataGlobal.Text = strName; var index = adapterGlobal.ReplyCommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.NotifyItemChanged(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.EditCommentAsync(CommentObject.Id, strName, "edit_reply") }); } } } } catch (Exception e) { Console.WriteLine(e); } }
protected override void OnCreate(Bundle savedInstanceState) { try { Window.SetSoftInputMode(SoftInput.AdjustResize); base.OnCreate(savedInstanceState); Methods.App.FullScreenApp(this); SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base); // Create your application here SetContentView(Resource.Layout.Native_Reply_Comment_Layout); Instance = this; CommentId = Intent.GetStringExtra("CommentId") ?? string.Empty; var data = Intent.GetStringExtra("CommentObject"); if (!string.IsNullOrEmpty(data)) { CommentObject = JsonConvert.DeserializeObject <CommentObjectExtra>(data); } //Get Value And Set Toolbar InitComponent(); SetRecyclerViewAdapters(); ReplyCountTextView.Text = CommentObject?.Replies + " " + GetString(Resource.String.Lbl_Replies); StartApiService("0"); AdsGoogle.Ad_Interstitial(this); } catch (Exception e) { Console.WriteLine(e); } }
private void DestroyBasic() { try { Instance = null; MAdapter = null; MainRecyclerView = null; CommentLayout = null; CommentLayoutView = null; ReplyCountTextView = null; ImgBack = null; ImgSent = null; ImgGallery = null; CommentObject = null; CommentId = null; PathImage = null; } catch (Exception e) { Console.WriteLine(e); } }
private void DestroyBasic() { try { Instance = null !; MAdapter = null !; MRecycler = null !; CommentLayout = null !; CommentLayoutView = null !; ReplyCountTextView = null !; ImgBack = null !; ImgSent = null !; ImgGallery = null !; CommentObject = null !; CommentId = null !; PathImage = null !; } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (p1 == DialogAction.Positive) { if (TypeDialog == "DeleteComment") { MainContext.RunOnUiThread(() => { try { if (TypeClass == "Comment") { //TypeClass var adapterGlobal = CommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.CommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { var index = adapterGlobal.CommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.CommentList.RemoveAt(index); adapterGlobal.NotifyItemRemoved(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.DeleteCommentAsync(CommentObject.Id) }); } else if (TypeClass == "Reply") { //TypeClass var adapterGlobal = ReplyCommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.ReplyCommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { var index = adapterGlobal.ReplyCommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.ReplyCommentList.RemoveAt(index); adapterGlobal.NotifyItemRemoved(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.DeleteCommentAsync(CommentObject.Id, "delete_reply") }); } Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CommentSuccessfullyDeleted), ToastLength.Short).Show(); } catch (Exception e) { Console.WriteLine(e); } }); } else { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } catch (Exception e) { Console.WriteLine(e); } }
public void OnInput(MaterialDialog p0, ICharSequence p1) { try { if (p1.Length() > 0) { var strName = p1.ToString(); if (!Methods.CheckConnectivity()) { Toast.MakeText(MainContext, MainContext.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); } else { if (TypeClass == "Comment") { //TypeClass var adapterGlobal = CommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.CommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { dataGlobal.Text = strName; var index = adapterGlobal.CommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.NotifyItemChanged(index); } } var dataPost = WRecyclerView.GetInstance()?.NativeFeedAdapter?.ListDiffer?.Where(a => a.PostData?.Id == CommentObject.PostId).ToList(); if (dataPost?.Count > 0) { foreach (var post in dataPost) { if (post.TypeView != PostModelType.CommentSection) { continue; } var dataComment = post.PostData.GetPostComments?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataComment != null) { dataComment.Text = strName; var index = post.PostData.GetPostComments.IndexOf(dataComment); if (index > -1) { WRecyclerView.GetInstance()?.NativeFeedAdapter.NotifyItemChanged(index); } } } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.EditCommentAsync(CommentObject.Id, strName) }); } else if (TypeClass == "Reply") { //TypeClass var adapterGlobal = ReplyCommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.ReplyCommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { dataGlobal.Text = strName; var index = adapterGlobal.ReplyCommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.NotifyItemChanged(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.EditCommentAsync(CommentObject.Id, strName, "edit_reply") }); } } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (p1 == DialogAction.Positive) { if (TypeDialog == "DeleteComment") { MainContext.RunOnUiThread(() => { try { switch (TypeClass) { case "Comment": { //TypeClass var adapterGlobal = CommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.CommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { var index = adapterGlobal.CommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.CommentList.RemoveAt(index); adapterGlobal.NotifyItemRemoved(index); } } var dataPost = TabbedMainActivity.GetInstance()?.NewsFeedTab?.PostFeedAdapter?.ListDiffer?.Where(a => a.PostData?.PostId == CommentObject?.PostId).ToList(); if (dataPost?.Count > 0) { foreach (var post in dataPost.Where(post => post.TypeView == PostModelType.CommentSection || post.TypeView == PostModelType.AddCommentSection)) { TabbedMainActivity.GetInstance()?.NewsFeedTab?.MainRecyclerView?.RemoveByRowIndex(post); } } var dataPost2 = WRecyclerView.GetInstance()?.NativeFeedAdapter?.ListDiffer?.Where(a => a.PostData?.PostId == CommentObject?.PostId).ToList(); if (dataPost2?.Count > 0) { foreach (var post in dataPost2.Where(post => post.TypeView == PostModelType.CommentSection || post.TypeView == PostModelType.AddCommentSection)) { WRecyclerView.GetInstance()?.RemoveByRowIndex(post); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.DeleteCommentAsync(CommentObject.Id) }); break; } case "Reply": { //TypeClass var adapterGlobal = ReplyCommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.ReplyCommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { var index = adapterGlobal.ReplyCommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.ReplyCommentList.RemoveAt(index); adapterGlobal.NotifyItemRemoved(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.DeleteCommentAsync(CommentObject.Id, "delete_reply") }); break; } } Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CommentSuccessfullyDeleted), ToastLength.Short)?.Show(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }); } else { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }