private void StreamingOnButton_Click(object sender, EventArgs e) { var dialog = new AlertDialog.Builder(_context, _context.GetThemedResourceId(Resource.Attribute.Dialog_Theme)).Create(); var dialogView = _context.LayoutInflater.Inflate(Resource.Layout.View_List, null); var recycler = dialogView.FindViewById <RecyclerView>(Resource.Id.List_RecyclerView); dialog.SetView(dialogView); var licensees = AniListEnum.GetEnumValues <MediaLicensee>().Select(x => new CheckBoxItemRecyclerAdapter.CheckBoxItem { Title = x.DisplayValue, IsChecked = _selectedStreamingOn?.Any(y => y == x.DisplayValue) == true }).ToList(); var adapter = new CheckBoxItemRecyclerAdapter(_context, licensees); recycler.SetAdapter(adapter); dialog.Show(); dialog.DismissEvent += (disSender, disArgs) => { _selectedStreamingOn = adapter.Items.Where(x => x.IsChecked).Select(x => x.Title).ToList(); SetupStreamingOnButton(_streamingOnButton); }; }
/// <summary> /// Show Reaction dialog when user long click on react button /// </summary> public void LongClickDialog(GlobalClickEventArgs postData, NativePostAdapter nativeFeedAdapter, string namePage = "") { try { PostData = postData; NamePage = namePage; NativeFeedAdapter = nativeFeedAdapter; //Show Dialog With 6 React AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(Context); //Irrelevant code for customizing the buttons and title LayoutInflater inflater = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService); View dialogView = inflater.Inflate(Resource.Layout.XReactDialogLayout, null); InitializingReactImages(dialogView); SetReactionsArray(); ResetReactionsIcons(); ClickImageButtons(); dialogBuilder.SetView(dialogView); MReactAlertDialog = dialogBuilder.Create(); MReactAlertDialog.Window?.SetBackgroundDrawableResource(MReactDialogShape); Window window = MReactAlertDialog.Window; window?.SetLayout(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); MReactAlertDialog.Show(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void GenresButton_Click(object sender, EventArgs e) { var dialog = new AlertDialog.Builder(_context, _context.GetThemedResourceId(Resource.Attribute.Dialog_Theme)).Create(); var dialogView = _context.LayoutInflater.Inflate(Resource.Layout.View_List, null); var recycler = dialogView.FindViewById <RecyclerView>(Resource.Id.List_RecyclerView); dialog.SetView(dialogView); var genres = _genres.OrderBy(x => x).Select(x => new CheckBoxItemRecyclerAdapter.CheckBoxItem { Title = x, IsChecked = _selectedGenres?.Any(y => y == x) == true }).ToList(); var adapter = new CheckBoxItemRecyclerAdapter(_context, genres); recycler.SetAdapter(adapter); dialog.Show(); dialog.DismissEvent += (disSender, disArgs) => { _selectedGenres = adapter.Items.Where(x => x.IsChecked).Select(x => x.Title).ToList(); SetupGenresButton(_genresButton); }; }
private void TagsButton_Click(object sender, EventArgs e) { var dialog = new AlertDialog.Builder(_context, _context.GetThemedResourceId(Resource.Attribute.Dialog_Theme)).Create(); var dialogView = _context.LayoutInflater.Inflate(Resource.Layout.View_List, null); var recycler = dialogView.FindViewById <RecyclerView>(Resource.Id.List_RecyclerView); dialog.SetView(dialogView); var tags = _presenter.GetMediaTags().OrderBy(x => x.Name).Select(x => new CheckBoxItemRecyclerAdapter.CheckBoxItem { Title = x.Name, Description = x.Description, IsChecked = _selectedTags?.Any(y => y == x.Name) == true }).ToList(); var adapter = new CheckBoxItemRecyclerAdapter(_context, tags) { ToggleDescription = true }; recycler.SetAdapter(adapter); dialog.Show(); dialog.DismissEvent += (disSender, disArgs) => { _selectedTags = adapter.Items.Where(x => x.IsChecked).Select(x => x.Title).ToList(); SetupTagsButton(_tagsButton); }; }
/// <summary> /// Show Reaction dialog when user long click on react button /// </summary> public void ClickDialog(CommentReplyClickEventArgs postData) { try { PostData = postData; //Show Dialog With 6 React AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MainContext); //Irrelevant code for customizing the buttons and title LayoutInflater inflater = (LayoutInflater)MainContext.GetSystemService(Context.LayoutInflaterService); View dialogView = inflater?.Inflate(Resource.Layout.XReactDialogLayout, null); InitializingReactImages(dialogView); ClickImageButtons(); dialogBuilder.SetView(dialogView); MReactAlertDialog = dialogBuilder.Create(); MReactAlertDialog.Window?.SetBackgroundDrawableResource(MReactDialogShape); Window window = MReactAlertDialog.Window; window?.SetLayout(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); MReactAlertDialog.Show(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public static Task <JwtLoginCredentials> GetInputAsync(string title) { var context = GetContext(); var tcs = new TaskCompletionSource <JwtLoginCredentials>(); var result = new JwtLoginCredentials(); AlertDialog dialog = null; AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.SetTitle(title); var viewInflated = LayoutInflater.From(context).Inflate(Resource.Layout.login_view, null, false); var userInput = viewInflated.FindViewById <AppCompatEditText>(Resource.Id.input_user); var passwordInput = viewInflated.FindViewById <AppCompatEditText>(Resource.Id.input_password); builder.SetView(viewInflated); builder.SetOnCancelListener(new DialogInterfaceOnCancelListener(() => tcs.TrySetResult(null))); builder.SetOnDismissListener(new DialogInterfaceOnDismissListener(() => tcs.TrySetResult(null))); builder.SetPositiveButton(Android.Resource.String.Ok, (sender, args) => { result.User = userInput.Text; result.Password = passwordInput.Text; tcs.TrySetResult(result); dialog.Dismiss(); }); builder.SetNegativeButton(Android.Resource.String.Cancel, (sender, args) => { tcs.TrySetResult(null); dialog.Cancel(); }); dialog = builder.Show(); return(tcs.Task); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { var alert = new AlertDialog.Builder(Activity); alert.SetTitle(Resource.String.chooseCategories); alert.SetCancelable(false); alert.SetPositiveButton(Resource.String.ok, (EventHandler <DialogClickEventArgs>)null); var view = Activity.LayoutInflater.Inflate(Resource.Layout.dialogChooseCategories, null); _categoryList = view.FindViewById <RecyclerView>(Resource.Id.dialogChooseCategories_list); alert.SetView(view); var dialog = alert.Create(); dialog.Show(); var layout = new LinearLayoutManager(Context); var decoration = new DividerItemDecoration(Context, layout.Orientation); _categoryList.AddItemDecoration(decoration); _categoryList.SetLayoutManager(layout); _categoryAdapter = new ChooseCategoriesAdapter(_categorySource); _categoryAdapter.ItemClick += _itemClick; _categoryList.SetAdapter(_categoryAdapter); _categoryList.HasFixedSize = true; _categoryList.SetItemViewCacheSize(20); var okButton = dialog.GetButton((int)DialogButtonType.Positive); okButton.Click += _onClose.Invoke; var emptyText = view.FindViewById <TextView>(Resource.Id.dialogChooseCategories_empty); if (_categorySource.Count() == 0) { emptyText.Visibility = ViewStates.Visible; _categoryList.Visibility = ViewStates.Gone; } foreach (var category in _checkedCategories) { var index = _categorySource.Categories.FindIndex(c => c.Id == category); _categoryAdapter.CheckedStatus[index] = true; } return(dialog); }
private void ShowDialogButton_Click(object sender, EventArgs e) { _builder = new AndroidX.AppCompat.App.AlertDialog.Builder(this); LayoutInflater inflater = this.LayoutInflater; View dialogView = inflater.Inflate(Resource.Layout.layout_loading_dialog, null); _builder.SetView(dialogView); _loadingDialog = _builder.Create(); _loadingProgressMessageTextView = dialogView.FindViewById <TextView>(Resource.Id.loadingProgressMessageTextView); _loadingProgressMessageTextView.Text = "This is loading"; MoveDialogToRightTopCorner(); _loadingDialog.Show(); }
void OnPromptRequested(Page sender, PromptArguments arguments) { // Verify that the page making the request is part of this activity if (!PageIsInThisContext(sender)) { return; } AlertDialog alertDialog = new AlertDialog.Builder(Activity).Create(); alertDialog.SetTitle(arguments.Title); alertDialog.SetMessage(arguments.Message); var frameLayout = new FrameLayout(Activity); var editText = new EditText(Activity) { Hint = arguments.Placeholder, Text = arguments.InitialValue }; var layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent) { LeftMargin = (int)(22 * Activity.Resources.DisplayMetrics.Density), RightMargin = (int)(22 * Activity.Resources.DisplayMetrics.Density) }; editText.LayoutParameters = layoutParams; editText.InputType = arguments.Keyboard.ToInputType(); if (arguments.Keyboard == Keyboard.Numeric) { editText.KeyListener = LocalizedDigitsKeyListener.Create(editText.InputType); } if (arguments.MaxLength > -1) { editText.SetFilters(new IInputFilter[] { new InputFilterLengthFilter(arguments.MaxLength) }); } frameLayout.AddView(editText); alertDialog.SetView(frameLayout); alertDialog.SetButton((int)DialogButtonType.Positive, arguments.Accept, (o, args) => arguments.SetResult(editText.Text)); alertDialog.SetButton((int)DialogButtonType.Negative, arguments.Cancel, (o, args) => arguments.SetResult(null)); alertDialog.CancelEvent += (o, args) => { arguments.SetResult(null); }; alertDialog.Window.SetSoftInputMode(SoftInput.StateVisible); alertDialog.Show(); editText.RequestFocus(); }
public override Android.App.Dialog OnCreateDialog(Bundle savedInstanceState) { var alert = new AlertDialog.Builder(Activity); alert.SetTitle(Resource.String.changeIcon); alert.SetNegativeButton(Resource.String.cancel, (EventHandler <DialogClickEventArgs>)null); alert.SetCancelable(false); var view = Activity.LayoutInflater.Inflate(Resource.Layout.dialogChangeIcon, null); _searchText = view.FindViewById <EditText>(Resource.Id.editSearch); _iconList = view.FindViewById <RecyclerView>(Resource.Id.list); alert.SetView(view); var dialog = alert.Create(); dialog.Show(); _searchText.TextChanged += OnSearchChanged; _iconListAdapter = new IconListAdapter(Context, _iconSource); _iconListAdapter.ItemClick += OnItemClick; _iconListAdapter.HasStableIds = true; _iconList.SetAdapter(_iconListAdapter); _iconList.HasFixedSize = true; _iconList.SetItemViewCacheSize(20); var layout = new FixedGridLayoutManager(Context, 6); _iconList.SetLayoutManager(layout); var cancelButton = dialog.GetButton((int)DialogButtonType.Negative); cancelButton.Click += (sender, e) => { dialog.Dismiss(); }; return(dialog); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { var alert = new AlertDialog.Builder(Activity); alert.SetTitle(Resource.String.changeIcon); alert.SetNegativeButton(Resource.String.cancel, (EventHandler <DialogClickEventArgs>)null); alert.SetCancelable(false); var view = Activity.LayoutInflater.Inflate(Resource.Layout.dialogIcon, null); _searchText = view.FindViewById <EditText>(Resource.Id.dialogIcon_search); _iconList = view.FindViewById <RecyclerView>(Resource.Id.dialogIcon_list); alert.SetView(view); var dialog = alert.Create(); dialog.Show(); dialog.Window.SetSoftInputMode(SoftInput.StateAlwaysVisible); _searchText.TextChanged += SearchChanged; _iconAdapter = new IconAdapter(Context, _iconSource); _iconAdapter.ItemClick += ItemClick; _iconAdapter.SetHasStableIds(true); _iconList.SetAdapter(_iconAdapter); _iconList.HasFixedSize = true; _iconList.SetItemViewCacheSize(20); var layout = new AuthListGridLayoutManager(Context, 6); _iconList.SetLayoutManager(layout); var cancelButton = dialog.GetButton((int)DialogButtonType.Negative); cancelButton.Click += _negativeButtonEvent.Invoke; return(dialog); }