示例#1
0
        public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig)
        {
            base.OnConfigurationChanged(newConfig);

            ProgressBarBlocker.LayoutParameters.Width = NavbarFragment.GetFullDisplayWidth( );
            ResultView.SetBounds(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels));
        }
示例#2
0
        void RegisterUser()
        {
            if (State == RegisterState.None)
            {
                // make sure they entered all required fields
                if (ValidateInput( ))
                {
                    ToggleControls(false);

                    ProgressBarBlocker.Visibility = ViewStates.Visible;
                    State = RegisterState.Trying;

                    // create a new user and submit them
                    Rock.Client.Person newPerson = new Rock.Client.Person();

                    // copy all the edited fields into the person object
                    newPerson.Email = EmailText.Text;

                    // set the nickName AND firstName to NickName
                    newPerson.NickName  = NickNameText.Text;
                    newPerson.FirstName = NickNameText.Text;

                    newPerson.LastName = LastNameText.Text;

                    MobileAppApi.RegisterNewUser(UserNameText.Text, PasswordText.Text, NickNameText.Text, LastNameText.Text, EmailText.Text, CellPhoneText.Text,
                                                 delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
                    {
                        ProgressBarBlocker.Visibility = ViewStates.Gone;

                        // scroll to the top so the Result is visible
                        ScrollView.Post(new Action(delegate
                        {
                            ScrollView.ScrollTo(0, 0);
                        }));

                        if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
                        {
                            ProfileAnalytic.Instance.Trigger(ProfileAnalytic.Register);

                            State = RegisterState.Success;
                            ResultView.Show(RegisterStrings.RegisterStatus_Success,
                                            PrivateControlStylingConfig.Result_Symbol_Success,
                                            RegisterStrings.RegisterResult_Success,
                                            GeneralStrings.Done);
                        }
                        else
                        {
                            State = RegisterState.Fail;
                            ResultView.Show(RegisterStrings.RegisterStatus_Failed,
                                            PrivateControlStylingConfig.Result_Symbol_Failed,
                                            statusDescription,
                                            GeneralStrings.Done);
                        }

                        ResultView.SetBounds(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels));
                    });
                }
            }
        }
示例#3
0
        public override void OnResume()
        {
            base.OnResume();

            // guard against backgrounding / resuming
            if (DidLaunch == false)
            {
                DidLaunch = true;

                SpringboardParent.ModalFragmentOpened(this);

                OOBEView.LayoutChanged(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels));
            }
        }
