public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            _context  = ((MainActivity)Activity);
            _setIndex = Arguments.GetInt("set_index");
            AlertDialog.Builder builder  = new AlertDialog.Builder(Activity);
            LayoutInflater      inflater = Activity.LayoutInflater;
            View view = inflater.Inflate(Resource.Layout.AddChatDialogLayout, null);

            spinner             = (Spinner)view.FindViewById(Resource.Id.addChat_platform_spinner);
            submitButton        = (Button)view.FindViewById(Resource.Id.addChannel_submit_button);
            channelNameEditText = (EditText)view.FindViewById(Resource.Id.addChat_channelName_editText);

            submitButton.Click += SubmitButton_Click;

            Adapters.AvalibleStreamingPlatformsArrayAdapter spinnerAdapter = new Adapters.AvalibleStreamingPlatformsArrayAdapter(_context, _context.Resources.GetStringArray(Resource.Array.avalible_steaming_platforms).ToList <string>());
            spinner.Adapter = spinnerAdapter;

            builder.SetView(view);

            TextView customTitle = new TextView(_context);

            customTitle.Text = "Добавить чат в сет '" + ((MainActivity)_context).SetsList.GetSetsList[_setIndex].Name + "'";
            customTitle.SetTextSize(ComplexUnitType.Dip, 20);
            customTitle.Gravity = GravityFlags.Center;

            builder.SetCustomTitle(customTitle);

            return(builder.Create());
        }
Exemple #2
0
        protected void CreateDialog()
        {
            _ListView?.Dispose();
            _Adapter?.Dispose();
            _ListView = new AListView(AndroidContext)
            {
                Focusable = false,
                DescendantFocusability = DescendantFocusability.AfterDescendants,
                ChoiceMode             = _PickerCell.SelectionMode switch
                {
                    SelectMode.Single => ChoiceMode.Single,
                    _ => ChoiceMode.Multiple,
                }
            };
            _ListView.SetDrawSelectorOnTop(true);
            _Adapter = new PickerAdapter(AndroidContext, this, _PickerCell, _ListView);

            _ListView.OnItemClickListener = _Adapter;
            _ListView.Adapter             = _Adapter;

            _TitleLabel = new TextView(AndroidContext)
            {
                Text    = _PickerCell.Prompt.Title,
                Gravity = GravityFlags.Center
            };
            _TitleLabel.SetBackgroundColor(_Adapter.BackgroundColor);
            _TitleLabel.SetTextColor(_Adapter.TitleTextColor);
            _TitleLabel.SetTextSize(ComplexUnitType.Sp, _Adapter.FontSize);


            if (_Dialog is not null)
            {
                return;
            }
            using (var builder = new AlertDialog.Builder(AndroidContext))
            {
                // builder.SetTitle(_PickerCell.PopupTitle);
                builder.SetCustomTitle(_TitleLabel);
                builder.SetView(_ListView);

                builder.SetNegativeButton(_PickerCell.Prompt.Cancel, CancelEventHandler);
                builder.SetPositiveButton(_PickerCell.Prompt.Accept, AcceptEventHandler);

                _Dialog = builder.Create();
            }

            if (_Dialog is null)
            {
                return;
            }
            _Dialog.SetCanceledOnTouchOutside(true);
            _Dialog.SetOnDismissListener(this);
            _Dialog.SetOnShowListener(this);
            _Dialog.Show();

            // Pending
            //var buttonTextColor = _PickerCell.AccentColor.IsDefault ? Xamarin.Forms.Color.Accent.ToAndroid() : _PickerCell.AccentColor.ToAndroid();
            //_dialog.GetButton((int)DialogButtonType.Positive).SetTextColor(buttonTextColor);
            //_dialog.GetButton((int)DialogButtonType.Negative).SetTextColor(buttonTextColor);
        }
        private void ShowDialog()
        {
            var builder = new AlertDialog.Builder(Context, Resource.Style.AlertsDialogTheme);

            var titleView = new TextView(Context)
            {
                Text     = "Edit Duration",
                TextSize = 20,
                Gravity  = GravityFlags.Center,
            };

            titleView.SetTextColor(Color.White);
            titleView.SetPadding(5, 5, 5, 2);
            titleView.SetCompoundDrawablesWithIntrinsicBounds(Resource.Drawable.ic_menu_notifications, 0, 0, 0);

            var layout = new LinearLayout(Context)
            {
                Orientation = Android.Widget.Orientation.Horizontal
            };

            layout.SetPadding(100, 10, 100, 10);
            layout.SetClipToPadding(true);

            var unitPickers = CreateUnitPickers();

            _unitPickers = unitPickers.ToList();

            foreach (var unitPicker in _unitPickers)
            {
                layout.AddView(unitPicker);
            }

            var dialog = builder.SetCustomTitle(titleView)
                         .SetView(layout)
                         .SetCancelable(true)
                         .SetNegativeButton("Cancel", (s, args) => { })
                         .SetPositiveButton("OK", (s, args) => Duration = ParseDuration(_unitPickers))
                         .Create();

            dialog.Window.SetBackgroundDrawable(ContextCompat.GetDrawable(Context, Resource.Drawable.rounded_border_dark));
            dialog.Show();
        }
        private void ApplyCustomFont(AlertDialog.Builder builder, string title, string message)
        {
            var titleView = new TextView(this.Context)
            {
                Text = title
            };

            TitleFont.ApplyTo(titleView);
            var frame        = new FrameLayout(this.Context);
            var layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent);

            layoutParams.SetMargins(16, 16, 16, 16);
            frame.AddView(titleView, layoutParams);
            builder.SetCustomTitle(frame);
            builder.SetMessage(message);

            var dialog = builder.Show();

            var messageView = (TextView)dialog.FindViewById(Android.Resource.Id.Message);

            MessageFont.ApplyTo(messageView);
        }
