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.Prayer_Create, container, false);
                    view.SetOnTouchListener( this );

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

                    // setup the first name background
                    FirstNameBGLayer = view.FindViewById<RelativeLayout>( Resource.Id.first_name_background );
                    ControlStyling.StyleBGLayer( FirstNameBGLayer );
                    //

                    LastNameBGLayer = view.FindViewById<RelativeLayout>( Resource.Id.last_name_background );
                    ControlStyling.StyleBGLayer( LastNameBGLayer );

                    // setup the prayer request background
                    RequestBGLayer = view.FindViewById<RelativeLayout>( Resource.Id.prayerRequest_background );
                    ControlStyling.StyleBGLayer( RequestBGLayer );
                    //

                    // setup the switch background
                    RelativeLayout backgroundLayout = view.FindViewById<RelativeLayout>( Resource.Id.switch_background );
                    ControlStyling.StyleBGLayer( backgroundLayout );

                    // setup the category background
                    backgroundLayout = view.FindViewById<RelativeLayout>( Resource.Id.spinner_background );
                    ControlStyling.StyleBGLayer( backgroundLayout );

                    // setup the text views
                    FirstNameText = (EditText)view.FindViewById<EditText>( Resource.Id.prayer_create_firstNameText );
                    ControlStyling.StyleTextField( FirstNameText, PrayerStrings.CreatePrayer_FirstNamePlaceholderText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize );
                    FirstNameBGColor = ControlStylingConfig.BG_Layer_Color;
                    FirstNameText.InputType |= Android.Text.InputTypes.TextFlagCapWords;

                    LastNameText = (EditText)view.FindViewById<EditText>( Resource.Id.prayer_create_lastNameText );
                    ControlStyling.StyleTextField( LastNameText, PrayerStrings.CreatePrayer_LastNamePlaceholderText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize );
                    LastNameBGColor = ControlStylingConfig.BG_Layer_Color;
                    LastNameText.InputType |= Android.Text.InputTypes.TextFlagCapWords;

                    RequestText = (EditText)view.FindViewById<EditText>( Resource.Id.prayer_create_requestText );
                    ControlStyling.StyleTextField( RequestText, PrayerStrings.CreatePrayer_PrayerRequest, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize );
                    RequestBGColor = ControlStylingConfig.BG_Layer_Color;
                    RequestText.InputType |= Android.Text.InputTypes.TextFlagCapSentences;


                    AnonymousSwitch = (Switch)view.FindViewById<Switch>( Resource.Id.postAnonymousSwitch );
                    AnonymousSwitch.Checked = false;
                    AnonymousSwitch.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e ) =>
                    {
                            if( AnonymousSwitch.Checked == false )
                            {
                                FirstNameText.Enabled = true;
                                LastNameText.Enabled = true;

                                FirstNameText.Text = string.Empty;
                                LastNameText.Text = string.Empty;
                            }
                            else
                            {
                                FirstNameText.Enabled = false;
                                LastNameText.Enabled = false;

                                FirstNameText.Text = PrayerStrings.CreatePrayer_Anonymous;
                                LastNameText.Text = PrayerStrings.CreatePrayer_Anonymous;
                            }

                            // set the colors back to neutral
                            Rock.Mobile.PlatformSpecific.Android.UI.Util.AnimateViewColor( FirstNameBGColor, ControlStylingConfig.BG_Layer_Color, FirstNameBGLayer, delegate { FirstNameBGColor = ControlStylingConfig.BG_Layer_Color; } );
                            Rock.Mobile.PlatformSpecific.Android.UI.Util.AnimateViewColor( LastNameBGColor, ControlStylingConfig.BG_Layer_Color, LastNameBGLayer, delegate { LastNameBGColor = ControlStylingConfig.BG_Layer_Color; } );
                    };

                    PublicSwitch = (Switch)view.FindViewById<Switch>( Resource.Id.makePublicSwitch );
                    PublicSwitch.Checked = false;

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

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

                    // setup our category spinner
                    Spinner = (Spinner)view.FindViewById<Spinner>( Resource.Id.categorySpinner );
                    ArrayAdapter adapter = new SpinnerArrayAdapter( Rock.Mobile.PlatformSpecific.Android.Core.Context, Android.Resource.Layout.SimpleListItem1 );
                    adapter.SetDropDownViewResource( Android.Resource.Layout.SimpleSpinnerDropDownItem );
                    Spinner.Adapter = adapter;

                    // populate the category
                    foreach ( Rock.Client.Category category in App.Shared.Network.RockGeneralData.Instance.Data.PrayerCategories )
                    {
                        adapter.Add( category.Name );
                    }

                    Button submitButton = (Button)view.FindViewById<Button>( Resource.Id.prayer_create_submitButton );
                    ControlStyling.StyleButton( submitButton, PrayerStrings.CreatePrayer_SubmitButtonText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize );
                    submitButton.Click += (object sender, EventArgs e ) =>
                    {
                        SubmitPrayerRequest( );
                    };

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

                    view.SetOnTouchListener(this);

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

                    // setup the first name background
                    FirstNameBGLayer = view.FindViewById <RelativeLayout>(Resource.Id.first_name_background);
                    ControlStyling.StyleBGLayer(FirstNameBGLayer);
                    //

                    LastNameBGLayer = view.FindViewById <RelativeLayout>(Resource.Id.last_name_background);
                    ControlStyling.StyleBGLayer(LastNameBGLayer);

                    EmailBGLayer = view.FindViewById <RelativeLayout>(Resource.Id.email_background);
                    ControlStyling.StyleBGLayer(EmailBGLayer);

                    // setup the prayer request background
                    RequestBGLayer = view.FindViewById <RelativeLayout>(Resource.Id.prayerRequest_background);
                    ControlStyling.StyleBGLayer(RequestBGLayer);
                    //

                    // setup the switch background
                    RelativeLayout backgroundLayout = view.FindViewById <RelativeLayout>(Resource.Id.switch_background);

                    ControlStyling.StyleBGLayer(backgroundLayout);

                    // setup the category background
                    backgroundLayout = view.FindViewById <RelativeLayout>(Resource.Id.spinner_background);
                    ControlStyling.StyleBGLayer(backgroundLayout);

                    // setup the text views
                    FirstNameText = (EditText)view.FindViewById <EditText>(Resource.Id.prayer_create_firstNameText);
                    ControlStyling.StyleTextField(FirstNameText, PrayerStrings.CreatePrayer_FirstNamePlaceholderText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
                    FirstNameBGColor         = ControlStylingConfig.BG_Layer_Color;
                    FirstNameText.InputType |= Android.Text.InputTypes.TextFlagCapWords;

                    LastNameText = (EditText)view.FindViewById <EditText>(Resource.Id.prayer_create_lastNameText);
                    ControlStyling.StyleTextField(LastNameText, PrayerStrings.CreatePrayer_LastNamePlaceholderText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
                    LastNameBGColor         = ControlStylingConfig.BG_Layer_Color;
                    LastNameText.InputType |= Android.Text.InputTypes.TextFlagCapWords;

                    EmailText = (EditText)view.FindViewById <EditText>(Resource.Id.prayer_create_emailText);
                    ControlStyling.StyleTextField(EmailText, PrayerStrings.CreatePrayer_EmailPlaceholderText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
                    EmailBGColor         = ControlStylingConfig.BG_Layer_Color;
                    EmailText.InputType |= Android.Text.InputTypes.TextFlagCapWords;

                    RequestText = (EditText)view.FindViewById <EditText>(Resource.Id.prayer_create_requestText);
                    ControlStyling.StyleTextField(RequestText, PrayerStrings.CreatePrayer_PrayerRequest, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
                    RequestBGColor         = ControlStylingConfig.BG_Layer_Color;
                    RequestText.InputType |= Android.Text.InputTypes.TextFlagCapSentences;


                    /*AnonymousSwitch = (Switch)view.FindViewById<Switch>( Resource.Id.postAnonymousSwitch );
                     * AnonymousSwitch.Checked = false;
                     * AnonymousSwitch.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e ) =>
                     * {
                     *      if( AnonymousSwitch.Checked == false )
                     *      {
                     *          FirstNameText.Enabled = true;
                     *          LastNameText.Enabled = true;
                     *
                     *          FirstNameText.Text = string.Empty;
                     *          LastNameText.Text = string.Empty;
                     *      }
                     *      else
                     *      {
                     *          FirstNameText.Enabled = false;
                     *          LastNameText.Enabled = false;
                     *
                     *          FirstNameText.Text = PrayerStrings.CreatePrayer_Anonymous;
                     *          LastNameText.Text = PrayerStrings.CreatePrayer_Anonymous;
                     *      }
                     *
                     *      // set the colors back to neutral
                     *      Rock.Mobile.PlatformSpecific.Android.UI.Util.AnimateViewColor( FirstNameBGColor, ControlStylingConfig.BG_Layer_Color, FirstNameBGLayer, delegate { FirstNameBGColor = ControlStylingConfig.BG_Layer_Color; } );
                     *      Rock.Mobile.PlatformSpecific.Android.UI.Util.AnimateViewColor( LastNameBGColor, ControlStylingConfig.BG_Layer_Color, LastNameBGLayer, delegate { LastNameBGColor = ControlStylingConfig.BG_Layer_Color; } );
                     * };*/

                    PublicSwitch         = (Switch)view.FindViewById <Switch>(Resource.Id.makePublicSwitch);
                    PublicSwitch.Checked = false;

                    //TextView postAnonymousLabel = view.FindViewById<TextView>( Resource.Id.postAnonymous );
                    //ControlStyling.StyleUILabel( postAnonymousLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize );

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

                    ControlStyling.StyleUILabel(publicLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);

                    // setup our category spinner
                    Spinner = (Spinner)view.FindViewById <Spinner>(Resource.Id.categorySpinner);
                    ArrayAdapter adapter = new SpinnerArrayAdapter(Rock.Mobile.PlatformSpecific.Android.Core.Context, Android.Resource.Layout.SimpleListItem1);

                    adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                    Spinner.Adapter = adapter;

                    // populate the category
                    foreach (KeyValuePair <string, int> category in MobileApp.Shared.Network.RockLaunchData.Instance.Data.PrayerCategories)
                    {
                        adapter.Add(category.Key);
                    }

                    Button submitButton = (Button)view.FindViewById <Button>(Resource.Id.prayer_create_submitButton);

                    ControlStyling.StyleButton(submitButton, PrayerStrings.CreatePrayer_SubmitButtonText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
                    submitButton.Click += (object sender, EventArgs e) =>
                    {
                        SubmitPrayerRequest( );
                    };

                    return(view);
                }