Exemplo n.º 1
0
                public void UpdateNews(List <RockNews> sourceNews)
                {
                    // free existing news
                    FreeImageResources( );

                    News.Clear( );

                    // copy the new news.
                    int i;

                    for (i = 0; i < sourceNews.Count; i++)
                    {
                        NewsEntry newsEntry = new NewsEntry();
                        News.Add(newsEntry);

                        newsEntry.News = sourceNews[i];
                        // see if we can load the file
                        bool fileFound = TryLoadCachedImageAsync(newsEntry, newsEntry.News.ImageName);
                        if (fileFound == false)
                        {
                            // if not, download it
                            string widthParam = string.Format("width={0}", NavbarFragment.GetCurrentContainerDisplayWidth( ));
                            string requestUrl = Rock.Mobile.Util.Strings.Parsers.AddParamToURL(newsEntry.News.ImageURL, widthParam);

                            FileCache.Instance.DownloadFileToCache(requestUrl, newsEntry.News.ImageName, null,
                                                                   delegate
                            {
                                // and THEN load it
                                TryLoadCachedImageAsync(newsEntry, newsEntry.News.ImageName);
                            });
                        }
                    }
                }
Exemplo n.º 2
0
                public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig)
                {
                    base.OnConfigurationChanged(newConfig);

                    ResultView.SetBounds(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels));
                    BlockerView.SetBounds(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels));
                }
Exemplo n.º 3
0
                ListItemView GetPrimaryView(View convertView, ViewGroup parent)
                {
                    PrimaryListItem primaryItem = convertView as PrimaryListItem;

                    if (primaryItem == null)
                    {
                        primaryItem = new PrimaryListItem(Rock.Mobile.PlatformSpecific.Android.Core.Context);

                        int height = (int)System.Math.Ceiling(NavbarFragment.GetCurrentContainerDisplayWidth( ) * PrivateConnectConfig.MainPageHeaderAspectRatio);
                        primaryItem.Billboard.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, height);
                        primaryItem.HasImage = false;
                    }
                    else
                    {
                        primaryItem.FreeImageResources( );
                    }

                    if (ParentFragment.Billboard != null)
                    {
                        if (primaryItem.HasImage == false)
                        {
                            primaryItem.HasImage = true;
                            Rock.Mobile.PlatformSpecific.Android.UI.Util.FadeView(primaryItem.Billboard, true, null);
                        }

                        primaryItem.Billboard.SetImageBitmap(ParentFragment.Billboard);
                    }

                    return(primaryItem);
                }
Exemplo n.º 4
0
                public override View GetView(int position, View convertView, ViewGroup parent)
                {
                    SingleNewsListItem listItem = convertView as SingleNewsListItem;

                    if (listItem == null)
                    {
                        listItem = new SingleNewsListItem(Rock.Mobile.PlatformSpecific.Android.Core.Context);

                        int height = (int)System.Math.Ceiling(NavbarFragment.GetCurrentContainerDisplayWidth( ) * PrivateNewsConfig.NewsMainAspectRatio);
                        listItem.LayoutParameters = new AbsListView.LayoutParams(ViewGroup.LayoutParams.WrapContent, height);
                        listItem.HasImage         = false;
                    }
                    else
                    {
                        listItem.FreeImageResources( );
                    }

                    // if we have a valid item
                    if (position < ParentFragment.News.Count)
                    {
                        // is our image ready?
                        if (ParentFragment.News[position].Image != null)
                        {
                            if (listItem.HasImage == false)
                            {
                                listItem.HasImage = true;
                                Rock.Mobile.PlatformSpecific.Android.UI.Util.FadeView(listItem.Billboard, true, null);
                            }

                            listItem.Billboard.SetImageBitmap(ParentFragment.News[position].Image);
                        }
                        // only show the "Loading..." if the image isn't actually downloaded.
                        else if (ParentFragment.Placeholder != null)
                        {
                            listItem.Billboard.SetImageBitmap(ParentFragment.Placeholder);
                        }
                        else
                        {
                            listItem.Billboard.SetImageBitmap(null);
                        }

                        if (ParentFragment.News[position].News.Developer_Private)
                        {
                            listItem.PrivateOverlay.Visibility = ViewStates.Visible;
                        }
                        else
                        {
                            listItem.PrivateOverlay.Visibility = ViewStates.Gone;
                        }
                    }
                    else
                    {
                        listItem.Billboard.SetImageBitmap(null);
                        listItem.PrivateOverlay.Visibility = ViewStates.Gone;
                    }

                    return(base.AddView(listItem));
                }
