示例#1
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Begin building a new dialog.
            var builder = new AlertDialog.Builder(Activity);
            //Get the layout inflater
            var inflater = Activity.LayoutInflater;

            populate(listData);
            viewdlg = SetViewDelegate;
            var view = inflater.Inflate(Resource.Layout.ItemCodeList, null);

            listView = view.FindViewById <ListView> (Resource.Id.ICodeList);
            if (listView != null)
            {
                adapter             = new GenericListAdapter <Invoice> (this.Activity, listData, Resource.Layout.ListItemRowCN, viewdlg);
                listView.Adapter    = adapter;
                listView.ItemClick += ListView_Click;
                txtSearch           = view.FindViewById <EditText> (Resource.Id.txtSearch);
                butSearch           = view.FindViewById <Button> (Resource.Id.butICodeBack);
                butSearch.Text      = Resources.GetString(Resource.String.button_search);
                butSearch.SetCompoundDrawables(null, null, null, null);
                butSearch.Click += ButSearch_Click;
                //txtSearch.TextChanged += TxtSearch_TextChanged;
                builder.SetView(view);
                builder.SetPositiveButton(Resources.GetString(Resource.String.button_cancel), HandlePositiveButtonClick);
            }
            var dialog = builder.Create();

            //Now return the constructed dialog to the calling activity
            return(dialog);
        }
示例#2
0
        public static void QueryCredentials(IOConnectionInfo ioc, Action <IOConnectionInfo> afterQueryCredentials, Activity activity)
        {
            //Build dialog to query credentials:
            AlertDialog.Builder builder = new AlertDialog.Builder(activity);
            builder.SetTitle(activity.GetString(Resource.String.credentials_dialog_title));
            builder.SetPositiveButton(activity.GetString(Android.Resource.String.Ok), (dlgSender, dlgEvt) =>
            {
                Dialog dlg                 = (Dialog)dlgSender;
                string username            = ((EditText)dlg.FindViewById(Resource.Id.cred_username)).Text;
                string password            = ((EditText)dlg.FindViewById(Resource.Id.cred_password)).Text;
                int credentialRememberMode = ((Spinner)dlg.FindViewById(Resource.Id.cred_remember_mode)).SelectedItemPosition;
                ioc.UserName               = username;
                ioc.Password               = password;
                ioc.CredSaveMode           = (IOCredSaveMode)credentialRememberMode;
                afterQueryCredentials(ioc);
            });
            builder.SetView(activity.LayoutInflater.Inflate(Resource.Layout.url_credentials, null));
            builder.SetNeutralButton(activity.GetString(Android.Resource.String.Cancel),
                                     (dlgSender, dlgEvt) => { });
            Dialog dialog = builder.Create();

            dialog.Show();
            ((EditText)dialog.FindViewById(Resource.Id.cred_username)).Text = ioc.UserName;
            ((EditText)dialog.FindViewById(Resource.Id.cred_password)).Text = ioc.Password;
            ((Spinner)dialog.FindViewById(Resource.Id.cred_remember_mode)).SetSelection((int)ioc.CredSaveMode);
        }
 private void ValueClicked(object sender, EventArgs e)
 {
     // Verify that an attribute has been selected.
     if (_selectedAttribute != null)
     {
         AlertDialog.Builder builder = new AlertDialog.Builder(this);
         if (_selectedAttribute.Domain is CodedValueDomain domain)
         {
             // Create a dialog for selecting from the coded values.
             builder.SetTitle("Select a value");
             string[] options = domain.CodedValues.Select(x => x.Name).ToArray();
             builder.SetItems(options, ValueSelected);
         }
         else
         {
             // Create a dialog for entering a value.
             _valueEntry = new EditText(this)
             {
                 InputType = Android.Text.InputTypes.ClassNumber
             };
             builder.SetTitle("Enter a value");
             builder.SetView(_valueEntry);
             builder.SetPositiveButton("OK", ValueEntered);
         }
         builder.Show();
     }
 }
        private void CreateLayout()
        {
            // Create a new vertical layout for the app
            var layout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical
            };

            // Add the map view to the layout
            layout.AddView(_myMapView);

            // Create an activity indicator
            // Show the waiting dialog.
            var builder = new AlertDialog.Builder(this);

            builder.SetView(new ProgressBar(this)
            {
                Indeterminate = true
            });
            builder.SetMessage("Drawing in progress.");
            _progressDialog = builder.Create();

            // Show the layout in the app
            SetContentView(layout);
        }
示例#5
0
        public Task <string> DisplayPromptAync(string title         = null, string description  = null,
                                               string text          = null, string okButtonText = null, string cancelButtonText = null,
                                               bool numericKeyboard = false, bool autofocus     = true)
        {
            var activity = (MainActivity)CrossCurrentActivity.Current.Activity;

            if (activity == null)
            {
                return(Task.FromResult <string>(null));
            }

            var alertBuilder = new AlertDialog.Builder(activity);

            alertBuilder.SetTitle(title);
            alertBuilder.SetMessage(description);
            var input = new EditText(activity)
            {
                InputType = InputTypes.ClassText
            };

            if (text == null)
            {
                text = string.Empty;
            }
            if (numericKeyboard)
            {
                input.InputType = InputTypes.ClassNumber | InputTypes.NumberFlagDecimal | InputTypes.NumberFlagSigned;
#pragma warning disable CS0618 // Type or member is obsolete
                input.KeyListener = DigitsKeyListener.GetInstance(false, false);
#pragma warning restore CS0618 // Type or member is obsolete
            }

            input.ImeOptions = input.ImeOptions | (ImeAction)ImeFlags.NoPersonalizedLearning |
                               (ImeAction)ImeFlags.NoExtractUi;
            input.Text = text;
            input.SetSelection(text.Length);
            var container = new FrameLayout(activity);
            var lp        = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent,
                                                          LinearLayout.LayoutParams.MatchParent);
            lp.SetMargins(25, 0, 25, 0);
            input.LayoutParameters = lp;
            container.AddView(input);
            alertBuilder.SetView(container);

            okButtonText     = okButtonText ?? AppResources.Ok;
            cancelButtonText = cancelButtonText ?? AppResources.Cancel;
            var result = new TaskCompletionSource <string>();
            alertBuilder.SetPositiveButton(okButtonText,
                                           (sender, args) => result.TrySetResult(input.Text ?? string.Empty));
            alertBuilder.SetNegativeButton(cancelButtonText, (sender, args) => result.TrySetResult(null));

            var alert = alertBuilder.Create();
            alert.Window.SetSoftInputMode(Android.Views.SoftInput.StateVisible);
            alert.Show();
            if (autofocus)
            {
                input.RequestFocus();
            }
            return(result.Task);
        }
        private void ShowDialogGallery()
        {
            var layoutInflater     = (Android.Views.LayoutInflater) this.GetSystemService(Context.LayoutInflaterService);
            var promptView         = layoutInflater.Inflate(Resource.Layout.dialog_directories, null);
            var alertDialogBuilder = new AlertDialog.Builder(this);

            alertDialogBuilder.SetView(promptView);

            var dialog = alertDialogBuilder.Create();

            dialog.Window.ClearFlags(Android.Views.WindowManagerFlags.BlurBehind);
            dialog.SetCanceledOnTouchOutside(true);
            dialog.SetCancelable(true);

            var listView = promptView.FindViewById <Android.Widget.ListView>(Resource.Id.listView);
            var adapter  = new GalleryDirectoryNewAdapter(this, galleryDirectories);

            listView.Adapter = adapter;

            listView.ItemClick += (sender, e) => {
                SyncGalleryItem(e.Position);
                dialog.Dismiss();
            };
            dialog.Show();
        }
        // Handlers
        private void HandlerBotaoPartilha(object sender, EventArgs e)
        {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetTitle("Mensagem a partilhar");

            EditText input = new EditText(this);

            // Specify the type of input expected; this, for example, sets the input as a password, and will mask the text
            input.InputType = InputTypes.TextFlagMultiLine | InputTypes.ClassText;
            builder.SetView(input);

            builder.SetPositiveButton("OK", (o, args) =>
            {
                if (input.Text.Trim().Length > 0)
                {
                    var sendIntent = new Intent();
                    sendIntent.SetAction(Intent.ActionSend);
                    sendIntent.PutExtra(Intent.ExtraText, input.Text);
                    sendIntent.SetType("text/plain");
                    StartActivity(sendIntent);
                }
            })
            .SetNegativeButton("Cancelar", (o, args) => { })
            .Create()
            .Show();
        }
示例#8
0
        //---------------------------------------------------------------------------------------------------------------------------------------------------

        //Showing product information.
        private void ListForChoosingAlcohols_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e)
        {
            //Creating a new layout for showing information about product.
            AlertDialog.Builder Object   = new AlertDialog.Builder(this);
            LayoutInflater      inflater = LayoutInflater.From(this);
            LinearLayout        layout   = new LinearLayout(this);
            View alcohol_Info            = inflater.Inflate(Resource.Layout.alcohol_Info, layout);

            Object.SetView(alcohol_Info);

            //Elements from the layout.
            TextView NameText       = alcohol_Info.FindViewById <TextView>(Resource.Id.NameText);
            TextView PercentageText = alcohol_Info.FindViewById <TextView>(Resource.Id.PercentageText);
            TextView CcalsText      = alcohol_Info.FindViewById <TextView>(Resource.Id.CcalsText);

            //Temporary product for getting information about choosed product.
            Alcohol TempAlcohol = DatabaseAlcohol.GetAlcohol(ListForAlcohols.ElementAt(e.Position));

            //Showing information.
            NameText.Text       = TempAlcohol.Name;
            PercentageText.Text = TempAlcohol.PercentageOfAlchol.ToString();
            CcalsText.Text      = TempAlcohol.CCal.ToString();

            //Action on positive button.
            Object.SetPositiveButton(Resource.String.OK, new EventHandler <DialogClickEventArgs>(delegate(object Sender, DialogClickEventArgs e1) {}));

            //Showing the form.
            Object.Show();
        }
示例#9
0
        void NewListAlertView(object sender, EventArgs e)
        {
            AlertDialog.Builder alert;
            alert = new AlertDialog.Builder(this);
            alert.SetTitle("New List");
            alert.SetMessage("Please enter the name of your new list");

            EditText input = new EditText(this)
            {
                TextSize = 22,
                Gravity  = GravityFlags.Center,
                Hint     = "New List"
            };

            input.SetSingleLine(true);
            alert.SetView(input);

            alert.SetPositiveButton("Save",
                                    (senderAleert, eAlert) => NewListSave(input.Text));
            alert.SetNegativeButton("Cancel",
                                    (senderAlert, eAlert) => { });

            Dialog dialog = alert.Create();

            dialog.Show();
        }
示例#10
0
        protected override Dialog OnCreateDialog(int id)
        {
            var customView = LayoutInflater.Inflate(Resource.Layout.wifi_dialog, null);
            var builder    = new AlertDialog.Builder(this);

            builder.SetIcon(Android.Resource.Drawable.IcMenuPreferences);
            builder.SetView(customView);
            builder.SetTitle("Set Wifi password");

            switch (id)
            {
            case WpaDialog:
            {
                builder.SetPositiveButton("OK", WpaOkClicked);
                builder.SetNegativeButton("Cancel", CancelClicked);
                return(builder.Create());
            }

            case WepDialog:
            {
                builder.SetPositiveButton("OK", WepOkClicked);
                builder.SetNegativeButton("Cancel", CancelClicked);
                return(builder.Create());
            }
            }
            return(base.OnCreateDialog(id));
        }
示例#11
0
        protected async override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Push);
            var users = await Buddy.GetAsync <BuddySDK.Models.PagedResult <User> >("/users");

            if (users.IsSuccess)
            {
                ListView        userList        = FindViewById <ListView> (Resource.Id.userList);
                UserChatAdapter userListAdapter = new UserChatAdapter(this, Resource.Layout.UserListItem, users.Value.PageResults.ToList());
                userList.Adapter        = userListAdapter;
                userList.ItemLongClick += (object sender, AdapterView.ItemLongClickEventArgs e) => {
                    User                user          = users.Value.PageResults.ElementAt(e.Position);
                    LayoutInflater      inflater      = (LayoutInflater)GetSystemService(Context.LayoutInflaterService);
                    AlertDialog.Builder senderBuilder = new AlertDialog.Builder(this);
                    senderBuilder.SetView(inflater.Inflate(Resource.Layout.PushSendDialog, null));
                    SendDialog = senderBuilder.Create();
                    SendDialog.Show();
                    SelectedUser = user.ID;
                    Button pusher = SendDialog.FindViewById <Button> (Resource.Id.sendMessage);
                    pusher.Click += async(clickSender, pushere) => {
                        var note = HandleSend();
                        if (null != note)
                        {
                            Toast sendConfirmed = Toast.MakeText(this, "Message sent", ToastLength.Long);
                            sendConfirmed.Show();
                        }
                        if (null != SendDialog)
                        {
                            SendDialog.Hide();
                        }
                    };
                };
            }
        }
示例#12
0
        public void Show(string title, List <GridItem> actions, enumPlace gravity)
        {
            AlertDialog     ad             = null;
            View            customView     = CrossCurrentActivity.Current.Activity.LayoutInflater.Inflate(Resource.Layout.CustomGridViewDialog, null);
            List <GridItem> correctActions = new List <GridItem>();

            if (actions != null)
            {
                GridItem gridItem;
                foreach (var action in actions)
                {
                    gridItem             = new GridItem();
                    gridItem.Id          = action.Id;
                    gridItem.Title       = action.Title;
                    gridItem.ClickAction = () =>
                    {
                        if (ad != null)
                        {
                            ad.Dismiss();
                        }

                        action.ClickAction?.Invoke();
                    };
                    correctActions.Add(gridItem);
                }
            }

            (customView.FindViewById <GridView>(Resource.Id.gridview)).Adapter = new GridAdapter(CrossCurrentActivity.Current.Activity, correctActions, gravity);
            AlertDialog.Builder builder = new AlertDialog.Builder(CrossCurrentActivity.Current.Activity);
            builder.SetTitle(title ?? "");
            builder.SetView(customView);
            ad = builder.Show();
        }
示例#13
0
        private void OpenChangePassDialog()
        {
            LayoutInflater inflater = (LayoutInflater)this.Context.GetSystemService(Context.LayoutInflaterService);
            View           v        = inflater.Inflate(Resource.Layout.dialog_change_password, null);

            EditText username = v.FindViewById <EditText>(Resource.Id.dialog_changePass_etUsername);
            EditText pass     = v.FindViewById <EditText>(Resource.Id.dialog_changePass_etPassword);
            EditText newPass  = v.FindViewById <EditText>(Resource.Id.dialog_changePass_etNewPassword);

            AlertDialog.Builder aDialogBuilder = new AlertDialog.Builder(this.Context);
            aDialogBuilder.SetView(v);
            aDialogBuilder.SetMessage("Change password");

            aDialogBuilder.SetPositiveButton("Confirm", new EventHandler <DialogClickEventArgs>((sender, e) =>
            {
                FragmentManagerXO.SendChangePassword(username.Text, pass.Text, newPass.Text);
                (sender as Dialog).Cancel();
            }));

            aDialogBuilder.SetNegativeButton("Cancel", new EventHandler <DialogClickEventArgs>((sender, e) =>
            {
                (sender as Dialog).Cancel();
            }));

            aDialogBuilder.Show();
        }
示例#14
0
        private void OpenPassRetrievalDialog()
        {
            AlertDialog.Builder aDialogBuilder = new AlertDialog.Builder(this.Context);

            EditText etEmail = new EditText(this.Context);

            aDialogBuilder.SetView(etEmail);

            aDialogBuilder.SetTitle("Password retrival");
            aDialogBuilder.SetMessage("Enter email to retrieve your password:"******"OK", new EventHandler <DialogClickEventArgs>((sender, e) =>
            {
                email = etEmail.Text;
                if (new Regex("^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$").IsMatch(email))
                {
                    FragmentManagerXO.SendForgotPassword(FragmentManagerXO.UserName, email);
                }
                else
                {
                    MessageBox("Incorrect e-mail address!", "Password retrieval issue");
                }
                ToLobby();
                (sender as Dialog).Cancel();
            }));

            aDialogBuilder.SetCancelable(false);
            aDialogBuilder.Create();
            aDialogBuilder.Show();
        }
示例#15
0
        public static void DisplayAlert(string title = "Exception", string message = "", ViewStates viewStates = ViewStates.Invisible)
        {
            var inflater = LayoutInflater.From(mcontext);
            var dialog   = new AlertDialog.Builder(mcontext).Create();
            var view     = inflater.Inflate(Resource.Layout.AlertInterface, null);

            var _title     = view.FindViewById <TextView>(Resource.Id._alertTitle);
            var _message   = view.FindViewById <TextView>(Resource.Id._alertMessage);
            var _okBtn     = view.FindViewById <Button>(Resource.Id._okBtn);
            var _cancleBtn = view.FindViewById <Button>(Resource.Id._cancelBtn);

            _cancleBtn.Visibility = viewStates;

            _okBtn.Click += delegate { dialog.Dismiss(); };

            _cancleBtn.Click += delegate { dialog.Dismiss(); };

            _title.Text   = title;
            _message.Text = message;

            dialog.SetView(view);

            dialog.SetIcon(Resource.Drawable.warning_icon);

            dialog.Show();
        }
示例#16
0
        public void mostrarDialogo()
        {
            // con este tema personalizado evitamos los bordes por defecto
            AlertDialog.Builder alert = new AlertDialog.Builder(this);
            //alert.SetTitle("Confirm delete");
            //alert.SetMessage("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.");

            LayoutInflater inflater = this.LayoutInflater;
            View           v        = inflater.Inflate(Resource.Layout.dialogDatos, null);

            alert.SetView(v);
            alert.SetCancelable(false);

            Button   aceptar    = v.FindViewById <Button>(Resource.Id.btnGuardarDialog);
            EditText edtCliente = v.FindViewById <EditText>(Resource.Id.edtDialogNombre);
            EditText edtCelular = v.FindViewById <EditText>(Resource.Id.edtDialogCeluar);

            aceptar.Click += (sender, e) => {
                client = edtCliente.Text;
                phone  = edtCelular.Text;
                dialog.Dismiss();
            };
            dialog = alert.Create();
            dialog.Show();
        }
示例#17
0
        //---------------------------------------------------------------------------------------------------------------------------------------------------

        //Choosing from existing users in the system.
        private void ChooseFromExistButton_Click(object sender, EventArgs e)
        {
            //Creating a new layout for choosing from existing users.
            AlertDialog.Builder Object   = new AlertDialog.Builder(this);
            LayoutInflater      inflater = LayoutInflater.From(this);
            LinearLayout        layout   = new LinearLayout(this);
            View FormViewChoose          = inflater.Inflate(Resource.Layout.ChooseUserFrom, layout);

            Object.SetView(FormViewChoose);

            //Element from layout.
            ListOfUsers = FormViewChoose.FindViewById <ListView>(Resource.Id.ListOfUsers);
            TempList    = new System.Collections.Generic.List <string>();

            //Displaying users on the layout.
            foreach (Classes.User TempUser in Classes.WorkWithDatabase.SQConnection.Table <Classes.User>())
            {
                TempList.Add(TempUser.Name);
            }

            var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, TempList);

            ListOfUsers.Adapter = adapter;

            //Actions on clicks on the items.
            ListOfUsers.ItemClick     += ListOfUsers_ItemClick;
            ListOfUsers.ItemLongClick += ListOfUsers_ItemLongClick;

            //Action on pressing negative button.
            Object.SetNegativeButton(Resource.String.Cancel, new EventHandler <DialogClickEventArgs>(delegate(object Sender, DialogClickEventArgs e1) { }));
            Object.Show();
        }
示例#18
0
        public static void Create(BaseAniDroidActivity context, MediaTitle title, ICollection <string> alternateNames)
        {
            var dialogView = context.LayoutInflater.Inflate(Resource.Layout.Dialog_MediaTitles, null);

            if (!string.IsNullOrWhiteSpace(title.Romaji))
            {
                dialogView.FindViewById(Resource.Id.MediaTitles_RomajiContainer).Visibility = ViewStates.Visible;
                dialogView.FindViewById <TextView>(Resource.Id.MediaTitles_Romaji).Text     = title.Romaji;
            }

            if (!string.IsNullOrWhiteSpace(title.English))
            {
                dialogView.FindViewById(Resource.Id.MediaTitles_EnglishContainer).Visibility = ViewStates.Visible;
                dialogView.FindViewById <TextView>(Resource.Id.MediaTitles_English).Text     = title.English;
            }

            if (!string.IsNullOrWhiteSpace(title.Native))
            {
                dialogView.FindViewById(Resource.Id.MediaTitles_NativeContainer).Visibility = ViewStates.Visible;
                dialogView.FindViewById <TextView>(Resource.Id.MediaTitles_Native).Text     = title.Native;
            }

            if (alternateNames?.Any() == true)
            {
                dialogView.FindViewById(Resource.Id.MediaTitles_AlsoKnownAsContainer).Visibility = ViewStates.Visible;
                dialogView.FindViewById <TextView>(Resource.Id.MediaTitles_AlsoKnownAs).Text     = string.Join("\n", alternateNames);
            }

            var dialog = new AlertDialog.Builder(context, context.GetThemedResourceId(Resource.Attribute.Dialog_Theme));

            dialog.SetView(dialogView);
            dialog.Show();
        }
        private void CreateDirectionsDialog(IEnumerable <string> directions)
        {
            // Create a dialog to show route directions
            AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);

            // Create the layout
            LinearLayout dialogLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical
            };

            // Create a list box for showing the route directions
            ListView directionsList = new ListView(this);
            ArrayAdapter <string> directionsAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, directions.ToArray());

            directionsList.Adapter = directionsAdapter;
            dialogLayout.AddView(directionsList);

            // Add the controls to the dialog
            dialogBuilder.SetView(dialogLayout);
            dialogBuilder.SetTitle("Route Directions");

            // Create the dialog (don't show it)
            _directionsDialog = dialogBuilder.Create();
        }
        private void ShowStatsList(IList <KeyValuePair <string, object> > stats)
        {
            // Create a list of statistics results (field names and values) to show in the list
            IList <string> statInfoList = new List <string>();

            foreach (KeyValuePair <string, object> kvp in stats)
            {
                // If the value is null, display "--"
                string displayString = "--";

                if (kvp.Value != null)
                {
                    displayString = kvp.Value.ToString();
                }

                statInfoList.Add(kvp.Key + " : " + displayString);
            }

            // Create an array adapter for the stats list
            ArrayAdapter <string> statsArrayAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, statInfoList);

            statsArrayAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleListItem1);

            // Create a list view to display the results
            ListView statsListView = new ListView(this)
            {
                Adapter = statsArrayAdapter
            };

            // Show the list view in a dialog
            AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
            dialogBuilder.SetView(statsListView);
            dialogBuilder.Show();
        }
示例#21
0
        /// <summary>
        /// Override this to create your own custom authentication dialog
        /// </summary>
        /// <returns>The dialog.</returns>
        /// <param name="context">Context.</param>
        public virtual AlertDialog.Builder CreateDialog(Context context)
        {
            var builder = new AlertDialog.Builder(context);

            builder.SetTitle(_alertTitle);
            builder.SetMessage(_alertMessage);
            builder.SetNegativeButton("Cancel", CancelledDialogDelegate);

            var linearLayout = new LinearLayout(context);

            linearLayout.Orientation = Orientation.Horizontal;
            linearLayout.SetHorizontalGravity(GravityFlags.Center);

            var imageView = new ImageView(context);

            imageView.SetImageResource(Resource.Drawable.ic_fp_40px);
            imageView.SetForegroundGravity(GravityFlags.Center);
            imageView.LayoutParameters = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MatchParent,
                ViewGroup.LayoutParams.WrapContent
                );

            linearLayout.AddView(imageView);
            builder.SetView(linearLayout);

            return(builder);
        }
示例#22
0
        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());
        }
示例#23
0
        public void Publish()
        {
            AlertDialog.Builder alert = new AlertDialog.Builder(this);

            alert.SetTitle("Publish");
            alert.SetMessage("Enter message to publish");

            // Set an EditText view to get user input
            EditText input = new EditText(this);

            alert.SetView(input);

            alert.SetPositiveButton("OK", (sender, e) =>
            {
                Display("Running Publish");
                string[] channels = channel.Split(',');
                foreach (string channelToCall in channels)
                {
                    pubnub.Publish <string> (channelToCall.Trim(), input.Text, DisplayReturnMessage);
                }
            });

            alert.SetNegativeButton("Cancel", (sender, e) =>
            {
            });
            alert.Show();
            //this.RunOnUiThread(() => alert.Show());
        }
        private void ShowDirections_Click(object sender, EventArgs e)
        {
            if (!_directions.Any())
            {
                ShowMessage("No directions", "Add stops and barriers, then click 'Route' before displaying directions.");
                return;
            }

            // Create a dialog to show route directions.
            AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);

            // Create the layout.
            LinearLayout dialogLayout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical
            };

            // Convert the directions list to a suitable format for display.
            string[] directionText = _directions.Select(directionObject => directionObject.DirectionText).ToArray();

            // Create a list box for showing the route directions.
            ListView directionsList = new ListView(this);
            ArrayAdapter <string> directionsAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, directionText);

            directionsList.Adapter = directionsAdapter;
            dialogLayout.AddView(directionsList);

            // Add the controls to the dialog.
            dialogBuilder.SetView(dialogLayout);
            dialogBuilder.SetTitle("Directions");

            // Show the dialog.
            dialogBuilder.Create().Show();
        }
示例#25
0
        /// <summary>
        /// Initialise la popup de la liste des zones favorites
        /// </summary>
        private void BuildAreaListFavorisPopup()
        {
            // création d'une alerte dialog
            Dialog listModeZoneFavorisDialog      = null;
            var    listModeZoneFavorisAlertDialog = new AlertDialog.Builder(this);

            // création de la liste adapter des zones favorites
            Android.Views.LayoutInflater inflater = LayoutInflater.From(this);
            Android.Views.View           view     = inflater.Inflate(Resource.Layout.ZoneFavoriteLayout, null);
            var zoneFavoriteListView = view.FindViewById <ListView>(Resource.Id.zoneFavorite_listView);
            FavoriteAreaAdapter favoriteAreaAdapter = null;

            favoriteAreaAdapter = new FavoriteAreaAdapter(this
                                                          , () => { listModeZoneFavorisDialog.Dismiss(); }
                                                          , () => { favoriteAreaAdapter.NotifyDataSetChanged(); });
            zoneFavoriteListView.Adapter = favoriteAreaAdapter;

            if (zoneFavoriteListView.Parent != null)
            {
                ((ViewGroup)zoneFavoriteListView.Parent).RemoveView(zoneFavoriteListView); // <- fix
            }
            zoneFavoriteListView.ChoiceMode    = ChoiceMode.Single;
            zoneFavoriteListView.ItemsCanFocus = true;
            listModeZoneFavorisAlertDialog.SetView(zoneFavoriteListView);

            // instatiation de notre popup dans un objet dialog
            listModeZoneFavorisDialog = listModeZoneFavorisAlertDialog.Create();
            listModeZoneFavorisDialog.Show();
        }
示例#26
0
        private void InputClicked(object sender, EventArgs e, ReactiveCommand <int, Unit> command, int value, string title)
        {
            var      inputDialog = new AlertDialog.Builder(this);
            EditText userInput   = new EditText(this);

            userInput.Text      = value.ToString();
            userInput.InputType = Android.Text.InputTypes.NumberFlagDecimal | Android.Text.InputTypes.ClassNumber;
            userInput.SetPadding(25, 25, 25, 25);

            inputDialog.SetTitle(title);
            inputDialog.SetView(userInput);
            inputDialog.SetPositiveButton(
                "Ok",
                (see, ess) =>
            {
                if (!String.IsNullOrEmpty(userInput.Text) && userInput.Text != "0")
                {
                    int parsedInput = int.Parse(userInput.Text);
                    command.Execute(parsedInput).Subscribe();
                }

                this.HideKeyboard(userInput);
            });

            inputDialog.Show();
            this.ShowKeyboard(userInput);
        }
示例#27
0
        void SetReminderConfirmation()
        {
            var            builder  = new AlertDialog.Builder(this.Activity);
            LayoutInflater inflater = this.Activity.LayoutInflater;
            View           view     = inflater.Inflate(Resource.Layout.AlertDialog_notifications, null, false);

            builder.SetView(view);
            builder.SetTitle("Add Notification");
            builder.SetPositiveButton("OK", (sender, e) => {
                RadioButton mins30radio = view.FindViewById <RadioButton>(Resource.Id.Minute30Radio);
                RadioButton day1radio   = view.FindViewById <RadioButton>(Resource.Id.Day1Radio);
                RadioButton week1radio  = view.FindViewById <RadioButton>(Resource.Id.Week1Radio);
                if (mins30radio.Checked)
                {
                    SetCalendarMins();
                }
                else if (day1radio.Checked)
                {
                    SetCalendarDay();
                }
                else if (week1radio.Checked)
                {
                    SetCalendarWeek();
                }
                GoToWorkshopBooked();
                //add calendar function here
            });
            builder.SetNegativeButton("Cancel", (sender, e) => {
                GoToWorkshopBooked();
            });
            builder.Create().Show();
        }
        private void ShowOwncloudDialog(Activity activity, Util.FileSelectedHandler onStartBrowse, Action onCancel, string defaultPath, string subtype)
        {
#if !EXCLUDE_JAVAFILESTORAGE && !NoNet
            AlertDialog.Builder builder = new AlertDialog.Builder(activity);
            View dlgContents            = activity.LayoutInflater.Inflate(Resource.Layout.owncloudcredentials, null);
            builder.SetView(dlgContents);

            builder.SetPositiveButton(Android.Resource.String.Ok,
                                      (sender, args) =>
            {
                string host = dlgContents.FindViewById <EditText>(Resource.Id.owncloud_url).Text;

                string user     = dlgContents.FindViewById <EditText>(Resource.Id.http_user).Text;
                string password = dlgContents.FindViewById <EditText>(Resource.Id.http_password).Text;

                string scheme = defaultPath.Substring(0, defaultPath.IndexOf(_schemeSeparator, StringComparison.Ordinal));
                if (host.Contains(_schemeSeparator) == false)
                {
                    host = scheme + _schemeSeparator + host;
                }
                string httpPath = new Keepass2android.Javafilestorage.WebDavStorage(null).BuildFullPath(WebDavFileStorage.Owncloud2Webdav(host, subtype == "owncloud" ? WebDavFileStorage.owncloudPrefix : WebDavFileStorage.nextcloudPrefix), user,
                                                                                                        password);
                onStartBrowse(httpPath);
            });
            EventHandler <DialogClickEventArgs> evtH = new EventHandler <DialogClickEventArgs>((sender, e) => onCancel());

            builder.SetNegativeButton(Android.Resource.String.Cancel, evtH);
            builder.SetTitle(activity.GetString(subtype == "owncloud" ?  Resource.String.enter_owncloud_login_title : Resource.String.enter_nextcloud_login_title));
            Dialog dialog = builder.Create();
            dlgContents.FindViewById <EditText>(Resource.Id.owncloud_url).SetHint(subtype == "owncloud" ? Resource.String.hint_owncloud_url : Resource.String.hint_nextcloud_url);
            dialog.Show();
#endif
        }
示例#29
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            AlertDialog.Builder builder  = new AlertDialog.Builder(Activity);
            LayoutInflater      inflater = Activity.LayoutInflater;
            var view = inflater.Inflate(Resource.Layout.dialog_userTask, null);

            var nameField        = view.FindViewById <EditText>(Resource.Id.dialog_userTask_name);
            var descriptionField = view.FindViewById <EditText>(Resource.Id.dialog_userTask_description);

            var headerText = view.FindViewById <TextView>(Resource.Id.dialog_userTask_text);

            if (_taskModel != null)
            {
                nameField.Text        = _taskModel.Name;
                descriptionField.Text = _taskModel.Description;
                headerText.Text       = GetString(Resource.String.editTask);

                builder.SetView(view)
                .SetPositiveButton(Resource.String.edit, (s, e) =>
                {
                    _taskModel.Name        = nameField.Text;
                    _taskModel.Description = descriptionField.Text;

                    _listener.OnConfirmTaskEdit(_taskModel);
                })
                .SetNegativeButton(Resource.String.cancel, (s, e) => { });
            }
            else
            {
                headerText.Text = GetString(Resource.String.createNewTask);

                builder.SetView(view)
                .SetPositiveButton(Resource.String.create, (s, e) =>
                {
                    _taskModel = new UserTaskModel()
                    {
                        Name        = nameField.Text,
                        Description = descriptionField.Text,
                        Checked     = false
                    };
                    _listener.OnConfirmTaskCreate(_taskModel);
                })
                .SetNegativeButton(Resource.String.cancel, (s, e) => { });
            }

            return(builder.Create());
        }
        private void AddBookmark()
        {
            // Create a dialog for entering the bookmark name
            AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);

            // Create the layout
            LinearLayout dialogLayout = new LinearLayout(this);

            dialogLayout.Orientation = Orientation.Vertical;

            // Create a layout for the text entry
            LinearLayout nameTextLayout = new LinearLayout(this);

            nameTextLayout.Orientation = Orientation.Horizontal;

            // EditText control for entering the bookmark name
            _bookmarkNameText = new EditText(this);

            // Label for the text entry
            var nameLabel = new TextView(this);

            nameLabel.Text = "Name:";

            // Add the controls to the layout
            nameTextLayout.AddView(nameLabel);
            nameTextLayout.AddView(_bookmarkNameText);

            // Create a layout for the dialog buttons (OK and Cancel)
            LinearLayout buttonLayout = new LinearLayout(this);

            buttonLayout.Orientation = Orientation.Horizontal;

            // Button to cancel the new bookmark
            var cancelButton = new Button(this);

            cancelButton.Text   = "Cancel";
            cancelButton.Click += (s, e) => _newBookmarkDialog.Dismiss();

            // Button to save the current viewpoint as a new bookmark
            var okButton = new Button(this);

            okButton.Text   = "OK";
            okButton.Click += CreateNewBookmark;

            // Add the buttons to the layout
            buttonLayout.AddView(cancelButton);
            buttonLayout.AddView(okButton);

            // Build the dialog with the text control and button layouts
            dialogLayout.AddView(nameTextLayout);
            dialogLayout.AddView(buttonLayout);

            // Set dialog content
            dialogBuilder.SetView(dialogLayout);
            dialogBuilder.SetTitle("New Bookmark");

            // Show the dialog
            _newBookmarkDialog = dialogBuilder.Show();
        }