public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( App.Shared.Config.ControlStylingConfig.BackgroundColor ); ScrollView = new UIScrollViewWrapper(); ScrollView.Layer.AnchorPoint = CGPoint.Empty; ScrollView.Parent = this; ScrollView.Bounds = View.Bounds; View.AddSubview( ScrollView ); ScrollView.ScrollEnabled = false; // setup everything except positioning, which will happen in LayoutChanged() SourceLocation = null; GroupEntries = new List<GroupFinder.GroupEntry>(); SearchAddressButton = UIButton.FromType( UIButtonType.System ); ScrollView.AddSubview( SearchAddressButton ); SearchAddressButton.Layer.AnchorPoint = CGPoint.Empty; ControlStyling.StyleButton( SearchAddressButton, ConnectStrings.GroupFinder_SearchButtonLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize ); SearchAddressButton.TouchUpInside += (object sender, EventArgs e ) => { SearchPage.Show( ); Task.NavToolbar.Reveal( false ); }; MapView = new MKMapView( ); ScrollView.AddSubview( MapView ); // set the default position for the map to whatever specified area. MKCoordinateRegion region = MKCoordinateRegion.FromDistance( new CLLocationCoordinate2D( ConnectConfig.GroupFinder_DefaultLatitude, ConnectConfig.GroupFinder_DefaultLongitude ), ConnectConfig.GroupFinder_DefaultScale_iOS, ConnectConfig.GroupFinder_DefaultScale_iOS ); MapView.SetRegion( region, true ); MapView.Layer.AnchorPoint = new CGPoint( 0, 0 ); MapView.Delegate = new MapViewDelegate() { Parent = this }; SearchResultsBGLayer = new UIView(); ScrollView.AddSubview( SearchResultsBGLayer ); SearchResultsBGLayer.Layer.AnchorPoint = new CGPoint( 0, 0 ); SearchResultsBGLayer.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ); SearchResultsPrefix = new UILabel( ); ScrollView.AddSubview( SearchResultsPrefix ); SearchResultsPrefix.Layer.AnchorPoint = new CGPoint( 0, 0 ); SearchResultsPrefix.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize ); SearchResultsPrefix.Text = ConnectStrings.GroupFinder_NoGroupsFound; SearchResultsPrefix.SizeToFit( ); SearchResultsPrefix.TextColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ); SearchResultsPrefix.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ); SearchResultsPrefix.TextAlignment = UITextAlignment.Center; SearchResultsNeighborhood = new UILabel( ); ScrollView.AddSubview( SearchResultsNeighborhood ); SearchResultsNeighborhood.Layer.AnchorPoint = new CGPoint( 0, 0 ); SearchResultsNeighborhood.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize ); SearchResultsNeighborhood.TextColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor ); SearchResultsNeighborhood.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ); SearchResultsNeighborhood.TextAlignment = UITextAlignment.Center; Seperator = new UIView( ); ScrollView.AddSubview( Seperator ); Seperator.Layer.BorderWidth = 1; Seperator.Layer.BorderColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ).CGColor; GroupFinderTableView = new UITableView(); ScrollView.AddSubview( GroupFinderTableView ); GroupTableSource = new GroupFinderViewController.TableSource( this ); // add the table view and source GroupFinderTableView.BackgroundColor = UIColor.Clear;//Rock.Mobile.UI.Util.GetUIColor( App.Shared.Config.ControlStylingConfig.Table_Footer_Color ); //GroupFinderTableView.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( App.Shared.Config.ControlStylingConfig.BG_Layer_Color ); GroupFinderTableView.Source = GroupTableSource; GroupFinderTableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; BlockerView = new UIBlockerView( ScrollView, ScrollView.Frame.ToRectF( ) ); SearchPage = new UIGroupFinderSearch(); SearchPage.Create( ScrollView, ScrollView.Frame.ToRectF( ), delegate { SearchPage.Hide( true ); GetGroups( SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text ); Task.NavToolbar.Reveal( true ); } ); SearchPage.SetTitle( ConnectStrings.GroupFinder_SearchPageHeader, ConnectStrings.GroupFinder_SearchPageDetails ); SearchPage.Hide( false ); KeyboardAdjustManager = new KeyboardAdjustManager( View ); // 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( ); // hook in delegates so we can handle return ((UITextField)SearchPage.Street.PlatformNativeObject).Delegate = new AddressDelegate( ) { Parent = this }; ((UITextField)SearchPage.City.PlatformNativeObject).Delegate = new AddressDelegate( ) { Parent = this }; ((UITextField)SearchPage.State.PlatformNativeObject).Delegate = new AddressDelegate( ) { Parent = this }; ((UITextField)SearchPage.ZipCode.PlatformNativeObject).Delegate = new AddressDelegate( ) { Parent = this }; }
public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(MobileApp.Shared.Config.ControlStylingConfig.BackgroundColor); ScrollView = new UIScrollViewWrapper(); ScrollView.Layer.AnchorPoint = CGPoint.Empty; ScrollView.Parent = this; ScrollView.Bounds = View.Bounds; View.AddSubview(ScrollView); ScrollView.ScrollEnabled = false; // setup everything except positioning, which will happen in LayoutChanged() SourceLocation = null; GroupEntries = new List <MobileAppApi.GroupSearchResult>(); SearchAddressButton = UIButton.FromType(UIButtonType.System); ScrollView.AddSubview(SearchAddressButton); SearchAddressButton.Layer.AnchorPoint = CGPoint.Empty; ControlStyling.StyleButton(SearchAddressButton, ConnectStrings.GroupFinder_SearchButtonLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); SearchAddressButton.TouchUpInside += (object sender, EventArgs e) => { SearchPage.Show( ); Task.NavToolbar.Reveal(false); }; MapView = new MKMapView( ); ScrollView.AddSubview(MapView); CurrGroupIndex = 0; NumRequestedGroups = 10; // set the default position for the map to whatever specified area. MKCoordinateRegion region = MKCoordinateRegion.FromDistance(new CLLocationCoordinate2D( ConnectConfig.GroupFinder_DefaultLatitude, ConnectConfig.GroupFinder_DefaultLongitude), ConnectConfig.GroupFinder_DefaultScale_iOS, ConnectConfig.GroupFinder_DefaultScale_iOS); MapView.SetRegion(region, true); MapView.Layer.AnchorPoint = new CGPoint(0, 0); MapView.Delegate = new MapViewDelegate() { Parent = this }; SearchResultsBGLayer = new UIView(); ScrollView.AddSubview(SearchResultsBGLayer); SearchResultsBGLayer.Layer.AnchorPoint = new CGPoint(0, 0); SearchResultsBGLayer.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color); SearchResultsPrefix = new UILabel( ); ScrollView.AddSubview(SearchResultsPrefix); SearchResultsPrefix.Layer.AnchorPoint = new CGPoint(0, 0); SearchResultsPrefix.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); SearchResultsPrefix.Text = ConnectStrings.GroupFinder_NoGroupsFound; SearchResultsPrefix.SizeToFit( ); SearchResultsPrefix.TextColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor); SearchResultsPrefix.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color); SearchResultsPrefix.TextAlignment = UITextAlignment.Center; SearchResultsNeighborhood = new UILabel( ); ScrollView.AddSubview(SearchResultsNeighborhood); SearchResultsNeighborhood.Layer.AnchorPoint = new CGPoint(0, 0); SearchResultsNeighborhood.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); SearchResultsNeighborhood.TextColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor); SearchResultsNeighborhood.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color); SearchResultsNeighborhood.TextAlignment = UITextAlignment.Center; Seperator = new UIView( ); ScrollView.AddSubview(Seperator); Seperator.Layer.BorderWidth = 1; Seperator.Layer.BorderColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor).CGColor; GroupFinderTableView = new UITableView(); ScrollView.AddSubview(GroupFinderTableView); GroupTableSource = new GroupFinderViewController.TableSource(this); // add the table view and source GroupFinderTableView.BackgroundColor = UIColor.Clear; GroupFinderTableView.Source = GroupTableSource; GroupFinderTableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; BlockerView = new UIBlockerView(ScrollView, ScrollView.Frame.ToRectF( )); SearchPage = new UIGroupFinderSearch(); SearchPage.Create(ScrollView, ScrollView.Frame.ToRectF( ), // Search Neighborhood Groups delegate { SearchPage.Hide(true); GetInitialGroups(PrivateGeneralConfig.GroupType_Neighborhood_GroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text); Task.NavToolbar.Reveal(true); }, // Search Short Term Groups delegate { SearchPage.Hide(true); GetInitialGroups(PrivateGeneralConfig.GroupType_ShortTermGroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text); Task.NavToolbar.Reveal(true); }, // Search Young Adults Groups delegate { SearchPage.Hide(true); GetInitialGroups(PrivateGeneralConfig.GroupType_YoungAdultsGroupId, SearchPage.Street.Text, SearchPage.City.Text, SearchPage.State.Text, SearchPage.ZipCode.Text); Task.NavToolbar.Reveal(true); }); SearchPage.SetTitle(ConnectStrings.GroupFinder_SearchPageHeader, ConnectStrings.GroupFinder_SearchPageDetails); SearchPage.Hide(false); KeyboardAdjustManager = new KeyboardAdjustManager(View); // 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( ); // hook in delegates so we can handle return ((UITextField)SearchPage.Street.PlatformNativeObject).Delegate = new AddressDelegate( ) { Parent = this }; ((UITextField)SearchPage.City.PlatformNativeObject).Delegate = new AddressDelegate( ) { Parent = this }; ((UITextField)SearchPage.State.PlatformNativeObject).Delegate = new AddressDelegate( ) { Parent = this }; ((UITextField)SearchPage.ZipCode.PlatformNativeObject).Delegate = new AddressDelegate( ) { Parent = this }; }