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); } }
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 MAdapterOnItemClick(object sender, ManageSessionsAdapterClickEventArgs e) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show(); return; } ItemSessionsDataObject = MAdapter.GetItem(e.Position); if (ItemSessionsDataObject != null) { 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_AreYouSureLogoutFromThisDevice)); dialog.PositiveText(GetText(Resource.String.Lbl_Ok)).OnPositive(this); dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this); dialog.AutoDismiss(true); dialog.AlwaysCallSingleChoiceCallback(); dialog.Build().Show(); } } catch (Exception exception) { Console.WriteLine(exception); } }
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); } }
//delete group chat private void BtnDeleteGroupOnClick(object sender, EventArgs e) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short) .Show(); } else { Type = "Delete"; var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light); dialog.Content(GetText(Resource.String.Lbl_AreYouSureDeleteGroup)); dialog.PositiveText(GetText(Resource.String.Lbl_DeleteGroup)).OnPositive(this); dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this); dialog.AlwaysCallSingleChoiceCallback(); dialog.Build().Show(); } } catch (Exception exception) { Console.WriteLine(exception); } }
public void ShowNormalDialog(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.Build().Show(); } catch (Exception exception) { Crashes.TrackError(exception); } }
//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); } }
public void ShowNormalDialog(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.Build().Show(); } catch (Exception exception) { Console.WriteLine(exception); } }
//Contact User private void BtnContactOnClick(object sender, EventArgs e) { try { if (AppSettings.MessengerIntegration) { 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_ContentAskOPenAppMessenger)); dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) => { try { Methods.App.OpenAppByPackageName(this, AppSettings.MessengerPackageName, "OpenChat", new ChatObject() { UserId = DataObject.UserData.UserId, Name = DataObject.UserData.Name, Avatar = DataObject.UserData.Avatar }); } catch (Exception exception) { Console.WriteLine(exception); } }); dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this); dialog.AlwaysCallSingleChoiceCallback(); dialog.Build().Show(); } } catch (Exception exception) { Console.WriteLine(exception); } }
private void MAdapterOnItemLongClick(object sender, ContactsAdapterClickEventArgs e) { try { var position = e.Position; if (position >= 0) { var item = MAdapter.GetItem(position); if (item == null) { return; } if (item.Avatar == "addImage") { return; } Position = e.Position; var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light); dialog.Title(GetString(Resource.String.Lbl_Remove) + " " + WoWonderTools.GetNameFinal(item)); dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive(this); dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this); dialog.AlwaysCallSingleChoiceCallback(); dialog.Build().Show(); } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
private void BtnAddPhoneNumberOnClick(object sender, EventArgs e) { try { FullNumber = TxtNumber2.Text; if (Regex.IsMatch(FullNumber, "^\\+?(\\d[\\d-. ]+)?(\\([\\d-. ]+\\))?[\\d-. ]+\\d$") && FullNumber.Length >= 10) { if (!string.IsNullOrEmpty(FullNumber)) { Intent intent = new Intent(ActivityContext, typeof(VerificationCodeActivity)); intent.PutExtra("Number", FullNumber); ActivityContext.StartActivityForResult(intent, 125); AddPhoneNumberWindow.Hide(); AddPhoneNumberWindow.Dismiss(); } } else { var dialog = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light); dialog.Title(Resource.String.Lbl_Warning); dialog.Content(FullNumber + " " + ActivityContext.GetText(Resource.String.Lbl_ISNotValidNumber)); dialog.PositiveText(ActivityContext.GetText(Resource.String.Lbl_Ok)).OnPositive((materialDialog, action) => { dialog.Dispose(); }); dialog.AlwaysCallSingleChoiceCallback(); dialog.Build().Show(); } } catch (Exception exception) { Console.WriteLine(exception); } }
//Contact seller private void BtnContactOnClick(object sender, EventArgs eventArgs) { try { if (AppSettings.MessengerIntegration) { 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_ContentAskOPenAppMessenger)); dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) => { try { Methods.App.OpenAppByPackageName(this, AppSettings.MessengerPackageName, "SendMsgProduct", new ChatObject() { UserId = ProductData.Seller.UserId, Avatar = ProductData.Seller.Avatar, Name = ProductData.Seller.Name, LastMessage = new LastMessageUnion() { LastMessageClass = new MessageData() { ProductId = ProductData.Id, Product = new ProductUnion() { ProductClass = ProductData } } } }); } catch (Exception exception) { Console.WriteLine(exception); } }); dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this); dialog.AlwaysCallSingleChoiceCallback(); dialog.Build().Show(); } else { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); return; } var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); var time = unixTimestamp.ToString(); PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Message.Send_Message(ProductData.Seller.UserId, time, "", "", "", "", "", "", ProductData.Id) }); Toast.MakeText(this, GetString(Resource.String.Lbl_MessageSentSuccessfully), ToastLength.Short).Show(); } } catch (Exception e) { Console.WriteLine(e); } }
private Task <string> OnJavascriptInjectionRequest(string eventobj) { try { if (!string.IsNullOrEmpty(eventobj)) { if (eventobj.Contains("type")) { var data = JsonConvert.DeserializeObject <Dictionary <string, object> >(eventobj); var type = data["type"].ToString(); if (type == "delete_post") { Activity.RunOnUiThread(() => { try { var DialogList = new MaterialDialog.Builder(Context); DialogList.Tag(data["post_id"].ToString()); DialogList.Title(Context.GetText(Resource.String.Lbl_Title_DeletePost)); DialogList.Content(Context.GetText(Resource.String.Lbl_Content_DeletePost)); DialogList.NegativeText(Context.GetText(Resource.String.Lbl_Cancel)); DialogList.OnNegative(this); DialogList.PositiveText(Context.GetText(Resource.String.Lbl_Delete)); DialogList.OnPositive(this); DialogList.Build().Show(); } catch (Exception exception) { Crashes.TrackError(exception); } }); } else if (type == "publisher-box") { Activity.RunOnUiThread(() => { var Int = new Intent(Activity, typeof(AddPost_Activity)); Int.PutExtra("Type", "Normal"); Int.PutExtra("PostId", UserDetails.User_id); Int.PutExtra("isOwner", "Normal"); StartActivityForResult(Int, 2500); }); } else { return(null); } } } return(null); } catch (Exception e) { Crashes.TrackError(e); return(null); } }
//Remove private void MAdapterOnOnRemoveItemClick(object sender, AllMediaAdapterClickEventArgs e) { try { var position = e.Position; if (position > -1) { var item = MAdapter.GetItem(position); if (item != null) { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); return; } if (!string.IsNullOrEmpty(item.Id)) { var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light); dialog.Title(GetText(Resource.String.Lbl_Warning)); dialog.Content(GetText(Resource.String.Lbl_AskDeleteFile)); dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) => { try { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Users.DeleteMediaFileUserAsync(item.Id) }); MAdapter.Remove(item); var dataUser = ListUtils.MyUserInfo.FirstOrDefault(); var dataImage = dataUser?.Mediafiles?.FirstOrDefault(file => file.Id == item.Id); if (dataImage != null) { dataUser.Mediafiles?.Remove(dataImage); SqLiteDatabase dbDatabase = new SqLiteDatabase(); dbDatabase.InsertOrUpdate_DataMyInfo(dataUser); dbDatabase.Dispose(); } } catch (Exception exception) { Console.WriteLine(exception); } }); dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this); dialog.AlwaysCallSingleChoiceCallback(); dialog.Build().Show(); } } } } 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)); } }
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 void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString) { try { if (itemString.ToString() == GetText(Resource.String.Lbl_CreateNewGroup)) { StartActivity(new Intent(Activity, typeof(CreateGroupChatActivity))); } else if (itemString.ToString() == GetText(Resource.String.Lbl_GroupRequest)) { StartActivity(new Intent(Activity, typeof(GroupRequestActivity))); } else if (itemString.ToString() == GetText(Resource.String.Lbl_Blocked_User_List)) { StartActivity(new Intent(Activity, typeof(BlockedUsersActivity))); } else if (itemString.ToString() == GetText(Resource.String.Lbl_Settings)) { StartActivity(new Intent(Activity, typeof(GeneralAccountActivity))); } else if (itemString.ToString() == GetText(Resource.String.Lbl_Clear_call_log)) { var dialog = new MaterialDialog.Builder(Activity).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light); dialog.Title(GetText(Resource.String.Lbl_Warning)); dialog.Content(GetText(Resource.String.Lbl_Clear_call_log)); dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) => { try { LastCallsTab?.MAdapter?.MCallUser?.Clear(); LastCallsTab?.MAdapter?.NotifyDataSetChanged(); LastCallsTab?.ShowEmptyPage(); //Toast.MakeText(this, GetText(Resource.String.Lbl_Done), ToastLength.Long)?.Show(); SqLiteDatabase dbDatabase = new SqLiteDatabase(); dbDatabase.Clear_CallUser_List(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }); dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(new WoWonderTools.MyMaterialDialog()); dialog.AlwaysCallSingleChoiceCallback(); dialog.Build().Show(); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
// 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); } }
//Contact seller private void BtnContactOnClick(object sender, EventArgs eventArgs) { try { if (AppSettings.MessengerIntegration) { 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_ContentAskOPenAppMessenger)); dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) => { try { Intent intent = new Intent(this, typeof(ChatWindowActivity)); intent.PutExtra("UserID", ProductData.Seller.UserId); intent.PutExtra("TypeChat", "User"); intent.PutExtra("UserItem", JsonConvert.SerializeObject(ProductData.Seller)); StartActivity(intent); } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }); dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this); dialog.AlwaysCallSingleChoiceCallback(); dialog.Build().Show(); } else { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); return; } var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); var time = unixTimestamp.ToString(); PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Message.Send_Message(ProductData.Seller.UserId, time, "", "", "", "", "", "", ProductData.Id) }); Toast.MakeText(this, GetString(Resource.String.Lbl_MessageSentSuccessfully), ToastLength.Short)?.Show(); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void MAdapterOnMessageButtonItemClick(object sender, ShowApplyJobsAdapterClickEventArgs e) { try { var item = MAdapter.GetItem(e.Position); if (item != null) { switch (AppSettings.MessengerIntegration) { case true when AppSettings.ShowDialogAskOpenMessenger: { var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light); dialog.Title(Resource.String.Lbl_Warning).TitleColorRes(Resource.Color.primary); dialog.Content(GetText(Resource.String.Lbl_ContentAskOPenAppMessenger)); dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) => { try { Intent intent = new Intent(this, typeof(ChatWindowActivity)); intent.PutExtra("UserID", item.UserData.UserId); intent.PutExtra("TypeChat", "User"); intent.PutExtra("UserItem", JsonConvert.SerializeObject(item.UserData)); StartActivity(intent); } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }); dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(new WoWonderTools.MyMaterialDialog()); dialog.AlwaysCallSingleChoiceCallback(); dialog.Build().Show(); break; } case true: Intent intent = new Intent(this, typeof(ChatWindowActivity)); intent.PutExtra("UserID", item.UserData.UserId); intent.PutExtra("TypeChat", "User"); intent.PutExtra("UserItem", JsonConvert.SerializeObject(item.UserData)); StartActivity(intent); break; } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
public void OnSuccess(Object result) { try { var findCurrentPlaceResponse = (FindCurrentPlaceResponse)result; switch (findCurrentPlaceResponse) { case null: return; } MAdapter.PlacesList = new ObservableCollection <MyPlace>(); foreach (var placeLikelihood in findCurrentPlaceResponse.PlaceLikelihoods) { MAdapter.PlacesList.Add(new MyPlace { Address = placeLikelihood.Place.Address, AddressComponents = placeLikelihood.Place.AddressComponents, Attributions = placeLikelihood.Place.Attributions, Id = placeLikelihood.Place.Id, LatLng = placeLikelihood.Place.LatLng, Name = placeLikelihood.Place.Name, OpeningHours = placeLikelihood.Place.OpeningHours, PhoneNumber = placeLikelihood.Place.PhoneNumber, PhotoMetadatas = placeLikelihood.Place.PhotoMetadatas, PlusCode = placeLikelihood.Place.PlusCode, PriceLevel = placeLikelihood.Place.PriceLevel, Rating = placeLikelihood.Place.Rating, UserRatingsTotal = placeLikelihood.Place.UserRatingsTotal, Viewport = placeLikelihood.Place.Viewport, WebsiteUri = placeLikelihood.Place.WebsiteUri, }); } MAdapter.NotifyDataSetChanged(); var dialogList = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light); dialogList.Title(Resource.String.Lbl_NearBy).TitleColorRes(Resource.Color.primary); dialogList.Adapter(MAdapter, new LinearLayoutManager(this)); dialogList.AutoDismiss(true); dialogList.NegativeText(GetText(Resource.String.Lbl_Close)).OnNegative(this); dialogList.AlwaysCallSingleChoiceCallback(); dialogList.Build().Show(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
//Logout private void LogoutPrefOnPreferenceClick(object sender, Preference.PreferenceClickEventArgs e) { try { var dialog = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light); dialog.Title(Resource.String.Lbl_Warning); dialog.Content(GetText(Resource.String.Lbl_Are_you_logout)); dialog.PositiveText(GetText(Resource.String.Lbl_Ok)).OnPositive(this); dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this); dialog.AlwaysCallSingleChoiceCallback(); dialog.Build().Show(); } catch (Exception exception) { Console.WriteLine(exception); } }
public async void ShowPlayListDialog() { try { MaterialDialog.Builder progressDialog = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light); progressDialog.Title(ActivityContext.GetText(Resource.String.Lbl_Checking_PlayLists_info)); progressDialog.Content(ActivityContext.GetText(Resource.String.Lbl_Please_wait)); progressDialog.Progress(true, 0); progressDialog.ProgressIndeterminateStyle(true); MaterialDialog dialog = progressDialog.Build(); dialog.Show(); if (ListUtils.PlayListVideoObjectList.Count == 0) { await ApiRequest.PlayListsVideosApi(ActivityContext); } dialog.Dismiss(); List <string> arrayAdapter = new List <string>(); MaterialDialog.Builder dialogList = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light); var count = ListUtils.PlayListVideoObjectList.Count; if (count > 0) { for (int i = 0; i < count; i++) { if (!string.IsNullOrEmpty(ListUtils.PlayListVideoObjectList[i].Name)) { arrayAdapter.Add(ListUtils.PlayListVideoObjectList[i].Name); } } } dialogList.Title(ActivityContext.GetText(Resource.String.Lbl_Select_One_Name)); dialogList.Items(arrayAdapter); dialogList.PositiveText(ActivityContext.GetText(Resource.String.Lbl_Creat_new)).OnPositive(this); dialogList.NegativeText(ActivityContext.GetText(Resource.String.Lbl_Cancel)).OnNegative(this); dialogList.ItemsCallback(this).Build().Show(); } catch (Exception exception) { Console.WriteLine(exception); } }
private void MAdapterOnOnItemClick(object sender, BlockedUsersAdapterClickEventArgs e) { try { Position = e.Position; 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_DoYouWantUnblock)); dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive(this); dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this); dialog.AlwaysCallSingleChoiceCallback(); dialog.Build().Show(); } catch (Exception exception) { Console.WriteLine(exception); } }
private void SubscribeChannelWithPaidButtonOnClick(object sender, EventArgs e) { try { //This channel is paid, You must pay to subscribe var dialog = new MaterialDialog.Builder(Context).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light); dialog.Title(Resource.String.Lbl_Warning); dialog.Content(Context.GetText(Resource.String.Lbl_ChannelIsPaid)); dialog.PositiveText(Context.GetText(Resource.String.Lbl_Ok)).OnPositive(this); dialog.NegativeText(Context.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); } }
//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); } }
//Privacy >> Clear //=================================================== private void ClearCacheOnPreferenceClick(object sender, Preference.PreferenceClickEventArgs preferenceClickEventArgs) { try { var dialog = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light); dialog.Title(GetText(Resource.String.Lbl_Warning)); dialog.Content(GetText(Resource.String.Lbl_TheFilesWillBeDeleted)); dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) => { Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_FilesAreNowDeleted), ToastLength.Long).Show(); Task.Factory.StartNew(() => { try { var dirPath = ActivityContext.CacheDir; dirPath.Delete(); string path = Methods.Path.FolderDcimMyApp; if (Directory.Exists(path)) { Directory.Delete(path, true); } Methods.Path.Chack_MyFolder(); } catch (Exception e) { Console.WriteLine(e); } }); }); dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this); dialog.AlwaysCallSingleChoiceCallback(); dialog.Build().Show(); } catch (Exception exception) { Console.WriteLine(exception); } }
//Delete Account private void DeleteAccountPref_OnPreferenceClick(object sender, Preference.PreferenceClickEventArgs preferenceClickEventArgs) { try { TypeDialog = "DeleteAccount"; var dialog = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light); dialog.Title(Resource.String.Lbl_Warning); dialog.Content(ActivityContext.GetText(Resource.String.Lbl_Are_you_DeleteAccount) + " " + AppSettings.ApplicationName); dialog.PositiveText(ActivityContext.GetText(Resource.String.Lbl_Ok)).OnPositive(this); dialog.NegativeText(ActivityContext.GetText(Resource.String.Lbl_Cancel)).OnNegative(this); dialog.Build().Show(); dialog.AlwaysCallSingleChoiceCallback(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { int contentResId = Arguments.GetInt(ArgContentResId, -1); int positiveResId = Arguments.GetInt(ArgPositiveResId, -1); int negativeResId = Arguments.GetInt(ArgNegativeResId, -1); var content = contentResId == -1 ? Arguments.GetString(ArgContent) : Activity.GetString(contentResId); int customViewResId = Arguments.GetInt(ArgCustomViewResId, -1); string positiveText = positiveResId == -1 ? Arguments.GetString(ArgPositive, null) : Activity.GetString(positiveResId); string negativeText = negativeResId == -1 ? Arguments.GetString(ArgNegative, null) : Activity.GetString(negativeResId); Cancelable = false; var builer = new MaterialDialog.Builder(Activity); if (customViewResId == -1) { builer.Content(content); } else { builer.CustomView(customViewResId, true); } builer .BackgroundColorRes(Resource.Color.dialog_background) .ContentColorRes(Resource.Color.dialog_content); if (!string.IsNullOrEmpty(positiveText)) { builer.PositiveText(positiveText) .PositiveColorRes(Resource.Color.dialog_positive); } if (!string.IsNullOrEmpty(negativeText)) { builer.NegativeText(negativeText) .NegativeColorRes(Resource.Color.dialog_negative); } builer.Callback(_resultCallback); return(builer.Build()); }
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(); }
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) { 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) { 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(); }