Exemple #1
0
        private void SetUpBottomSheet(int height)

        {
            // Set up bottom sheet
            BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.From(bottomSheet);

            bottomSheetBehavior.PeekHeight = height;
            bottomSheetBehavior.SetBottomSheetCallback(new BSCallBack(bgFabMenu));

            // Fill sports list
            List <string> sportList = new List <string>();

            foreach (var sport in RequestSender.GetSports())
            {
                sportList.Add(sport.Name);
            }

            // Sport spinner
            var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, sportList);

            sportSpinner.Adapter = adapter;

            // Date picker
            searchDates.Focusable = false;
            searchDates.Click    += (sender, e) => {
                DateTime         today  = DateTime.Today;
                DatePickerDialog dialog = new DatePickerDialog(this, OnStartDateSet, today.Year, today.Month, today.Day);
                dialog.DatePicker.MinDate = today.Millisecond;
                dialog.Show();
            };

            // Load events
            List <WebApi.Classes.Event> events = RequestSender.GetBriefEvents();

            eventList.HasFixedSize = true;
            eventListLayout        = new LinearLayoutManager(this);
            eventList.SetLayoutManager(eventListLayout);
            eventListAdapter = new PulloutEventAdapter(events);
            eventList.SetAdapter(eventListAdapter);
        }
Exemple #2
0
        public static void ReloadMapEventMarkers()
        {
            // Clear markers
            foreach (var marker in eventMarkers)
            {
                marker.Remove();
            }
            eventMarkers.Clear();

            // Get events from API
            var events = RequestSender.GetBriefEvents();

            // Create markers
            foreach (var @event in events)
            {
                MarkerOptions marker = new MarkerOptions();
                marker.SetPosition(new LatLng(@event.Latitude, @event.Longitude));
                marker.SetTitle(@event.Name);
                marker.SetIcon(BitmapDescriptorFactory.FromBitmap(eventPin));
                var mark = map.AddMarker(marker);
                eventMarkers.Add(mark);
            }
        }
Exemple #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.event_tabs);


            addEventButton = FindViewById <Button>(Resource.Id.addEventButton);
            eventListView  = FindViewById <RecyclerView>(Resource.Id.eventEditView);
            draftListView  = FindViewById <RecyclerView>(Resource.Id.draftView);

            //Navigation bar
            BottomNavigationView navigation = FindViewById <BottomNavigationView>(Resource.Id.navigation);

            navigation.LayoutParameters.Width = ViewGroup.LayoutParams.FillParent;
            navigation.SetOnNavigationItemSelectedListener(this);

            List <Event> fullEventList = RequestSender.GetBriefEvents();
            var          accounts      = RequestSender.GetAccounts();

            if (RequestSender.ThisAccount().Can((uint)Permissions.EDIT_OTHER_EVENTS))
            {
                eventList = fullEventList;
            }
            else
            {
                eventList = fullEventList.Where(item => item.Author == RequestSender.GetLoggedInAccountId()).ToList();
            }

            eventListView.HasFixedSize = true;
            eventListView.AddItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.Vertical));
            eventListLayout = new LinearLayoutManager(this);
            eventListView.SetLayoutManager(eventListLayout);
            eventListAdapter = new EventListAdapter(eventList);
            eventListView.SetAdapter(eventListAdapter);
        }