Exemple #5
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            _context = Activity;
            AlertDialog.Builder builder  = new AlertDialog.Builder(Activity);
            LayoutInflater      inflater = Activity.LayoutInflater;
            View view = inflater.Inflate(Resource.Layout.AddSetDialogLayout, null);

            submitButton    = (Button)view.FindViewById(Resource.Id.addSet_submit_button);
            setNameEditText = (EditText)view.FindViewById(Resource.Id.addSet_setName_editText);

            submitButton.Click += SubmitButton_Click;

            builder.SetView(view);

            TextView customTitle = new TextView(_context);

            customTitle.Text = "Добавить сет";
            customTitle.SetTextSize(ComplexUnitType.Dip, 20);
            customTitle.Gravity = GravityFlags.Center;

            builder.SetCustomTitle(customTitle);

            return(builder.Create());
        }
        protected override void OnItemClick(object sender, int position)
        {
            base.OnItemClick(sender, position);

            pendingPosition = position;

            // Dialog title, contain name of clicked item
            View dialogTitleView = LayoutInflater.Inflate(Resource.Layout.textview_dialog_title, null);

            dialogTitleTextView      = dialogTitleView.FindViewById <TextView>(Resource.Id.dialog_title_textview);
            dialogTitleTextView.Text = presenter.GetNameAt(position);

            // Confirmation dialog
            AlertDialog.Builder builder = new AlertDialog.Builder(this.Activity);
            builder.SetCustomTitle(dialogTitleTextView);
            builder.SetMessage(Resource.String.pending_confirm_msg);

            // Accept Button
            string positiveText = Resources.GetString(Resource.String.pending_accept);

            builder.SetPositiveButton(positiveText, AlertDialogAcceptClicked);

            // Reject Button
            string negativeText = Resources.GetString(Resource.String.pending_reject);

            builder.SetNegativeButton(negativeText, AlertDialogRejectClicked);

            // Cancel Button
            string neutralText = Resources.GetString(Resource.String.pending_cancel);

            builder.SetNeutralButton(neutralText, AlertDialogCancelClicked);

            // Create and show the dialog
            alertDialog = builder.Create();
            alertDialog.Show();
        }
