protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                Window.SetSoftInputMode(SoftInput.AdjustResize);

                base.OnCreate(savedInstanceState);
                SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base);

                Methods.App.FullScreenApp(this);

                // Create your application here
                SetContentView(Resource.Layout.Native_Comment_Layout);

                Instance = this;

                PostId     = Intent.GetStringExtra("PostId") ?? string.Empty;
                PostObject = JsonConvert.DeserializeObject <PostDataObject>(Intent.GetStringExtra("PostObject"));

                //Get Value And Set Toolbar
                InitComponent();

                GetDataPost();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
 private void DestroyBasic()
 {
     try
     {
         Instance            = null;
         CommentsAdapter     = null;
         SwipeRefreshLayout  = null;
         MainRecyclerView    = null;
         TxtComment          = null;
         LikeCountBox        = null;
         ImgSent             = null; ImgGallery = null; ImgBack = null;
         BtnVoice            = null;
         PostObject          = null;
         PostId              = null;
         PathImage           = null; PathVoice = null; TextRecorder = null;
         TopFragment         = null;
         RecordSoundFragment = null;
         RecorderService     = null;
         CommentLayout       = null;
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
示例#3
0
        private void SetRecyclerViewAdapters()
        {
            try
            {
                MAdapter = new ReplyCommentAdapter(this, MainRecyclerView, CommentId);

                if (CommentObject != null)
                {
                    CommentLayout.LayoutResource = string.IsNullOrEmpty(CommentObject.CFile) ? Resource.Layout.Style_Comment : Resource.Layout.Style_Comment_Image;
                }
                CommentLayoutView = CommentLayout.Inflate();

                var holder = new CommentAdapterViewHolder(CommentLayoutView, "Light")
                {
                    ReplyTextView = { Visibility = ViewStates.Gone }
                };

                //Load data same as comment adapter
                CommentActivity.GetInstance()?.CommentsAdapter?.LoadCommentData(CommentObject, holder);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#4
0
        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()?.CommentsAdapter;
                            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);
            }
        }
示例#5
0
        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()?.CommentsAdapter;
                                    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);
            }
        }