/// <summary>
        /// Shows a dialog.
        /// </summary>
        /// <param name="title">A dialog title.</param>
        /// <param name="value">A dialog value.</param>
        /// <param name="canCopy">Indicates that "Copy value" is activated.</param>
        /// <param name="valueToCopy">Value to copy by button.</param>
        internal void ShowInfoDialog(string title, string value, bool canCopy, string valueToCopy)
        {
            // dialog builder
            using (Android.Support.V7.App.AlertDialog.Builder dialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(new ContextThemeWrapper(this, Resource.Style.AlertDialogTheme)))
            {
                // create button
                dialogBuilder.SetPositiveButton(Resources.GetString(Resource.String.ok_button), (EventHandler <DialogClickEventArgs>)null);
                if (canCopy)
                {
                    dialogBuilder.SetNeutralButton(Resources.GetString(Resource.String.copy_value_button), (EventHandler <DialogClickEventArgs>)null);
                    _infoDialogValueToCopy = valueToCopy;
                }
                // create dialog
                _infoDialog = dialogBuilder.Create();

                _infoDialog.Window.SetBackgroundDrawableResource(Android.Resource.Drawable.ScreenBackgroundDarkTransparent);
                // set dialog title
                _infoDialog.SetTitle(title);
                // set dialog message
                _infoDialog.SetMessage(value);
                // show on screen
                _infoDialog.Show();

                // get display size
                DisplayMetrics displayMetrics = new DisplayMetrics();
                WindowManager.DefaultDisplay.GetMetrics(displayMetrics);
                int height = (int)(displayMetrics.HeightPixels * 3 / 4);

                // if dialog content height is greater than 3/4 of screen height
                if (_infoDialog.Window.Attributes.Height > height)
                {
                    _infoDialog.Window.SetLayout(_infoDialog.Window.Attributes.Width, height);
                }

                TextView dialogTextView = _infoDialog.FindViewById <TextView>(Android.Resource.Id.Message);
                // allow to select dialog text
                dialogTextView.SetTextIsSelectable(true);
                // allow to click links
                dialogTextView.MovementMethod = LinkMovementMethod.Instance;
                dialogTextView.LinksClickable = true;
                // add links
                Utils.MyLinkify.AddLinks(dialogTextView, Patterns.EmailAddress, null);
                Utils.MyLinkify.AddLinks(dialogTextView, Patterns.WebUrl, null, new Utils.MyLinkify(), null);

                if (canCopy)
                {
                    _infoDialogNeutralButton         = _infoDialog.GetButton((int)DialogButtonType.Neutral);
                    _infoDialogNeutralButton.Click  += NeutralButton_Click;
                    _infoDialogPositiveButton        = _infoDialog.GetButton((int)DialogButtonType.Positive);
                    _infoDialogPositiveButton.Click += PositiveButton_Click;
                }
            }
        }
示例#2
0
        // Alert Dialog Section
        void ShowNewTripDialog(string RiderName, string PickupAddress, string DestinationAddress, string Paymentmethod)
        {
            alert = new Android.Support.V7.App.AlertDialog.Builder(this);
            alert.SetView(Resource.Layout.NewTripRequest);
            alert.SetCancelable(false);
            alertDialog = alert.Show();

            // linearTimer
            linearTimerView        = (LinearTimerView)alertDialog.FindViewById(Resource.Id.linearTimer);
            linearTimerView.Click += LinearTimerView_Click;

            linearTimer = new LinearTimer(linearTimerView);
            linearTimer.StartTimer(360, 120 * 100);

            RiderPickupAddresstxt = (TextView)alertDialog.FindViewById(Resource.Id.RiderPickupAddresstxt);
            RiderDestinationtxt   = (TextView)alertDialog.FindViewById(Resource.Id.RiderDestinationtxt);
            RiderNametxt          = (TextView)alertDialog.FindViewById(Resource.Id.RiderNametxt);
            Paymentmethodtxt      = (TextView)alertDialog.FindViewById(Resource.Id.Paymentmethodtxt);

            // Cancel Trip Before Accept
            TextView cancel = (TextView)alertDialog.FindViewById(Resource.Id.cancelTrip);

            cancel.Click += Cancel_Click;

            RiderPickupAddresstxt.Text = PickupAddress;
            RiderDestinationtxt.Text   = DestinationAddress;
            RiderNametxt.Text          = RiderName;
            Paymentmethodtxt.Text      = Paymentmethod;

            // Start miusc
            string filePath = "http://server6.mp3quran.net/thubti/001.mp3";

            StartPlayer(filePath);
        }
示例#3
0
        /// <summary>
        /// Shows a dialog with information.
        /// </summary>
        /// <param name="title">A dialog title.</param>
        /// <param name="value">A dialog value.</param>
        internal void ShowInfoDialog(string title, string value)
        {
            // create the dialog builder
            using (Android.Support.V7.App.AlertDialog.Builder dialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this))
            {
                // create a button
                dialogBuilder.SetPositiveButton(Resource.String.ok_button, (EventHandler <DialogClickEventArgs>)null);

                // create a dialog
                _infoDialog = dialogBuilder.Create();

                // set dialog title
                _infoDialog.SetTitle(title);
                // set dialog message
                _infoDialog.SetMessage(value);
                // show on screen
                _infoDialog.Show();

                // get display size
                DisplayMetrics displayMetrics = new DisplayMetrics();
                WindowManager.DefaultDisplay.GetMetrics(displayMetrics);
                int height = (int)(displayMetrics.HeightPixels * 3 / 4);

                // if dialog content height is greater than 3/4 of screen height
                if (_infoDialog.Window.Attributes.Height > height)
                {
                    _infoDialog.Window.SetLayout(_infoDialog.Window.Attributes.Width, height);
                }

                TextView dialogTextView = _infoDialog.FindViewById <TextView>(Android.Resource.Id.Message);
                // allow to select dialog text
                dialogTextView.SetTextIsSelectable(true);
                // allow to click links
                dialogTextView.MovementMethod = LinkMovementMethod.Instance;
                dialogTextView.LinksClickable = true;
                // add links
                Utils.MyLinkify.AddLinks(dialogTextView, Patterns.EmailAddress, null);
                Utils.MyLinkify.AddLinks(dialogTextView, Patterns.WebUrl, null, new Utils.MyLinkify(), null);
            }
        }