Beispiel #1
0
        public void StartLoading()
        {
            CreateDialog();
            CreateAndSetWindowToDialog();
            CreateAndSetProgressBarToDialog();
            dialog.Show();

            void CreateDialog()
            {
                dialog = new Dialog(CurrentActivity);
                dialog.RequestWindowFeature((int)WindowFeatures.NoTitle);
                dialog.SetCancelable(true); // Set to true until a time out and canExecute is implemented.
                dialog.SetCanceledOnTouchOutside(false);
            }

            void CreateAndSetWindowToDialog()
            {
                var window = dialog.Window;

                window.SetLayout(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                window.SetBackgroundDrawable(new ColorDrawable(Android.Graphics.Color.Transparent));
            }

            void CreateAndSetProgressBarToDialog()
            {
                var progress = new Android.Widget.ProgressBar(CurrentActivity)
                {
                    LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent),
                    Indeterminate    = true
                };

                dialog.AddContentView(progress, progress.LayoutParameters);
            }
        }
 private void FullscreenDialog()
 {
     mainpage.RemoveView(PlayerView);
     ((Activity)Context).RequestedOrientation = Android.Content.PM.ScreenOrientation.SensorLandscape;
     mFullScreenDialog.AddContentView(PlayerView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
     mFullScreen.SetImageDrawable(ContextCompat.GetDrawable(Context, Resource.Drawable.exo_controls_fullscreen_exit));
     mExoPlayerFullscreen = true;
     mFullScreenDialog.Show();
 }
Beispiel #3
0
        private void ShowWinnerModal()
        {
            var RoundWinner     = (CardsAgainstHumility.RoundWinner == CardsAgainstHumility.PlayerName ? "You" : CardsAgainstHumility.RoundWinner);
            var currentQuestion = CardsAgainstHumility.CurrentQuestion;
            var winningAnswer   = new WhiteCard(CardsAgainstHumility.WinningCard, 20);

            RunOnUiThread(() =>
            {
                // Prepare the builder
                var dlg  = new Dialog(this);
                var view = LayoutInflater.Inflate(Resource.Layout.RoundWinnerAnnouncement, null);

                // Show the winner's name
                var winnerName = view.FindViewById <TextView>(Resource.Id.wm_Winner);
                winnerName.SetTypeface(UIAssets.AppFont, TypefaceStyle.Normal);
                winnerName.Text = $"{RoundWinner} won the round";
                winnerName.SetTextSize(ComplexUnitType.Dip, 16);

                // Prepare the black card
                var blackCard = view.FindViewById <View>(Resource.Id.wm_BlackCard);
                UIAssets.PrepareBlackCard(blackCard, currentQuestion);

                // Prepare the white card
                var whiteCard = view.FindViewById <FrameLayout>(Resource.Id.wm_WhiteCard);
                UIAssets.PrepareWhiteCard(whiteCard, winningAnswer);

                // Place the white card just below the bottom of the black card's text
                PlaceWhiteCardBelowBlackCardText(whiteCard, blackCard);

                // Link up the close button
                var closeBtn = view.FindViewById <Button>(Resource.Id.wm_closeBtn);
                closeBtn.SetTypeface(UIAssets.AppFont, TypefaceStyle.Normal);
                closeBtn.Click += (owner, args) =>
                {
                    dlg.Dismiss();
                };

                // Show the modal
                dlg.AddContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent));
                dlg.Window.SetBackgroundDrawable(new ColorDrawable(Color.Transparent));
                dlg.Show();
            });
        }
Beispiel #4
0
        public void StartLoading()
        {
            dialog = new Dialog(Xamarin.Forms.Forms.Context);
            dialog.RequestWindowFeature((int)WindowFeatures.NoTitle);
            dialog.SetCancelable(false);
            dialog.SetCanceledOnTouchOutside(false);
            Window window = dialog.Window;

            window.SetLayout(WindowManagerLayoutParams.MatchParent, WindowManagerLayoutParams.MatchParent);
            window.SetBackgroundDrawable(new ColorDrawable(Color.Transparent));

            var progress = new ProgressBar(Xamarin.Forms.Forms.Context);

            progress.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
            progress.Indeterminate    = true;
            dialog.AddContentView(progress, progress.LayoutParameters);

            dialog.Show();
        }