Exemplo n.º 5
0
                public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig)
                {
                    base.OnConfigurationChanged(newConfig);

                    PrepareCreateNotes( );

                    ResultView.SetBounds(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels));

                    AnimateTutorialScreen(false);
                }
Exemplo n.º 6
0
                public override void OnResume()
                {
                    base.OnResume();

                    ParentTask.NavbarFragment.NavToolbar.SetBackButtonEnabled(true);
                    ParentTask.NavbarFragment.NavToolbar.SetCreateButtonEnabled(false, null);
                    ParentTask.NavbarFragment.NavToolbar.SetShareButtonEnabled(false, null);
                    ParentTask.NavbarFragment.NavToolbar.Reveal(false);

                    JoinGroupView.DisplayView(GroupTitle, MeetingTime, Distance, GroupID);
                    JoinGroupView.LayoutChanged(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels));
                }
Exemplo n.º 7
0
                ListItemView GetPrimaryView(View convertView, ViewGroup parent)
                {
                    MessagePrimaryListItem messageItem = convertView as MessagePrimaryListItem;

                    if (messageItem == null)
                    {
                        messageItem = new MessagePrimaryListItem(ParentFragment.Activity.BaseContext);

                        int height = (int)System.Math.Ceiling(NavbarFragment.GetCurrentContainerDisplayWidth( ) * PrivateNoteConfig.NotesMainPlaceholderAspectRatio);
                        messageItem.Thumbnail.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, height);

                        messageItem.HasImage = false;
                    }
                    else
                    {
                        messageItem.FreeImageResources( );
                    }

                    messageItem.ParentAdapter = this;

                    if (ParentFragment.SeriesBillboard != null)
                    {
                        if (messageItem.HasImage == false)
                        {
                            messageItem.HasImage = true;
                            Rock.Mobile.PlatformSpecific.Android.UI.Util.FadeView(messageItem.Thumbnail, true, null);
                        }

                        messageItem.Thumbnail.SetImageBitmap(ParentFragment.SeriesBillboard);
                        messageItem.Thumbnail.SetScaleType(ImageView.ScaleType.CenterCrop);
                    }
                    else if (ParentFragment.PlaceholderImage != null)
                    {
                        messageItem.Thumbnail.SetImageBitmap(ParentFragment.PlaceholderImage);
                        messageItem.Thumbnail.SetScaleType(ImageView.ScaleType.CenterCrop);
                    }

                    messageItem.Title.Text = ParentFragment.Series.SeriesName;
                    if (ParentFragment.Series.SeriesPrivate == true)
                    {
                        messageItem.Title.Text += " (Private)";
                    }

                    messageItem.DateRange.Text = ParentFragment.Series.DateRanges;
                    messageItem.Desc.Text      = ParentFragment.Series.Description;

                    return(messageItem);
                }
Exemplo n.º 8
0
                public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig)
                {
                    base.OnConfigurationChanged(newConfig);

                    Point displaySize = new Point( );

                    Activity.WindowManager.DefaultDisplay.GetSize(displaySize);

                    if (MapView != null)
                    {
                        MapView.LayoutParameters.Height = (int)(displaySize.Y * .50f);
                    }

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

                    SearchPage.LayoutChanged(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels));
                }
