示例#1
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_Post, container, false);

                    view.SetOnTouchListener(this);

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

                    ResultView = new UIResultView(view, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels),
                                                  delegate
                    {
                        if (Success == true)
                        {
                            // leave
                            ParentTask.OnClick(this, 0);
                        }
                        else
                        {
                            // retry
                            SubmitPrayerRequest( );
                        }
                    });

                    BlockerView = new UIBlockerView(view, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels));


                    return(view);
                }
示例#2
0
                public override void OnResume()
                {
                    base.OnResume();

                    IsActive = true;

                    ParentTask.NavbarFragment.NavToolbar.SetBackButtonEnabled(false);
                    ParentTask.NavbarFragment.NavToolbar.SetShareButtonEnabled(false, null);
                    ParentTask.NavbarFragment.NavToolbar.SetCreateButtonEnabled(true, delegate
                    {
                        ParentTask.OnClick(this, 0);
                    });
                    ParentTask.NavbarFragment.NavToolbar.Reveal(true);

                    if (IsRequesting == false)
                    {
                        TimeSpan deltaTime = DateTime.Now - LastDownloadTime;
                        if (deltaTime.TotalHours > PrivatePrayerConfig.PrayerDownloadFrequency.TotalHours)
                        {
                            Rock.Mobile.Util.Debug.WriteLine("Downloading Prayers");
                            DownloadPrayers( );
                        }
                        else
                        {
                            Rock.Mobile.Util.Debug.WriteLine("Not downloading prayers");

                            // We already have cached prayers, so simply restore them.
                            StatusLayer.Visibility = ViewStates.Invisible;
                            ResultLayer.Visibility = ViewStates.Invisible;
                            RetryButton.Visibility = ViewStates.Invisible;

                            // setup the carousel again
                            Carousel.Clear( );
                            foreach (PrayerCard prayerCard in PrayerRequestCards)
                            {
                                Carousel.AddCard(prayerCard.View);
                            }

                            // prayers received and are being viewed
                            PrayerAnalytic.Instance.Trigger(PrayerAnalytic.Read);
                        }

                        LayoutChanged( );
                    }
                    else
                    {
                        // we're still in the process of requesting, so restore the "request UI"
                        SetUIRequestingPrayers( );
                    }
                }
示例#3
0
                public void OnClick(int position, int buttonIndex)
                {
                    if (position < GroupEntries.Count)
                    {
                        if (buttonIndex == 0)
                        {
                            // select the row
                            (ListView.Adapter as GroupArrayAdapter).SetSelectedRow(position);

                            // scroll it into view
                            ListView.SmoothScrollToPosition(position);

                            // hide all other marker windows (if showing)
                            // go thru each marker and find the match, and then return it
                            foreach (Android.Gms.Maps.Model.Marker currMarker in MarkerList)
                            {
                                currMarker.HideInfoWindow( );
                            }

                            // validate the map because Google Play can error
                            if (Map != null)
                            {
                                // center that map marker
                                Android.Gms.Maps.Model.Marker marker = RowToMapMarker(position);
                                marker.ShowInfoWindow( );

                                Android.Gms.Maps.Model.LatLng centerMarker = new Android.Gms.Maps.Model.LatLng(marker.Position.Latitude, marker.Position.Longitude);

                                CameraUpdate camPos = CameraUpdateFactory.NewLatLngZoom(centerMarker, Map.CameraPosition.Zoom);
                                Map.AnimateCamera(camPos, 250, null);
                            }
                        }
                        else if (buttonIndex == 1)
                        {
                            // Ok! notify the parent they tapped Join, and it will launch the
                            // join group fragment! It's MARCH, FRIDAY THE 13th!!!! OH NOOOO!!!!
                            ParentTask.OnClick(this, position, GroupEntries[position]);
                            Rock.Mobile.Util.Debug.WriteLine(string.Format("Join neighborhood group in row {0}", position));
                        }
                    }
                    else
                    {
                        GetAdditionalGroups( );
                    }
                }
