예제 #1
0
        public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString)
        {
            try
            {
                string text = itemString.ToString();

                if (!Methods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                }
                else
                {
                    if (text == GetString(Resource.String.Lbl_MessageCall5))
                    {
                        var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
                        dialog.Input(Resource.String.Lbl_Write_your_message, 0, false, this);
                        dialog.InputType(InputTypes.TextFlagImeMultiLine);
                        dialog.PositiveText(GetText(Resource.String.Btn_Send)).OnPositive(this);
                        dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                        dialog.Build().Show();
                        dialog.AlwaysCallSingleChoiceCallback();
                    }
                    else
                    {
                        SendMess(text);
                    }
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        private void SocialAdapter_OnItemClick(object sender, SocialLinks_AdapterClickEventArgs adapterClickEvents)
        {
            try
            {
                var position = adapterClickEvents.Position;
                if (position >= 0)
                {
                    var item = SocialAdapter.GetItem(position);
                    if (item != null)
                    {
                        Socialitem = item;

                        var dialog = new MaterialDialog.Builder(this);

                        dialog.Title(item.SocialName);
                        dialog.Input(Resource.String.Lbl_Enter_your_link, 0, false, this);

                        dialog.InputType(InputTypes.TextFlagImeMultiLine);
                        dialog.PositiveText(GetText(Resource.String.Lbl_Save)).OnPositive(this);
                        dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                        dialog.Build().Show();
                        dialog.AlwaysCallSingleChoiceCallback();
                    }
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
        //Event Menu >> Edit Comment
        private void EditCommentEvent(CommentObjectExtra item)
        {
            try
            {
                if (Methods.CheckConnectivity())
                {
                    TypeDialog    = "EditComment";
                    CommentObject = item;

                    var dialog = new MaterialDialog.Builder(MainContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);

                    dialog.Title(Resource.String.Lbl_Edit);
                    dialog.Input(MainContext.GetString(Resource.String.Lbl_Write_comment), Methods.FunString.DecodeString(item.Text), this);

                    dialog.InputType(InputTypes.TextFlagImeMultiLine);
                    dialog.PositiveText(MainContext.GetText(Resource.String.Lbl_Update)).OnPositive(this);
                    dialog.NegativeText(MainContext.GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                    dialog.Build().Show();
                    dialog.AlwaysCallSingleChoiceCallback();
                }
                else
                {
                    Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        private void MAdapterOnItemClick(object sender, SocialLinksAdapterClickEventArgs e)
        {
            try
            {
                var item = MAdapter.GetItem(e.Position);
                if (item != null)
                {
                    SocialItem = item;

                    var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);

                    dialog.Title(item.SocialName);
                    dialog.Input(Resource.String.Lbl_Enter_your_link, 0, false, this);

                    dialog.InputType(InputTypes.TextFlagImeMultiLine);
                    dialog.PositiveText(GetText(Resource.String.Lbl_Save)).OnPositive(this);
                    dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                    dialog.Build().Show();
                    dialog.AlwaysCallSingleChoiceCallback();
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        public override bool OnPreferenceTreeClick(Preference preference)
        {
            try
            {
                switch (preference.Key)
                {
                case "about_me_key":
                {
                    TypeDialog = "About";
                    var dialog = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);
                    dialog.Title(GetString(Resource.String.Lbl_About)).TitleColorRes(Resource.Color.primary);
                    dialog.Input(GetString(Resource.String.Lbl_About), preference.Summary, false, this);
                    dialog.InputType(InputTypes.TextFlagImeMultiLine);
                    dialog.PositiveText(GetText(Resource.String.Lbl_Save)).OnPositive(this);
                    dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.Build().Show();

                    return(true);
                }

                case "Night_Mode_key":
                {
                    TypeDialog = "NightMode";

                    var arrayAdapter = new List <string>();
                    var dialogList   = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);

                    dialogList.Title(Resource.String.Lbl_Theme).TitleColorRes(Resource.Color.primary);

                    arrayAdapter.Add(GetText(Resource.String.Lbl_Light));
                    arrayAdapter.Add(GetText(Resource.String.Lbl_Dark));

                    switch ((int)Build.VERSION.SdkInt)
                    {
                    case >= 29:
                        arrayAdapter.Add(GetText(Resource.String.Lbl_SetByBattery));
                        break;
                    }

                    dialogList.Items(arrayAdapter);
                    dialogList.PositiveText(GetText(Resource.String.Lbl_Close)).OnPositive(this);
                    dialogList.AlwaysCallSingleChoiceCallback();
                    dialogList.ItemsCallback(this).Build().Show();

                    return(true);
                }

                default:
                    return(base.OnPreferenceTreeClick(preference));
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
                return(base.OnPreferenceTreeClick(preference));
            }
        }
예제 #6
0
        // send data and send api and show liner add code email
        private void SaveButtonOnClick(object sender, EventArgs e)
        {
            try
            {
                if (!Methods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                    return;
                }

                switch (TypeTwoFactor)
                {
                case "1":
                {
                    TypeDialog = "ConfirmationCode";
                    var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
                    dialog.Title(Resource.String.Lbl_ConfirmationEmailSent);
                    dialog.Input(Resource.String.Lbl_ConfirmationCode, 0, false, this);
                    dialog.InputType(InputTypes.ClassNumber);
                    dialog.PositiveText(GetText(Resource.String.Lbl_Send)).OnPositive(this);
                    dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.Build().Show();

                    break;
                }

                case "0":
                    var dictionary = new Dictionary <string, string>
                    {
                        { "two_factor", "0" },
                    };

                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Users.UpdateProfileAsync(dictionary)
                    });
                    var local = ListUtils.MyUserInfo.FirstOrDefault();
                    if (local != null)
                    {
                        local.TwoFactor = "0";

                        var sqLiteDatabase = new SqLiteDatabase();
                        sqLiteDatabase.InsertOrUpdate_DataMyInfo(local);
                        sqLiteDatabase.Dispose();
                    }
                    Finish();
                    break;
                }
            }
            catch (Exception exception)
            {
                AndHUD.Shared.Dismiss(this);
                Console.WriteLine(exception);
            }
        }
 //Interest
 private void EdtInterestOnClick(object sender, View.TouchEventArgs e)
 {
     try
     {
         TypeDialog = "Interest";
         var dialog = new MaterialDialog.Builder(Context).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);
         dialog.Title(GetString(Resource.String.Lbl_Interest));
         dialog.Input(Resource.String.Lbl_EnterTextInterest, 0, false, this);
         dialog.InputType(InputTypes.TextFlagImeMultiLine);
         dialog.PositiveText(GetText(Resource.String.Lbl_Submit)).OnPositive(this);
         dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
         dialog.AlwaysCallSingleChoiceCallback();
         dialog.Build().Show();
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
        //Event Add Comment
        private void BtnCommentOnClick(object sender, EventArgs e)
        {
            try
            {
                var dialog = new MaterialDialog.Builder(this);

                dialog.Title(Resource.String.Lbl_leave_comment);
                dialog.Input(Resource.String.Lbl_Write_comment, 0, false, this);
                dialog.InputType(InputTypes.TextFlagImeMultiLine);
                dialog.PositiveText(GetText(Resource.String.Lbl_Comment)).OnPositive(this);
                dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                dialog.Build().Show();
                dialog.AlwaysCallSingleChoiceCallback();
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
예제 #9
0
        public void ShowEditTextDialog(string title, string content = null, string positiveText = null, string negativeText = null)
        {
            try
            {
                MaterialDialog.Builder DialogList = new MaterialDialog.Builder(ActivityContext);

                if (!string.IsNullOrEmpty(title))
                {
                    DialogList.Title(title);
                }

                if (!string.IsNullOrEmpty(content))
                {
                    DialogList.Content(content);
                }

                if (!string.IsNullOrEmpty(negativeText))
                {
                    DialogList.NegativeText(negativeText);
                    DialogList.OnNegative(this);
                }

                if (!string.IsNullOrEmpty(positiveText))
                {
                    DialogList.PositiveText(positiveText);
                    DialogList.OnPositive(this);
                }

                DialogList.InputType(InputTypes.ClassText | InputTypes.TextFlagMultiLine);
                DialogList.Input("", "", this);
                DialogList.Build().Show();
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
예제 #10
0
        public void ShowEditTextDialog(string title, string content = null, string positiveText = null, string negativeText = null)
        {
            try
            {
                MaterialDialog.Builder dialogList = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);

                if (!string.IsNullOrEmpty(title))
                {
                    dialogList.Title(title);
                }

                if (!string.IsNullOrEmpty(content))
                {
                    dialogList.Content(content);
                }

                if (!string.IsNullOrEmpty(negativeText))
                {
                    dialogList.NegativeText(negativeText);
                    dialogList.OnNegative(this);
                }

                if (!string.IsNullOrEmpty(positiveText))
                {
                    dialogList.PositiveText(positiveText);
                    dialogList.OnPositive(this);
                }

                dialogList.InputType(InputTypes.ClassText | InputTypes.TextFlagMultiLine);
                dialogList.Input("", "", this);
                dialogList.Build().Show();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        // send data and send api and show liner add code email
        private async void SaveButtonOnClick(object sender, EventArgs e)
        {
            try
            {
                if (!Methods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                    return;
                }

                switch (TypeTwoFactor)
                {
                case "1":
                {
                    //Show a progress
                    AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading) + "...");

                    var(apiStatus, respond) = await RequestsAsync.Auth.SendCodeTwoFactorAsync(UserDetails.Email);

                    if (apiStatus == 200)
                    {
                        if (!(respond is SendCodeTwoFactorObject result))
                        {
                            return;
                        }
                        if (result.Data.MessageBody.Contains("Your confirmation code is"))
                        {
                            TwoFactorEmailCode = result.Data.MessageBody.Split(':').Last().Replace(" ", "");
                            Toast.MakeText(this, GetText(Resource.String.Lbl_ConfirmationCodeSent), ToastLength.Short).Show();

                            AndHUD.Shared.Dismiss(this);

                            TypeDialog = "ConfirmationCode";
                            var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
                            dialog.Title(Resource.String.Lbl_ConfirmationEmailSent);
                            dialog.Input(Resource.String.Lbl_ConfirmationCode, 0, false, this);
                            dialog.InputType(InputTypes.ClassNumber);
                            dialog.PositiveText(GetText(Resource.String.Lbl_Send)).OnPositive(this);
                            dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                            dialog.AlwaysCallSingleChoiceCallback();
                            dialog.Build().Show();
                        }
                        else
                        {
                            //Show a Error image with a message
                            AndHUD.Shared.ShowError(this, result.Message, MaskType.Clear, TimeSpan.FromSeconds(2));
                        }
                    }
                    else
                    {
                        Methods.DisplayReportResult(this, respond);
                    }

                    break;
                }

                case "0":
                    var dictionary = new Dictionary <string, string>
                    {
                        { "two_factor", "0" },
                    };

                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Users.UpdateProfileAsync(dictionary)
                    });
                    var local = ListUtils.MyUserInfo.FirstOrDefault();
                    if (local != null)
                    {
                        local.TwoFactor = "0";

                        var sqLiteDatabase = new SqLiteDatabase();
                        sqLiteDatabase.InsertOrUpdate_DataMyInfo(local);
                        sqLiteDatabase.Dispose();
                    }

                    Finish();
                    break;
                }
            }
            catch (Exception exception)
            {
                AndHUD.Shared.Dismiss(this);
                Console.WriteLine(exception);
            }
        }
예제 #12
0
        //Click Button Login
        private async void BtnLoginOnClick(object sender, EventArgs eventArgs)
        {
            try
            {
                if (!Methods.CheckConnectivity())
                {
                    Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_CheckYourInternetConnection), GetText(Resource.String.Lbl_Ok));
                }
                else
                {
                    if (!string.IsNullOrEmpty(MEditTextEmail.Text.Replace(" ", "")) || !string.IsNullOrEmpty(MEditTextPassword.Text))
                    {
                        ProgressBar.Visibility       = ViewStates.Visible;
                        MButtonViewSignIn.Visibility = ViewStates.Gone;

                        var(apiStatus, respond) = await RequestsAsync.WoWonder.GetAuthWoWonderAsync(MEditTextEmail.Text.Replace(" ", ""), MEditTextPassword.Text, TimeZone);

                        if (apiStatus == 200)
                        {
                            if (respond is WoWonderAuthObject auth)
                            {
                                UserId = auth.UserId;
                                SetDataLogin(auth.UserId, auth.AccessToken);
                            }
                            else if (respond is WoWonderAuthMessageObject messageObject)
                            {
                                UserId = messageObject.UserId;

                                //TwoFactor
                                var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
                                dialog.Title(Resource.String.Lbl_ConfirmationEmailSent);
                                dialog.Input(Resource.String.Lbl_ConfirmationCode, 0, false, (materialDialog, s) =>
                                {
                                    try
                                    {
                                        if (s.Length <= 0)
                                        {
                                            return;
                                        }
                                        CodeName = s.ToString();
                                        SendButtonOnClick();
                                    }
                                    catch (Exception e)
                                    {
                                        Console.WriteLine(e);
                                    }
                                });
                                dialog.InputType(InputTypes.ClassText);
                                dialog.PositiveText(GetText(Resource.String.Lbl_Send)).OnPositive(this);
                                dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                                dialog.Build().Show();
                            }
                        }
                        else if (apiStatus == 400)
                        {
                            if (respond is WoWonderErrorObject error)
                            {
                                var errorText = error.Error.ErrorText;
                                var errorId   = error.Error.ErrorId;
                                switch (errorId)
                                {
                                case "3":
                                    Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_ErrorLogin_3), GetText(Resource.String.Lbl_Ok));
                                    break;

                                case "4":
                                    Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_ErrorLogin_4), GetText(Resource.String.Lbl_Ok));
                                    break;

                                case "5":
                                    Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_ErrorLogin_5), GetText(Resource.String.Lbl_Ok));
                                    break;

                                default:
                                    Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), errorText, GetText(Resource.String.Lbl_Ok));
                                    break;
                                }
                            }

                            ProgressBar.Visibility       = ViewStates.Gone;
                            MButtonViewSignIn.Visibility = ViewStates.Visible;
                        }
                        else if (apiStatus == 404)
                        {
                            ProgressBar.Visibility       = ViewStates.Gone;
                            MButtonViewSignIn.Visibility = ViewStates.Visible;
                            Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), respond.ToString(), GetText(Resource.String.Lbl_Ok));
                        }
                    }
                    else
                    {
                        ProgressBar.Visibility       = ViewStates.Gone;
                        MButtonViewSignIn.Visibility = ViewStates.Visible;
                        Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_Please_enter_your_data), GetText(Resource.String.Lbl_Ok));
                    }
                }
            }
            catch (Exception exception)
            {
                ProgressBar.Visibility       = ViewStates.Gone;
                MButtonViewSignIn.Visibility = ViewStates.Visible;
                Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), exception.Message, GetText(Resource.String.Lbl_Ok));
                Console.WriteLine(exception);
            }
        }
