Exemplo n.º 1
0
 private void InitShowDialog()
 {
     dialog_ShowBuilder = new AndroidX.AppCompat.App.AlertDialog.Builder(this, Resource.Style.Theme_Dialog_FullScreen);
     dialog_Show        = dialog_ShowBuilder.Create();
     dialog_Show.Show();
     dialog_Show.Dismiss();
 }
Exemplo n.º 2
0
 protected void HideWaitDiaLog()
 {
     try
     {
         if (dialog_Show != null)
         {
             if (dialog_Show.IsShowing)
             {
                 dialog_Show?.Dismiss();
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Exemplo n.º 3
0
        private void ImgButtonOnClick(ReactionsClickEventArgs e)
        {
            try
            {
                if (!Methods.CheckConnectivity())
                {
                    Toast.MakeText(Application.Context, Application.Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                    return;
                }

                if (UserDetails.SoundControl)
                {
                    Methods.AudioRecorderAndPlayer.PlayAudioFromAsset("reaction.mp3");
                }

                Reaction data = MReactionPack[e.Position];
                UpdateReactButtonByReaction(data);
                MReactAlertDialog.Dismiss();

                PostData.NewsFeedClass.Reaction ??= new WoWonderClient.Classes.Posts.Reaction();

                if (data.GetReactText() == ReactConstants.Like)
                {
                    PostData.NewsFeedClass.Reaction.Type = "1";
                    string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Like").Value?.Id ?? "1";
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react)
                    });
                }
                else if (data.GetReactText() == ReactConstants.Love)
                {
                    PostData.NewsFeedClass.Reaction.Type = "2";
                    string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Love").Value?.Id ?? "2";
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react)
                    });
                }
                else if (data.GetReactText() == ReactConstants.HaHa)
                {
                    PostData.NewsFeedClass.Reaction.Type = "3";
                    string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "HaHa").Value?.Id ?? "3";
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react)
                    });
                }
                else if (data.GetReactText() == ReactConstants.Wow)
                {
                    PostData.NewsFeedClass.Reaction.Type = "4";
                    string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Wow").Value?.Id ?? "4";
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react)
                    });
                }
                else if (data.GetReactText() == ReactConstants.Sad)
                {
                    PostData.NewsFeedClass.Reaction.Type = "5";
                    string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Sad").Value?.Id ?? "5";
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react)
                    });
                }
                else if (data.GetReactText() == ReactConstants.Angry)
                {
                    PostData.NewsFeedClass.Reaction.Type = "6";
                    string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Angry").Value?.Id ?? "6";
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react)
                    });
                }

                if (PostData.NewsFeedClass.Reaction.IsReacted != null && !PostData.NewsFeedClass.Reaction.IsReacted.Value)
                {
                    PostData.NewsFeedClass.Reaction.IsReacted = true;
                    PostData.NewsFeedClass.Reaction.Count++;
                }

                if (NamePage == "ImagePostViewerActivity" || NamePage == "MultiImagesPostViewerActivity")
                {
                    var likeCount = PostData.View?.FindViewById <TextView>(Resource.Id.LikeText1);

                    if (likeCount != null && !likeCount.Text.Contains("K") && !likeCount.Text.Contains("M"))
                    {
                        var x = Convert.ToInt32(likeCount.Text);
                        x++;

                        likeCount.Text = Convert.ToString(x, CultureInfo.InvariantCulture);
                    }
                }
                else
                {
                    var dataGlobal = NativeFeedAdapter?.ListDiffer?.Where(a => a.PostData?.Id == PostData.NewsFeedClass.PostId).ToList();
                    if (dataGlobal?.Count > 0)
                    {
                        foreach (var dataClass in from dataClass in dataGlobal let index = NativeFeedAdapter.ListDiffer.IndexOf(dataClass) where index > -1 select dataClass)
                        {
                            dataClass.PostData = PostData.NewsFeedClass;
                            if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine)
                            {
                                dataClass.PostData.PostLikes = PostData.NewsFeedClass.Reaction.Count.ToString();
                            }
                            else
                            {
                                dataClass.PostData.PostLikes = PostData.NewsFeedClass.PostLikes;
                            }
                            NativeFeedAdapter.NotifyItemChanged(NativeFeedAdapter.ListDiffer.IndexOf(dataClass), "reaction");
                        }
                    }

                    var likeCount = PostData.View?.FindViewById <TextView>(Resource.Id.Likecount);
                    if (likeCount != null)
                    {
                        likeCount.Text = PostData.NewsFeedClass.Reaction.Count + " " + Application.Context.Resources?.GetString(Resource.String.Lbl_Reactions);
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 显示Android提示框
 /// </summary>
 /// <param name="title">标题</param>
 /// <param name="msg">内容消息</param>
 /// <param name="onSureClick">确定事件</param>
 /// <param name="onCancelClick">取消事件</param>
 /// <param name="sureText">确定文字</param>
 /// <param name="cancelText">取消文字</param>
 protected void ShowAndroidPromptBox(string title, string msg, Action onSureClick, Action onCancelClick, bool isCancelable = false, string sureText = "确定", string cancelText = "取消")
 {
     AndroidX.AppCompat.App.AlertDialog jk = null;
     jk =
         new AndroidX.AppCompat.App.AlertDialog.Builder(this)
         .SetTitle(title)
         .SetMessage(msg)
         .SetCancelable(isCancelable)
         .SetPositiveButton(sureText, (object sender, DialogClickEventArgs eve) => { jk.Dismiss(); jk = null; onSureClick?.Invoke(); })
         .SetNegativeButton(cancelText, (object sender, DialogClickEventArgs eve) => { jk.Dismiss(); jk = null; onCancelClick?.Invoke(); })
         .Show();
 }