public void Redraw(string StationCRSCode, ScrollView ParentScroller) { this._ParentScrollView = ParentScroller; _RootMap.RemoveAllViews(); _MapImage = new ImageView(this.Context); float XPos, YPos = 0.0f; if (StationCRSCode == "LAN") { _MapImage.SetBackgroundResource(Resource.Drawable.Map_LAN); XPos = 0.4f; YPos = -0.1f; _RootMap.SetX(RtGraphicsLayouts.ConvertPxDp(1800) * (XPos / 2.0f)); _RootMap.SetY(RtGraphicsLayouts.ConvertPxDp(1800) * (YPos / 2.0f)); _MapImage.LayoutParameters = RtGraphicsLayouts.LayoutParameters(1800, 1800); _RootMap.AddView(_MapImage); //Draw Markers for LAN StationFacilitiesMarker MarkerDoor1 = new StationFacilitiesMarker(Context, 0.60f, 0.645f, StationFacilitiesMarker.MarkerTypes.EnteranceExit); MarkerDoor1.AddtoView(_RootMap); StationFacilitiesMarker MarkerDoor2 = new StationFacilitiesMarker(Context, 0.425f, 0.635f, StationFacilitiesMarker.MarkerTypes.EnteranceExit); MarkerDoor2.AddtoView(_RootMap); } else if (StationCRSCode == "PRE") { _MapImage.SetBackgroundResource(Resource.Drawable.Map_PRE); XPos = 0.4f; YPos = -0.1f; _RootMap.SetX(RtGraphicsLayouts.ConvertPxDp(1800) * (XPos / 2.0f)); _RootMap.SetY(RtGraphicsLayouts.ConvertPxDp(1800) * (YPos / 2.0f)); _MapImage.LayoutParameters = RtGraphicsLayouts.LayoutParameters(1800, 1800); _RootMap.AddView(_MapImage); //Draw Markers for LAN //StationFacilitiesMarker MarkerDoor1 = new StationFacilitiesMarker(Context, 0.60f, 0.645f, StationFacilitiesMarker.MarkerTypes.EnteranceExit); //MarkerDoor1.AddtoView(_RootMap); //StationFacilitiesMarker MarkerDoor2 = new StationFacilitiesMarker(Context, 0.425f, 0.635f, StationFacilitiesMarker.MarkerTypes.EnteranceExit); //MarkerDoor2.AddtoView(_RootMap); } }
//Initialiser public RtTrainDeparturesView(Context Context, Activity Activity) { this.Context = Context; //Set Context this.Activity = Activity; //Set Activity //Initialise graphics RtGraphicsLayouts = new RtGraphicsLayouts(this.Context); //Generate View _RootLayout = new LinearLayout(this.Context); _RootLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); _RootLayout.Orientation = Orientation.Vertical; _RootLayout.Visibility = ViewStates.Gone; //Generate Departures Root _TrainDeparturesLayout = new LinearLayout(this.Context); _TrainDeparturesLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); _TrainDeparturesLayout.Orientation = Orientation.Vertical; _TrainDeparturesLayout.Visibility = ViewStates.Gone; _RootLayout.AddView(_TrainDeparturesLayout); //Generate Departures Loading Root _TrainDeparturesLoading = new LinearLayout(this.Context); _TrainDeparturesLoading.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 400); _TrainDeparturesLoading.Orientation = Orientation.Vertical; _TrainDeparturesLoading.SetGravity(GravityFlags.Center); _TrainDeparturesLoading.SetBackgroundResource(Resource.Drawable.StyleCornerBox); _RootLayout.AddView(_TrainDeparturesLoading); ImageView LoadingIcon = new ImageView(this.Context); LoadingIcon.LayoutParameters = RtGraphicsLayouts.LayoutParameters(120, 120); LoadingIcon.SetImageResource(Resource.Drawable.Icon_Loading); _TrainDeparturesLoading.AddView(LoadingIcon); //Thread for rotating loading icon new Thread(() => { int Z = 0; while (true) { Activity.RunOnUiThread(() => LoadingIcon.Rotation = Z); Z += 4; Thread.Sleep(20); } }).Start(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RtGraphicsLayouts RtGraphicsLayouts = new RtGraphicsLayouts(this); RtGraphicsLayouts.SetColourStatusBar(Window, RtGraphicsColours.Orange); LinearLayout RootLayout = new LinearLayout(this); RootLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); RootLayout.SetBackgroundColor(RtGraphicsColours.Orange); SetContentView(RootLayout); GenerateInitialSettings(); StartActivity(typeof(Activity_Home)); }
private void NavBarTitle_AfterTextChanged(object sender, Android.Text.AfterTextChangedEventArgs e) { string InputText = (sender as EditText).Text; if (InputText.Length > 0) { RtStationData[] SearchData = (InputText.Length == 3 && InputText.ToUpper() == InputText) ? RtStations.SearchByCRS(InputText) : RtStations.SearchByName(InputText); ContentRoot.RemoveAllViews(); for (int i = 0; i < SearchData.Length; i++) { LinearLayout ResultBack = new LinearLayout(this); ResultBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, NAVBARHEIGHT); ResultBack.SetDpPadding(RtGraphicsLayouts, SMALLPADDING, SMALLPADDING, SMALLPADDING, SMALLPADDING); ContentRoot.AddView(ResultBack); TextView tResult = new TextView(this); tResult.Format(RtGraphicsExt.TextFormats.Paragraph); tResult.Text = SearchData[i].Code + " - " + SearchData[i].StationName; ResultBack.AddView(tResult); } } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //Initialisation RtGraphicsLayouts = new RtGraphicsLayouts(this); RtGraphicsLayouts.SetColourStatusBar(Window, RtGraphicsColours.Orange); //Root LinearLayout RootLayout = new LinearLayout(this); RootLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); RootLayout.Orientation = Orientation.Vertical; SetContentView(RootLayout); //Navbar Root LinearLayout NavbarLayout = new LinearLayout(this); NavbarLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, NAVBARHEIGHT); NavbarLayout.SetBackgroundColor(RtGraphicsColours.Orange); RootLayout.AddView(NavbarLayout); //Navbar Back Icon LinearLayout NavbarBack = new LinearLayout(this); NavbarBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(NAVBARHEIGHT, NAVBARHEIGHT); NavbarBack.SetBackgroundResource(Resource.Drawable.IconBack); NavbarBack.Click += NavbarBack_Click;; NavbarLayout.AddView(NavbarBack); //Navbar Title TextView NavBarTitle = new TextView(this); NavBarTitle.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-140, RtGraphicsLayouts.EXPAND); NavBarTitle.SetDpPadding(RtGraphicsLayouts, NAVBARPADDING, NAVBARPADDING, NAVBARHEIGHT + NAVBARPADDING, NAVBARPADDING); NavBarTitle.Gravity = GravityFlags.Center; NavBarTitle.Format(RtGraphicsExt.TextFormats.Heading); NavBarTitle.Text = NAVBARTEXT; NavbarLayout.AddView(NavBarTitle); //Screen Content Scroller ContentScrollerRoot = new ScrollView(this); ContentScrollerRoot.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); RootLayout.AddView(ContentScrollerRoot); //Screen Content LinearLayout ContentScrollRoot = new LinearLayout(this); ContentScrollRoot.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); ContentScrollRoot.Orientation = Orientation.Vertical; ContentScrollRoot.SetDpPadding(RtGraphicsLayouts, SMALLPADDING, SMALLPADDING, SMALLPADDING, SMALLPADDING); ContentScrollerRoot.AddView(ContentScrollRoot); //From Station Box ContentScrollRoot.AddView(GenerateStationSelectionBox(StationSelectionBoxType.From)); ContentScrollRoot.AddView(GenerateSpacer()); //Train Results Box TrainDepartures = new RtTrainDeparturesView(this, this); TrainDepartures.Callback += TrainDepartures_Callback; ContentScrollRoot.AddView(TrainDepartures); ContentScrollRoot.AddView(GenerateSpacer()); //To Station Box ContentScrollRoot.AddView(GenerateStationSelectionBox(StationSelectionBoxType.To)); }
private LinearLayout GenerateSpacer() { LinearLayout Spacer1 = new LinearLayout(this); Spacer1.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, SMALLPADDING); return(Spacer1); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //Initialisation RtGraphicsLayouts RtGraphicsLayouts = new RtGraphicsLayouts(this); RtGraphicsLayouts.SetColourStatusBar(Window, RtGraphicsColours.Orange); //Root LinearLayout RootLayout = new LinearLayout(this); RootLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); RootLayout.Orientation = Orientation.Vertical; SetContentView(RootLayout); //Navbar LinearLayout NavbarLayout = new LinearLayout(this); NavbarLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, NAVBARHEIGHT); NavbarLayout.SetBackgroundColor(RtGraphicsColours.Orange); RootLayout.AddView(NavbarLayout); LinearLayout NavbarBack = new LinearLayout(this); NavbarBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(NAVBARHEIGHT, NAVBARHEIGHT); NavbarBack.SetBackgroundResource(Resource.Drawable.IconBack); NavbarBack.Click += NavbarBack_Click;; NavbarLayout.AddView(NavbarBack); TextView NavBarTitle = new TextView(this); NavBarTitle.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-140, RtGraphicsLayouts.EXPAND); NavBarTitle.SetDpPadding(RtGraphicsLayouts, NAVBARPADDING, NAVBARPADDING, NAVBARHEIGHT + NAVBARPADDING, NAVBARPADDING); NavBarTitle.Gravity = GravityFlags.Center; NavBarTitle.Format(RtGraphicsExt.TextFormats.Heading); NavBarTitle.Text = NAVBARTEXT; NavbarLayout.AddView(NavBarTitle); //Content ScrollView ContentScrollerRoot = new ScrollView(this); ContentScrollerRoot.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); RootLayout.AddView(ContentScrollerRoot); LinearLayout ContentScrollRoot = new LinearLayout(this); ContentScrollRoot.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); ContentScrollRoot.Orientation = Orientation.Vertical; ContentScrollRoot.SetDpPadding(RtGraphicsLayouts, SMALLPADDING, SMALLPADDING, SMALLPADDING, SMALLPADDING); ContentScrollerRoot.AddView(ContentScrollRoot); //Settings Panel 1 LinearLayout SettingsBack = new LinearLayout(this); SettingsBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); SettingsBack.Orientation = Orientation.Vertical; SettingsBack.SetBackgroundResource(Resource.Drawable.StyleCornerBox); SettingsBack.SetDpPadding(RtGraphicsLayouts, BIGPADDING, BIGPADDING, BIGPADDING, BIGPADDING); ContentScrollRoot.AddView(SettingsBack); SettingsCheckbox = new RtCheckboxView(this); SettingsCheckbox.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-(BIGPADDING + BIGPADDING + SMALLPADDING + SMALLPADDING), RtGraphicsLayouts.CONTAIN); SettingsCheckbox.Callback += SettingsCheckbox_Callback; SettingsCheckbox.Checked = (RtSettings.ReadSetting("RRINT") == ONE); SettingsCheckbox.Text = SETTINGTEXT; SettingsCheckbox.Description = SETTINGDESC; SettingsBack.AddView(SettingsCheckbox); SettingsCheckbox1 = new RtCheckboxView(this); SettingsCheckbox1.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-(BIGPADDING + BIGPADDING + SMALLPADDING + SMALLPADDING), RtGraphicsLayouts.CONTAIN); SettingsCheckbox1.Callback += SettingsCheckbox_Callback; SettingsCheckbox1.Checked = (RtSettings.ReadSetting("RRAAM") == ONE); SettingsCheckbox1.Text = SETTINGTEXT1; SettingsBack.AddView(SettingsCheckbox1); LinearLayout SettingsBackSpacer = new LinearLayout(this); SettingsBackSpacer.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, SMALLPADDING); ContentScrollRoot.AddView(SettingsBackSpacer); //Settings Panel 2 LinearLayout SettingsBack1 = new LinearLayout(this); SettingsBack1.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); SettingsBack1.Orientation = Orientation.Vertical; SettingsBack1.SetBackgroundResource(Resource.Drawable.StyleCornerBox); SettingsBack1.SetDpPadding(RtGraphicsLayouts, BIGPADDING, BIGPADDING, BIGPADDING, BIGPADDING); ContentScrollRoot.AddView(SettingsBack1); SettingsCheckbox2 = new RtCheckboxView(this); SettingsCheckbox2.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-(BIGPADDING + BIGPADDING + SMALLPADDING + SMALLPADDING), RtGraphicsLayouts.CONTAIN); SettingsCheckbox2.Callback += SettingsCheckbox_Callback; SettingsCheckbox2.Checked = (RtSettings.ReadSetting("SSO") == ONE); SettingsCheckbox2.Text = SETTINGTEXT2; SettingsCheckbox2.Description = SETTINGDESC2; SettingsBack1.AddView(SettingsCheckbox2); SettingsCheckbox3 = new RtCheckboxView(this); SettingsCheckbox3.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-(BIGPADDING + BIGPADDING + SMALLPADDING + SMALLPADDING), RtGraphicsLayouts.CONTAIN); SettingsCheckbox3.Callback += SettingsCheckbox_Callback; SettingsCheckbox3.Checked = (RtSettings.ReadSetting("SSBD") == ONE); SettingsCheckbox3.Text = SETTINGTEXT3; SettingsCheckbox3.Description = SETTINGDESC3; SettingsBack1.AddView(SettingsCheckbox3); LinearLayout SettingsBackSpacer1 = new LinearLayout(this); SettingsBackSpacer1.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, SMALLPADDING); ContentScrollRoot.AddView(SettingsBackSpacer1); //Settings Panel 3 LinearLayout SettingsBack2 = new LinearLayout(this); SettingsBack2.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); SettingsBack2.Orientation = Orientation.Vertical; SettingsBack2.SetBackgroundResource(Resource.Drawable.StyleCornerBox); SettingsBack2.SetDpPadding(RtGraphicsLayouts, BIGPADDING, BIGPADDING, BIGPADDING, BIGPADDING); ContentScrollRoot.AddView(SettingsBack2); SettingsCheckbox4 = new RtCheckboxView(this); SettingsCheckbox4.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-(BIGPADDING + BIGPADDING + SMALLPADDING + SMALLPADDING), RtGraphicsLayouts.CONTAIN); SettingsCheckbox4.Callback += SettingsCheckbox_Callback; SettingsCheckbox4.Checked = (RtSettings.ReadSetting("CN") == ONE); SettingsCheckbox4.Text = SETTINGTEXT4; SettingsCheckbox4.Description = SETTINGDESC4; SettingsBack2.AddView(SettingsCheckbox4); SettingsCheckbox5 = new RtCheckboxView(this); SettingsCheckbox5.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-(BIGPADDING + BIGPADDING + SMALLPADDING + SMALLPADDING), RtGraphicsLayouts.CONTAIN); SettingsCheckbox5.Callback += SettingsCheckbox_Callback; SettingsCheckbox5.Checked = (RtSettings.ReadSetting("SSDI") == ONE); SettingsCheckbox5.Text = SETTINGTEXT5; SettingsBack2.AddView(SettingsCheckbox5); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); //Initialisation RtGraphicsLayouts RtGraphicsLayouts = new RtGraphicsLayouts(this); RtGraphicsLayouts.SetColourStatusBar(Window, RtGraphicsColours.Orange); //Root RelativeLayout AbsoluteRootLayout = new RelativeLayout(this); AbsoluteRootLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); SetContentView(AbsoluteRootLayout); //Root Layout LinearLayout RootLayout = new LinearLayout(this); RootLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); RootLayout.Orientation = Orientation.Vertical; AbsoluteRootLayout.AddView(RootLayout); //Station Selector Dialog (after screen contents, so it overlays) FromStationSearchDialog = new RtStationSearchDialog(this, this, Window); FromStationSearchDialog.StationSelected += StationSearchDialog_StationSelected; AbsoluteRootLayout.AddView(FromStationSearchDialog); ToStationSearchDialog = new RtStationSearchDialog(this, this, Window, 1); ToStationSearchDialog.StationSelected += StationSearchDialog_StationSelected; AbsoluteRootLayout.AddView(ToStationSearchDialog); //Navbar Root LinearLayout NavBarSearchBack = new LinearLayout(this); NavBarSearchBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, NAVBARHEIGHT); NavBarSearchBack.SetBackgroundColor(RtGraphicsColours.Orange); RootLayout.AddView(NavBarSearchBack); //Left Image ImageView NavbarSearchLeft = new ImageView(this); NavbarSearchLeft.LayoutParameters = RtGraphicsLayouts.LayoutParameters(100, NAVBARHEIGHT); NavbarSearchLeft.SetImageResource(Resource.Drawable.Icon_SelectRouteLeft); NavBarSearchBack.AddView(NavbarSearchLeft); //Centre LinearLayout NavBarSearchCentre = new LinearLayout(this); NavBarSearchCentre.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-200, NAVBARHEIGHT); NavBarSearchCentre.Orientation = Orientation.Vertical; NavBarSearchBack.AddView(NavBarSearchCentre); //Right Image ImageView NavbarSearchRight = new ImageView(this); NavbarSearchRight.LayoutParameters = RtGraphicsLayouts.LayoutParameters(100, NAVBARHEIGHT); NavbarSearchRight.SetImageResource(Resource.Drawable.Icon_SelectRouteRight); NavBarSearchBack.AddView(NavbarSearchRight); //Right Event NavbarSearchRight.Click += delegate { SwapFromTo(); }; //From Search Box Back LinearLayout FromSearchBack = new LinearLayout(this); FromSearchBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-200, NAVBARHEIGHT / 2); FromSearchBack.SetDpPadding(RtGraphicsLayouts, 0, 35, 0, 10); NavBarSearchCentre.AddView(FromSearchBack); //From Search Box RelativeLayout FromSearchBox = new RelativeLayout(this); FromSearchBox.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); FromSearchBox.SetDpPadding(RtGraphicsLayouts, NAVBARPADDING, 0, NAVBARPADDING, 0); FromSearchBox.SetBackgroundResource(Resource.Drawable.StyleRoundShaded); FromSearchBack.AddView(FromSearchBox); //From Search Hint FromSearchHint = new TextView(this); FromSearchHint.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); FromSearchHint.Format(RtGraphicsExt.TextFormats.Heading1); FromSearchHint.SetTextColor(RtGraphicsColours.Salmon); FromSearchHint.Gravity = GravityFlags.CenterVertical; FromSearchHint.Text = "From"; FromSearchBox.AddView(FromSearchHint); //From Search Text FromSearchText = new TextView(this); FromSearchText.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); FromSearchText.Format(RtGraphicsExt.TextFormats.Heading1); FromSearchText.Gravity = GravityFlags.CenterVertical; FromSearchBox.AddView(FromSearchText); //From Events FromSearchBox.Click += delegate { FromStationSearchDialog.ShowDialog(FromSearchText.Text); }; //To Search Box Back LinearLayout ToSearchBack = new LinearLayout(this); ToSearchBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-200, NAVBARHEIGHT / 2); ToSearchBack.SetDpPadding(RtGraphicsLayouts, 0, 10, 0, 35); NavBarSearchCentre.AddView(ToSearchBack); //To Search Box RelativeLayout ToSearchBox = new RelativeLayout(this); ToSearchBox.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); ToSearchBox.SetDpPadding(RtGraphicsLayouts, NAVBARPADDING, 0, NAVBARPADDING, 0); ToSearchBox.SetBackgroundResource(Resource.Drawable.StyleRoundShaded); ToSearchBack.AddView(ToSearchBox); //To Search Hint ToSearchHint = new TextView(this); ToSearchHint.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); ToSearchHint.Format(RtGraphicsExt.TextFormats.Heading1); ToSearchHint.SetTextColor(RtGraphicsColours.Salmon); ToSearchHint.Gravity = GravityFlags.CenterVertical; ToSearchHint.Text = "To"; ToSearchBox.AddView(ToSearchHint); //To Search Text ToSearchText = new TextView(this); ToSearchText.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); ToSearchText.Format(RtGraphicsExt.TextFormats.Heading1); ToSearchText.Gravity = GravityFlags.CenterVertical; ToSearchBox.AddView(ToSearchText); //To Events ToSearchBox.Click += delegate { ToStationSearchDialog.ShowDialog(ToSearchText.Text); }; //Screen Content Scroller ScrollView ContentScrollerRoot = new ScrollView(this); ContentScrollerRoot.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); RootLayout.AddView(ContentScrollerRoot); //Screen Content LinearLayout ContentScrollRoot = new LinearLayout(this); ContentScrollRoot.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); ContentScrollRoot.Orientation = Orientation.Vertical; ContentScrollRoot.SetDpPadding(RtGraphicsLayouts, 25, 25, 25, 25); ContentScrollerRoot.AddView(ContentScrollRoot); //Train Results Box RtTrainDeparturesView = new RtTrainDeparturesView(this, this); RtTrainDeparturesView.Callback += RtTrainDeparturesView_Callback; ContentScrollRoot.AddView(RtTrainDeparturesView); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //Initialisation RtGraphicsLayouts = new RtGraphicsLayouts(this); RtGraphicsLayouts.SetColourStatusBar(Window, RtGraphicsColours.Orange); //Root LinearLayout RootLayout = new LinearLayout(this); RootLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); RootLayout.Orientation = Orientation.Vertical; SetContentView(RootLayout); //Navbar LinearLayout NavbarLayout = new LinearLayout(this); NavbarLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, NAVBARHEIGHT); NavbarLayout.SetBackgroundColor(RtGraphicsColours.Orange); RootLayout.AddView(NavbarLayout); LinearLayout NavbarBack = new LinearLayout(this); NavbarBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(NAVBARHEIGHT, NAVBARHEIGHT); NavbarBack.SetBackgroundResource(Resource.Drawable.IconBack); NavbarBack.Click += NavbarBack_Click;; NavbarLayout.AddView(NavbarBack); TextView NavBarTitle = new TextView(this); NavBarTitle.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-140, RtGraphicsLayouts.EXPAND); NavBarTitle.SetDpPadding(RtGraphicsLayouts, NAVBARPADDING, NAVBARPADDING, NAVBARHEIGHT + NAVBARPADDING, NAVBARPADDING); NavBarTitle.Gravity = GravityFlags.Center; NavBarTitle.Format(RtGraphicsExt.TextFormats.Heading); NavBarTitle.Text = NAVBARTEXT; NavbarLayout.AddView(NavBarTitle); //Content ScrollView ContentScrollerRoot = new ScrollView(this); ContentScrollerRoot.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); RootLayout.AddView(ContentScrollerRoot); LinearLayout ContentScrollRoot = new LinearLayout(this); ContentScrollRoot.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); ContentScrollRoot.Orientation = Orientation.Vertical; ContentScrollerRoot.AddView(ContentScrollRoot); LinearLayout NavbarTitleBorder = new LinearLayout(this); NavbarTitleBorder.SetBackgroundColor(RtGraphicsColours.OrangeDim); NavbarTitleBorder.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); NavbarTitleBorder.SetDpPadding(RtGraphicsLayouts, SMALLPADDING, SMALLPADDING, SMALLPADDING, SMALLPADDING); ContentScrollRoot.AddView(NavbarTitleBorder); EditText NavBarTitleSearch = new EditText(this); NavBarTitleSearch.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); //NavBarTitle.SetDpPadding(RtGraphicsLayouts, NAVBARPADDING, NAVBARPADDING, NAVBARHEIGHT + NAVBARPADDING, NAVBARPADDING); //NavBarTitleSearch.SetBackgroundColor(RtGraphicsColours.GreyLightest); NavBarTitleSearch.Background.SetColorFilter(RtGraphicsColours.OrangeDim, PorterDuff.Mode.SrcIn); NavBarTitleSearch.SetHintTextColor(RtGraphicsColours.Orange); NavBarTitleSearch.Format(RtGraphicsExt.TextFormats.Heading); NavBarTitleSearch.SetTextColor(RtGraphicsColours.GreyLightest); NavBarTitleSearch.Hint = NAVBARTEXT; NavBarTitleSearch.AfterTextChanged += NavBarTitle_AfterTextChanged; NavbarTitleBorder.AddView(NavBarTitleSearch); ContentRoot = new LinearLayout(this); ContentRoot.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); ContentRoot.Orientation = Orientation.Vertical; ContentRoot.SetDpPadding(RtGraphicsLayouts, SMALLPADDING, SMALLPADDING, SMALLPADDING, SMALLPADDING); ContentScrollRoot.AddView(ContentRoot); }
//Creates the view private void GenerateView() { //Dialog Shaded Back _RootView = new LinearLayout(this.Context); _RootView.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); _RootView.SetDpPadding(RtGraphicsLayouts, DIALOGPADDING, DIALOGPADDING, DIALOGPADDING, DIALOGPADDING); _RootView.SetBackgroundColor(RtGraphicsColours.SemiTransparentBlack); _RootView.Visibility = ViewStates.Gone; _RootView.SetGravity(GravityFlags.Center); //Dialog Back LinearLayout DialogLayout = new LinearLayout(this.Context); DialogLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); DialogLayout.Orientation = Orientation.Vertical; DialogLayout.SetBackgroundResource(Resource.Drawable.StyleCornerBox); _RootView.AddView(DialogLayout); //Dialog Top Bar LinearLayout DialogTopBar = new LinearLayout(this.Context); DialogTopBar.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, DIALOGHORIZONTALSHEIGHT); DialogTopBar.SetDpPadding(RtGraphicsLayouts, ZERO, SMALLPADDING, ZERO, SMALLPADDING); DialogLayout.AddView(DialogTopBar); //Location Icon ImageView DialogLocation = new ImageView(this.Context); DialogLocation.LayoutParameters = RtGraphicsLayouts.LayoutParameters(ICONSWIDTH, ICONSHEIGHT); DialogLocation.SetImageResource((Option_SearchLocation) ? Resource.Drawable.Icon_Location : Resource.Drawable.Icon_LocationFaded); DialogTopBar.AddView(DialogLocation); //Navigable Icon ImageView DialogNavigatable = new ImageView(this.Context); DialogNavigatable.LayoutParameters = RtGraphicsLayouts.LayoutParameters(ICONSWIDTH, ICONSHEIGHT); DialogNavigatable.SetImageResource((Option_SearchNavigable) ? Resource.Drawable.Icon_Navigation : Resource.Drawable.Icon_NavigationFaded); DialogTopBar.AddView(DialogNavigatable); //Cancel Icon ImageView DialogCancel = new ImageView(this.Context); DialogCancel.LayoutParameters = RtGraphicsLayouts.LayoutParameters(ICONSWIDTH, ICONSHEIGHT); DialogCancel.SetImageResource(Resource.Drawable.IconCancel); DialogTopBar.AddView(DialogCancel); //Search Input SearchInput = new EditText(this.Context); SearchInput.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, DIALOGHORIZONTALSHEIGHT); SearchInput.SetDpPadding(RtGraphicsLayouts, DIALOGPADDING, SMALLPADDING, DIALOGPADDING, SMALLPADDING); SearchInput.SetBackgroundColor(RtGraphicsColours.Orange); SearchInput.Format(RtGraphicsExt.TextFormats.Heading); DialogLayout.AddView(SearchInput); //Results Scroller ScrollView ResultsScroll = new ScrollView(this.Context); DialogLayout.AddView(ResultsScroll); //Results Root LinearLayout ResultsRoot = new LinearLayout(this.Context); ResultsRoot.Orientation = Orientation.Vertical; ResultsScroll.AddView(ResultsRoot); //GPS Instance RtGPS GPS = new RtGPS((LocationManager)ContextWrapper.GetSystemService(ContextWrapper.LocationService)); //Event Handlers _RootView.Click += delegate { CloseDialog(); }; DialogCancel.Click += delegate { CloseDialog(); }; SearchInput.AfterTextChanged += delegate { DrawResults(ResultsRoot, GPS); }; DialogLocation.Click += delegate { ToggleLocationOption(DialogLocation); }; DialogNavigatable.Click += delegate { ToggleNavigableOption(DialogNavigatable); }; }
//Show Departures Method public void ShowDepartures(string FromCRS, string ToCRS) { //Show this view and hide the empty departures list. _TrainDeparturesLayout.Visibility = ViewStates.Gone; _TrainDeparturesLoading.Visibility = ViewStates.Visible; _RootLayout.Visibility = ViewStates.Visible; //Download departures data new Thread(() => { RoutePlanner.RequestStatus RequestStatus; RouteSummary[] DeparturesData = new RoutePlanner().GetRouteInfo(FromCRS, ToCRS, out RequestStatus); //On the UI thread, create result views. if (RequestStatus == RoutePlanner.RequestStatus.OK) { Activity.RunOnUiThread(() => { _TrainDeparturesLayout.RemoveAllViews(); //Draw departures list for (int i = 0; i < DeparturesData.Length; i++) { int LocalIndex = i; LinearLayout lTrainTimeBack = new LinearLayout(this.Context); lTrainTimeBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 150); lTrainTimeBack.Orientation = Orientation.Vertical; lTrainTimeBack.SetDpPadding(RtGraphicsLayouts, 2, 2, 2, 2); lTrainTimeBack.SetBackgroundResource(Resource.Drawable.StyleCornerBox); _TrainDeparturesLayout.AddView(lTrainTimeBack); LinearLayout lTrainTimeContent = new LinearLayout(this.Context); lTrainTimeContent.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 100); lTrainTimeBack.AddView(lTrainTimeContent); LinearLayout lTrainTimeContentTOCBar = new LinearLayout(this.Context); lTrainTimeContentTOCBar.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 44); lTrainTimeBack.AddView(lTrainTimeContentTOCBar); LinearLayout lTrainTimeArrival = new LinearLayout(this.Context); lTrainTimeArrival.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-550, RtGraphicsLayouts.EXPAND); lTrainTimeArrival.Orientation = Orientation.Vertical; lTrainTimeArrival.SetDpPadding(RtGraphicsLayouts, 0, 50, 0, 0); lTrainTimeContent.AddView(lTrainTimeArrival); LinearLayout lTrainTimeDuration = new LinearLayout(this.Context); lTrainTimeDuration.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-400, RtGraphicsLayouts.EXPAND); lTrainTimeContent.AddView(lTrainTimeDuration); LinearLayout lTrainTimeDeparture = new LinearLayout(this.Context); lTrainTimeDeparture.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-550, RtGraphicsLayouts.EXPAND); lTrainTimeDeparture.Orientation = Orientation.Vertical; lTrainTimeDeparture.SetDpPadding(RtGraphicsLayouts, 0, 50, 0, 0); lTrainTimeContent.AddView(lTrainTimeDeparture); TextView DepartureTime = new TextView(this.Context); DepartureTime.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); DepartureTime.TextSize = 16; DepartureTime.Text = DeparturesData[i].DepartureTime; DepartureTime.Gravity = GravityFlags.Center; lTrainTimeDeparture.AddView(DepartureTime); TextView ArrivalTime = new TextView(this.Context); ArrivalTime.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); ArrivalTime.TextSize = 16; ArrivalTime.Text = DeparturesData[i].ArrivalTime; ArrivalTime.Gravity = GravityFlags.Center; lTrainTimeArrival.AddView(ArrivalTime); ////////////////////////////////////////////////// // // // // // // // // // // // // ////////////////////////////////////////////////// // Textview Stuff textview // Departure Time Arrival Time LinearLayout lVert = new LinearLayout(this.Context); lVert.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); lVert.SetDpPadding(RtGraphicsLayouts, 25, 0, 0, 0); lVert.Orientation = Orientation.Vertical; lTrainTimeContent.AddView(lVert); LinearLayout lHori1 = new LinearLayout(this.Context); lVert.AddView(lHori1); ImageView DepartureIcon = new ImageView(this.Context); DepartureIcon.LayoutParameters = RtGraphicsLayouts.LayoutParameters(50, 50); DepartureIcon.SetImageResource(Resource.Drawable.Icon_DeparturesFrom); lHori1.AddView(DepartureIcon); TextView JourneyTime = new TextView(this.Context); JourneyTime.TextSize = 16; //JourneyTime.Text = DeparturesData[i].durationHours + "h " + ((DeparturesData[i].durationMinutes.Length == 1) ? "0" + DeparturesData[i].durationMinutes : DeparturesData[i].durationMinutes) + "m"; JourneyTime.SetTextColor(RtGraphicsColours.GreyLightest); lHori1.AddView(JourneyTime); ImageView ArrivalIcon = new ImageView(this.Context); ArrivalIcon.LayoutParameters = RtGraphicsLayouts.LayoutParameters(50, 50); ArrivalIcon.SetImageResource(Resource.Drawable.Icon_DeparturesTo); lHori1.AddView(ArrivalIcon); LinearLayout lHori = new LinearLayout(this.Context); lVert.AddView(lHori); TextView tPlannedArrival = new TextView(this.Context); tPlannedArrival.SetTextColor(Android.Graphics.Color.Gray); //tPlannedArrival.Text = DeparturesData[i].changes + " Changes"; lHori.AddView(tPlannedArrival); TextView tActualArrival = new TextView(this.Context); tActualArrival.SetTextColor(Android.Graphics.Color.LightGray); tActualArrival.SetDpPadding(RtGraphicsLayouts, 25, 0, 0, 0); //tActualArrival.Text = DeparturesData[i].statusMessage; lHori.AddView(tActualArrival); if (tActualArrival.Text == "on time") { tActualArrival.Text = "On Time"; tActualArrival.SetTextColor(Android.Graphics.Color.DarkGreen); } else if (tActualArrival.Text == "Ca:nc") { tActualArrival.SetTextColor(Android.Graphics.Color.DarkRed); } else if (tActualArrival.Text == "null") { tActualArrival.Visibility = ViewStates.Gone; } LinearLayout lSpacer = new LinearLayout(this.Context); lSpacer.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 20); _TrainDeparturesLayout.AddView(lSpacer); } //lTrainTimeBack.Click += delegate { Callback?.Invoke(DeparturesData[LocalIndex]); }; //Once all drawn, show departures list _TrainDeparturesLayout.Visibility = ViewStates.Visible; _TrainDeparturesLoading.Visibility = ViewStates.Gone; }); } else if (RequestStatus == RoutePlanner.RequestStatus.ERROR) { Activity.RunOnUiThread(() => { _TrainDeparturesLayout.RemoveAllViews(); TextView FromSearchEmpty = new TextView(this.Context); FromSearchEmpty.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 400); FromSearchEmpty.Gravity = GravityFlags.Center; FromSearchEmpty.Format(RtGraphicsExt.TextFormats.Paragraph1); FromSearchEmpty.Text = "No Connection."; _TrainDeparturesLayout.AddView(FromSearchEmpty); _TrainDeparturesLayout.Visibility = ViewStates.Visible; _TrainDeparturesLoading.Visibility = ViewStates.Gone; }); } else if (RequestStatus == RoutePlanner.RequestStatus.EMPTY) { Activity.RunOnUiThread(() => { _TrainDeparturesLayout.RemoveAllViews(); TextView FromSearchEmpty = new TextView(this.Context); FromSearchEmpty.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 400); FromSearchEmpty.Gravity = GravityFlags.Center; FromSearchEmpty.Format(RtGraphicsExt.TextFormats.Paragraph1); FromSearchEmpty.Text = "No Departures."; _TrainDeparturesLayout.AddView(FromSearchEmpty); _TrainDeparturesLayout.Visibility = ViewStates.Visible; _TrainDeparturesLoading.Visibility = ViewStates.Gone; }); } }).Start(); }
//Show Departures Method public void ShowDepartures(string FromCRS, string ToCRS) { //Show this view and hide the empty departures list. _TrainDeparturesLayout.Visibility = ViewStates.Gone; _TrainDeparturesLoading.Visibility = ViewStates.Visible; _RootLayout.Visibility = ViewStates.Visible; //Now on a new thread download the data. new Thread(() => { //Download departures data RtTrain[] DeparturesData = RtTrainData.GetLiveDepartures(FromCRS, ToCRS); //On the UI thread, create result views. Activity.RunOnUiThread(() => { _TrainDeparturesLayout.RemoveAllViews(); if (DeparturesData.Length == 0) { //If no departures TextView FromSearchEmpty = new TextView(this.Context); FromSearchEmpty.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); FromSearchEmpty.Gravity = GravityFlags.Center; FromSearchEmpty.Format(RtGraphicsExt.TextFormats.Paragraph1); FromSearchEmpty.Text = "No Trains Currently."; _TrainDeparturesLayout.AddView(FromSearchEmpty); } else { //Draw departures list for (int i = 0; i < DeparturesData.Length; i++) { int LocalIndex = i; LinearLayout lTrainTimeBack = new LinearLayout(this.Context); lTrainTimeBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 150); lTrainTimeBack.SetDpPadding(RtGraphicsLayouts, 25, 25, 25, 25); lTrainTimeBack.SetBackgroundResource(Resource.Drawable.StyleCornerBox); _TrainDeparturesLayout.AddView(lTrainTimeBack); ImageView iTrainTimeIcon = new ImageView(this.Context); iTrainTimeIcon.LayoutParameters = RtGraphicsLayouts.LayoutParameters(100, 100); if (DeparturesData[i].tocName == "Virgin Trains") { iTrainTimeIcon.SetImageResource(Resource.Drawable.Icon_VT); } else if (DeparturesData[i].tocName == "TransPennine Express") { iTrainTimeIcon.SetImageResource(Resource.Drawable.Icon_TP); } else if (DeparturesData[i].tocName == "Northern") { iTrainTimeIcon.SetImageResource(Resource.Drawable.Icon_NR); } //else if (sTOC == "SR") // iTrainTimeIcon.SetImageResource(Resource.Drawable.Icon_SR); else { iTrainTimeIcon.SetImageResource(Resource.Drawable.Icon_UNKNOWN); } lTrainTimeBack.AddView(iTrainTimeIcon); LinearLayout lVert = new LinearLayout(this.Context); lVert.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-(100 + 25 + 25 + 25 + 25), 150); lVert.SetDpPadding(RtGraphicsLayouts, 25, 0, 0, 0); lVert.Orientation = Orientation.Vertical; lTrainTimeBack.AddView(lVert); LinearLayout lHori1 = new LinearLayout(this.Context); lVert.AddView(lHori1); TextView DepartureTime = new TextView(this.Context); DepartureTime.TextSize = 16; DepartureTime.Text = DeparturesData[i].departureTime; DepartureTime.SetDpPadding(RtGraphicsLayouts, 0, 0, -680, 0); lHori1.AddView(DepartureTime); ImageView DepartureIcon = new ImageView(this.Context); DepartureIcon.LayoutParameters = RtGraphicsLayouts.LayoutParameters(50, 50); DepartureIcon.SetImageResource(Resource.Drawable.Icon_DeparturesFrom); lHori1.AddView(DepartureIcon); TextView JourneyTime = new TextView(this.Context); JourneyTime.TextSize = 16; JourneyTime.Text = DeparturesData[i].durationHours + "h " + ((DeparturesData[i].durationMinutes.Length == 1) ? "0" + DeparturesData[i].durationMinutes : DeparturesData[i].durationMinutes) + "m"; lHori1.AddView(JourneyTime); ImageView ArrivalIcon = new ImageView(this.Context); ArrivalIcon.LayoutParameters = RtGraphicsLayouts.LayoutParameters(50, 50); ArrivalIcon.SetImageResource(Resource.Drawable.Icon_DeparturesTo); lHori1.AddView(ArrivalIcon); TextView ArrivalTime = new TextView(this.Context); ArrivalTime.TextSize = 16; ArrivalTime.Text = DeparturesData[i].arrivalTime; ArrivalTime.SetDpPadding(RtGraphicsLayouts, -680, 0, 0, 0); lHori1.AddView(ArrivalTime); LinearLayout lHori = new LinearLayout(this.Context); lVert.AddView(lHori); TextView tPlannedArrival = new TextView(this.Context); tPlannedArrival.SetTextColor(Android.Graphics.Color.Gray); tPlannedArrival.Text = DeparturesData[i].changes + " Changes"; lHori.AddView(tPlannedArrival); TextView tActualArrival = new TextView(this.Context); tActualArrival.SetTextColor(Android.Graphics.Color.LightGray); tActualArrival.SetDpPadding(RtGraphicsLayouts, 25, 0, 0, 0); tActualArrival.Text = DeparturesData[i].statusMessage; lHori.AddView(tActualArrival); if (tActualArrival.Text == "on time") { tActualArrival.Text = "On Time"; tActualArrival.SetTextColor(Android.Graphics.Color.DarkGreen); } else if (tActualArrival.Text == "Ca:nc") { tActualArrival.SetTextColor(Android.Graphics.Color.DarkRed); } else if (tActualArrival.Text == "null") { tActualArrival.Visibility = ViewStates.Gone; } LinearLayout lSpacer = new LinearLayout(this.Context); lSpacer.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 10); _TrainDeparturesLayout.AddView(lSpacer); lTrainTimeBack.Click += delegate { Callback?.Invoke(DeparturesData[LocalIndex]); }; } } //Once all drawn, show departures list _TrainDeparturesLayout.Visibility = ViewStates.Visible; _TrainDeparturesLoading.Visibility = ViewStates.Gone; }); }).Start(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //Initialisation RtGraphicsLayouts RtGraphicsLayouts = new RtGraphicsLayouts(this); RtGraphicsLayouts.SetColourStatusBar(Window, RtGraphicsColours.Orange); //Root LinearLayout RootLayout = new LinearLayout(this); RootLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); RootLayout.Orientation = Orientation.Vertical; SetContentView(RootLayout); //Navbar LinearLayout NavbarLayout = new LinearLayout(this); NavbarLayout.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, NAVBARHEIGHT); NavbarLayout.SetBackgroundColor(RtGraphicsColours.Orange); RootLayout.AddView(NavbarLayout); TextView NavBarTitle = new TextView(this); NavBarTitle.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-140, RtGraphicsLayouts.EXPAND); NavBarTitle.SetDpPadding(RtGraphicsLayouts, NAVBARHEIGHT + NAVBARPADDING, NAVBARPADDING, NAVBARPADDING, NAVBARPADDING); NavBarTitle.Gravity = GravityFlags.Center; NavBarTitle.Format(RtGraphicsExt.TextFormats.Heading); NavBarTitle.Text = NAVBARTEXT; NavbarLayout.AddView(NavBarTitle); LinearLayout NavbarOptions = new LinearLayout(this); NavbarOptions.LayoutParameters = RtGraphicsLayouts.LayoutParameters(NAVBARHEIGHT, NAVBARHEIGHT); NavbarOptions.SetBackgroundResource(Resource.Drawable.IconOptions); NavbarOptions.Click += NavbarOptions_Click; NavbarLayout.AddView(NavbarOptions); //Content ScrollView ContentScrollerRoot = new ScrollView(this); ContentScrollerRoot.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); RootLayout.AddView(ContentScrollerRoot); LinearLayout ContentScrollRoot = new LinearLayout(this); ContentScrollRoot.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); ContentScrollRoot.Orientation = Orientation.Vertical; ContentScrollRoot.SetDpPadding(RtGraphicsLayouts, SMALLPADDING, ZERO, SMALLPADDING, SMALLPADDING); ContentScrollerRoot.AddView(ContentScrollRoot); //Add Route Button LinearLayout AddRouteSpacer = new LinearLayout(this); AddRouteSpacer.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, ADDROUTESPACERHEIGHT); AddRouteSpacer.SetGravity(GravityFlags.Center); ContentScrollRoot.AddView(AddRouteSpacer); LinearLayout AddRouteButton = new LinearLayout(this); AddRouteButton.LayoutParameters = RtGraphicsLayouts.LayoutParameters(ADDROUTEBTNNWIDTH, ADDROUTEBTNHEIGHT); AddRouteButton.Orientation = Orientation.Vertical; AddRouteButton.Click += AddRouteButton_Click; AddRouteSpacer.AddView(AddRouteButton); LinearLayout AddRouteButtonTop = new LinearLayout(this); AddRouteButtonTop.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, BIGPADDING); AddRouteButtonTop.SetBackgroundResource(Resource.Drawable.StyleTicketTop); AddRouteButton.AddView(AddRouteButtonTop); LinearLayout AddRouteButtonMiddle = new LinearLayout(this); AddRouteButtonMiddle.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, NAVBARHEIGHT); AddRouteButtonMiddle.SetBackgroundResource(Resource.Drawable.StyleTicketMiddle); AddRouteButtonMiddle.SetGravity(GravityFlags.Center); AddRouteButton.AddView(AddRouteButtonMiddle); LinearLayout AddRouteButtonBottom = new LinearLayout(this); AddRouteButtonBottom.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, BIGPADDING); AddRouteButtonBottom.SetBackgroundResource(Resource.Drawable.StyleTicketBottom); AddRouteButton.AddView(AddRouteButtonBottom); TextView AddRouteText = new TextView(this); AddRouteText.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.CONTAIN, RtGraphicsLayouts.CONTAIN); AddRouteText.Format(RtGraphicsExt.TextFormats.Heading2); AddRouteText.Text = ADDROUTTBNTEXT; AddRouteButtonMiddle.AddView(AddRouteText); //No Roots Panel LinearLayout NoRootsBack = new LinearLayout(this); NoRootsBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN); NoRootsBack.SetBackgroundResource(Resource.Drawable.StyleCornerBox); NoRootsBack.SetDpPadding(RtGraphicsLayouts, BIGPADDING, BIGPADDING, BIGPADDING, BIGPADDING); ContentScrollRoot.AddView(NoRootsBack); TextView NoRoutesText = new TextView(this); NoRoutesText.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-(NOROUTESICONSIZE + BIGPADDING + BIGPADDING + SMALLPADDING + SMALLPADDING), RtGraphicsLayouts.CONTAIN); NoRoutesText.Format(RtGraphicsExt.TextFormats.Paragraph); NoRoutesText.Text = NOROUTESTEXT; NoRootsBack.AddView(NoRoutesText); ImageView NoRoutesArt = new ImageView(this); NoRoutesArt.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND); NoRoutesArt.SetImageResource(Resource.Drawable.IconNoRoutes); NoRootsBack.AddView(NoRoutesArt); }