예제 #13
0
        public async void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString)
        {
            try
            {
                string text = itemString.ToString();
                if (text == GetString(Resource.String.Btn_Paypal))
                {
                    InitPayPalPayment.BtnPaypalOnClick(Price, "AddFunds");
                }
                else if (text == GetString(Resource.String.Lbl_CreditCard))
                {
                    OpenIntentCreditCard();
                }
                else if (text == GetString(Resource.String.Lbl_BankTransfer))
                {
                    OpenIntentBankTransfer();
                }
                else if (text == GetString(Resource.String.Lbl_RazorPay))
                {
                    InitRazorPay?.BtnRazorPayOnClick(Price, "AddFunds", "");
                }
                else if (text == GetString(Resource.String.Lbl_PayStack))
                {
                    var dialog = new MaterialDialog.Builder(Context).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);
                    dialog.Title(Resource.String.Lbl_PayStack).TitleColorRes(Resource.Color.primary);
                    dialog.Input(Resource.String.Lbl_Email, 0, false, async(materialDialog, s) =>
                    {
                        try
                        {
                            switch (s.Length)
                            {
                            case <= 0:
                                return;
                            }

                            var check = Methods.FunString.IsEmailValid(s.ToString().Replace(" ", ""));
                            switch (check)
                            {
                            case false:
                                Methods.DialogPopup.InvokeAndShowDialog(Activity, GetText(Resource.String.Lbl_VerificationFailed), GetText(Resource.String.Lbl_IsEmailValid), GetText(Resource.String.Lbl_Ok));
                                return;

                            default:
                                Toast.MakeText(Context, Context.GetText(Resource.String.Lbl_Please_wait), ToastLength.Short)?.Show();

                                await PayStack(s.ToString());
                                break;
                            }
                        }
                        catch (Exception e)
                        {
                            Methods.DisplayReportResultTrack(e);
                        }
                    });
                    dialog.InputType(InputTypes.TextVariationEmailAddress);
                    dialog.PositiveText(GetText(Resource.String.Lbl_PayNow)).OnPositive(this);
                    dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.Build().Show();
                }
                else if (text == GetString(Resource.String.Lbl_CashFree))
                {
                    OpenCashFreeDialog();
                }
                else if (text == GetString(Resource.String.Lbl_PaySera))
                {
                    Toast.MakeText(Context, Context.GetText(Resource.String.Lbl_Please_wait), ToastLength.Short)?.Show();

                    await PaySera();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        //open Payment
        private void BtnDonateOnClick(object sender, EventArgs e)
        {
            try
            {
                DialogType = "Donate";

                var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
                dialog.Title(Resource.String.Lbl_Donate);
                dialog.Input(Resource.String.Lbl_DonateCode, 0, false, (materialDialog, s) =>
                {
                    try
                    {
                        if (s.Length <= 0)
                        {
                            return;
                        }
                        CodeName = s.ToString();

                        if (Convert.ToDouble(CodeName) > Convert.ToDouble(DataObject.Amount))
                        {
                            Toast.MakeText(this, GetText(Resource.String.Lbl_CantDonate) + " " + TxtFundAmount.Text, ToastLength.Long)?.Show();
                            return;
                        }

                        DialogType = "Payment";

                        var arrayAdapter = new List <string>();
                        var dialogList   = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);

                        if (AppSettings.ShowInAppBilling && Client.IsExtended && Convert.ToInt64(CodeName) <= 100)
                        {
                            arrayAdapter.Add(GetString(Resource.String.Btn_GooglePlay));
                        }

                        if (AppSettings.ShowPaypal)
                        {
                            arrayAdapter.Add(GetString(Resource.String.Btn_Paypal));
                        }

                        if (AppSettings.ShowCreditCard)
                        {
                            arrayAdapter.Add(GetString(Resource.String.Lbl_CreditCard));
                        }

                        //if (AppSettings.ShowBankTransfer) //wael add on next version
                        //    arrayAdapter.Add(GetString(Resource.String.Lbl_BankTransfer));

                        if (AppSettings.ShowRazorPay)
                        {
                            arrayAdapter.Add(GetString(Resource.String.Lbl_RazorPay));
                        }

                        if (AppSettings.ShowPayStack)
                        {
                            arrayAdapter.Add(GetString(Resource.String.Lbl_PayStack));
                        }

                        if (AppSettings.ShowCashFree)
                        {
                            arrayAdapter.Add(GetString(Resource.String.Lbl_CashFree));
                        }

                        if (AppSettings.ShowPaySera)
                        {
                            arrayAdapter.Add(GetString(Resource.String.Lbl_PaySera));
                        }

                        dialogList.Items(arrayAdapter);
                        dialogList.NegativeText(GetText(Resource.String.Lbl_Close)).OnNegative(this);
                        dialogList.AlwaysCallSingleChoiceCallback();
                        dialogList.ItemsCallback(this).Build().Show();
                    }
                    catch (Exception exception)
                    {
                        Methods.DisplayReportResultTrack(exception);
                    }
                });
                dialog.InputType(InputTypes.ClassText);
                dialog.PositiveText(GetText(Resource.String.Btn_Send)).OnPositive(this);
                dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                dialog.AlwaysCallSingleChoiceCallback();
                dialog.Build().Show();
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        private void ActivitesAdapter_OnItemClick(object sender, PostActivites_AdapterClickEventArgs adapterClickEvents)
        {
            try
            {
                var position = adapterClickEvents.Position;
                if (position >= 0)
                {
                    var item = ActivitesAdapter.GetItem(position);
                    if (item != null)
                    {
                        if (item.ID == 1) // Listening to
                        {
                            TypeDialog = "Listening";

                            var dialog = new MaterialDialog.Builder(this);

                            dialog.Title(Resource.String.Lbl_What_Are_You_Doing);
                            dialog.Input(Resource.String.Lbl_Comment_Hint_Listening, 0, false, this);
                            dialog.InputType(InputTypes.TextFlagImeMultiLine);
                            dialog.PositiveText(GetText(Resource.String.Lbl_Submit)).OnPositive(this);
                            dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                            dialog.Build().Show();
                            dialog.AlwaysCallSingleChoiceCallback();
                        }
                        else if (item.ID == 2) // Playing
                        {
                            TypeDialog = "Playing";

                            var dialog = new MaterialDialog.Builder(this);

                            dialog.Title(Resource.String.Lbl_What_Are_You_Doing);
                            dialog.Input(Resource.String.Lbl_Comment_Hint_Playing, 0, false, this);
                            dialog.InputType(InputTypes.TextFlagImeMultiLine);
                            dialog.PositiveText(GetText(Resource.String.Lbl_Submit)).OnPositive(this);
                            dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                            dialog.Build().Show();
                            dialog.AlwaysCallSingleChoiceCallback();
                        }
                        else if (item.ID == 3) // Watching
                        {
                            TypeDialog = "Watching";

                            var dialog = new MaterialDialog.Builder(this);

                            dialog.Title(Resource.String.Lbl_What_Are_You_Doing);
                            dialog.Input(Resource.String.Lbl_Comment_Hint_Watching, 0, false, this);
                            dialog.InputType(InputTypes.TextFlagImeMultiLine);
                            dialog.PositiveText(GetText(Resource.String.Lbl_Submit)).OnPositive(this);
                            dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                            dialog.Build().Show();
                            dialog.AlwaysCallSingleChoiceCallback();
                        }
                        else if (item.ID == 4) // Traveling
                        {
                            TypeDialog = "Traveling";

                            var dialog = new MaterialDialog.Builder(this);

                            dialog.Title(Resource.String.Lbl_What_Are_You_Doing);
                            dialog.Input(Resource.String.Lbl_Comment_Hint_Traveling, 0, false, this);
                            dialog.InputType(InputTypes.TextFlagImeMultiLine);
                            dialog.PositiveText(GetText(Resource.String.Lbl_Submit)).OnPositive(this);
                            dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                            dialog.Build().Show();
                            dialog.AlwaysCallSingleChoiceCallback();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
예제 #16
0
        // send data and send api and show liner add code email
        private async void SaveButtonOnClick(object sender, EventArgs e)
        {
            try
            {
                if (Methods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                    return;
                }

                switch (TypeTwoFactor)
                {
                case "Enable":
                {
                    //Show a progress
                    AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading) + "...");

                    var(apiStatus, respond) = await RequestsAsync.Global.UpdateTwoFactorAsync();

                    if (apiStatus == 200)
                    {
                        if (!(respond is MessageObject result))
                        {
                            return;
                        }
                        if (result.Message.Contains("confirmation code sent"))
                        {
                            Toast.MakeText(this, GetText(Resource.String.Lbl_ConfirmationCodeSent), ToastLength.Short).Show();

                            AndHUD.Shared.Dismiss(this);

                            TypeDialog = "ConfirmationCode";
                            var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
                            dialog.Title(Resource.String.Lbl_ConfirmationEmailSent);
                            dialog.Input(Resource.String.Lbl_ConfirmationCode, 0, false, this);
                            dialog.InputType(InputTypes.ClassNumber);
                            dialog.PositiveText(GetText(Resource.String.Btn_Send)).OnPositive(this);
                            dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                            dialog.AlwaysCallSingleChoiceCallback();
                            dialog.Build().Show();
                        }
                        else
                        {
                            //Show a Error image with a message
                            AndHUD.Shared.ShowError(this, result.Message, MaskType.Clear, TimeSpan.FromSeconds(2));
                        }
                    }
                    else
                    {
                        Methods.DisplayReportResult(this, respond);
                    }

                    break;
                }

                case "Disable":
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        RequestsAsync.Global.UpdateTwoFactorAsync
                    });
                    var local = ListUtils.MyProfileList.FirstOrDefault();
                    if (local != null)
                    {
                        local.TwoFactor = "0";

                        var sqLiteDatabase = new SqLiteDatabase();
                        sqLiteDatabase.Insert_Or_Update_To_MyProfileTable(local);
                        sqLiteDatabase.Dispose();
                    }

                    Finish();
                    break;
                }
            }
            catch (Exception exception)
            {
                AndHUD.Shared.Dismiss(this);
                Console.WriteLine(exception);
            }
        }
예제 #17
0
        public async void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString)
        {
            try
            {
                string text = itemString.ToString();
                if (text == GetString(Resource.String.Btn_Paypal))
                {
                    Price   = ItemUpgrade.PlanPrice;
                    PayType = "membership";
                    PayId   = ItemUpgrade.Id.ToString();
                    InitPayPalPayment.BtnPaypalOnClick(Price, "membership");
                }
                else if (text == GetString(Resource.String.Btn_GooglePlay))
                {
                    Price = ItemUpgrade.PlanPrice;
                    PayId = ItemUpgrade.Id.ToString();

                    BillingPayment.SetConnInAppBilling();
                    BillingPayment.InitInAppBilling(Price, "membership", PayId);
                }
                else if (text == GetString(Resource.String.Lbl_CreditCard))
                {
                    OpenIntentCreditCard();
                }
                else if (text == GetString(Resource.String.Lbl_BankTransfer))
                {
                    OpenIntentBankTransfer();
                }
                else if (text == GetString(Resource.String.Lbl_RazorPay))
                {
                    Price = ItemUpgrade.PlanPrice;
                    PayId = ItemUpgrade.Id.ToString();

                    InitRazorPay?.BtnRazorPayOnClick(Price, "membership", PayId);
                }
                else if (text == GetString(Resource.String.Lbl_PayStack))
                {
                    Price = ItemUpgrade.PlanPrice;
                    PayId = ItemUpgrade.Id.ToString();

                    var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
                    dialog.Title(Resource.String.Lbl_PayStack);
                    dialog.Input(Resource.String.Lbl_Email, 0, false, async(materialDialog, s) =>
                    {
                        try
                        {
                            if (s.Length <= 0)
                            {
                                return;
                            }
                            var check = Methods.FunString.IsEmailValid(s.ToString().Replace(" ", ""));
                            if (!check)
                            {
                                Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_VerificationFailed), GetText(Resource.String.Lbl_IsEmailValid), GetText(Resource.String.Lbl_Ok));
                                return;
                            }

                            Toast.MakeText(this, GetText(Resource.String.Lbl_Please_wait), ToastLength.Short)?.Show();

                            await PayStack(s.ToString());
                        }
                        catch (Exception e)
                        {
                            Methods.DisplayReportResultTrack(e);
                        }
                    });
                    dialog.InputType(InputTypes.TextVariationEmailAddress);
                    dialog.PositiveText(GetText(Resource.String.Lbl_PayNow)).OnPositive(this);
                    dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.Build().Show();
                }
                else if (text == GetString(Resource.String.Lbl_CashFree))
                {
                    OpenCashFreeDialog();
                }
                else if (text == GetString(Resource.String.Lbl_PaySera))
                {
                    Toast.MakeText(this, GetText(Resource.String.Lbl_Please_wait), ToastLength.Short)?.Show();

                    await PaySera();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        public async void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString)
        {
            try
            {
                string text = itemString.ToString();
                if (text == GetString(Resource.String.Btn_Paypal))
                {
                    InitPayPalPayment.BtnPaypalOnClick(CodeName, "Funding");
                }
                else if (text == GetString(Resource.String.Btn_GooglePlay))
                {
                    BillingPayment.SetConnInAppBilling();
                    BillingPayment.InitInAppBilling(CodeName, "Funding", "");
                }
                else if (text == GetString(Resource.String.Lbl_CreditCard))
                {
                    OpenIntentCreditCard();
                }
                else if (text == GetString(Resource.String.Lbl_BankTransfer))
                {
                    OpenIntentBankTransfer();
                }
                else if (text == GetString(Resource.String.Lbl_RazorPay))
                {
                    InitRazorPay?.BtnRazorPayOnClick(CodeName, "Funding", "");
                }
                else if (text == GetString(Resource.String.Lbl_PayStack))
                {
                    DialogType = "PayStack";

                    var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
                    dialog.Title(Resource.String.Lbl_PayStack);
                    dialog.Input(Resource.String.Lbl_Email, 0, false, async(materialDialog, s) =>
                    {
                        try
                        {
                            if (s.Length <= 0)
                            {
                                return;
                            }

                            var check = Methods.FunString.IsEmailValid(s.ToString().Replace(" ", ""));
                            if (!check)
                            {
                                Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_VerificationFailed), GetText(Resource.String.Lbl_IsEmailValid), GetText(Resource.String.Lbl_Ok));
                                return;
                            }

                            Toast.MakeText(this, GetText(Resource.String.Lbl_Please_wait), ToastLength.Short)?.Show();

                            await PayStack(s.ToString());
                        }
                        catch (Exception e)
                        {
                            Methods.DisplayReportResultTrack(e);
                        }
                    });
                    dialog.InputType(InputTypes.TextVariationEmailAddress);
                    dialog.PositiveText(GetText(Resource.String.Lbl_PayNow)).OnPositive(this);
                    dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.Build().Show();
                }
                else if (text == GetString(Resource.String.Lbl_CashFree))
                {
                    OpenCashFreeDialog();
                }
                else if (text == GetString(Resource.String.Lbl_PaySera))
                {
                    Toast.MakeText(this, GetText(Resource.String.Lbl_Please_wait), ToastLength.Short)?.Show();

                    await PaySera();
                }
                else if (text == GetString(Resource.String.Lbl_Share))
                {
                    ShareEvent();
                }
                else if (text == GetString(Resource.String.Lbl_Edit))
                {
                    EditEvent();
                }
                else if (text == GetString(Resource.String.Lbl_Copy))
                {
                    CopyLinkEvent();
                }
                else if (text == GetString(Resource.String.Lbl_Delete))
                {
                    DialogType = "Delete";

                    var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
                    dialog.Title(Resource.String.Lbl_Warning);
                    dialog.Content(GetText(Resource.String.Lbl_DeleteFunding));
                    dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) =>
                    {
                        try
                        {
                            // Send Api delete
                            if (Methods.CheckConnectivity())
                            {
                                PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                    () => RequestsAsync.Funding.DeleteFunding(DataObject.Id)
                                });

                                var instance    = FundingActivity.GetInstance();
                                var dataFunding = instance?.FundingTab?.MAdapter?.FundingList?.FirstOrDefault(a => a.Id == DataObject.Id);
                                if (dataFunding != null)
                                {
                                    instance?.FundingTab?.MAdapter?.FundingList.Remove(dataFunding);
                                    instance.FundingTab?.MAdapter?.NotifyItemRemoved(instance.FundingTab.MAdapter.FundingList.IndexOf(dataFunding));
                                }

                                var dataMyFunding = instance?.MyFundingTab?.MAdapter?.FundingList?.FirstOrDefault(a => a.Id == DataObject.Id);
                                if (dataMyFunding != null)
                                {
                                    instance?.MyFundingTab?.MAdapter?.FundingList.Remove(dataMyFunding);
                                    instance.MyFundingTab?.MAdapter?.NotifyItemRemoved(instance.MyFundingTab.MAdapter.FundingList.IndexOf(dataMyFunding));
                                }

                                var recycler    = TabbedMainActivity.GetInstance()?.NewsFeedTab?.MainRecyclerView;
                                var dataGlobal2 = recycler?.NativeFeedAdapter.ListDiffer?.Where(a => a.PostData?.FundId == DataObject.Id).ToList();
                                if (dataGlobal2 != null)
                                {
                                    foreach (var postData in dataGlobal2)
                                    {
                                        recycler.RemoveByRowIndex(postData);
                                    }
                                }

                                var adapterGlobal = WRecyclerView.GetInstance()?.NativeFeedAdapter;
                                var diff          = adapterGlobal?.ListDiffer;
                                var dataGlobal    = diff?.Where(a => a.PostData?.FundId == DataObject.Id).ToList();
                                if (dataGlobal != null)
                                {
                                    foreach (var postData in dataGlobal)
                                    {
                                        WRecyclerView.GetInstance()?.RemoveByRowIndex(postData);
                                    }
                                }

                                Toast.MakeText(this, GetText(Resource.String.Lbl_postSuccessfullyDeleted), ToastLength.Short)?.Show();
                            }
                            else
                            {
                                Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                            }
                        }
                        catch (Exception e)
                        {
                            Methods.DisplayReportResultTrack(e);
                        }
                    });
                    dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.ItemsCallback(this).Build().Show();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }