コード例 #1
0
        //DeletePost
        public void OnMenuDeletePostOnClick(MoreFeedClickEventArgs feed)
        {
            try
            {
                if (Methods.CheckConnectivity())
                {
                    TypeDialog   = "DeletePost";
                    MoreFeedArgs = feed;

                    var dialog = new MaterialDialog.Builder(MainContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);
                    dialog.Title(MainContext.GetText(Resource.String.Lbl_DeletePost));
                    dialog.Content(MainContext.GetText(Resource.String.Lbl_AreYouSureDeletePost));
                    dialog.PositiveText(MainContext.GetText(Resource.String.Lbl_Yes)).OnPositive(this);
                    dialog.NegativeText(MainContext.GetText(Resource.String.Lbl_No)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.ItemsCallback(this).Build().Show();
                }
                else
                {
                    Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #2
0
 //Go to Post
 public void OnMenuGoPostOnClick(MoreFeedClickEventArgs feed)
 {
     try
     {
         ((HomeActivity)feed.View.Context).OpenNewsFeedItem(feed.NewsFeedClass);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
コード例 #3
0
 //Edit Post
 public void OnMenuEditPostOnClick(MoreFeedClickEventArgs feed)
 {
     try
     {
         Intent intent = new Intent(MainContext, typeof(EditPostActivity));
         intent.PutExtra("IdPost", feed.NewsFeedClass.PostId.ToString());
         intent.PutExtra("TextPost", feed.NewsFeedClass.Description);
         MainContext.StartActivityForResult(intent, 2250);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
コード例 #4
0
        //Event Show More :  DeletePost , EditPost , GoPost , Copy Link  , Report ..
        public void OnMoreClick(MoreFeedClickEventArgs args, bool isShow = false, string namePage = "")
        {
            try
            {
                var dataUser = ListUtils.MyProfileList.FirstOrDefault();

                NamePage     = namePage;
                MoreFeedArgs = args;
                TextView moreIcon = args.View.FindViewById <TextView>(Resource.Id.moreicon);
                if (moreIcon != null)
                {
                    var arrayAdapter = new List <string>();
                    var dialogList   = new MaterialDialog.Builder(MainContext);
                    if (args.IsOwner)
                    {
                        arrayAdapter.Add(MainContext.GetText(Resource.String.Lbl_DeletePost));
                        arrayAdapter.Add(MainContext.GetText(Resource.String.Lbl_EditPost));
                    }

                    if (args.NewsFeedClass?.Boosted == "0" && dataUser?.IsPro == "1")
                    {
                        arrayAdapter.Add(MainContext.GetString(Resource.String.Lbl_BoostPost));
                    }
                    else if (args.NewsFeedClass?.Boosted == "1" && dataUser?.IsPro == "1")
                    {
                        arrayAdapter.Add(MainContext.GetString(Resource.String.Lbl_UnBoostPost));
                    }

                    if (isShow)
                    {
                        arrayAdapter.Add(MainContext.GetText(Resource.String.Lbl_GoToPost));
                    }

                    arrayAdapter.Add(MainContext.GetText(Resource.String.Lbl_ReportThisPost));
                    arrayAdapter.Add(MainContext.GetText(Resource.String.Lbl_Copy));

                    dialogList.Title(MainContext.GetText(Resource.String.Lbl_Post));
                    dialogList.Items(arrayAdapter);
                    dialogList.PositiveText(MainContext.GetText(Resource.String.Lbl_Close)).OnPositive(this);
                    dialogList.AlwaysCallSingleChoiceCallback();
                    dialogList.ItemsCallback(this).Build().Show();
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
コード例 #5
0
 //ReportPost
 public void OnMenuReportPostOnClick(MoreFeedClickEventArgs feed)
 {
     try
     {
         if (Methods.CheckConnectivity())
         {
             //Sent Api >>
             RequestsAsync.Post.ReportPosts(feed.NewsFeedClass.PostId.ToString()).ConfigureAwait(false);
             Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_YourReportPost), ToastLength.Short).Show();
         }
         else
         {
             Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }