public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            // Dialog to display
            LinearLayout dialogView = null;

            // Get the context for creating the dialog controls
            Android.Content.Context ctx = Activity.ApplicationContext;
            AndroidX.AppCompat.View.ContextThemeWrapper ctxWrapper = new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeMaterialLight);

            // Set a dialog title
            Dialog.SetTitle(_metadata.Credits);

            // The container for the dialog is a vertical linear layout
            dialogView = new LinearLayout(ctxWrapper)
            {
                Orientation = Orientation.Vertical
            };
            dialogView.SetPadding(20, 20, 20, 20);

            // Add a text box for showing metadata summary
            TextView summaryTextView = new TextView(ctxWrapper)
            {
                Text = _metadata.Summary
            };

            dialogView.AddView(summaryTextView);

            // Add an image to show the thumbnail
            _thumbnailImageView = new ImageView(ctxWrapper);
            _thumbnailImageView.SetMinimumHeight(200);
            _thumbnailImageView.SetMinimumWidth(200);
            dialogView.AddView(_thumbnailImageView);

            // Call a function to load the thumbnail image from the metadata
            LoadThumbnail();

            // Add a text box for showing metadata tags
            TextView tagsTextView = new TextView(ctxWrapper)
            {
                Text = string.Join(",", _metadata.Tags)
            };

            dialogView.AddView(tagsTextView);

            // Add a button to close the dialog
            Button dismissButton = new Button(ctxWrapper)
            {
                Text = "OK"
            };

            dismissButton.Click += (s, e) => Dismiss();
            dialogView.AddView(dismissButton);

            // Return the new view for display
            return(dialogView);
        }
示例#2
0
        // Override OnCreateView to create the dialog controls.
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);
            Context             ctx        = this.Activity.ApplicationContext;
            ContextThemeWrapper ctxWrapper = new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeMaterialLight);

            // The container for the dialog is a vertical linear layout.
            LinearLayout dialogView = new LinearLayout(ctxWrapper)
            {
                Orientation = Orientation.Vertical
            };

            // Add a text box for entering a username.
            _usernameTextbox = new EditText(ctxWrapper)
            {
                Hint = "Username = user1"
            };
            dialogView.AddView(_usernameTextbox);

            // Add a text box for entering a password.
            _passwordTextbox = new EditText(ctxWrapper)
            {
                Hint      = "Password = user1",
                InputType = Android.Text.InputTypes.TextVariationPassword | Android.Text.InputTypes.ClassText
            };
            dialogView.AddView(_passwordTextbox);

            // Use a horizontal layout for the two buttons (login and cancel).
            LinearLayout buttonsRow = new LinearLayout(ctxWrapper)
            {
                Orientation = Orientation.Horizontal
            };

            // Create a button to login with these credentials.
            Button loginButton = new Button(ctxWrapper)
            {
                Text = "Login"
            };

            loginButton.Click += LoginButtonClick;
            buttonsRow.AddView(loginButton);

            // Create a button to cancel.
            Button cancelButton = new Button(ctxWrapper)
            {
                Text = "Cancel"
            };

            cancelButton.Click += CancelButtonClick;
            buttonsRow.AddView(cancelButton);

            dialogView.AddView(buttonsRow);

            // Return the new view for display.
            return(dialogView);
        }
示例#3
0
        public override View OnCreateView(LayoutInflater contextInflater, ViewGroup container,
                                          Bundle savedInstanceState)
        {
            var contextThemeWrapper = new ContextThemeWrapper(Activity, Resource.Style.BottomSheetStyle);
            var prefs = new PreferenceWrapper(Context);

            contextThemeWrapper.Theme.ApplyStyle(AccentColourMap.GetOverlayId(prefs.AccentColour), true);
            StyledInflater = contextInflater.CloneInContext(contextThemeWrapper);

            return(StyledInflater.Inflate(_layout, container, false));
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Dialog to display
            LinearLayout dialogView = null;

            // Get the context for creating the dialog controls
            Android.Content.Context ctx        = Activity.ApplicationContext;
            ContextThemeWrapper     ctxWrapper = new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeMaterialLight);

            // Set a dialog title
            Dialog.SetTitle("Search Portal");

            try
            {
                base.OnCreateView(inflater, container, savedInstanceState);

                // The container for the dialog is a vertical linear layout
                dialogView = new LinearLayout(ctxWrapper)
                {
                    Orientation = Orientation.Vertical
                };

                // Add a text box for entering web map search text
                _mapSearchTextbox = new EditText(ctxWrapper)
                {
                    Hint = "Search text"
                };
                dialogView.AddView(_mapSearchTextbox);

                // Add a button to complete search
                Button searchMapsButton = new Button(ctxWrapper)
                {
                    Text = "Search"
                };
                searchMapsButton.Click += SearchMapsButtonClick;
                dialogView.AddView(searchMapsButton);
            }
            catch (Exception ex)
            {
                // Show the exception message
                AlertDialog.Builder alertBuilder = new AlertDialog.Builder(Activity);
                alertBuilder.SetTitle("Error");
                alertBuilder.SetMessage(ex.Message);
                alertBuilder.Show();
            }

            // Return the new view for display
            return(dialogView);
        }