Beispiel #5
0
        /// <summary>
        /// 公共弹窗.
        /// </summary>
        /// <param name="context">Context.传入当前调用该方法的activity实例</param>
        /// <param name="title">Title.</param>
        /// <param name="content">Content.</param>
        /// <param name="type">Type. 显示类型1:仅为确定,2:有“确定”、“取消”两个操作</param>
        /// <param name="cbFunc">Cb func.</param>
        public static void ShowDialog(Context context, String title, String content, int type, ShowDialogClick cbFunc)
        {
            Dialog dialog = new Dialog(context, Resource.Style.myDialog);
            // 设置像是内容模板
            LayoutInflater inflater         = LayoutInflater.From(context);
            View           view             = inflater.Inflate(Resource.Layout.dialog_global, null);
            Button         confirmButton    = (Button)view.FindViewById(Resource.Id.setting_account_bind_confirm); // 确认
            Button         cancelButton     = (Button)view.FindViewById(Resource.Id.setting_account_bind_cancel);  // 取消
            TextView       dialogTitle      = (TextView)view.FindViewById(Resource.Id.global_dialog_title);        // 标题
            View           line_hori_center = view.FindViewById(Resource.Id.line_hori_center);                     // 中竖线

            confirmButton.Visibility    = ViewStates.Gone;                                                         // 默认隐藏取消按钮
            line_hori_center.Visibility = ViewStates.Gone;
            TextView textView = (TextView)view.FindViewById(Resource.Id.setting_account_bind_text);

            // 设置对话框的宽度
            Window dialogWindow          = dialog.Window;
            WindowManagerLayoutParams lp = dialogWindow.Attributes;

            lp.Width = (int)(context.Resources.DisplayMetrics.Density * 288);
            dialogWindow.Attributes = lp;

            // 设置显示类型
            if (type != 1 && type != 2)
            {
                type = 1;
            }
            dialogTitle.SetText(title, TextView.BufferType.Normal); // 设置标题
            textView.SetText(content, TextView.BufferType.Normal);  // 设置提示内容

            // 确认按钮操作
            if (type == 1 || type == 2)
            {
                confirmButton.Visibility = ViewStates.Visible;
                confirmButton.Click     += (sender, e) =>
                {
                    if (cbFunc != null)
                    {
                        cbFunc(1);
                    }
                    dialog.Dismiss();
                };
            }
            // 取消按钮事件
            if (type == 2)
            {
                cancelButton.Visibility     = ViewStates.Visible;
                line_hori_center.Visibility = ViewStates.Visible;
                cancelButton.Click         += (sender, e) =>
                {
                    if (cbFunc != null)
                    {
                        cbFunc(0);
                    }
                    dialog.Dismiss();
                };
            }
            dialog.AddContentView(view, new ViewGroup.LayoutParams(WindowManagerLayoutParams.MatchParent, WindowManagerLayoutParams.MatchParent));
            dialog.SetCancelable(true);             // 点击返回键关闭
            dialog.SetCanceledOnTouchOutside(true); // 点击外部关闭
            dialog.Show();
            dialog.SetCancelable(false);
            dialog.SetCanceledOnTouchOutside(false);
        }