示例#4
0
                void SubmitPrayerRequest( )
                {
                    // if first and last name are valid, OR anonymous is on
                    // and if there's text in the request field.
                    if (CheckDebug( ) == false)
                    {
                        if (ValidateInput( ))
                        {
                            Rock.Client.PrayerRequest prayerRequest = new Rock.Client.PrayerRequest();

                            FirstNameText.Enabled = false;
                            LastNameText.Enabled  = false;
                            EmailText.Enabled     = false;
                            RequestText.Enabled   = false;

                            // setup the request
                            prayerRequest.FirstName = FirstNameText.Text;
                            prayerRequest.LastName  = LastNameText.Text;
                            prayerRequest.Email     = EmailText.Text;

                            int?personAliasId = null;
                            if (MobileApp.Shared.Network.RockMobileUser.Instance.Person.PrimaryAliasId.HasValue)
                            {
                                personAliasId = MobileApp.Shared.Network.RockMobileUser.Instance.Person.PrimaryAliasId;
                            }

                            prayerRequest.Text                   = RequestText.Text;
                            prayerRequest.EnteredDateTime        = DateTime.Now;
                            prayerRequest.ExpirationDate         = DateTime.Now.Add(PrivatePrayerConfig.PrayerExpirationTime);
                            prayerRequest.CategoryId             = MobileApp.Shared.Network.RockLaunchData.Instance.Data.PrayerCategoryToId(Spinner.SelectedItem.ToString( ));
                            prayerRequest.IsActive               = true;
                            prayerRequest.Guid                   = Guid.NewGuid( );
                            prayerRequest.IsPublic               = PublicSwitch.Checked;
                            prayerRequest.IsApproved             = false;
                            prayerRequest.CreatedByPersonAliasId = /*AnonymousSwitch.Checked == true ? null :*/ personAliasId;

                            ParentTask.OnClick(this, 0, prayerRequest);
                        }
                    }
                }
示例#5
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);
                    }

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

                    Point displaySize = new Point( );

                    Activity.WindowManager.DefaultDisplay.GetSize(displaySize);
                    NoteDiscGuideView = new UINoteDiscGuideView(view, new System.Drawing.RectangleF(0, 0, displaySize.X, displaySize.Y), delegate
                    {
                        ParentTask.OnClick(this, 3, null);
                    });

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

                    view.SetOnTouchListener(this);


                    GetEngagedEntries = ConnectLink.BuildGetEngagedList( );

                    GetEngagedBillboards = new Bitmap[GetEngagedEntries.Count];

                    ListView = view.FindViewById <ListView>(Resource.Id.connect_primary_list);

                    ListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
                    {
                        // ignore clicks to the top banner
                        if (e.Position > 0)
                        {
                            // get the row index relative to getEngaged
                            int getEngagedRowIndex = e.Position - 1;

                            // if they clicked a non-groupfinder row, get the link they want to visit
                            ParentTask.OnClick(this, getEngagedRowIndex, GetEngagedEntries[getEngagedRowIndex]);
                        }
                    };
                    ListView.SetOnTouchListener(this);
                    ListView.Adapter = new ArrayAdapter(this);

                    return(view);
                }
示例#7
0
 void OnJoinClicked( )
 {
     ParentTask.OnClick(this, 0, GroupEntry);
 }
示例#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);
                    }

                    // at this point our properties should be set.

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

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

                    // set the banner
                    RelativeLayout headerImageLayout = view.FindViewById <RelativeLayout>(Resource.Id.news_details_header_image_layout);

                    ImageBanner = new Rock.Mobile.PlatformSpecific.Android.Graphics.AspectScaledImageView(Activity);
                    headerImageLayout.AddView(ImageBanner, 0);

                    int width  = NavbarFragment.GetCurrentContainerDisplayWidth( );
                    int height = (int)System.Math.Ceiling(width * PrivateNewsConfig.NewsMainAspectRatio);

                    ImageBanner.LayoutParameters = new RelativeLayout.LayoutParams(width, height);

                    // set the button
                    Button headerButton = view.FindViewById <Button>(Resource.Id.news_details_header_image_button);

                    headerButton.LayoutParameters = new RelativeLayout.LayoutParams(width, height);
                    headerButton.Click           += (object sender, EventArgs e) =>
                    {
                        if (string.IsNullOrWhiteSpace(ReferenceURL) == false)
                        {
                            ParentTask.OnClick(this, headerButton.Id);
                        }
                    };

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

                    title.Text = Title?.ToUpper( );
                    title.SetSingleLine( );
                    title.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
                    title.SetMaxLines(1);
                    title.SetHorizontallyScrolling(true);
                    ControlStyling.StyleUILabel(title, ControlStylingConfig.Font_Bold, ControlStylingConfig.Large_FontSize);

                    // set the description
                    TextView description = view.FindViewById <TextView>(Resource.Id.news_details_details);

                    description.Text           = Description;
                    description.MovementMethod = new ScrollingMovementMethod();
                    ControlStyling.StyleUILabel(description, ControlStylingConfig.Font_Light, ControlStylingConfig.Small_FontSize);

                    // if we're in developer mode, add the start / end times for this promotion
                    if (MobileApp.Shared.Network.RockLaunchData.Instance.Data.DeveloperModeEnabled == true)
                    {
                        // if we're in developer mode, add the start / end times for this promotion
                        if (MobileApp.Shared.Network.RockLaunchData.Instance.Data.DeveloperModeEnabled == true)
                        {
                            description.Text += DeveloperInfo;
                        }
                    }

                    Button launchUrlButton = view.FindViewById <Button>(Resource.Id.news_details_launch_url);

                    launchUrlButton.Click += (object sender, EventArgs e) =>
                    {
                        // move to the next page...
                        ParentTask.OnClick(this, launchUrlButton.Id);
                    };
                    ControlStyling.StyleButton(launchUrlButton, NewsStrings.LearnMore, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);

                    // hide the button if there's no reference URL.
                    if (string.IsNullOrWhiteSpace(ReferenceURL) == true)
                    {
                        launchUrlButton.Visibility = ViewStates.Gone;
                    }
                    else
                    {
                        launchUrlButton.Visibility = ViewStates.Visible;
                    }

                    return(view);
                }
