Exemplo n.º 1
0
        private NavigationLayoutManager initializeSlidingPanel()
        {
            //Binds a variable for the recycler view, layout manager, and slideUp panel
            var recyclerView  = FindViewById <RecyclerView>(Resource.Id.slidingRecycler);
            var layoutManager = new NavigationLayoutManager(this);
            var slideUpLayout = FindViewById <SlidingUpPanelLayout>(Resource.Id.sliding_layout);

            //Sets the layout manager to not allow scrolling so it doesn't interfere with pulling up the sliding layout
            layoutManager.scrollable = false;

            //Creates a blank new adapter
            var adapter = new RouteSummaryRowAdapter();

            //Sets the layout manager and adapter for the recyclerView
            recyclerView.SetLayoutManager(layoutManager);
            recyclerView.SetAdapter(adapter);

            //Returns the layoutManager produced (not really used)
            return(layoutManager);
        }
Exemplo n.º 2
0
        private void bindStartSelectButtonDelegates(Button start, Button select,
                                                    AutoCompleteTextView originBox, AutoCompleteTextView destinationBox)
        {
            select.Click += async delegate
            {
                //Gets the coordinates for the origin and destination points
                double[] originCoords      = mbi.ConvertAddressToGpsCoordinates(originBox.Text, map.MyLocation.Latitude, map.MyLocation.Longitude);
                double[] destinationCoords = mbi.ConvertAddressToGpsCoordinates(destinationBox.Text, map.MyLocation.Latitude, map.MyLocation.Longitude)
                ;
                //Clears old routes
                Tools.clearRoutes(map);

                //Asks Otp for response based on the origin and destination
                otpResponse = await OtpAPI.Query(originCoords, destinationCoords);

                //Plots the first two routes in the response
                Tools.plotRoute(otpResponse, map, 2, colors);

                //Sets the camera to show the overall route
                Tools.setRoutingCamera(originCoords, destinationCoords, map);

                //Parses the itinerary, uses it to create an adapter for a recycler view
                Itinerary itin    = OtpAPI.ParseItinerary(otpResponse["plan"]["itineraries"][0]);
                var       adapter = new RouteSummaryRowAdapter(itin);

                //Binds the adapter to the recyclerView
                var rv = FindViewById <RecyclerView>(Resource.Id.slidingRecycler);
                rv.SetAdapter(adapter);

                //Sets the start button to be fully opaque and clickable
                start.Alpha     = 1;
                start.Clickable = true;

                //Slides up the bottom panel to show the route summary
                FindViewById <SlidingUpPanelLayout>(Resource.Id.sliding_layout).SetPanelState(SlidingUpPanelLayout.PanelState.Expanded);
            };
            start.Click += delegate {
                //Reconfigures the ui for the navigation mode, now that the user wants to start navigation
                reconfigureUiForNavigation(0);
            };
        }