Exemplo n.º 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);
                    }

                    GroupInfoView = new UIGroupInfo();

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

                    view.SetOnTouchListener(this);

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

                    ScrollView       = view.FindViewById <ScrollView>(Resource.Id.scroll_view);
                    ScrollViewLayout = ScrollView.FindViewById <RelativeLayout>(Resource.Id.view_background);
                    ScrollViewLayout.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor));

                    GroupInfoView.Create(ScrollViewLayout, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels), OnJoinClicked);

                    return(view);
                }
Exemplo n.º 10
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);
                }
Exemplo n.º 11
0
                protected void CreateNotes( )
                {
                    try
                    {
                        // expect the note and its style sheet to exist.
                        NoteFileName = Rock.Mobile.Util.Strings.Parsers.ParseURLToFileName(NoteUrl);
                        MemoryStream noteData = (MemoryStream)FileCache.Instance.LoadFile(NoteFileName);
                        string       noteXML  = Encoding.UTF8.GetString(noteData.ToArray( ), 0, (int)noteData.Length);
                        noteData.Dispose( );

                        Note = new Note(noteXML);

                        // Use the metrics and not ScrollView for dimensions, because depending on when this gets called the ScrollView
                        // may not have its dimensions set yet.
                        float scrollPercentOffset = Note.Create(NavbarFragment.GetCurrentContainerDisplayWidth( ),
                                                                this.Resources.DisplayMetrics.HeightPixels,
                                                                ScrollViewLayout,
                                                                NoteFileName + PrivateNoteConfig.UserNoteSuffix,
                                                                DisplayMessageBox,
                                                                UpdateScrollViewHeight);

                        // set the requested background color
                        ScrollView.SetBackgroundColor((Android.Graphics.Color)Rock.Mobile.UI.Util.GetUIColor(Note.mStyle.mBackgroundColor ?? 0x000000FF));

                        // update the height of the scroll view to fit all content
                        float noteBottom = Note.GetNoteAbsoluteHeight( );

                        int scrollFrameHeight = ( int )noteBottom + (this.Resources.DisplayMetrics.HeightPixels / 3);
                        ScrollViewLayout.LayoutParameters.Height = scrollFrameHeight;

                        // scroll to where the user left off
                        ScrollView.Post(new Action(delegate
                        {
                            ScrollView.ForceScrollTo(0, (int)(scrollPercentOffset * (float)scrollFrameHeight));
                        }));

                        FinishNotesCreation( );

                        // log the note they are reading.
                        MessageAnalytic.Instance.Trigger(MessageAnalytic.Read, NoteName);

                        // display the tutorial if it hasn't been shown this run of the app, and the user has never created their own note.
                        if (TutorialDisplayed == false && MobileApp.Shared.Network.RockMobileUser.Instance.UserNoteCreated == false)
                        {
                            TutorialDisplayed = true;

                            System.IO.Stream tutorialStream = Activity.BaseContext.Assets.Open(PrivateNoteConfig.TutorialOverlayImage);

                            TutorialImage = Android.Graphics.BitmapFactory.DecodeStream(tutorialStream);
                            TutorialOverlay.SetImageBitmap(TutorialImage);

                            // wait a second before revealing the tutorial overlay
                            System.Timers.Timer timer = new System.Timers.Timer();
                            timer.AutoReset = false;
                            timer.Interval  = 750;
                            timer.Elapsed  += (object sender, System.Timers.ElapsedEventArgs e) =>
                            {
                                Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                                {
                                    TutorialBacker.Visibility = ViewStates.Visible;
                                    AnimateTutorialScreen(true);
                                    ScrollView.ScrollEnabled = false;
                                });
                            };
                            timer.Start( );
                        }

                        ParentTask.NavbarFragment.NavToolbar.Reveal(true);
                    }
                    catch (Exception ex)
                    {
                        ReportException("", ex);
                    }
                }