示例#5
0
        // Create the dialog UI
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Dialog UI to display
            LinearLayout dialogView = null;

            // Get the context for creating the dialog controls
            Android.Content.Context ctx        = this.Activity.ApplicationContext;
            ContextThemeWrapper     ctxWrapper = new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeMaterialLight);

            // Set a dialog title
            this.Dialog.SetTitle("Order Results");

            // Call OnCreateView on the base
            base.OnCreateView(inflater, container, savedInstanceState);

            // The container for the dialog is a vertical linear layout
            dialogView = new LinearLayout(ctxWrapper)
            {
                Orientation = Orientation.Vertical
            };

            // Create an instance of a custom list adapter for showing the order fields
            OrderFieldListAdapter listAdapter = new OrderFieldListAdapter(this.Activity, _potentialOrderByFields);

            // Create a new list view that uses the adapter
            _orderFieldsListView = new ListView(ctxWrapper)
            {
                Adapter = listAdapter,

                // Allow the user to select multiple fields in the list view
                ChoiceMode = ChoiceMode.Multiple
            };

            // Loop through all order fields in the list
            for (int i = 0; i < _potentialOrderByFields.Count; i++)
            {
                // If this field has been selected to order with, check it in the list view
                bool chosenForOrder = _potentialOrderByFields[i].OrderWith;
                _orderFieldsListView.SetItemChecked(i, chosenForOrder);
            }

            // Add the list view to the dialog
            dialogView.AddView(_orderFieldsListView);

            // Return the new view for display
            return(dialogView);
        }
示例#6
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Dialog UI to display
            LinearLayout dialogView = null;

            // Get the context for creating the dialog controls
            Android.Content.Context ctx        = this.Activity.ApplicationContext;
            ContextThemeWrapper     ctxWrapper = new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeMaterialLight);

            // Set a dialog title
            this.Dialog.SetTitle("Group Results By");

            // Call OnCreateView on the base
            base.OnCreateView(inflater, container, savedInstanceState);

            // The container for the dialog is a vertical linear layout
            dialogView = new LinearLayout(ctxWrapper)
            {
                Orientation = Orientation.Vertical
            };

            // Create an instance of a custom list adapter to show the available group fields
            GroupFieldListAdapter listAdapter = new GroupFieldListAdapter(this.Activity, _potentialGroupByFields);

            // Create a new list view that uses the adapter and allows for multiple row selection
            _groupFieldsListView = new ListView(ctxWrapper)
            {
                Adapter    = listAdapter,
                ChoiceMode = ChoiceMode.Multiple
            };

            // Loop through all the available fields
            for (int i = 0; i < _potentialGroupByFields.Count; i++)
            {
                // See if this field have been selected for grouping results or not
                bool chosenForGroup = _potentialGroupByFields.ElementAt(i).Value;

                // Set the checked state in the list view to show the chosen fields
                _groupFieldsListView.SetItemChecked(i, chosenForGroup);
            }

            // Add the list view to the dialog UI
            dialogView.AddView(_groupFieldsListView);

            // Return the new view for display
            return(dialogView);
        }