Exemple #7
0
        private void Control_Click(object sender, EventArgs e)
        {
            Picker model      = Element;
            var    RCKWLLFont = Typeface.CreateFromAsset(Xamarin.Forms.Forms.Context.ApplicationContext.Assets, "RCKWLL.ttf");

            var picker = new NumberPicker(Context);

            if (model.Items != null && model.Items.Any())
            {
                picker.MaxValue = model.Items.Count - 1;
                picker.MinValue = 0;
                picker.SetDisplayedValues(model.Items.ToArray());
                picker.WrapSelectorWheel      = false;
                picker.DescendantFocusability = Android.Views.DescendantFocusability.BlockDescendants;
                picker.Value = model.SelectedIndex;
            }

            var layout = new LinearLayout(Context)
            {
                Orientation = Orientation.Vertical
            };

            layout.AddView(picker);

            ElementController.SetValueFromRenderer(VisualElement.IsFocusedProperty, true);
            //Create a custom title element
            TextView title = new TextView(Context)
            {
                Text     = model.Title,
                Typeface = RCKWLLFont,
                Gravity  = Android.Views.GravityFlags.Center,
            };

            title.TextSize = 20;
            title.SetTextColor(Android.Graphics.Color.White);
            title.SetBackgroundColor(Android.Graphics.Color.Rgb(234, 49, 117));
            title.SetHeight(100);

            var builder = new AlertDialog.Builder(Context);

            builder.SetView(layout);
            builder.SetCustomTitle(title);

            builder.SetNegativeButton("CANCEL", (s, a) =>
            {
                ElementController.SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
                // It is possible for the Content of the Page to be changed when Focus is changed.
                // In this case, we'll lose our Control.
                Control?.ClearFocus();
                _dialog = null;
            });

            builder.SetPositiveButton("OK", (s, a) =>
            {
                ElementController.SetValueFromRenderer(Picker.SelectedIndexProperty, picker.Value);
                // It is possible for the Content of the Page to be changed on SelectedIndexChanged.
                // In this case, the Element & Control will no longer exist.
                if (Element != null)
                {
                    if (model.Items.Count > 0 && Element.SelectedIndex >= 0)
                    {
                        Control.Text = model.Items[Element.SelectedIndex];
                    }
                    ElementController.SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
                    // It is also possible for the Content of the Page to be changed when Focus is changed.
                    // In this case, we'll lose our Control.
                    Control?.ClearFocus();
                }
                _dialog = null;
            });

            _dialog = builder.Create();
            _dialog.DismissEvent += (ssender, args) =>
            {
                ElementController?.SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
            };
            _dialog.Show();
        }
        /////////////////////////////////////////////////////////////////////////////////////////////////////////
        //////                                   START DIALOG DEFINITION                                    //////
        //////////////////////////////////////////////////////////////////////////////////////////////////////////
        private AlertDialog.Builder CreateDirectoryChooserDialog(String title, List <String> listItems, EventHandler <DialogClickEventArgs> onClickListener)
        {
            AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(_mContext);
            ////////////////////////////////////////////////
            // Create title text showing file select type //
            ////////////////////////////////////////////////
            _mTitleView1 = new TextView(_mContext);
            _mTitleView1.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            //m_titleView1.setTextAppearance(m_context, android.R.style.TextAppearance_Large);
            //m_titleView1.setTextColor( m_context.getResources().getColor(android.R.color.black) );

            if (_selectType == _fileOpen)
            {
                _mTitleView1.Text = "Open";
            }
            if (_selectType == _fileSave)
            {
                _mTitleView1.Text = "Save As";
            }
            if (_selectType == _folderChoose)
            {
                _mTitleView1.Text = "Select folder";
            }

            //need to make this a variable Save as, Open, Select Directory
            _mTitleView1.Gravity = GravityFlags.CenterVertical;
            //_mTitleView1.SetBackgroundColor(Color.DarkGray); // dark gray     -12303292
            _mTitleView1.SetTextColor(Color.Black);
            _mTitleView1.SetPadding((int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 10), (int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 10), 0, (int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 15));
            _mTitleView1.SetTextSize(ComplexUnitType.Dip, 18);
            _mTitleView1.SetTypeface(null, TypefaceStyle.Bold);
            // Create custom view for AlertDialog title
            LinearLayout titleLayout1 = new LinearLayout(_mContext);

            titleLayout1.Orientation = Orientation.Vertical;
            titleLayout1.AddView(_mTitleView1);

            if (_selectType == _fileSave)
            {
                ///////////////////////////////
                // Create New Folder Button  //
                ///////////////////////////////
                Button newDirButton = new Button(_mContext);
                newDirButton.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                newDirButton.Text             = "New Folder";
                newDirButton.Click           += (sender, args) =>
                {
                    EditText input = new EditText(_mContext);
                    new AlertDialog.Builder(_mContext).SetTitle("New Folder Name").SetView(input).SetPositiveButton("OK", (o, eventArgs) =>
                    {
                        String newDirName = input.Text;
                        // Create new directory
                        if (CreateSubDir(_mDir + "/" + newDirName))
                        {
                            // Navigate into the new directory
                            _mDir += "/" + newDirName;
                            UpdateDirectory();
                        }
                        else
                        {
                            Toast.MakeText(_mContext, "Failed to create '" + newDirName + "' folder", ToastLength.Short).Show();
                        }
                    }).SetNegativeButton("Cancel", (o, eventArgs) => { }).Show();
                };
                titleLayout1.AddView(newDirButton);
            }
            /////////////////////////////////////////////////////
            // Create View with folder path and entry text box //
            /////////////////////////////////////////////////////
            LinearLayout titleLayout = new LinearLayout(_mContext);

            titleLayout.Orientation = Orientation.Vertical;



            var currentSelection = new TextView(_mContext);

            currentSelection.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            currentSelection.SetTextColor(Color.Black);
            currentSelection.Gravity = GravityFlags.CenterVertical;
            currentSelection.Text    = "Current selection:";
            currentSelection.SetPadding((int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 10), (int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 5), 0, (int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 3));
            currentSelection.SetTextSize(ComplexUnitType.Dip, 12);
            currentSelection.SetTypeface(null, TypefaceStyle.Bold);

            titleLayout.AddView(currentSelection);

            _mTitleView = new TextView(_mContext);
            _mTitleView.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            _mTitleView.SetTextColor(Color.Black);
            _mTitleView.Gravity = GravityFlags.CenterVertical;
            _mTitleView.Text    = title;
            _mTitleView.SetPadding((int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 10), 0, (int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 10), (int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 5));
            _mTitleView.SetTextSize(ComplexUnitType.Dip, 10);
            _mTitleView.SetTypeface(null, TypefaceStyle.Normal);

            titleLayout.AddView(_mTitleView);

            if (_selectType == _fileOpen || _selectType == _fileSave)
            {
                _inputText      = new EditText(_mContext);
                _inputText.Text = DefaultFileName;
                titleLayout.AddView(_inputText);
            }
            //////////////////////////////////////////
            // Set Views and Finish Dialog builder  //
            //////////////////////////////////////////
            dialogBuilder.SetView(titleLayout);
            dialogBuilder.SetCustomTitle(titleLayout1);
            _mListAdapter = CreateListAdapter(listItems);
            dialogBuilder.SetSingleChoiceItems(_mListAdapter, -1, onClickListener);
            dialogBuilder.SetCancelable(true);
            return(dialogBuilder);
        }
        private AlertDialog.Builder createDirectoryChooserDialog(string title, List <string> listItems,
                                                                 IDialogInterfaceOnClickListener onClickListener)
        {
            AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(m_context);

            // Create custom view for AlertDialog title containing
            // current directory TextView and possible 'New folder' button.
            // Current directory TextView allows long directory path to be wrapped to multiple lines.
            LinearLayout titleLayout = new LinearLayout(m_context);

            titleLayout.Orientation = Orientation.Vertical;

            m_titleView = new TextView(m_context);
            m_titleView.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            m_titleView.SetTextAppearance(m_context, Android.Resource.Style.TextAppearanceLarge);
            m_titleView.SetTextColor(Color.White);
            m_titleView.Gravity = GravityFlags.CenterVertical | GravityFlags.CenterHorizontal;
            m_titleView.Text    = title;

            Button newDirButton = new Button(m_context);

            newDirButton.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            newDirButton.Text             = "New folder";
            newDirButton.Click           += (sender, ev) => {
                EditText input = new EditText(m_context);

                // Show new folder name input dialog
                new AlertDialog.Builder(m_context).
                SetTitle("New folder name").
                SetView(input).SetPositiveButton("OK", (sen, eve) => {
                    string newDir = input.Text;
                    // Create new directory
                    if (createSubDir(m_dir + "/" + newDir))
                    {
                        // Navigate into the new directory
                        m_dir += "/" + newDir;
                        this.updateDirectory();
                    }
                    else
                    {
                        Toast.MakeText(
                            m_context, "Failed to create '" + newDir +
                            "' folder", ToastLength.Short).Show();
                    }
                }).SetNegativeButton("Cancel", (sen, eve) => { }).Show();
            };

            if (!m_isNewFolderEnabled)
            {
                newDirButton.Visibility = ViewStates.Gone;
            }

            titleLayout.AddView(m_titleView);
            titleLayout.AddView(newDirButton);

            dialogBuilder.SetCustomTitle(titleLayout);

            m_listAdapter = new ArrayAdapterOverrided(m_context, listItems);

            dialogBuilder.SetSingleChoiceItems(m_listAdapter, -1, onClickListener);
            dialogBuilder.SetCancelable(false);

            return(dialogBuilder);
        }