Exemplo n.º 12
0
                void LayoutChanged( )
                {
                    GroupInfoView.LayoutChanged(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels));

                    ScrollViewLayout.LayoutParameters.Height = (int)(GroupInfoView.GetControlBottom( ) * 1.05f);
                }
Exemplo n.º 13
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.BiblePassage, container, false) as RelativeLayout;

                view.SetOnTouchListener(this);

                PassageWebView = new WebView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                PassageWebView.SetBackgroundColor(Android.Graphics.Color.Rgb(28, 28, 28));
                PassageWebView.SetPadding(10, 0, 40, 0);

                view.AddView(PassageWebView);
                view.SetBackgroundColor(Android.Graphics.Color.Rgb(28, 28, 28));

                // get our power management control
                PowerManager pm = PowerManager.FromContext(Rock.Mobile.PlatformSpecific.Android.Core.Context);

                WakeLock = pm.NewWakeLock(WakeLockFlags.Full, "Bible Passage");

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

                ResultView = new UIResultView(view, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels),
                                              delegate
                {
                    if (RequestingBiblePassage == false)
                    {
                        RetrieveBiblePassage( );
                    }
                });

                return(view);
            }
Exemplo n.º 14
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);
                    }

                    JoinGroupView = new UIJoinGroup();

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

                    view.SetOnTouchListener(this);

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

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

                    JoinGroupView.Create(backgroundView, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels));


                    // get the native object types so we can hook in necessary support pointers
                    ((View)JoinGroupView.View.PlatformNativeObject).SetOnTouchListener(this);
                    ((EditText)JoinGroupView.CellPhone.PlatformNativeObject).AddTextChangedListener(new PhoneNumberFormattingTextWatcher());

                    return(view);
                }
Exemplo n.º 15
0
                void LayoutChanged( )
                {
                    float prayerRegionHeight = GetPrayerRegionHeight( );

                    float cardWidth  = GetCardWidth( );
                    float cardHeight = GetCardHeight( );

                    // setup the card positions to be to the offscreen to the left, centered on screen, and offscreen to the right
                    float cardYOffset = (prayerRegionHeight - cardHeight) / 2;

                    PrayerCardSize = new RectangleF(0, 0, cardWidth, cardHeight);

                    Carousel.LayoutChanged(cardWidth, cardHeight, new RectangleF(0, cardYOffset, NavbarFragment.GetCurrentContainerDisplayWidth( ), prayerRegionHeight));

                    // now update the layout for each prayer card
                    foreach (PrayerCard prayerCard in PrayerRequestCards)
                    {
                        prayerCard.LayoutChanged(PrayerCardSize);
                    }
                }