示例#4
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.Register, container, false);

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

            ScrollView = view.FindViewById <ScrollView>(Resource.Id.scroll_background);

            RelativeLayout layoutView = view.FindViewById <RelativeLayout>(Resource.Id.scroll_linear_background);

            ProgressBarBlocker                         = view.FindViewById <RelativeLayout>(Resource.Id.progressBarBlocker);
            ProgressBarBlocker.Visibility              = ViewStates.Gone;
            ProgressBarBlocker.LayoutParameters        = new RelativeLayout.LayoutParams(0, 0);
            ProgressBarBlocker.LayoutParameters.Width  = NavbarFragment.GetFullDisplayWidth( );
            ProgressBarBlocker.LayoutParameters.Height = this.Resources.DisplayMetrics.HeightPixels;

            ResultView = new UIResultView(layoutView, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels), OnResultViewDone);

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

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


            // setup the username
            UserNameLayer = view.FindViewById <RelativeLayout>(Resource.Id.username_background);
            ControlStyling.StyleBGLayer(UserNameLayer);

            UserNameText = UserNameLayer.FindViewById <EditText>(Resource.Id.userNameText);
            ControlStyling.StyleTextField(UserNameText, RegisterStrings.UsernamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            UserNameBGColor         = ControlStylingConfig.BG_Layer_Color;
            UserNameText.InputType |= InputTypes.TextFlagCapWords;

            View borderView = UserNameLayer.FindViewById <View>(Resource.Id.username_border);

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

            // password
            PasswordLayer = view.FindViewById <RelativeLayout>(Resource.Id.password_background);
            ControlStyling.StyleBGLayer(PasswordLayer);

            PasswordText            = PasswordLayer.FindViewById <EditText>(Resource.Id.passwordText);
            PasswordText.InputType |= InputTypes.TextVariationPassword;
            ControlStyling.StyleTextField(PasswordText, RegisterStrings.PasswordPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            PasswordBGColor = ControlStylingConfig.BG_Layer_Color;

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



            ConfirmPasswordLayer = view.FindViewById <RelativeLayout>(Resource.Id.confirmPassword_background);
            ControlStyling.StyleBGLayer(ConfirmPasswordLayer);

            ConfirmPasswordText            = ConfirmPasswordLayer.FindViewById <EditText>(Resource.Id.confirmPasswordText);
            ConfirmPasswordText.InputType |= InputTypes.TextVariationPassword;
            ControlStyling.StyleTextField(ConfirmPasswordText, RegisterStrings.ConfirmPasswordPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            ConfirmPasswordBGColor = ControlStylingConfig.BG_Layer_Color;



            // 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;

            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;


            // setup the cell phone section
            CellPhoneLayer = view.FindViewById <RelativeLayout>(Resource.Id.cellphone_background);
            ControlStyling.StyleBGLayer(CellPhoneLayer);

            CellPhoneText = CellPhoneLayer.FindViewById <EditText>(Resource.Id.cellPhoneText);
            ControlStyling.StyleTextField(CellPhoneText, RegisterStrings.CellPhonePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            CellPhoneText.AddTextChangedListener(new PhoneNumberFormattingTextWatcher());


            // email layer
            EmailLayer = view.FindViewById <RelativeLayout>(Resource.Id.email_background);
            ControlStyling.StyleBGLayer(EmailLayer);

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

            EmailText = EmailLayer.FindViewById <EditText>(Resource.Id.emailAddressText);
            ControlStyling.StyleTextField(EmailText, RegisterStrings.EmailPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            EmailBGColor = ControlStylingConfig.BG_Layer_Color;


            // Register button
            RegisterButton = view.FindViewById <Button>(Resource.Id.registerButton);
            ControlStyling.StyleButton(RegisterButton, RegisterStrings.RegisterButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);

            CancelButton = view.FindViewById <Button>(Resource.Id.cancelButton);
            ControlStyling.StyleButton(CancelButton, GeneralStrings.Cancel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            CancelButton.Background = null;

            RegisterButton.Click += (object sender, EventArgs e) =>
            {
                RegisterUser( );
            };

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

                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: SpringboardParent.ModalFragmentDone(null); break;

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

                builder.Show( );
            };

            return(view);
        }
示例#5
0
        public override void OnCreate( Bundle savedInstanceState )
        {
            base.OnCreate( savedInstanceState );

            EnableBack = true;

            RetainInstance = true;

            // setup our fragments. See if they already exist before creating a new one. It's possible
            // Android unloaded some but not all of us.
            NavbarFragment = FragmentManager.FindFragmentById(Resource.Id.navbar) as NavbarFragment;
            if ( NavbarFragment == null )
            {
                NavbarFragment = new NavbarFragment();
            }
            NavbarFragment.SpringboardParent = this;

            LoginFragment = FragmentManager.FindFragmentByTag( "Droid.LoginFragment" ) as LoginFragment;
            if ( LoginFragment == null )
            {
                LoginFragment = new LoginFragment( );
            }
            LoginFragment.SpringboardParent = this;

            ProfileFragment = FragmentManager.FindFragmentByTag( "Droid.ProfileFragment" ) as ProfileFragment;
            if( ProfileFragment == null )
            {
                ProfileFragment = new ProfileFragment( );
            }
            ProfileFragment.SpringboardParent = this;

            RegisterFragment = FragmentManager.FindFragmentByTag( "Droid.RegisterFragment" ) as RegisterFragment;
            if( RegisterFragment == null )
            {
                RegisterFragment = new RegisterFragment( );
            }
            RegisterFragment.SpringboardParent = this;

            OOBEFragment = FragmentManager.FindFragmentByTag( "Droid.OOBEFragment" ) as OOBEFragment;
            if( OOBEFragment == null )
            {
                OOBEFragment = new OOBEFragment( );
            }
            OOBEFragment.SpringboardParent = this;

            SplashFragment = FragmentManager.FindFragmentByTag( "Droid.SplashFragment" ) as SplashFragment;
            if( SplashFragment == null )
            {
                SplashFragment = new SplashFragment( );
            }
            SplashFragment.SpringboardParent = this;

            ImageCropFragment = FragmentManager.FindFragmentByTag( "Droid.ImageCropFragment" ) as ImageCropFragment;
            if( ImageCropFragment == null )
            {
                ImageCropFragment = new ImageCropFragment( );
                ImageCropFragment.SpringboardParent = this;
            }


            // get the mask used for the profile pic
            ProfileMask = BitmapFactory.DecodeResource( Rock.Mobile.PlatformSpecific.Android.Core.Context.Resources, Resource.Drawable.androidPhotoMask );

            // Execute a transaction, replacing any existing
            // fragment with this one inside the frame.
            var ft = FragmentManager.BeginTransaction();
            ft.Replace(Resource.Id.navbar, NavbarFragment);
            ft.SetTransition(FragmentTransit.FragmentFade);
            ft.Commit();

            // create our tasks
            Elements = new List<SpringboardElement>();
            Elements.Add( new SpringboardElement( new Droid.Tasks.News.NewsTask( NavbarFragment ), Resource.Id.springboard_news_frame, SpringboardConfig.Element_News_Icon, SpringboardStrings.Element_News_Title ) );
            Elements.Add( new SpringboardElement( new Droid.Tasks.Notes.NotesTask( NavbarFragment ), Resource.Id.springboard_notes_frame, SpringboardConfig.Element_Messages_Icon, SpringboardStrings.Element_Messages_Title ) );
            Elements.Add( new SpringboardElement( new Droid.Tasks.Give.GiveTask( NavbarFragment ), Resource.Id.springboard_give_frame, SpringboardConfig.Element_Give_Icon, SpringboardStrings.Element_Give_Title ) );
            Elements.Add( new SpringboardElement( new Droid.Tasks.Connect.ConnectTask( NavbarFragment ), Resource.Id.springboard_connect_frame, SpringboardConfig.Element_Connect_Icon, SpringboardStrings.Element_Connect_Title ) );
            Elements.Add( new SpringboardElement( new Droid.Tasks.Prayer.PrayerTask( NavbarFragment ), Resource.Id.springboard_prayer_frame, SpringboardConfig.Element_Prayer_Icon, SpringboardStrings.Element_Prayer_Title ) );
            Elements.Add( new SpringboardElement( new Droid.Tasks.About.AboutTask( NavbarFragment ), Resource.Id.springboard_about_frame, SpringboardConfig.Element_More_Icon, SpringboardStrings.Element_More_Title ) );

            ActiveElementIndex = 0;
            if( savedInstanceState != null )
            {
                // grab the last active element
                ActiveElementIndex = savedInstanceState.GetInt( "LastActiveElement" );
            }

            // load our objects from disk
            Rock.Mobile.Util.Debug.WriteLine( string.Format( "Loading objects from device." ) );
            RockNetworkManager.Instance.LoadObjectsFromDevice( );
            Rock.Mobile.Util.Debug.WriteLine( string.Format( "Loading objects done." ) );
        }
示例#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);
        }
示例#7
0
        public override void OnCreate( Bundle savedInstanceState )
        {
            base.OnCreate( savedInstanceState );

            EnableBack = true;

            RetainInstance = true;

            // setup our fragments (checking for these to be created might be unnecessary, since we'll retain this fragment)
            NavbarFragment = new NavbarFragment( );
            NavbarFragment.SpringboardParent = this;

            LoginFragment = new LoginFragment( );
            LoginFragment.SpringboardParent = this;

            ProfileFragment = new ProfileFragment( );
            ProfileFragment.SpringboardParent = this;

            RegisterFragment = new RegisterFragment( );
            RegisterFragment.SpringboardParent = this;

            OOBEFragment = new OOBEFragment( );
            OOBEFragment.SpringboardParent = this;

            SplashFragment = new SplashFragment( );
            SplashFragment.SpringboardParent = this;

            ImageCropFragment = new ImageCropFragment( );
            ImageCropFragment.SpringboardParent = this;

            // get the mask used for the profile pic
            ProfileMask = BitmapFactory.DecodeResource( Rock.Mobile.PlatformSpecific.Android.Core.Context.Resources, Resource.Drawable.androidPhotoMask );

            // Execute a transaction, replacing any existing
            // fragment with this one inside the frame.
            var ft = FragmentManager.BeginTransaction();
            ft.Replace(Resource.Id.navbar, NavbarFragment);
            ft.SetTransition(FragmentTransit.FragmentFade);
            ft.Commit();

            // create our tasks
            Elements = new List<SpringboardElement>();
            Elements.Add( new SpringboardElement( new Droid.Tasks.News.NewsTask( NavbarFragment ), Resource.Id.springboard_news_frame, SpringboardConfig.Element_News_Icon, SpringboardStrings.Element_News_Title ) );
            Elements.Add( new SpringboardElement( new Droid.Tasks.Connect.ConnectTask( NavbarFragment ), Resource.Id.springboard_connect_frame, SpringboardConfig.Element_Connect_Icon, SpringboardStrings.Element_Connect_Title ) );
            Elements.Add( new SpringboardElement( new Droid.Tasks.Notes.NotesTask( NavbarFragment ), Resource.Id.springboard_notes_frame, SpringboardConfig.Element_Messages_Icon, SpringboardStrings.Element_Messages_Title ) );
            Elements.Add( new SpringboardElement( new Droid.Tasks.Prayer.PrayerTask( NavbarFragment ), Resource.Id.springboard_prayer_frame, SpringboardConfig.Element_Prayer_Icon, SpringboardStrings.Element_Prayer_Title ) );
            Elements.Add( new SpringboardElement( new Droid.Tasks.Give.GiveTask( NavbarFragment ), Resource.Id.springboard_give_frame, SpringboardConfig.Element_Give_Icon, SpringboardStrings.Element_Give_Title ) );
            Elements.Add( new SpringboardElement( new Droid.Tasks.About.AboutTask( NavbarFragment ), Resource.Id.springboard_about_frame, SpringboardConfig.Element_More_Icon, SpringboardStrings.Element_More_Title ) );

            ActiveElementIndex = 0;
            if( savedInstanceState != null )
            {
                // grab the last active element
                ActiveElementIndex = savedInstanceState.GetInt( "LastActiveElement" );
            }

            // load our objects from disk
            Rock.Mobile.Util.Debug.WriteLine( string.Format( "Loading objects from device." ) );
            RockApi.Instance.LoadObjectsFromDevice( );
            Rock.Mobile.Util.Debug.WriteLine( string.Format( "Loading objects done." ) );

            // seed the last sync time with now, so that when OnResume gets called we don't do it again.
            LastRockSync = DateTime.Now;

            SyncRockData( );
        }
示例#8
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);
            }

            OOBEView = new UIOOBE( );

            RelativeLayout view = inflater.Inflate(Resource.Layout.OOBEView, container, false) as RelativeLayout;

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

            view.SetOnTouchListener(this);

            string imageName = "splash_logo_android.png";

            Point displaySize = new Point( );

            Activity.WindowManager.DefaultDisplay.GetSize(displaySize);

            DisplayMetrics metrics = Resources.DisplayMetrics;

            string bgImageName = string.Format("oobe_splash_bg_{0}.png", metrics.DensityDpi.ToString( ).ToLower( ));

            OOBEView.Create(view, bgImageName, imageName, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels),

                            delegate(int index, bool isCampusSelection)
            {
                SpringboardParent.OOBEUserClick(index, isCampusSelection);
            });

            return(view);
        }
