コード例 #1
0
        //Returns text view error mesage
        public TextView DrawErrorMessage(string Message)
        {
            TextView ErrorMessage = new TextView(this.Context);

            ErrorMessage.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, DIALOGHORIZONTALSHEIGHT);
            ErrorMessage.Format(RtGraphicsExt.TextFormats.Paragraph1);
            ErrorMessage.Text    = Message;
            ErrorMessage.Gravity = GravityFlags.Center;
            return(ErrorMessage);
        }
コード例 #2
0
        private void DrawSearchResults(LinearLayout Parent, EditText FromSearchInput, LinearLayout FromSearchBack, LinearLayout FromStationBack, TextView FromStationText, TextView FromStationNoNav, string Search, StationSelectionBoxType StationSelectionBoxType, StationFacilitiesView StationFacilitiesView)
        {
            RtStationData[] StationResults = (Search.Length == 3 && Search.ToUpper() == Search) ? RtStations.SearchByCRS(Search) : RtStations.SearchByName(Search);

            Parent.RemoveAllViews();
            for (int i = 0; i < StationResults.Length; i++)
            {
                int          ilocal     = i;
                LinearLayout ResultBack = new LinearLayout(this);
                ResultBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 100);
                ResultBack.SetDpPadding(RtGraphicsLayouts, SMALLPADDING, SMALLPADDING, SMALLPADDING, SMALLPADDING);
                ResultBack.SetGravity(GravityFlags.CenterVertical);
                Parent.AddView(ResultBack);

                TextView tResult = new TextView(this);
                tResult.Format(RtGraphicsExt.TextFormats.Paragraph);
                tResult.Text = StationResults[i].Code + " - " + StationResults[i].StationName;
                ResultBack.AddView(tResult);

                ResultBack.Click += delegate
                {
                    FromStationBack.Visibility = ViewStates.Visible;
                    FromStationText.Text       = tResult.Text;
                    FromSearchBack.Visibility  = ViewStates.Gone;
                    HideKeyboard(FromSearchInput);

                    if (StationResults[ilocal].Code == "LAN" || StationResults[ilocal].Code == "PRE")
                    {
                        FromStationNoNav.Visibility = ViewStates.Gone;
                        StationFacilitiesView.Redraw(StationResults[ilocal].Code, ContentScrollerRoot);
                    }
                    else
                    {
                        FromStationNoNav.Visibility = ViewStates.Visible;
                    }

                    if (StationSelectionBoxType == StationSelectionBoxType.From)
                    {
                        FromStationCode = StationResults[ilocal].Code;
                        FromStationname = StationResults[ilocal].StationName;
                    }
                    else
                    {
                        ToStationCode = StationResults[ilocal].Code;
                        ToStationname = StationResults[ilocal].StationName;
                    }

                    StationSelectionChanged();
                };
            }
        }
コード例 #3
0
        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);
                }
            }
        }
コード例 #4
0
        public RtCheckboxView(Context Context)
        {
            this.Context = Context;

            RtGraphicsLayouts = new RtGraphicsLayouts(Context);

            CheckboxBack = new LinearLayout(Context);
            CheckboxBack.SetDpPadding(RtGraphicsLayouts, 0, SMALLPADDING, 0, SMALLPADDING);
            CheckboxBack.Click += CheckboxBack_Click;

            LeftSide             = new LinearLayout(Context);
            LeftSide.Orientation = Orientation.Vertical;

            TextView = new TextView(Context);
            TextView.Format(RtGraphicsExt.TextFormats.Paragraph);

            DescriptionView = new TextView(Context);
            DescriptionView.Format(RtGraphicsExt.TextFormats.Paragraph1);
            DescriptionView.Visibility = ViewStates.Gone;

            Checkbox = new LinearLayout(Context);
            Checkbox.SetBackgroundResource(Resource.Drawable.IconCheckbox);
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        private LinearLayout GenerateStationSelectionBox(StationSelectionBoxType StationSelectionBoxType)
        {
            //From Back
            LinearLayout FromBack = new LinearLayout(this);

            FromBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 400);
            FromBack.Orientation      = Orientation.Vertical;
            FromBack.SetBackgroundResource(Resource.Drawable.StyleCornerBox);
            //FromBack.SetDpPadding(RtGraphicsLayouts, BIGPADDING, BIGPADDING, BIGPADDING, BIGPADDING);

            //From Station
            LinearLayout FromStationBack = new LinearLayout(this);

            FromStationBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND);
            FromStationBack.Orientation      = Orientation.Vertical;
            FromStationBack.Visibility       = ViewStates.Gone;
            FromBack.AddView(FromStationBack);

            LinearLayout FromStationBar = new LinearLayout(this);

            FromStationBar.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 100);
            FromStationBar.SetDpPadding(RtGraphicsLayouts, 10, 10, 10, 10);
            FromStationBack.AddView(FromStationBar);

            TextView FromStationText = new TextView(this);

            FromStationText.LayoutParameters = RtGraphicsLayouts.LayoutParameters(-(10 + 10 + SMALLPADDING + SMALLPADDING + 80), RtGraphicsLayouts.EXPAND);
            FromStationText.Format(RtGraphicsExt.TextFormats.Paragraph2);
            FromStationText.SetDpPadding(RtGraphicsLayouts, 25, 0, 0, 0);
            FromStationText.Gravity = GravityFlags.CenterVertical;
            FromStationText.Text    = "Not Set";
            FromStationBar.AddView(FromStationText);

            ImageView FromStationIcon = new ImageView(this);

            FromStationIcon.LayoutParameters = RtGraphicsLayouts.LayoutParameters(80, 80);
            FromStationIcon.SetImageResource(Resource.Drawable.IconCancel);
            FromStationBar.AddView(FromStationIcon);

            LinearLayout FromStationBarSeperator = new LinearLayout(this);

            FromStationBarSeperator.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 2);
            FromStationBarSeperator.SetBackgroundColor(RtGraphicsColours.GreyLightest);
            FromStationBack.AddView(FromStationBarSeperator);

            TextView FromStationNoNav = new TextView(this);

            FromStationNoNav.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND);
            FromStationNoNav.Gravity          = GravityFlags.Center;
            FromStationNoNav.Format(RtGraphicsExt.TextFormats.Paragraph1);
            FromStationNoNav.Text = "This station doesn't support navigation.";
            FromStationBack.AddView(FromStationNoNav);

            StationFacilitiesView StationFacilitiesView = new StationFacilitiesView(this);

            StationFacilitiesView.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND);
            FromStationBack.AddView(StationFacilitiesView);

            //From Search
            LinearLayout FromSearchBack = new LinearLayout(this);

            FromSearchBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND);
            FromSearchBack.Orientation      = Orientation.Vertical;
            FromBack.AddView(FromSearchBack);

            RelativeLayout FromSearchBar = new RelativeLayout(this);

            FromSearchBar.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 100);
            FromSearchBar.SetDpPadding(RtGraphicsLayouts, 10, 10, 10, 10);
            FromSearchBack.AddView(FromSearchBar);

            ImageView FromSearchbarIcon = new ImageView(this);

            FromSearchbarIcon.LayoutParameters = RtGraphicsLayouts.LayoutParameters(80, 80);
            FromSearchbarIcon.SetImageResource(Resource.Drawable.IconSearch);
            FromSearchBar.AddView(FromSearchbarIcon);

            EditText FromSearchBox = new EditText(this);

            FromSearchBox.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND);
            FromSearchBox.SetDpPadding(RtGraphicsLayouts, 80 + SMALLPADDING, 0, 0, 0);
            FromSearchBox.Background.SetColorFilter(Android.Graphics.Color.White, Android.Graphics.PorterDuff.Mode.SrcIn);
            FromSearchBox.Format(RtGraphicsExt.TextFormats.Paragraph2);
            FromSearchBox.Hint = (StationSelectionBoxType == StationSelectionBoxType.From) ? "From" : "To";
            FromSearchBar.AddView(FromSearchBox);

            LinearLayout FromSearchBarSeperator = new LinearLayout(this);

            FromSearchBarSeperator.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, 2);
            FromSearchBarSeperator.SetBackgroundColor(RtGraphicsColours.GreyLightest);
            FromSearchBack.AddView(FromSearchBarSeperator);

            TextView FromSearchEmpty = new TextView(this);

            FromSearchEmpty.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.EXPAND);
            FromSearchEmpty.Gravity          = GravityFlags.Center;
            FromSearchEmpty.Format(RtGraphicsExt.TextFormats.Paragraph1);
            FromSearchEmpty.Text = "Search above for a station.";
            FromSearchBack.AddView(FromSearchEmpty);

            ScrollView FromSearchResultsScroll = new ScrollView(this);

            FromSearchResultsScroll.Visibility = ViewStates.Gone;
            FromSearchBack.AddView(FromSearchResultsScroll);

            LinearLayout FromSearchResultsBack = new LinearLayout(this);

            FromSearchResultsBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN);
            FromSearchResultsBack.Orientation      = Orientation.Vertical;
            FromSearchResultsScroll.AddView(FromSearchResultsBack);

            //Event Handlers
            FromStationIcon.Click += delegate
            {
                FromStationBack.Visibility = ViewStates.Gone;
                FromSearchBack.Visibility  = ViewStates.Visible;

                if (StationSelectionBoxType == StationSelectionBoxType.From)
                {
                    FromStationCode = "";
                    FromStationname = "";
                }
                else
                {
                    ToStationCode = "";
                    ToStationname = "";
                }

                StationSelectionChanged();
            };
            FromSearchBox.AfterTextChanged += delegate
            {
                if (FromSearchBox.Length() > 1)
                {
                    DrawSearchResults(FromSearchResultsBack, FromSearchBox, FromSearchBack, FromStationBack, FromStationText, FromStationNoNav, FromSearchBox.Text, StationSelectionBoxType, StationFacilitiesView); FromSearchResultsScroll.Visibility = ViewStates.Visible; FromSearchEmpty.Visibility = ViewStates.Gone;
                }
                else
                {
                    FromSearchResultsScroll.Visibility = ViewStates.Gone;
                    FromSearchEmpty.Visibility         = ViewStates.Visible;
                }

                if (StationSelectionBoxType == StationSelectionBoxType.From)
                {
                    ContentScrollerRoot.SmoothScrollTo(0, 0);
                }
                else
                {
                    ContentScrollerRoot.SmoothScrollTo(0, 1000000);
                }
            };

            return(FromBack);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        //Draw results
        private void DrawResults(LinearLayout ResultsRoot, RtGPS GPS)
        {
            //If GPS sending position
            if ((GPS.Ready && Option_SearchLocation) || !Option_SearchLocation)
            {
                //Search stations
                RtStationData[] data = new RtStations().SearchStations(SearchInput.Text, MAXSEARCHRESULTS, (Option_SearchLocation) ? GPS : null, Option_SearchNavigable);

                //Clear Results View
                ResultsRoot.RemoveAllViews();

                //Loop through stations data
                for (int i = 0; i < data.Length; i++)
                {
                    //Create a local copy of variable for click event
                    RtStationData localdat = data[i];

                    //Result Back
                    LinearLayout ResultBack = new LinearLayout(this.Context);
                    ResultBack.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, DIALOGRESULTHEIGHT);
                    ResultBack.SetDpPadding(RtGraphicsLayouts, SMALLPADDING, SMALLPADDING, SMALLPADDING, SMALLPADDING);
                    ResultBack.SetGravity(GravityFlags.CenterVertical);
                    ResultsRoot.AddView(ResultBack);

                    //Result Station Name
                    TextView ResultStationName = new TextView(this.Context);
                    ResultStationName.Format(RtGraphicsExt.TextFormats.Paragraph);
                    ResultStationName.Text = data[i].StationName;
                    ResultBack.AddView(ResultStationName);

                    //Result Station CRS
                    TextView ResultCRS = new TextView(this.Context);
                    ResultCRS.LayoutParameters = RtGraphicsLayouts.LayoutParameters(RtGraphicsLayouts.EXPAND, RtGraphicsLayouts.CONTAIN);
                    ResultCRS.SetDpPadding(RtGraphicsLayouts, ZERO, ZERO, SMALLPADDING, ZERO);
                    ResultCRS.Format(RtGraphicsExt.TextFormats.Paragraph1);
                    ResultCRS.Text    = data[i].Code;
                    ResultCRS.Gravity = GravityFlags.Right;
                    ResultBack.AddView(ResultCRS);

                    //Result Back Event
                    ResultBack.Click += delegate
                    {
                        //If callback isn't null, invoke it, causing sleection to be returned and dialog hidden.
                        StationSelected?.Invoke(DialogID, localdat);
                        CloseDialog();
                    };
                }

                //If theres no stations
                if (data.Length == ZERO)
                {
                    ResultsRoot.RemoveAllViews();
                    ResultsRoot.AddView(DrawErrorMessage(ERROR_NOSTATIONSFOUND));
                    GPS = new RtGPS((LocationManager)ContextWrapper.GetSystemService(ContextWrapper.LocationService));
                }
            }
            else if (GPS.NoGPS)
            {
                //If no GPS
                ResultsRoot.RemoveAllViews();
                ResultsRoot.AddView(DrawErrorMessage(ERROR_GPSTURNEDOFF));
                GPS = new RtGPS((LocationManager)ContextWrapper.GetSystemService(ContextWrapper.LocationService));
            }
            else
            {
                //If GPS not ready
                ResultsRoot.RemoveAllViews();
                ResultsRoot.AddView(DrawErrorMessage(ERROR_GPSLOADING));
            }
        }
コード例 #11
0
        //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();
        }
コード例 #12
0
        //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();
        }
コード例 #13
0
        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);
        }