Exemplo n.º 16
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_Primary, container, false);

                    view.SetOnTouchListener(this);

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

                    ActivityIndicator            = (ProgressBar)view.FindViewById <ProgressBar>(Resource.Id.prayer_primary_activityIndicator);
                    ActivityIndicator.Visibility = ViewStates.Invisible;

                    // create the carousel
                    float prayerRegionHeight = GetPrayerRegionHeight( );

                    float cardWidth  = GetCardWidth( );
                    float cardHeight = GetCardHeight( );

                    // setup the card positions to be to the offscreen to the left, centered on screen, and offscreen to the right
                    float cardYOffset = (prayerRegionHeight - cardHeight) / 2;

                    PrayerCardSize = new RectangleF(0, 0, cardWidth, cardHeight);

                    // setup the card positions to be to the offscreen to the left, centered on screen, and offscreen to the right
                    Carousel = PlatformCardCarousel.Create(view, cardWidth, cardHeight, new RectangleF(0, cardYOffset, NavbarFragment.GetCurrentContainerDisplayWidth( ), prayerRegionHeight), PrivatePrayerConfig.Card_AnimationDuration);


                    // setup our error UI
                    StatusLayer = view.FindViewById <View>(Resource.Id.status_background);
                    ControlStyling.StyleBGLayer(StatusLayer);

                    StatusText = StatusLayer.FindViewById <TextView>(Resource.Id.text);
                    ControlStyling.StyleUILabel(StatusText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);

                    ResultLayer = view.FindViewById <View>(Resource.Id.result_background);
                    ControlStyling.StyleBGLayer(ResultLayer);

                    ResultSymbol = ResultLayer.FindViewById <TextView>(Resource.Id.resultSymbol);
                    ResultSymbol.SetTypeface(FontManager.Instance.GetFont(PrivateControlStylingConfig.Icon_Font_Secondary), TypefaceStyle.Normal);
                    ResultSymbol.SetTextSize(ComplexUnitType.Dip, PrivatePrayerConfig.PostPrayer_ResultSymbolSize_Droid);
                    ResultSymbol.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor));
                    ResultSymbol.Text = PrivateControlStylingConfig.Result_Symbol_Failed;

                    ResultText = ResultLayer.FindViewById <TextView>(Resource.Id.text);
                    ControlStyling.StyleUILabel(ResultText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Large_FontSize);

                    RetryButton = view.FindViewById <Button>(Resource.Id.retryButton);
                    ControlStyling.StyleButton(RetryButton, GeneralStrings.Retry, ControlStylingConfig.Font_Regular, ControlStylingConfig.Large_FontSize);

                    RetryButton.Click += (object sender, EventArgs e) =>
                    {
                        if (IsRequesting == false)
                        {
                            DownloadPrayers( );
                        }
                    };

                    return(view);
                }
Exemplo n.º 17
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.TaskWebView, container, false) as RelativeLayout;

                view.SetOnTouchListener(this);

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

                view.AddView(WebLayout);

                ResultView = new UIResultView(view, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels),
                                              delegate
                {
                    ResultView.Hide( );

                    if (string.IsNullOrEmpty(Url) == false)
                    {
                        ProcessUrl( );
                    }
                });

                // get our power management control
                PowerManager pm = PowerManager.FromContext(Rock.Mobile.PlatformSpecific.Android.Core.Context);

                WakeLock = pm.NewWakeLock(WakeLockFlags.Full, "TaskWeb");

                return(view);
            }