示例#9
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.Login, container, false);

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

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

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

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

            BlockerView = new UIBlockerView(view, bounds);

            LoginResultLayer = view.FindViewById <View>(Resource.Id.result_background);
            ControlStyling.StyleBGLayer(LoginResultLayer);
            LoginResultLayer.Alpha = 0.0f;

            LoginButton = view.FindViewById <Button>(Resource.Id.loginButton);
            ControlStyling.StyleButton(LoginButton, LoginStrings.LoginButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            LoginButton.Click += (object sender, EventArgs e) =>
            {
                TryRockBind( );
            };

            CancelButton = view.FindViewById <Button>(Resource.Id.cancelButton);
            ControlStyling.StyleButton(CancelButton, GeneralStrings.Cancel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            CancelButton.Background = null;
            CancelButton.Click     += (object sender, EventArgs e) =>
            {
                SpringboardParent.ModalFragmentDone(null);
            };


            TextView additionalOptions = view.FindViewById <TextView>(Resource.Id.additionalOptions);

            ControlStyling.StyleUILabel(additionalOptions, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            additionalOptions.Text = LoginStrings.AdditionalOptions;

            TextView orTextView = view.FindViewById <TextView>(Resource.Id.orTextView);

            ControlStyling.StyleUILabel(orTextView, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            orTextView.Text = LoginStrings.OrString;


            RegisterButton = view.FindViewById <Button>(Resource.Id.registerButton);
            ControlStyling.StyleButton(RegisterButton, LoginStrings.RegisterButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            RegisterButton.Click += (object sender, EventArgs e) =>
            {
                SpringboardParent.ModalFragmentDone(null);
                SpringboardParent.RegisterNewUser( );
            };

            ForgotPasswordButton = view.FindViewById <Button>(Resource.Id.forgotPasswordButton);
            ControlStyling.StyleButton(ForgotPasswordButton, LoginStrings.ForgotPasswordButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            ForgotPasswordButton.Click += (object sender, EventArgs e) =>
            {
                TaskWebFragment.HandleUrl(true, true, LoginConfig.ForgotPassword_Url, null, null);
            };

            // get the username field and background
            UsernameLayer = view.FindViewById <View>(Resource.Id.login_background);
            ControlStyling.StyleBGLayer(UsernameLayer);

            UsernameField   = view.FindViewById <EditText>(Resource.Id.usernameText);
            UserNameBGColor = ControlStylingConfig.BG_Layer_Color;
            ControlStyling.StyleTextField(UsernameField, LoginStrings.UsernamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);

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

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


            // get the password field and background
            PasswordLayer = view.FindViewById <View>(Resource.Id.password_background);
            ControlStyling.StyleBGLayer(PasswordLayer);
            PasswordField   = view.FindViewById <EditText>(Resource.Id.passwordText);
            PasswordBGColor = ControlStylingConfig.BG_Layer_Color;
            ControlStyling.StyleTextField(PasswordField, LoginStrings.PasswordPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);

            LoginResultLabel = view.FindViewById <TextView>(Resource.Id.loginResult);
            ControlStyling.StyleUILabel(LoginResultLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);

            // Setup the facebook button
            FacebookButton            = view.FindViewById <ImageButton>(Resource.Id.facebookButton);
            FacebookButton.Background = null;
            FacebookButton.Click     += (object sender, EventArgs e) =>
            {
                TryFacebookBind( );
            };

            // invoke a webview
            WebLayout = new WebLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context);
            WebLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            WebLayout.SetBackgroundColor(Android.Graphics.Color.Black);

            return(view);
        }