public void OnInput(MaterialDialog p0, ICharSequence p1) { try { if (p1.Length() > 0) { var strName = p1.ToString(); if (!Methods.CheckConnectivity()) { Toast.MakeText(MainContext, Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } else { if (TypeClass == "Comment") { //TypeClass var adapterGlobal = MainContext?.CommentsFragment?.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 adapterGlobal1 = GlobalPlayerActivity.GetInstance()?.CommentsFragment?.MAdapter; var dataGlobal1 = adapterGlobal1?.CommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal1 != null) { dataGlobal1.Text = strName; var index = adapterGlobal1.CommentList.IndexOf(dataGlobal1); if (index > -1) { adapterGlobal1.NotifyItemChanged(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comments.Edit_Comment_Http(CommentObject.Id.ToString(), strName) }); } else if (TypeClass == "Reply") { //TypeClass var adapterGlobal = ReplyCommentBottomSheet.GetInstance()?.ReplyAdapter; var dataGlobal = adapterGlobal?.ReplyList?.FirstOrDefault(a => a.Id == ReplyObject?.Id); if (dataGlobal != null) { dataGlobal.Text = strName; var index = adapterGlobal.ReplyList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.NotifyItemChanged(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comments.Edit_Comment_Reply_Http(ReplyObject.Id.ToString(), strName) }); } } } } catch (Exception e) { Console.WriteLine(e); } }
public MaterialDialogAdapter(MaterialDialog dialog, int resource, int textViewResourceId, string[] objects) : base(dialog.mBuilder.context, resource, textViewResourceId, objects) { this.dialog = dialog; itemColor = DialogUtils.ResolveColor(Context, Resource.Attribute.md_item_color, dialog.defaultItemColor); }
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 ? 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(Activity, GetText(Resource.String.Lbl_VerificationFailed), GetText(Resource.String.Lbl_IsEmailValid), GetText(Resource.String.Lbl_Ok)); return; } Toast.MakeText(Context, Context.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(Context, Context.GetText(Resource.String.Lbl_Please_wait), ToastLength.Short)?.Show(); await PaySera(); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString) { try { string text = itemString.ToString(); if (text == Activity.GetText(Resource.String.Lbl_Edit)) { if (Methods.CheckConnectivity()) { TypeDialog = "EditComment"; new MaterialDialog.Builder(Activity) .Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light) .Title(Resource.String.Lbl_Edit) .InputType(InputTypes.ClassText | InputTypes.TextVariationPersonName | InputTypes.TextFlagCapWords) .PositiveText(Activity.GetText(Resource.String.Lbl_Save)).OnPositive(this) .NegativeText(Resource.String.Lbl_Cancel).OnNegative(this) .Input(Activity.GetText(Resource.String.Lbl_AddCommentHere), ItemComments.Text, this) .Build().Show(); } else { Toast.MakeText(Activity, Activity.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } else if (text == Activity.GetText(Resource.String.Lbl_Delete)) { if (Methods.CheckConnectivity()) { var data = MAdapter.CommentList.FirstOrDefault(a => a.Id == ItemComments?.Id); if (data != null) { MAdapter.CommentList.Remove(data); int index = MAdapter.CommentList.IndexOf(data); if (index >= 0) { MAdapter.NotifyItemRemoved(index); } //Send api delete PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Activities.DeleteCommentActivity_Http(ItemActivity.Id) }); } } else { Toast.MakeText(Activity, Activity.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } else if (text == Activity.GetText(Resource.String.Lbl_Copy)) { CopyLinkEvent(Methods.FunString.DecodeString(ItemComments.Text)); } } catch (Exception e) { Console.WriteLine(e); } }
public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString) { try { string text = itemString.ToString(); if (TypeDialog == "Status") { TxtStatus.Text = text; if (text == GetText(Resource.String.Lbl_All)) { Status = "all"; } else if (text == GetText(Resource.String.Lbl_Offline)) { Status = "off"; } else if (text == GetText(Resource.String.Lbl_Online)) { Status = "on"; } } else if (TypeDialog == "Verified") { TxtVerified.Text = text; if (text == GetText(Resource.String.Lbl_All)) { Verified = "all"; } else if (text == GetText(Resource.String.Lbl_UnVerified)) { Verified = "off"; } else if (text == GetText(Resource.String.Lbl_Verified)) { Verified = "on"; } } else if (TypeDialog == "ProfilePicture") { TxtProfilePicture.Text = text; if (text == GetText(Resource.String.Lbl_All)) { ProfilePicture = "all"; } else if (text == GetText(Resource.String.Lbl_Yes)) { ProfilePicture = "yes"; } else if (text == GetText(Resource.String.Lbl_No)) { ProfilePicture = "no"; } } else if (TypeDialog == "Location") { string[] countriesArray = Context.Resources?.GetStringArray(Resource.Array.countriesArray); var check = countriesArray.FirstOrDefault(a => a == text); if (check != null) { Location = check == GetText(Resource.String.Lbl_All) ? "all" : (itemId).ToString(); } LocationPlace.Text = itemString.ToString(); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public static void HideKeyboard(Dialog di, MaterialDialog.Builder builder) { MaterialDialog dialog = (MaterialDialog)di; if (dialog.GetInputEditText() == null) return; dialog.GetInputEditText().Post(() => { dialog.GetInputEditText().RequestFocus(); InputMethodManager imm = (InputMethodManager)builder.Context.GetSystemService(Context.InputMethodService); if (imm != null) imm.HideSoftInputFromWindow(dialog.GetInputEditText().WindowToken, 0); }); }
protected override void ShowDialog(Bundle state) { List <int> indices = new List <int>(); foreach (String s in Values) { int index = FindIndexOfValue(s); if (index >= 0) { indices.Add(FindIndexOfValue(s)); } } MaterialDialog.Builder builder = new MaterialDialog.Builder(context) .SetTitle(DialogTitle) .SetContent(DialogMessage) .SetIcon(DialogIcon) .SetNegativeText(NegativeButtonText) .SetPositiveText(PositiveButtonText) .SetCallback(new ButtonCallback() { Neutral = (x) => { OnClick(x, (int)DialogButtonType.Neutral); }, Negative = (x) => { OnClick(x, (int)DialogButtonType.Negative); }, Positive = (x) => { OnClick(x, (int)DialogButtonType.Positive); } }) .SetItems(GetEntries()) .SetItemsCallbackMultiChoice(indices.ToArray(), new ListCallbackMultiChoice { Selection = (dialog, which, text) => { OnClick(null, (int)DialogButtonType.Positive); dialog.Dismiss(); ISet <String> values = new HashSet <String>(); foreach (int i in which) { values.Add(GetEntryValues()[i]); } if (CallChangeListener((Java.Lang.Object)values)) { Values = values; } return(true); } }).SetDismissListener(this); View contentView = OnCreateDialogView(); if (contentView != null) { OnBindDialogView(contentView); builder.SetCustomView(contentView, false); } else { builder.SetContent(DialogMessage); } try { PreferenceManager pm = PreferenceManager; Method method = pm.Class.GetDeclaredMethod( "registerOnActivityDestroyListener", Java.Lang.Class.FromType(typeof(PreferenceManager.IOnActivityDestroyListener))); method.Accessible = true; method.Invoke(pm, this); } catch (Exception) { } mDialog = builder.Build(); if (state != null) { mDialog.OnRestoreInstanceState(state); } mDialog.Show(); }
public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString) { try { if (TypeDialog == "Genders") { if (itemString.ToString() == GetText(Resource.String.Lbl_All)) { TxtGender.Text = GetText(Resource.String.Lbl_All); GenderStatus = "all"; } else { if (ListUtils.SettingsSiteList?.Genders?.Count > 0) { var key = ListUtils.SettingsSiteList?.Genders?.FirstOrDefault(a => a.Value == itemString.ToString()).Key; if (key != null) { TxtGender.Text = itemString.ToString(); GenderStatus = key; } else { TxtGender.Text = itemString.ToString(); GenderStatus = "male"; } } else { if (itemString.ToString() == GetText(Resource.String.Radio_Male)) { TxtGender.Text = GetText(Resource.String.Radio_Male); GenderStatus = "male"; } else if (itemString.ToString() == GetText(Resource.String.Radio_Female)) { TxtGender.Text = GetText(Resource.String.Radio_Female); GenderStatus = "female"; } else { TxtGender.Text = GetText(Resource.String.Radio_Male); GenderStatus = "male"; } } } } else if (TypeDialog == "Country") { TxtLocation.Text = itemString.ToString(); } else if (TypeDialog == "MyPages") { var dataPage = ListUtils.MyPageList[itemId]; if (dataPage != null) { TxtWebsite.Text = dataPage.Url; } TxtMyPages.Text = itemString.ToString(); } else if (TypeDialog == "Placement") { if (itemString.ToString() == GetText(Resource.String.Lbl_PlacementPost)) { PlacementStatus = "post"; } else if (itemString.ToString() == GetText(Resource.String.Lbl_PlacementSidebar)) { PlacementStatus = "sidebar"; } TxtPlacement.Text = itemString.ToString(); } else if (TypeDialog == "Bidding") { if (itemString.ToString() == GetText(Resource.String.Lbl_BiddingClick)) { BiddingStatus = "clicks"; } else if (itemString.ToString() == GetText(Resource.String.Lbl_BiddingViews)) { BiddingStatus = "views"; } TxtBidding.Text = itemString.ToString(); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString) { try { var txt = itemString.ToString(); if (txt == GetString(Resource.String.Lbl_ImageGallery)) { OpenDialogGallery("Image"); } else if (txt == GetString(Resource.String.Lbl_TakeImageFromCamera)) { ImageType = "Camera"; // Check if we're running on Android 5.0 or higher if ((int)Build.VERSION.SdkInt < 23) { //requestCode >> 503 => Camera new IntentController(this).OpenIntentCamera(); } else { if (CheckSelfPermission(Manifest.Permission.Camera) == Permission.Granted && CheckSelfPermission(Manifest.Permission.ReadExternalStorage) == Permission.Granted && CheckSelfPermission(Manifest.Permission.WriteExternalStorage) == Permission.Granted) { //requestCode >> 503 => Camera new IntentController(this).OpenIntentCamera(); } else { new PermissionsController(this).RequestPermission(108); } } } else if (txt == GetString(Resource.String.Lbl_VideoGallery)) { ImageType = "VideoGallery"; // Check if we're running on Android 5.0 or higher if ((int)Build.VERSION.SdkInt < 23) { //requestCode >> 501 => video Gallery new IntentController(this).OpenIntentVideoGallery(); } else { if (CheckSelfPermission(Manifest.Permission.Camera) == Permission.Granted && CheckSelfPermission(Manifest.Permission.ReadExternalStorage) == Permission.Granted && CheckSelfPermission(Manifest.Permission.WriteExternalStorage) == Permission.Granted) { //requestCode >> 501 => video Gallery new IntentController(this).OpenIntentVideoGallery(); } else { new PermissionsController(this).RequestPermission(108); } } } else if (txt == GetString(Resource.String.Lbl_RecordVideoFromCamera)) { ImageType = "VideoCamera"; // Check if we're running on Android 5.0 or higher if ((int)Build.VERSION.SdkInt < 23) { //requestCode >> 513 => video Camera new IntentController(this).OpenIntentVideoCamera(); } else { if (CheckSelfPermission(Manifest.Permission.Camera) == Permission.Granted && CheckSelfPermission(Manifest.Permission.ReadExternalStorage) == Permission.Granted && CheckSelfPermission(Manifest.Permission.WriteExternalStorage) == Permission.Granted) { //requestCode >> 513 => video Camera new IntentController(this).OpenIntentVideoCamera(); } else { new PermissionsController(this).RequestPermission(108); } } } } catch (Exception e) { Console.WriteLine(e); } }
public void SetDialog(MaterialDialog dialog) { SetDialog(dialog, true); }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (TypeDialog == "DeleteComment") { if (p1 == DialogAction.Positive) { MainContext.RunOnUiThread(() => { try { if (TypeClass == "Comment") { //TypeClass var adapterGlobal = ArticlesViewActivity.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); } } if (!Methods.CheckConnectivity()) { Toast.MakeText(MainContext, MainContext.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); } else { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Article.DeleteCommentAsync(CommentObject.BlogId, CommentObject.Id) }); } } else if (TypeClass == "Reply") { //TypeClass var adapterGlobal = ArticlesViewActivity.GetInstance()?.ReplyFragment?.MAdapterArticles; 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); } } if (!Methods.CheckConnectivity()) { Toast.MakeText(MainContext, MainContext.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); } else { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Article.DeleteCommentAsync(CommentObject.BlogId, CommentObject.Id, "reply_delete") }); } } Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CommentSuccessfullyDeleted), ToastLength.Short)?.Show(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }); } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } else { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void OnInput(MaterialDialog p0, ICharSequence p1) { try { if (p1.Length() > 0) { var strName = p1.ToString(); if (!Methods.CheckConnectivity()) { Toast.MakeText(MainContext, Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } else { if (TypeClass == "Comment") { //TypeClass var adapterGlobal = MainContext?.CommentsFragment?.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 adapterGlobal1 = GlobalPlayerActivity.GetInstance()?.CommentsFragment?.MAdapter; //var dataGlobal1 = adapterGlobal1?.CommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); //if (dataGlobal1 != null) //{ // dataGlobal1.Text = strName; // var index = adapterGlobal1.CommentList.IndexOf(dataGlobal1); // if (index > -1) // { // adapterGlobal1.NotifyItemChanged(index); // } //} //PollyController.RunRetryPolicyFunction(new List<Func<Task>> { () => RequestsAsync.Comments.Edit_Comment_Http(CommentObject.Id.ToString(), strName) }); Task.Run(async() => { using (var client = new System.Net.Http.HttpClient()) { var formContent = new System.Net.Http.FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("server_key", "0913cbbd8c729a5db4db40e4aa267a17"), new KeyValuePair <string, string>("type", "edit"), new KeyValuePair <string, string>("comment_id", CommentObject.Id.ToString()), new KeyValuePair <string, string>("text", strName), new KeyValuePair <string, string>("user_id", UserDetails.UserId), new KeyValuePair <string, string>("s", UserDetails.AccessToken) }); // send a Post request var uri = PlayTubeClient.Client.WebsiteUrl + "/api/v1.0/?type=response_comments"; var result = await client.PostAsync(uri, formContent); if (result.IsSuccessStatusCode) { // handling the answer var resultString = await result.Content.ReadAsStringAsync(); var jConfigObject = Newtonsoft.Json.Linq.JObject.Parse(resultString); if (jConfigObject["api_status"].ToString() == "200") { } } } }); } else if (TypeClass == "Reply") { //TypeClass var adapterGlobal = ReplyResponseCommentBottomSheet.GetInstance()?.ReplyAdapter; var dataGlobal = adapterGlobal?.ReplyList?.FirstOrDefault(a => a.Id == ReplyObject?.Id); if (dataGlobal != null) { dataGlobal.Text = strName; var index = adapterGlobal.ReplyList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.NotifyItemChanged(index); } } //PollyController.RunRetryPolicyFunction(new List<Func<Task>> { () => RequestsAsync.Comments.Edit_Comment_Reply_Http(ReplyObject.Id.ToString(), strName) }); Task.Run(async() => { using (var client = new System.Net.Http.HttpClient()) { var formContent = new System.Net.Http.FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("server_key", "0913cbbd8c729a5db4db40e4aa267a17"), new KeyValuePair <string, string>("type", "edit"), new KeyValuePair <string, string>("reply_id", ReplyObject.Id.ToString()), new KeyValuePair <string, string>("text", strName), new KeyValuePair <string, string>("user_id", UserDetails.UserId), new KeyValuePair <string, string>("s", UserDetails.AccessToken) }); // send a Post request var uri = PlayTubeClient.Client.WebsiteUrl + "/api/v1.0/?type=response_comments"; var result = await client.PostAsync(uri, formContent); if (result.IsSuccessStatusCode) { // handling the answer var resultString = await result.Content.ReadAsStringAsync(); var jConfigObject = Newtonsoft.Json.Linq.JObject.Parse(resultString); if (jConfigObject["api_status"].ToString() == "200") { } } } }); } } } } catch (Exception e) { Console.WriteLine(e); } }
protected override void ShowDialog(Bundle state) { if (GetEntries() == null || GetEntryValues() == null) { throw new InvalidOperationException( "ListPreference requires an entries array and an entryValues array."); } int preselect = FindIndexOfValue(Value); MaterialDialog.Builder builder = new MaterialDialog.Builder(context) .SetTitle(DialogTitle) .SetContent(DialogMessage) .SetIcon(DialogIcon) .SetDismissListener(this) .SetCallback(new ButtonCallback() { Neutral = (x) => { OnClick(x, (int)DialogButtonType.Neutral); }, Negative = (x) => { OnClick(x, (int)DialogButtonType.Negative); }, Positive = (x) => { OnClick(x, (int)DialogButtonType.Positive); } }) .SetNegativeText(NegativeButtonText) .SetItems(GetEntries()) .SetAutoDismiss(true) .SetItemsCallbackSingleChoice(preselect, new ListCallbackSingleChoice { Selection = (dialog, itemView, which, text) => { OnClick(null, (int)DialogButtonType.Positive); if (which >= 0 && GetEntryValues() != null) { try { Field clickedIndex = this.Class.GetDeclaredField("mClickedDialogEntryIndex"); clickedIndex.Accessible = true; clickedIndex.Set(this, which); } catch (Exception e) { throw e; } } return true; } }); View contentView = OnCreateDialogView(); if (contentView != null) { OnBindDialogView(contentView); builder.SetCustomView(contentView, false); } else { builder.SetContent(DialogMessage); } try { PreferenceManager pm = PreferenceManager; Method method = pm.Class.GetDeclaredMethod( "registerOnActivityDestroyListener", Java.Lang.Class.FromType(typeof(PreferenceManager.IOnActivityDestroyListener))); method.Accessible = true; method.Invoke(pm, this); } catch (Exception) { } mDialog = builder.Build(); if (state != null) mDialog.OnRestoreInstanceState(state); mDialog.Show(); }
protected override void ShowDialog(Bundle state) { List<int> indices = new List<int>(); foreach (String s in Values) { int index = FindIndexOfValue(s); if (index >= 0) indices.Add(FindIndexOfValue(s)); } MaterialDialog.Builder builder = new MaterialDialog.Builder(context) .SetTitle(DialogTitle) .SetContent(DialogMessage) .SetIcon(DialogIcon) .SetNegativeText(NegativeButtonText) .SetPositiveText(PositiveButtonText) .SetCallback(new ButtonCallback() { Neutral = (x) => { OnClick(x, (int)DialogButtonType.Neutral); }, Negative = (x) => { OnClick(x, (int)DialogButtonType.Negative); }, Positive = (x) => { OnClick(x, (int)DialogButtonType.Positive); } }) .SetItems(GetEntries()) .SetItemsCallbackMultiChoice(indices.ToArray(), new ListCallbackMultiChoice { Selection = (dialog, which, text) => { OnClick(null, (int)DialogButtonType.Positive); dialog.Dismiss(); ISet<String> values = new HashSet<String>(); foreach (int i in which) { values.Add(GetEntryValues()[i]); } if (CallChangeListener((Java.Lang.Object)values)) Values = values; return true; } }).SetDismissListener(this); View contentView = OnCreateDialogView(); if (contentView != null) { OnBindDialogView(contentView); builder.SetCustomView(contentView, false); } else { builder.SetContent(DialogMessage); } try { PreferenceManager pm = PreferenceManager; Method method = pm.Class.GetDeclaredMethod( "registerOnActivityDestroyListener", Java.Lang.Class.FromType(typeof(PreferenceManager.IOnActivityDestroyListener))); method.Accessible = true; method.Invoke(pm, this); } catch (Exception) { } mDialog = builder.Build(); if (state != null) mDialog.OnRestoreInstanceState(state); mDialog.Show(); }
public void OnClick(MaterialDialog p0, DialogAction p1) { }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (TypeDialog == "DeletePost") { var home = (HomeActivity)MainContext; if (p1 == DialogAction.Positive) { MainContext.RunOnUiThread(() => { try { var list = home.NewsFeedFragment?.NewsFeedAdapter?.PixelNewsFeedList; var dataPost = list?.FirstOrDefault(a => a.PostId == MoreFeedArgs.NewsFeedClass.PostId); if (dataPost != null) { int index = list.IndexOf(dataPost); if (index >= 0) { home.NewsFeedFragment.NewsFeedAdapter?.PixelNewsFeedList?.Remove(dataPost); home.NewsFeedFragment.NewsFeedAdapter?.NotifyItemRemoved(index); } } if (AppSettings.ProfileTheme == ProfileTheme.DefaultTheme) { var dataPostProfile = home.ProfileFragment?.UserPostAdapter?.PostList?.FirstOrDefault(a => a.PostId == MoreFeedArgs.NewsFeedClass.PostId); if (dataPostProfile != null) { int index = home.ProfileFragment.UserPostAdapter.PostList.IndexOf(dataPostProfile); if (index >= 0) { home.ProfileFragment?.UserPostAdapter?.PostList.Remove(dataPostProfile); home.ProfileFragment?.UserPostAdapter?.NotifyItemRemoved(index); } } } else if (AppSettings.ProfileTheme == ProfileTheme.TikTheme) { var dataPostProfile = home.TikProfileFragment?.MyPostTab?.MAdapter?.PostList?.FirstOrDefault(a => a.PostId == MoreFeedArgs.NewsFeedClass.PostId); if (dataPostProfile != null) { int index = home.TikProfileFragment.MyPostTab.MAdapter.PostList.IndexOf(dataPostProfile); if (index >= 0) { home.TikProfileFragment?.MyPostTab?.MAdapter?.PostList.Remove(dataPostProfile); home.TikProfileFragment?.MyPostTab?.MAdapter?.NotifyItemRemoved(index); } } } //Delete post from list if (NamePage == "HashTags") { //Delete post from list //TODO Wael //var dataPostHashTags = HashTagPostFragment.HashTagAdapter?.PixelNewsFeedList?.FirstOrDefault(a => a.PostId == MoreFeedArgs.NewsFeedClass.PostId); //if (dataPostHashTags != null) //{ // HashTagPostFragment.HashTagAdapter?.Remove(dataPostHashTags); //} } else if (NamePage == "GifPost" || NamePage == "ImagePost" || NamePage == "MultiImagePost" || NamePage == "VideoPost" || NamePage == "YoutubePost") { home.FragmentNavigatorBack(); home.NewsFeedFragment.NewsFeedAdapter?.NotifyDataSetChanged(); } else if (NamePage == "NewsFeedPost") { } //SqLiteDatabase dbDatabase = new SqLiteDatabase(); //dbDatabase.RemoveOneNewsFeedPost(MoreFeedArgs.NewsFeedClass.PostId); //dbDatabase.Dispose(); Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_postSuccessfullyDeleted), ToastLength.Short).Show(); //Sent Api >> RequestsAsync.Post.DeletePosts(MoreFeedArgs.NewsFeedClass.PostId.ToString()).ConfigureAwait(false); } catch (Exception e) { Console.WriteLine(e); } }); } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } else { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } } catch (Exception e) { Console.WriteLine(e); } }
public void OnInput(MaterialDialog p0, ICharSequence p1) { try { if (TypeDialog == "Listening") { if (p1.Length() > 0) { var strName = p1.ToString(); var resultIntent = new Intent(); resultIntent.PutExtra("ActivitiesType", "listening"); resultIntent.PutExtra("ActivitiesText", strName); SetResult(Result.Ok, resultIntent); Finish(); } } else if (TypeDialog == "Playing") { if (p1.Length() > 0) { var strName = p1.ToString(); var resultIntent = new Intent(); resultIntent.PutExtra("ActivitiesType", "playing"); resultIntent.PutExtra("ActivitiesText", strName); SetResult(Result.Ok, resultIntent); Finish(); } } else if (TypeDialog == "Watching") { if (p1.Length() > 0) { var strName = p1.ToString(); var resultIntent = new Intent(); resultIntent.PutExtra("ActivitiesType", "watching"); resultIntent.PutExtra("ActivitiesText", strName); SetResult(Result.Ok, resultIntent); Finish(); } } else if (TypeDialog == "Traveling") { if (p1.Length() > 0) { var strName = p1.ToString(); var resultIntent = new Intent(); resultIntent.PutExtra("ActivitiesType", "traveling"); resultIntent.PutExtra("ActivitiesText", strName); SetResult(Result.Ok, resultIntent); Finish(); } } } catch (Exception e) { Crashes.TrackError(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); } }
public void OnSelection(MaterialDialog p0, View p1, int p2, ICharSequence p3) { }
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 OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString) { try { switch (TypeDialog) { case "Categories": CategoryId = CategoriesController.ListCategoriesJob.FirstOrDefault(categories => categories.CategoriesName == itemString.ToString())?.CategoriesId; TxtCategory.Text = itemString.ToString(); break; case "JobType": JobTypeId = WoWonderTools.GetJobTypeList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString(); TxtJobType.Text = itemString.ToString(); break; case "SalaryDate": SalaryDateId = WoWonderTools.GetSalaryDateList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString(); TxtSalaryDate.Text = itemString.ToString(); break; case "Currency": TxtCurrency.Text = itemString.ToString(); CurrencyId = WoWonderTools.GetIdCurrency(itemString.ToString()); break; case "AddQuestion": { TxtAddQuestion.Text = GetText(Resource.String.Lbl_AddQuestion) + "(" + MAdapter.ItemCount + ")"; var addQuestionId = WoWonderTools.GetAddQuestionList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString(); //SetQuestionOne(addQuestionId); MAdapter.QuestionList.Add(new QuestionJob { Id = MAdapter.ItemCount, QuestionType = addQuestionId }); MAdapter.NotifyItemInserted(MAdapter.QuestionList.IndexOf(MAdapter.QuestionList.Last())); break; } case "AddQuestionAdapter": { TxtAddQuestion.Text = GetText(Resource.String.Lbl_AddQuestion) + "(" + MAdapter.ItemCount + ")"; var addQuestionId = WoWonderTools.GetAddQuestionList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString(); var data = MAdapter.QuestionList.FirstOrDefault(a => a.Id == ItemQuestionJob.Id && a.QuestionType == ItemQuestionJob.QuestionType); if (data != null) { data.QuestionType = addQuestionId; MAdapter.NotifyItemChanged(MAdapter.QuestionList.IndexOf(data)); } break; } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString) { try { string text = itemString.ToString(); if (text == GetString(Resource.String.Lbl_Light)) { AppCompatDelegate.DefaultNightMode = AppCompatDelegate.ModeNightNo; AppSettings.SetTabDarkTheme = false; MainSettings.SharedNightMode.Edit().PutString("Night_Mode_key", MainSettings.LightMode).Commit(); if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { Window.ClearFlags(WindowManagerFlags.TranslucentStatus); Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); } Intent intent = new Intent(this, typeof(SplashScreenActivity)); intent.AddCategory(Intent.CategoryHome); intent.SetAction(Intent.ActionMain); intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask | ActivityFlags.ClearTask); StartActivity(intent); FinishAffinity(); } else if (text == GetString(Resource.String.Lbl_Dark)) { AppCompatDelegate.DefaultNightMode = AppCompatDelegate.ModeNightYes; AppSettings.SetTabDarkTheme = true; MainSettings.SharedNightMode.Edit().PutString("Night_Mode_key", MainSettings.DarkMode).Commit(); if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { Window.ClearFlags(WindowManagerFlags.TranslucentStatus); Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); } Intent intent = new Intent(this, typeof(SplashScreenActivity)); intent.AddCategory(Intent.CategoryHome); intent.SetAction(Intent.ActionMain); intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask | ActivityFlags.ClearTask); StartActivity(intent); FinishAffinity(); } else if (text == GetString(Resource.String.Lbl_SetByBattery)) { MainSettings.SharedNightMode.Edit().PutString("Night_Mode_key", MainSettings.DefaultMode).Commit(); if ((int)Build.VERSION.SdkInt >= 29) { AppCompatDelegate.DefaultNightMode = AppCompatDelegate.ModeNightFollowSystem; var currentNightMode = Resources.Configuration.UiMode & UiMode.NightMask; switch (currentNightMode) { case UiMode.NightNo: // Night mode is not active, we're using the light theme AppSettings.SetTabDarkTheme = false; break; case UiMode.NightYes: // Night mode is active, we're using dark theme AppSettings.SetTabDarkTheme = true; break; } } else { AppCompatDelegate.DefaultNightMode = AppCompatDelegate.ModeNightAuto; var currentNightMode = Resources.Configuration.UiMode & UiMode.NightMask; switch (currentNightMode) { case UiMode.NightNo: // Night mode is not active, we're using the light theme AppSettings.SetTabDarkTheme = false; break; case UiMode.NightYes: // Night mode is active, we're using dark theme AppSettings.SetTabDarkTheme = true; break; } if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { Window.ClearFlags(WindowManagerFlags.TranslucentStatus); Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); } Intent intent = new Intent(this, typeof(SplashScreenActivity)); intent.AddCategory(Intent.CategoryHome); intent.SetAction(Intent.ActionMain); intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask | ActivityFlags.ClearTask); StartActivity(intent); FinishAffinity(); } } } catch (Exception e) { Console.WriteLine(e); } }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (TypeDialog == "DeleteSong") { if (p1 == DialogAction.Positive) { MainContext.RunOnUiThread(() => { try { if (Methods.CheckConnectivity()) { SoundDataObject dataSong = null; dynamic mAdapter = null; switch (NamePage) { //Delete Song from list case "FavoritesFragment": dataSong = GlobalContext?.LibraryFragment?.FavoritesFragment?.MAdapter?.SoundsList?.FirstOrDefault(a => a.Id == MoreSongArgs.SongsClass.Id); mAdapter = GlobalContext?.LibraryFragment?.FavoritesFragment?.MAdapter; break; case "LatestDownloadsFragment": dataSong = GlobalContext?.LibraryFragment?.LatestDownloadsFragment?.MAdapter?.SoundsList?.FirstOrDefault(a => a.Id == MoreSongArgs.SongsClass.Id); mAdapter = GlobalContext?.LibraryFragment?.LatestDownloadsFragment?.MAdapter; break; case "LikedFragment": dataSong = GlobalContext?.LibraryFragment?.LikedFragment?.MAdapter?.SoundsList?.FirstOrDefault(a => a.Id == MoreSongArgs.SongsClass.Id); mAdapter = GlobalContext?.LibraryFragment?.LikedFragment?.MAdapter; break; case "RecentlyPlayedFragment": dataSong = GlobalContext?.LibraryFragment?.RecentlyPlayedFragment?.MAdapter?.SoundsList?.FirstOrDefault(a => a.Id == MoreSongArgs.SongsClass.Id); mAdapter = GlobalContext?.LibraryFragment?.RecentlyPlayedFragment?.MAdapter; break; case "SharedFragment": dataSong = GlobalContext?.LibraryFragment?.SharedFragment?.MAdapter?.SoundsList?.FirstOrDefault(a => a.Id == MoreSongArgs.SongsClass.Id); mAdapter = GlobalContext?.LibraryFragment?.SharedFragment?.MAdapter; break; case "PurchasesFragment": dataSong = GlobalContext?.LibraryFragment?.PurchasesFragment?.MAdapter?.SoundsList?.FirstOrDefault(a => a.Id == MoreSongArgs.SongsClass.Id); mAdapter = GlobalContext?.LibraryFragment?.PurchasesFragment?.MAdapter; break; case "SongsByGenresFragment": dataSong = GlobalContext?.MainFragment?.SongsByGenresFragment?.MAdapter?.SoundsList?.FirstOrDefault(a => a.Id == MoreSongArgs.SongsClass.Id); mAdapter = GlobalContext?.MainFragment?.SongsByGenresFragment?.MAdapter; break; case "SongsByTypeFragment": dataSong = GlobalContext?.MainFragment?.SongsByTypeFragment?.MAdapter?.SoundsList?.FirstOrDefault(a => a.Id == MoreSongArgs.SongsClass.Id); mAdapter = GlobalContext?.MainFragment?.SongsByTypeFragment?.MAdapter; break; case "SearchSongsFragment": dataSong = GlobalContext?.BrowseFragment?.SearchFragment?.SongsTab?.MAdapter?.SoundsList?.FirstOrDefault(a => a.Id == MoreSongArgs.SongsClass.Id); mAdapter = GlobalContext?.BrowseFragment?.SearchFragment?.SongsTab?.MAdapter; break; } if (mAdapter != null) { if (dataSong is SoundDataObject data) { mAdapter.SoundsList.Remove(data); int index = mAdapter.SoundsList.IndexOf(data); if (index >= 0) { mAdapter.NotifyItemRemoved(index); } } } Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_SongSuccessfullyDeleted), ToastLength.Short).Show(); //Sent Api >> PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Tracks.DeleteTrackAsync(MoreSongArgs.SongsClass.Id.ToString()) }); } else { Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } catch (Exception e) { Console.WriteLine(e); } }); } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } else { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } } catch (Exception e) { Console.WriteLine(e); } }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (DialogType == "Delete") { if (p1 == DialogAction.Positive) { // Send Api delete if (Methods.CheckConnectivity()) { var adapterGlobal = WRecyclerView.GetInstance()?.NativeFeedAdapter; var diff = adapterGlobal?.ListDiffer; var dataGlobal = diff?.Where(a => a.PostData?.OfferId == DataInfoObject?.Id).ToList(); if (dataGlobal != null) { foreach (var postData in dataGlobal) { WRecyclerView.GetInstance()?.RemoveByRowIndex(postData); } } var recycler = TabbedMainActivity.GetInstance()?.NewsFeedTab?.MainRecyclerView; var dataGlobal2 = recycler?.NativeFeedAdapter.ListDiffer?.Where(a => a.PostData?.OfferId == DataInfoObject?.Id).ToList(); if (dataGlobal2 != null) { foreach (var postData in dataGlobal2) { recycler.RemoveByRowIndex(postData); } } Toast.MakeText(this, GetText(Resource.String.Lbl_postSuccessfullyDeleted), ToastLength.Short)?.Show(); PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Offers.DeleteOffer(DataInfoObject.Id) }); } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); } } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } else { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { switch (DialogType) { case "Delete" when p1 == DialogAction.Positive: { // Send Api delete if (Methods.CheckConnectivity()) { var adapterGlobal = WRecyclerView.GetInstance()?.NativeFeedAdapter; var diff = adapterGlobal?.ListDiffer; var dataGlobal = diff?.Where(a => a.PostData?.PostId == DataInfoObject?.PostId).ToList(); if (dataGlobal != null) { foreach (var postData in dataGlobal) { WRecyclerView.GetInstance()?.RemoveByRowIndex(postData); } } var recycler = TabbedMainActivity.GetInstance()?.NewsFeedTab?.MainRecyclerView; var dataGlobal2 = recycler?.NativeFeedAdapter.ListDiffer?.Where(a => a.PostData?.PostId == DataInfoObject?.PostId).ToList(); if (dataGlobal2 != null) { foreach (var postData in dataGlobal2) { recycler.RemoveByRowIndex(postData); } } var dataJob = JobList?.FirstOrDefault(a => a.Id == DataInfoObject.Id); if (dataJob != null) { JobList.Remove(dataJob); NotifyItemRemoved(JobsActivity.GetInstance().MAdapter.JobList.IndexOf(dataJob)); } Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_postSuccessfullyDeleted), ToastLength.Short)?.Show(); PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Posts.PostActionsAsync(DataInfoObject.PostId, "delete") }); } else { Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); } break; } case "Delete": { if (p1 == DialogAction.Negative) { p0.Dismiss(); } break; } default: { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } break; } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
protected override void ShowDialog(Bundle state) { var mBuilder = new MaterialDialog.Builder(Context) .SetTitle(DialogTitle) .SetIcon(DialogIcon) .SetPositiveText(PositiveButtonText) .SetNegativeText(NegativeButtonText) .SetDismissListener(this) .SetCallback(new ButtonCallback { Positive = (x) => { OnClick(x, (int)DialogButtonType.Positive); String value = mEditText.Text; if (CallChangeListener(value) && Persistent) { Text = value; } }, Neutral = (x) => { OnClick(x, (int)DialogButtonType.Neutral); }, Negative = (x) => { OnClick(x, (int)DialogButtonType.Negative); } }) .SetDismissListener(this); View layout = LayoutInflater.From(Context).Inflate(Resource.Layout.sino_droid_md_stub_inputpref, null); OnBindDialogView(layout); MDTintHelper.SetTint(mEditText, mColor); TextView message = layout.FindViewById <TextView>(Android.Resource.Id.Message); if (DialogMessage != null && DialogMessage.Length > 0) { message.Visibility = ViewStates.Visible; message.Text = DialogMessage; } else { message.Visibility = ViewStates.Gone; } mBuilder.SetCustomView(layout, false); try { var pm = PreferenceManager; Java.Lang.Reflect.Method method = pm.Class.GetDeclaredMethod( "registerOnActivityDestroyListener", Java.Lang.Class.FromType(typeof(PreferenceManager.IOnActivityDestroyListener))); method.Accessible = true; method.Invoke(pm, this); } catch (Exception) { } mDialog = mBuilder.Build(); if (state != null) { mDialog.OnRestoreInstanceState(state); } RequestInputMethod(mDialog); mDialog.Show(); }
protected override void ShowDialog(Bundle state) { var mBuilder = new MaterialDialog.Builder(Context) .SetTitle(DialogTitle) .SetIcon(DialogIcon) .SetPositiveText(PositiveButtonText) .SetNegativeText(NegativeButtonText) .SetDismissListener(this) .SetCallback(new ButtonCallback { Positive = (x) => { OnClick(x, (int)DialogButtonType.Positive); String value = mEditText.Text; if (CallChangeListener(value) && Persistent) Text = value; }, Neutral = (x) => { OnClick(x, (int)DialogButtonType.Neutral); }, Negative = (x) => { OnClick(x, (int)DialogButtonType.Negative); } }) .SetDismissListener(this); View layout = LayoutInflater.From(Context).Inflate(Resource.Layout.sino_droid_md_stub_inputpref, null); OnBindDialogView(layout); MDTintHelper.SetTint(mEditText, mColor); TextView message = layout.FindViewById<TextView>(Android.Resource.Id.Message); if (DialogMessage != null && DialogMessage.Length > 0) { message.Visibility = ViewStates.Visible; message.Text = DialogMessage; } else { message.Visibility = ViewStates.Gone; } mBuilder.SetCustomView(layout, false); try { var pm = PreferenceManager; Java.Lang.Reflect.Method method = pm.Class.GetDeclaredMethod( "registerOnActivityDestroyListener", Java.Lang.Class.FromType(typeof(PreferenceManager.IOnActivityDestroyListener))); method.Accessible = true; method.Invoke(pm, this); } catch (Exception) { } mDialog = mBuilder.Build(); if (state != null) mDialog.OnRestoreInstanceState(state); RequestInputMethod(mDialog); mDialog.Show(); }
public static Task <bool?> ShowDialog(this IDialogService dialogService, MaterialDialog dialog) => ShowDialog(dialogService, dialog, Route.SmallDialog);
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (p1 == DialogAction.Positive) { if (TypeDialog == "DeleteComment") { MainContext.RunOnUiThread(() => { try { if (TypeClass == "Comment") { //TypeClass var adapterGlobal = MainContext?.CommentsFragment?.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 adapterGlobal1 = GlobalPlayerActivity.GetInstance()?.CommentsFragment?.MAdapter; var dataGlobal1 = adapterGlobal1?.CommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal1 != null) { var index = adapterGlobal1.CommentList.IndexOf(dataGlobal1); if (index > -1) { adapterGlobal1.CommentList.RemoveAt(index); adapterGlobal1.NotifyItemRemoved(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comments.Delete_Comment_Http(CommentObject.Id.ToString()) }); } else if (TypeClass == "Reply") { //TypeClass var adapterGlobal = ReplyCommentBottomSheet.GetInstance()?.ReplyAdapter; var dataGlobal = adapterGlobal?.ReplyList?.FirstOrDefault(a => a.Id == ReplyObject?.Id); if (dataGlobal != null) { var index = adapterGlobal.ReplyList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.ReplyList.RemoveAt(index); adapterGlobal.NotifyItemRemoved(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comments.Delete_Reply_Http(ReplyObject.Id.ToString()) }); } 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 static Task <bool?> ShowDialog(this IDialogService dialogService, MaterialDialog dialog, double width) => dialogService.ShowTrackedDialog(dialog, width).Task;
public void OnInput(MaterialDialog p0, ICharSequence p1) { try { if (p1.Length() > 0) { var strName = p1.ToString(); if (Methods.CheckConnectivity()) { var dataUser = ListUtils.MyProfileList.FirstOrDefault(); if (SocialItem != null) { MAdapter.Update(SocialItem, strName); var dataPrivacy = new Dictionary <string, string>(); if (SocialItem.Id == 1) { dataPrivacy.Add("facebook", strName); if (dataUser != null) { dataUser.Facebook = strName; } } if (SocialItem.Id == 2) { dataPrivacy.Add("twitter", strName); if (dataUser != null) { dataUser.Twitter = strName; } } if (SocialItem.Id == 3) { dataPrivacy.Add("google", strName); if (dataUser != null) { dataUser.Google = strName; } } if (SocialItem.Id == 4) { dataPrivacy.Add("vk", strName); if (dataUser != null) { dataUser.Vk = strName; } } if (SocialItem.Id == 5) { dataPrivacy.Add("linkedin", strName); if (dataUser != null) { dataUser.Linkedin = strName; } } if (SocialItem.Id == 6) { dataPrivacy.Add("instagram", strName); if (dataUser != null) { dataUser.Instagram = strName; } } if (SocialItem.Id == 7) { dataPrivacy.Add("youtube", strName); if (dataUser != null) { dataUser.Youtube = strName; } } if (dataUser != null) { var sqLiteDatabase = new SqLiteDatabase(); sqLiteDatabase.Insert_Or_Update_To_MyProfileTable(dataUser); sqLiteDatabase.Dispose(); } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Update_User_Data(dataPrivacy) }); } } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show(); } } else { Toast.MakeText(this, GetText(Resource.String.Lbl_The_name_can_not_be_blank), ToastLength.Short).Show(); } } catch (Exception ex) { Console.WriteLine(ex); } }
private IEnumerator HideWindowAfterSeconds(MaterialDialog dialog, float duration) { yield return(new WaitForSeconds(duration)); dialog.Hide(); }
public async void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString) { try { if (itemString.ToString() == Context.GetText(Resource.String.Lbl_View_Profile)) { WoWonderTools.OpenProfile(Activity, DataUserChat.UserId, DataUserChat); } else if (itemString.ToString() == Context.GetText(Resource.String.Lbl_Block)) { if (Methods.CheckConnectivity()) { (int apiStatus, var respond) = await RequestsAsync.Global.Block_User(DataUserChat.UserId, true); //true >> "block" if (apiStatus == 200) { Console.WriteLine(respond); var dbDatabase = new SqLiteDatabase(); dbDatabase.Delete_UsersContact(DataUserChat.UserId); dbDatabase.Dispose(); Toast.MakeText(Context, Context.GetText(Resource.String.Lbl_Blocked_successfully), ToastLength.Short).Show(); } } else { Toast.MakeText(Context, Context.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } else if (itemString.ToString() == Context.GetText(Resource.String.Lbl_Voice_call)) { string timeNow = DateTime.Now.ToString("hh:mm"); var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); string time = Convert.ToString(unixTimestamp); Intent intentVideoCall = new Intent(Context, typeof(TwilioVideoCallActivity)); if (AppSettings.UseAgoraLibrary && AppSettings.UseTwilioLibrary == false) { intentVideoCall = new Intent(Context, typeof(AgoraAudioCallActivity)); intentVideoCall.PutExtra("type", "Agora_audio_calling_start"); } else if (AppSettings.UseAgoraLibrary == false && AppSettings.UseTwilioLibrary) { intentVideoCall = new Intent(Context, typeof(TwilioAudioCallActivity)); intentVideoCall.PutExtra("type", "Twilio_audio_calling_start"); } intentVideoCall.PutExtra("UserID", DataUserChat.UserId); intentVideoCall.PutExtra("avatar", DataUserChat.Avatar); intentVideoCall.PutExtra("name", DataUserChat.Name); intentVideoCall.PutExtra("time", timeNow); intentVideoCall.PutExtra("CallID", time); StartActivity(intentVideoCall); } else if (itemString.ToString() == Context.GetText(Resource.String.Lbl_Video_call)) { string timeNow = DateTime.Now.ToString("hh:mm"); var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); string time = Convert.ToString(unixTimestamp); Intent intentVideoCall = new Intent(Context, typeof(TwilioVideoCallActivity)); if (AppSettings.UseAgoraLibrary && AppSettings.UseTwilioLibrary == false) { intentVideoCall = new Intent(Context, typeof(AgoraVideoCallActivity)); intentVideoCall.PutExtra("type", "Agora_video_calling_start"); } else if (AppSettings.UseAgoraLibrary == false && AppSettings.UseTwilioLibrary) { intentVideoCall = new Intent(Context, typeof(TwilioVideoCallActivity)); intentVideoCall.PutExtra("type", "Twilio_video_calling_start"); } intentVideoCall.PutExtra("UserID", DataUserChat.UserId); intentVideoCall.PutExtra("avatar", DataUserChat.Avatar); intentVideoCall.PutExtra("name", DataUserChat.Name); intentVideoCall.PutExtra("time", timeNow); intentVideoCall.PutExtra("CallID", time); intentVideoCall.PutExtra("access_token", "YOUR_TOKEN"); intentVideoCall.PutExtra("access_token_2", "YOUR_TOKEN"); intentVideoCall.PutExtra("from_id", "0"); intentVideoCall.PutExtra("active", "0"); intentVideoCall.PutExtra("status", "0"); intentVideoCall.PutExtra("room_name", "TestRoom"); StartActivity(intentVideoCall); } } catch (Exception e) { Console.WriteLine(e); } }
public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString) { try { if (itemString.ToString() == Context.GetText(Resource.String.Lbl_Voice_call)) { string timeNow = DateTime.Now.ToString("hh:mm"); var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); string time = Convert.ToString(unixTimestamp); Intent intentVideoCall = new Intent(Context, typeof(TwilioVideoCallActivity)); if (AppSettings.UseAgoraLibrary && AppSettings.UseTwilioLibrary == false) { intentVideoCall = new Intent(Context, typeof(AgoraAudioCallActivity)); intentVideoCall.PutExtra("type", "Agora_audio_calling_start"); } else if (AppSettings.UseAgoraLibrary == false && AppSettings.UseTwilioLibrary) { intentVideoCall = new Intent(Context, typeof(TwilioAudioCallActivity)); intentVideoCall.PutExtra("type", "Twilio_audio_calling_start"); } intentVideoCall.PutExtra("UserID", DataUser.UserId); intentVideoCall.PutExtra("avatar", DataUser.Avatar); intentVideoCall.PutExtra("name", DataUser.Name); intentVideoCall.PutExtra("time", timeNow); intentVideoCall.PutExtra("CallID", time); StartActivity(intentVideoCall); } else if (itemString.ToString() == Context.GetText(Resource.String.Lbl_Video_call)) { string timeNow = DateTime.Now.ToString("hh:mm"); var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); string time = Convert.ToString(unixTimestamp); Intent intentVideoCall = new Intent(Context, typeof(TwilioVideoCallActivity)); if (AppSettings.UseAgoraLibrary && AppSettings.UseTwilioLibrary == false) { intentVideoCall = new Intent(Context, typeof(AgoraVideoCallActivity)); intentVideoCall.PutExtra("type", "Agora_video_calling_start"); } else if (AppSettings.UseAgoraLibrary == false && AppSettings.UseTwilioLibrary) { intentVideoCall = new Intent(Context, typeof(TwilioVideoCallActivity)); intentVideoCall.PutExtra("type", "Twilio_video_calling_start"); } intentVideoCall.PutExtra("UserID", DataUser.UserId); intentVideoCall.PutExtra("avatar", DataUser.Avatar); intentVideoCall.PutExtra("name", DataUser.Name); intentVideoCall.PutExtra("time", timeNow); intentVideoCall.PutExtra("CallID", time); intentVideoCall.PutExtra("access_token", "YOUR_TOKEN"); intentVideoCall.PutExtra("access_token_2", "YOUR_TOKEN"); intentVideoCall.PutExtra("from_id", "0"); intentVideoCall.PutExtra("active", "0"); intentVideoCall.PutExtra("status", "0"); intentVideoCall.PutExtra("room_name", "TestRoom"); StartActivity(intentVideoCall); } } catch (Exception e) { Console.WriteLine(e); } }
protected override void ShowDialog(Bundle state) { MaterialDialog.Builder builder = new MaterialDialog.Builder(context) .SetTitle(DialogTitle) .SetContent(DialogMessage) .SetIcon(DialogIcon) .SetDismissListener(this) .SetCallback(new ButtonCallback { Neutral = (x) => { OnClick(x,(int)DialogButtonType.Neutral); }, Negative = (x) => { OnClick(x, (int)DialogButtonType.Negative); }, Positive = (x) => { OnClick(x, (int)DialogButtonType.Positive); } }) .SetPositiveText(PositiveButtonText) .SetNegativeText(NegativeButtonText) .SetAutoDismiss(true); View contentView = OnCreateDialogView(); if (contentView != null) { OnBindDialogView(contentView); builder.SetCustomView(contentView, false); } else { builder.SetContent(DialogMessage); } try { PreferenceManager pm = PreferenceManager; Java.Lang.Reflect.Method method = pm.Class.GetDeclaredMethod( "registerOnActivityDestroyListener", Java.Lang.Class.FromType(typeof(PreferenceManager.IOnActivityDestroyListener))); method.Accessible = true; method.Invoke(pm, this); } catch (Exception) { } mDialog = builder.Build(); if (state != null) mDialog.OnRestoreInstanceState(state); mDialog.Show(); }
public static void ShowKeyboard(IDialogInterface di, MaterialDialog.Builder builder) { MaterialDialog dialog = (MaterialDialog)di; if (dialog.GetInputEditText() == null) return; dialog.GetInputEditText().Post(() => { dialog.GetInputEditText().RequestFocus(); InputMethodManager imm = (InputMethodManager)builder.Context.GetSystemService(Context.InputMethodService); if (imm != null) imm.ShowSoftInput(dialog.GetInputEditText(), ShowFlags.Implicit); }); }