Exemplo n.º 18
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);
                    }

                    GroupEntries   = new List <MobileAppApi.GroupSearchResult>();
                    MarkerList     = new List <Android.Gms.Maps.Model.Marker>();
                    SourceLocation = new MobileAppApi.GroupSearchResult();

                    // limit the address to 90% of the screen so it doesn't conflict with the progress bar.
                    Point displaySize = new Point( );

                    Activity.WindowManager.DefaultDisplay.GetSize(displaySize);
                    //float fixedWidth = displaySize.X / 4.0f;

                    // catch any exceptions thrown, as they'll be related to no map API key
                    try
                    {
                        MapView = new Android.Gms.Maps.MapView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                        MapView.LayoutParameters        = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                        MapView.LayoutParameters.Height = (int)(displaySize.Y * .50f);
                        MapView.GetMapAsync(this);
                        MapView.SetBackgroundColor(Color.Black);

                        MapView.OnCreate(savedInstanceState);
                    }
                    catch
                    {
                        MapView = null;
                        Rock.Mobile.Util.Debug.WriteLine("GOOGLE MAPS: Unable to create. Verify you have a valid API KEY.");
                    }

                    NumRequestedGroups = 10;


                    SearchAddressButton = new Button(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    SearchAddressButton.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                    ControlStyling.StyleButton(SearchAddressButton, ConnectStrings.GroupFinder_SearchButtonLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
                    SearchAddressButton.Click += (object sender, EventArgs e) =>
                    {
                        SearchPage.Show( );
                    };


                    // setup the linear layout containing the "Your Neighborhood is: Horizon" text
                    SearchLayout = new LinearLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    SearchLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                    SearchLayout.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color));
                    SearchLayout.SetGravity(GravityFlags.Center);

                    SearchResultPrefix = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    SearchResultPrefix.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                    SearchResultPrefix.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Regular), TypefaceStyle.Normal);
                    SearchResultPrefix.SetTextSize(Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize);
                    SearchResultPrefix.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor));
                    SearchResultPrefix.Text = ConnectStrings.GroupFinder_NoGroupsFound;

                    SearchResultNeighborhood = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    SearchResultNeighborhood.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                    SearchResultNeighborhood.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Regular), TypefaceStyle.Normal);
                    SearchResultNeighborhood.SetTextSize(Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize);
                    SearchResultNeighborhood.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor));
                    SearchResultNeighborhood.Text = "";


                    Seperator = new View(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    Seperator.LayoutParameters        = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 0);
                    Seperator.LayoutParameters.Height = 2;
                    Seperator.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor));

                    ListView = new ListView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    ListView.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                    ListView.ItemClick       += (object sender, AdapterView.ItemClickEventArgs e) =>
                    {
                        OnClick(e.Position, 0);
                    };
                    ListView.SetOnTouchListener(this);
                    ListView.Adapter = new GroupArrayAdapter(this);

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

                    view.SetOnTouchListener(this);

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

                    LinearLayout groupLayout = view.FindViewById <LinearLayout>(Resource.Id.groupFrame) as LinearLayout;

                    // setup the address layout, which has the address text, padding, and finally the progress bar.
                    if (MapView != null)
                    {
                        ((LinearLayout)groupLayout).AddView(MapView);
                    }

                    ((LinearLayout)groupLayout).AddView(SearchAddressButton);

                    ((LinearLayout)groupLayout).AddView(SearchLayout);
                    ((LinearLayout)SearchLayout).AddView(SearchResultPrefix);
                    ((LinearLayout)SearchLayout).AddView(SearchResultNeighborhood);

                    ((LinearLayout)groupLayout).AddView(Seperator);
                    ((LinearLayout)groupLayout).AddView(ListView);

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

                    SearchPage = new UIGroupFinderSearch();
                    SearchPage.Create(view, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels),
                                      // Search Neighborhood Groups
                                      delegate
                    {
                        SearchPage.Hide(true);
                        GetInitialGroups(PrivateGeneralConfig.GroupType_Neighborhood_GroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text);
                    },

                                      // Search Next Gen Groups
                                      delegate
                    {
                        SearchPage.Hide(true);
                        GetInitialGroups(PrivateGeneralConfig.GroupType_NextGenGroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text);
                    },

                                      // Search Young Adult Groups
                                      delegate
                    {
                        SearchPage.Hide(true);
                        GetInitialGroups(PrivateGeneralConfig.GroupType_YoungAdultsGroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text);
                    });
                    SearchPage.SetTitle(ConnectStrings.GroupFinder_SearchPageHeader, ConnectStrings.GroupFinder_SearchPageDetails);
                    SearchPage.LayoutChanged(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels));
                    SearchPage.Hide(false);

                    // if we should automatically show the search page...
                    if (ShowSearchOnAppear == true)
                    {
                        // don't allow them to tap the address button until we reveal the search page.
                        SearchAddressButton.Enabled = false;

                        // wait a couple seconds before revealing the search page.
                        System.Timers.Timer timer = new System.Timers.Timer();
                        timer.AutoReset = false;
                        timer.Interval  = 1000;
                        timer.Elapsed  += (object sender, System.Timers.ElapsedEventArgs e) =>
                        {
                            Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                            {
                                SearchAddressButton.Enabled = true;
                                SearchPage.Show( );
                            });
                        };
                        timer.Start( );
                    }
                    else
                    {
                        // otherwise, just allow the seach button
                        SearchAddressButton.Enabled = true;
                    }

                    // hook into the search page as its listener
                    ((View)SearchPage.View.PlatformNativeObject).SetOnTouchListener(this);
                    ((EditText)SearchPage.Street.PlatformNativeObject).SetOnEditorActionListener(this);
                    ((EditText)SearchPage.City.PlatformNativeObject).SetOnEditorActionListener(this);
                    ((EditText)SearchPage.State.PlatformNativeObject).SetOnEditorActionListener(this);
                    ((EditText)SearchPage.ZipCode.PlatformNativeObject).SetOnEditorActionListener(this);
                    return(view);
                }