示例#9
0
 public void OnClick(int position)
 {
     ParentTask.OnClick(this, position);
 }
示例#10
0
 public void OnClick(int position, int buttonIndex)
 {
     ParentTask.OnClick(this, position, buttonIndex);
 }
示例#11
0
                public override bool OnTouch(View v, MotionEvent e)
                {
                    // check to see if we should monitor navBar reveal
                    if (e.Action == MotionEventActions.Down)
                    {
                        NavBarRevealTracker.BeginTracking(ScrollView.ScrollY);
                    }

                    if (base.OnTouch(v, e) == true)
                    {
                        return(true);
                    }
                    else
                    {
                        switch (e.Action)
                        {
                        case MotionEventActions.Move:
                        {
                            // if at any point during a move the task is no longer allowed to receive input,
                            // STOP SCROLLING. It means the user began panning out the view
                            if (ParentTask.NavbarFragment.ShouldTaskAllowInput( ) == false)
                            {
                                ScrollView.ScrollEnabled = false;
                            }

                            if (Note != null)
                            {
                                Note.TouchesMoved(new System.Drawing.PointF(e.GetX( ), e.GetY( )));
                            }

                            break;
                        }

                        case MotionEventActions.Up:
                        {
                            if (Note != null)
                            {
                                // if the tutorial is showing, we don't want to do anything but hide it.
                                // This prevents a URL from changing the page when the user only intended to
                                // hide the tutorial.
                                if (TutorialShowing( ))
                                {
                                    AnimateTutorialScreen(false);
                                }
                                else
                                {
                                    bool urlLaunchesExternalBrowser = false;
                                    bool urlUsesRockImpersonation   = false;

                                    string activeUrl = Note.TouchesEnded(new System.Drawing.PointF(e.GetX( ), e.GetY( )), out urlLaunchesExternalBrowser, out urlUsesRockImpersonation);

                                    // create a params object we can send to the parent
                                    UrlClickParams clickParams = new UrlClickParams()
                                    {
                                        UseExternalBrowser    = urlLaunchesExternalBrowser,
                                        UseImpersonationToken = urlUsesRockImpersonation,
                                        Url = activeUrl
                                    };

                                    // again, only process this if we didn't create a note. We don't want to treat a double tap
                                    // like a request to view a note
                                    if (DidGestureCreateNote == false)
                                    {
                                        if (string.IsNullOrEmpty(activeUrl) == false)
                                        {
                                            // if the url uses the rock impersonation token, it's safe to assume they tapped the takeaway.
                                            if (urlUsesRockImpersonation)
                                            {
                                                MessageAnalytic.Instance.Trigger(MessageAnalytic.Takeaway, activeUrl);
                                            }

                                            ParentTask.OnClick(this, 0, clickParams);
                                        }
                                    }
                                }
                            }

                            ScrollView.ScrollEnabled = true;
                            MovingUserNote           = false;

                            DidGestureCreateNote = false;

                            break;
                        }
                        }
                    }
                    return(false);
                }