Beispiel #6
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            if (container == null)
            {
                // Currently in a layout without a container, so no reason to create our view.
                return(null);
            }

            View view = inflater.Inflate(Resource.Layout.Profile, container, false);

            view.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor));

            RelativeLayout navBar = view.FindViewById <RelativeLayout>(Resource.Id.navbar_relative_layout);

            navBar.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor));

            // setup the name section
            NickNameLayer = view.FindViewById <RelativeLayout>(Resource.Id.firstname_background);
            ControlStyling.StyleBGLayer(NickNameLayer);

            NickNameText = NickNameLayer.FindViewById <EditText>(Resource.Id.nickNameText);
            ControlStyling.StyleTextField(NickNameText, RegisterStrings.NickNamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            NickNameBGColor                = ControlStylingConfig.BG_Layer_Color;
            NickNameText.InputType        |= InputTypes.TextFlagCapWords;
            NickNameText.AfterTextChanged += (sender, e) => { Dirty = true; };

            View borderView = NickNameLayer.FindViewById <View>(Resource.Id.middle_border);

            borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor));

            LastNameLayer = view.FindViewById <RelativeLayout>(Resource.Id.lastname_background);
            ControlStyling.StyleBGLayer(LastNameLayer);

            LastNameText = LastNameLayer.FindViewById <EditText>(Resource.Id.lastNameText);
            ControlStyling.StyleTextField(LastNameText, RegisterStrings.LastNamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            LastNameBGColor                = ControlStylingConfig.BG_Layer_Color;
            LastNameText.InputType        |= InputTypes.TextFlagCapWords;
            LastNameText.AfterTextChanged += (sender, e) => { Dirty = true; };


            // setup the contact section
            EmailLayer = view.FindViewById <RelativeLayout>(Resource.Id.email_background);
            ControlStyling.StyleBGLayer(EmailLayer);
            EmailBGColor = ControlStylingConfig.BG_Layer_Color;

            EmailField = EmailLayer.FindViewById <EditText>(Resource.Id.emailAddressText);
            ControlStyling.StyleTextField(EmailField, ProfileStrings.EmailPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            EmailField.AfterTextChanged += (sender, e) => { Dirty = true; };

            View backgroundView = view.FindViewById <RelativeLayout>(Resource.Id.cellphone_background);

            ControlStyling.StyleBGLayer(backgroundView);

            borderView = backgroundView.FindViewById <View>(Resource.Id.middle_border);
            borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor));

            CellPhoneField = backgroundView.FindViewById <EditText>(Resource.Id.cellPhoneText);
            ControlStyling.StyleTextField(CellPhoneField, ProfileStrings.CellPhonePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            CellPhoneField.AfterTextChanged += (sender, e) => { Dirty = true; };
            CellPhoneField.AddTextChangedListener(new PhoneNumberFormattingTextWatcher());


            // setup the address section
            backgroundView = view.FindViewById <RelativeLayout>(Resource.Id.address_background);
            ControlStyling.StyleBGLayer(backgroundView);

            StreetField = backgroundView.FindViewById <EditText>(Resource.Id.streetAddressText);
            ControlStyling.StyleTextField(StreetField, ProfileStrings.StreetPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            StreetField.AfterTextChanged += (sender, e) => { Dirty = true; };
            StreetField.InputType        |= InputTypes.TextFlagCapWords;

            borderView = backgroundView.FindViewById <View>(Resource.Id.street_border);
            borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor));

            CityField = backgroundView.FindViewById <EditText>(Resource.Id.cityAddressText);
            ControlStyling.StyleTextField(CityField, ProfileStrings.CityPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            CityField.AfterTextChanged += (sender, e) => { Dirty = true; };
            CityField.InputType        |= InputTypes.TextFlagCapWords;

            borderView = backgroundView.FindViewById <View>(Resource.Id.city_border);
            borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor));

            StateField = backgroundView.FindViewById <EditText>(Resource.Id.stateAddressText);
            ControlStyling.StyleTextField(StateField, ProfileStrings.StatePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            StateField.AfterTextChanged += (sender, e) => { Dirty = true; };
            StateField.InputType        |= InputTypes.TextFlagCapWords;

            borderView = backgroundView.FindViewById <View>(Resource.Id.state_border);
            borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor));

            ZipField = backgroundView.FindViewById <EditText>(Resource.Id.zipAddressText);
            ControlStyling.StyleTextField(ZipField, ProfileStrings.ZipPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            ZipField.AfterTextChanged += (sender, e) => { Dirty = true; };


            // personal
            backgroundView = view.FindViewById <RelativeLayout>(Resource.Id.personal_background);
            ControlStyling.StyleBGLayer(backgroundView);

            BirthdateField = backgroundView.FindViewById <EditText>(Resource.Id.birthdateText);
            ControlStyling.StyleTextField(BirthdateField, ProfileStrings.BirthdatePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            BirthdateField.FocusableInTouchMode = false;
            BirthdateField.Focusable            = false;
            Button birthdateButton = backgroundView.FindViewById <Button>(Resource.Id.birthdateButton);

            birthdateButton.Click += (object sender, EventArgs e) =>
            {
                // setup the initial date to use ( either now, or the date in the field )
                DateTime initialDateTime = DateTime.Now;
                if (string.IsNullOrWhiteSpace(BirthdateField.Text) == false)
                {
                    initialDateTime = DateTime.Parse(BirthdateField.Text);
                }

                // build our
                LayoutInflater dateInflate = LayoutInflater.From(Activity);
                DatePicker     newPicker   = (DatePicker)dateInflate.Inflate(Resource.Layout.DatePicker, null);
                newPicker.Init(initialDateTime.Year, initialDateTime.Month - 1, initialDateTime.Day, this);

                Dialog dialog = new Dialog(Activity);
                dialog.AddContentView(newPicker, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
                dialog.Show( );
            };

            borderView = backgroundView.FindViewById <View>(Resource.Id.middle_border);
            borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor));

            // Gender
            GenderField = view.FindViewById <EditText>(Resource.Id.genderText);
            ControlStyling.StyleTextField(GenderField, ProfileStrings.GenderPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            GenderField.FocusableInTouchMode = false;
            GenderField.Focusable            = false;
            Button genderButton = backgroundView.FindViewById <Button>(Resource.Id.genderButton);

            genderButton.Click += (object sender, EventArgs e) =>
            {
                AlertDialog.Builder        builder = new AlertDialog.Builder(Activity);
                Java.Lang.ICharSequence [] strings = new Java.Lang.ICharSequence[]
                {
                    new Java.Lang.String(RockLaunchData.Instance.Data.Genders[1]),
                    new Java.Lang.String(RockLaunchData.Instance.Data.Genders[2]),
                };

                builder.SetItems(strings, delegate(object s, DialogClickEventArgs clickArgs)
                {
                    Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                    {
                        GenderField.Text = RockLaunchData.Instance.Data.Genders[clickArgs.Which + 1];
                        Dirty            = true;
                    });
                });

                builder.Show( );
            };

            borderView = backgroundView.FindViewById <View>(Resource.Id.campus_middle_border);
            borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor));

            // Campus
            CampusField = view.FindViewById <EditText>(Resource.Id.campusText);
            ControlStyling.StyleTextField(CampusField, ProfileStrings.CampusPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            CampusField.FocusableInTouchMode = false;
            CampusField.Focusable            = false;
            Button campusButton = backgroundView.FindViewById <Button>(Resource.Id.campusButton);

            campusButton.Click += (object sender, EventArgs e) =>
            {
                // build an alert dialog containing all the campus choices
                AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                builder.SetTitle(ProfileStrings.SelectCampus_SourceTitle);
                Java.Lang.ICharSequence [] campusStrings = new Java.Lang.ICharSequence[RockLaunchData.Instance.Data.Campuses.Count];
                for (int i = 0; i < RockLaunchData.Instance.Data.Campuses.Count; i++)
                {
                    campusStrings[i] = new Java.Lang.String(RockLaunchData.Instance.Data.Campuses[i].Name);
                }

                // launch the dialog, and on selection, update the viewing campus text.
                builder.SetItems(campusStrings, delegate(object s, DialogClickEventArgs clickArgs)
                {
                    Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                    {
                        int campusIndex  = clickArgs.Which;
                        CampusField.Text = RockLaunchData.Instance.Data.Campuses[campusIndex].Name;
                        Dirty            = true;
                    });
                });

                builder.Show( );
            };

            // Done buttons
            DoneButton = view.FindViewById <Button>(Resource.Id.doneButton);
            ControlStyling.StyleButton(DoneButton, ProfileStrings.DoneButtonTitle, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);

            LogoutButton = view.FindViewById <Button>(Resource.Id.logoutButton);
            ControlStyling.StyleButton(LogoutButton, ProfileStrings.LogoutButtonTitle, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            LogoutButton.Background = null;

            DoneButton.Click += (object sender, EventArgs e) =>
            {
                if (Dirty == true)
                {
                    if (ValidateInput( ))
                    {
                        // Since they made changes, confirm they want to save them.
                        AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                        builder.SetTitle(ProfileStrings.SubmitChangesTitle);

                        Java.Lang.ICharSequence [] strings = new Java.Lang.ICharSequence[]
                        {
                            new Java.Lang.String(GeneralStrings.Yes),
                            new Java.Lang.String(GeneralStrings.No),
                            new Java.Lang.String(GeneralStrings.Cancel)
                        };

                        builder.SetItems(strings, delegate(object s, DialogClickEventArgs clickArgs)
                        {
                            Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                            {
                                switch (clickArgs.Which)
                                {
                                case 0: SubmitChanges( ); SpringboardParent.ModalFragmentDone(null); break;

                                case 1: SpringboardParent.ModalFragmentDone(null); break;

                                case 2: break;
                                }
                            });
                        });

                        builder.Show( );
                    }
                }
                else
                {
                    SpringboardParent.ModalFragmentDone(null);
                }
            };

            LogoutButton.Click += (object sender, EventArgs e) =>
            {
                // Since they made changes, confirm they want to save them.
                AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                builder.SetTitle(ProfileStrings.LogoutTitle);

                Java.Lang.ICharSequence [] strings = new Java.Lang.ICharSequence[]
                {
                    new Java.Lang.String(GeneralStrings.Yes),
                    new Java.Lang.String(GeneralStrings.No)
                };

                builder.SetItems(strings, delegate(object s, DialogClickEventArgs clickArgs)
                {
                    Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                    {
                        switch (clickArgs.Which)
                        {
                        case 0: RockMobileUser.Instance.LogoutAndUnbind( ); SpringboardParent.ModalFragmentDone(null); break;

                        case 1: break;
                        }
                    });
                });

                builder.Show( );
            };

            // blocker and result views
            ScrollView = view.FindViewById <LockableScrollView>(Resource.Id.scroll_view);
            ScrollView.ScrollEnabled = false;

            // scroll to the top
            ScrollView.Post(new Action(delegate
            {
                ScrollView.ForceScrollTo(0, 0);
            }));

            RelativeLayout parentLayout = view.FindViewById <RelativeLayout>(Resource.Id.relative_layout);

            RectangleF bounds = new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels);

            BlockerView = new UIBlockerView(parentLayout, bounds);
            BlockerView.Hide( );

            ResultView = new UIResultView(parentLayout, bounds, delegate
            {
                SpringboardParent.ModalFragmentDone(null);
            });
            ResultView.Hide( );

            return(view);
        }