Exemple #10
0
        private AlertDialog.Builder CreateDirectoryChooserDialog(String title, List <String> listItems, EventHandler <DialogClickEventArgs> onClickListener)
        {
            AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(_mContext);

            _mTitleView1 = new TextView(_mContext);
            _mTitleView1.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);

            if (_selectType == _fileOpen)
            {
                _mTitleView1.Text = "Abrir";
            }
            if (_selectType == _fileSave)
            {
                _mTitleView1.Text = "Guardar como";
            }
            if (_selectType == _folderChoose)
            {
                _mTitleView1.Text = "Selecionar carpeta...";
            }

            _mTitleView1.Gravity = GravityFlags.CenterVertical;
            _mTitleView1.SetTextColor(Color.Black);
            _mTitleView1.SetTextSize(ComplexUnitType.Dip, 18);
            _mTitleView1.SetTypeface(null, TypefaceStyle.Bold);

            LinearLayout titleLayout1 = new LinearLayout(_mContext);

            titleLayout1.Orientation = Orientation.Vertical;
            titleLayout1.AddView(_mTitleView1);

            if (_selectType == _fileSave)
            {
                Button newDirButton = new Button(_mContext);
                newDirButton.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                newDirButton.Text             = "Nueva Carpeta.";
                newDirButton.Click           += (sender, args) =>
                {
                    EditText input = new EditText(_mContext);
                    new AlertDialog.Builder(_mContext).SetTitle("Nombre del Carpeta.").SetView(input).SetPositiveButton("OK", (o, eventArgs) =>
                    {
                        String newDirName = input.Text;
                        if (CreateSubDir(_mDir + "/" + newDirName))
                        {
                            _mDir += "/" + newDirName;
                            UpdateDirectory();
                        }
                        else
                        {
                            Toast.MakeText(_mContext, "Failed to create '" + newDirName + "' folder", ToastLength.Short).Show();
                        }
                    }).SetNegativeButton("Cancel", (o, eventArgs) => { }).Show();
                };
                titleLayout1.AddView(newDirButton);
            }

            LinearLayout titleLayout = new LinearLayout(_mContext);

            titleLayout.Orientation = Orientation.Vertical;

            var currentSelection = new TextView(_mContext);

            currentSelection.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            currentSelection.SetTextColor(Color.Black);
            currentSelection.Gravity = GravityFlags.CenterVertical;
            currentSelection.Text    = "Current selection:";
            currentSelection.SetTextSize(ComplexUnitType.Dip, 12);
            currentSelection.SetTypeface(null, TypefaceStyle.Bold);

            titleLayout.AddView(currentSelection);

            _mTitleView = new TextView(_mContext);
            _mTitleView.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            _mTitleView.SetTextColor(Color.Black);
            _mTitleView.Gravity = GravityFlags.CenterVertical;
            _mTitleView.Text    = title;
            _mTitleView.SetTextSize(ComplexUnitType.Dip, 10);
            _mTitleView.SetTypeface(null, TypefaceStyle.Normal);

            titleLayout.AddView(_mTitleView);

            if (_selectType == _fileOpen || _selectType == _fileSave)
            {
                _inputText      = new EditText(_mContext);
                _inputText.Text = DefaultFileName;
                titleLayout.AddView(_inputText);
            }

            dialogBuilder.SetView(titleLayout);
            dialogBuilder.SetCustomTitle(titleLayout1);
            _mListAdapter = CreateListAdapter(listItems);
            dialogBuilder.SetSingleChoiceItems(_mListAdapter, -1, onClickListener);
            dialogBuilder.SetCancelable(true);
            return(dialogBuilder);
        }
Exemple #11
0
        public void SetTitle([StringRes] int title)
        {
            var titleView = CreateCustomTitle(_context);

            _builder.SetCustomTitle(titleView);
        }