示例#7
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Dialog UI to display
            LinearLayout dialogView = null;

            // Get the context for creating the dialog controls
            Android.Content.Context ctx        = Activity.ApplicationContext;
            ContextThemeWrapper     ctxWrapper = new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeMaterialLight);

            // Set a dialog title
            Dialog.SetTitle("Statistics Definitions");

            // Call OnCreateView on the base
            base.OnCreateView(inflater, container, savedInstanceState);

            // The container for the dialog is a vertical linear layout
            dialogView = new LinearLayout(ctxWrapper)
            {
                Orientation = Orientation.Vertical
            };

            // Spinner for choosing a field to get statistics for
            _fieldSpinner = new Spinner(ctxWrapper);

            // Create an array adapter to display the fields
            ArrayAdapter fieldsAdapter = new ArrayAdapter(ctxWrapper, Android.Resource.Layout.SimpleSpinnerItem);

            foreach (string field in _fieldNames)
            {
                fieldsAdapter.Add(field);
            }

            // Set the drop down style for the array adapter, then assign it to the field spinner control
            fieldsAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            _fieldSpinner.Adapter = fieldsAdapter;

            // Create a horizontal layout to display the field spinner (with a label)
            LinearLayout fieldView = new LinearLayout(ctxWrapper)
            {
                Orientation = Orientation.Horizontal
            };

            // Create a label for the spinner
            TextView fieldLabel = new TextView(ctxWrapper)
            {
                Text     = "Field:",
                LabelFor = _fieldSpinner.Id
            };

            // Add field controls to the horizontal layout
            fieldView.AddView(fieldLabel);
            fieldView.AddView(_fieldSpinner);
            fieldView.SetPadding(140, 0, 0, 0);
            dialogView.AddView(fieldView);

            // Spinner for selecting the statistic type
            _statSpinner = new Spinner(ctx);

            // Create an array adapter to display the statistic types
            ArrayAdapter statTypeAdapter = new ArrayAdapter(ctxWrapper, Android.Resource.Layout.SimpleSpinnerItem);

            // Read the statistic types from the StatisticType enum
            Array statTypes = Enum.GetValues(typeof(StatisticType));

            foreach (object stat in statTypes)
            {
                // Add each statistic type to the adapter
                statTypeAdapter.Add(stat.ToString());
            }

            // Set the drop down style for the array adapter, then assign it to the statistic type spinner control
            statTypeAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            _statSpinner.Adapter = statTypeAdapter;

            // Create a horizontal layout to display the statistic type spinner (with a label)
            LinearLayout statTypeView = new LinearLayout(ctxWrapper)
            {
                Orientation = Orientation.Horizontal
            };

            // Create the label for the statistic type list
            TextView typeLabel = new TextView(ctxWrapper)
            {
                Text     = "Type:",
                LabelFor = _statSpinner.Id
            };

            // Add statistic type controls to the horizontal layout
            statTypeView.AddView(typeLabel);
            statTypeView.AddView(_statSpinner);
            statTypeView.SetPadding(140, 0, 0, 0);

            // Add the statistic type layout to the dialog
            dialogView.AddView(statTypeView);

            // Create a button to add a new statistic definition (selected field and statistic type)
            Button addStatDefButton = new Button(ctxWrapper)
            {
                Text = "Add"
            };

            addStatDefButton.Click += AddStatisticDefinition;

            // Create a button to remove the selected statistic definition
            Button removeStatDefButton = new Button(ctxWrapper)
            {
                Text = "Remove"
            };

            removeStatDefButton.Click += RemoveStatisticDefinition;

            // Create a horizontal layout to contain the add and remove buttons
            LinearLayout buttonView = new LinearLayout(ctxWrapper)
            {
                Orientation = Orientation.Horizontal
            };

            buttonView.AddView(addStatDefButton);
            buttonView.AddView(removeStatDefButton);

            // Add the button layout to the dialog
            dialogView.AddView(buttonView);

            // Create a list view and an instance of a custom list adapter to show the statistic definitions
            StatDefinitionListAdapter listAdapter = new StatDefinitionListAdapter(Activity, _statisticDefinitions);

            _statDefListView = new ListView(ctxWrapper)
            {
                Adapter = listAdapter,

                // Only allow one choice in the statistic definitions list ('remove' button will work on the selected row)
                ChoiceMode = ChoiceMode.Single
            };

            // Add the statistic definitions list to the dialog
            dialogView.AddView(_statDefListView);

            // Return the new view for display
            return(dialogView);
        }
示例#8
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Dialog to display
            LinearLayout dialogView = null;

            // Get the context for creating the dialog controls
            Android.Content.Context ctx        = Activity.ApplicationContext;
            ContextThemeWrapper     ctxWrapper = new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeMaterialLight);

            // Set a dialog title
            Dialog.SetTitle("Save map to Portal");

            try
            {
                base.OnCreateView(inflater, container, savedInstanceState);

                // The container for the dialog is a vertical linear layout
                dialogView = new LinearLayout(ctxWrapper)
                {
                    Orientation = Orientation.Vertical
                };
                dialogView.SetPadding(10, 0, 10, 10);

                // Add a text box for entering a title for the new web map
                _mapTitleTextbox = new EditText(ctxWrapper)
                {
                    Hint = "Title"
                };
                dialogView.AddView(_mapTitleTextbox);

                // Add a text box for entering a description
                _mapDescriptionTextbox = new EditText(ctxWrapper)
                {
                    Hint = "Description"
                };
                dialogView.AddView(_mapDescriptionTextbox);

                // Add a text box for entering tags (populate with some values so the user doesn't have to fill this in)
                _tagsTextbox = new EditText(ctxWrapper)
                {
                    Text = "ArcGIS Runtime, Web Map"
                };
                dialogView.AddView(_tagsTextbox);

                // Add a button to save the map
                Button saveMapButton = new Button(ctxWrapper)
                {
                    Text = "Save"
                };
                saveMapButton.Click += SaveMapButtonClick;
                dialogView.AddView(saveMapButton);

                // If there's an existing portal item, configure the dialog for "update" (read-only entries)
                if (_portalItem != null)
                {
                    _mapTitleTextbox.Text    = _portalItem.Title;
                    _mapTitleTextbox.Enabled = false;

                    _mapDescriptionTextbox.Text    = _portalItem.Description;
                    _mapDescriptionTextbox.Enabled = false;

                    _tagsTextbox.Text    = string.Join(",", _portalItem.Tags);
                    _tagsTextbox.Enabled = false;

                    // Change some of the control text
                    Dialog.SetTitle("Save changes to map");
                    saveMapButton.Text = "Update";
                }
            }
            catch (Exception ex)
            {
                // Show the exception message
                AlertDialog.Builder alertBuilder = new AlertDialog.Builder(Activity);
                alertBuilder.SetTitle("Error");
                alertBuilder.SetMessage(ex.Message);
                alertBuilder.Show();
            }

            // Return the new view for display
            return(dialogView);
        }