Exemplo n.º 19
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);
                }
Exemplo n.º 20
0
 float GetCardWidth( )
 {
     return(NavbarFragment.GetCurrentContainerDisplayWidth( ) * PrayerCardSizePerc);
 }
Exemplo n.º 21
0
                public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
                {
                    base.OnCreateView(inflater, container, savedInstanceState);

                    // get the root control from our .axml
                    var layout = inflater.Inflate(Resource.Layout.Notes, container, false) as RelativeLayout;

                    // get the refresh button from the layout
                    RefreshButton = layout.FindViewById <Button>(Resource.Id.refreshButton);

                    // create our overridden lockable scroll view
                    ScrollView = new LockableScrollView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    ScrollView.ScrollBarStyle            = ScrollbarStyles.InsideInset;
                    ScrollView.OverScrollMode            = OverScrollMode.Always;
                    ScrollView.VerticalScrollbarPosition = ScrollbarPosition.Default;
                    ScrollView.LayoutParameters          = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
                    ScrollView.OnTouchIntercept          = OnInterceptTouchEvent;
                    ScrollView.OnChangedScroll           = OnScrollChanged;
                    ((RelativeLayout.LayoutParams)ScrollView.LayoutParameters).AddRule(LayoutRules.CenterHorizontal);
                    ((RelativeLayout.LayoutParams)ScrollView.LayoutParameters).AddRule(LayoutRules.Below, Resource.Id.refreshButton);

                    // add it to our main layout.
                    layout.AddView(ScrollView);

                    Indicator            = layout.FindViewById <ProgressBar>(Resource.Id.progressBar);
                    Indicator.Visibility = ViewStates.Gone;
                    Indicator.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(0));
                    Indicator.BringToFront();

                    // create the layout that will contain the notes
                    ScrollViewLayout = new RelativeLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    ScrollView.AddView(ScrollViewLayout);
                    ScrollViewLayout.SetOnTouchListener(this);

                    RefreshButton.Click += (object sender, EventArgs e) =>
                    {
                        DeleteNote( );

                        PrepareCreateNotes(  );
                    };

                    // if the refresh button isn't enabled, hide it
                    if (MobileApp.Shared.Network.RockLaunchData.Instance.Data.DeveloperModeEnabled == false)
                    {
                        RefreshButton.Visibility = ViewStates.Gone;
                    }

                    // get our power management control
                    PowerManager pm = PowerManager.FromContext(Rock.Mobile.PlatformSpecific.Android.Core.Context);

                    WakeLock = pm.NewWakeLock(WakeLockFlags.Full, "Notes");

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

                    ResultView.Hide( );

                    // setup the tutorial overlay
                    TutorialBacker = new View(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    TutorialBacker.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                    TutorialBacker.Alpha            = 0;
                    TutorialBacker.SetBackgroundColor(Android.Graphics.Color.Black);
                    layout.AddView(TutorialBacker);

                    AnimatingTutorial = false;
                    TutorialOverlay   = new ImageView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    TutorialOverlay.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                    ((RelativeLayout.LayoutParams)TutorialOverlay.LayoutParameters).AddRule(LayoutRules.CenterInParent);
                    TutorialOverlay.Alpha = 0;
                    TutorialOverlay.SetBackgroundColor(Android.Graphics.Color.Transparent);
                    layout.AddView(TutorialOverlay);

                    NavBarRevealTracker = new NavBarReveal( );

                    return(layout);
                }