public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            var view = inflater.Inflate(Resource.Layout.StopFavoritFragment, container, false);

            _favoritesViewModel = Stops.Setup.IoC.Container.Get <Core.ViewModels.FavoritesViewModel>();
            _favoritesViewModel.Load();

            _searchFragment = (SearchFragment)ChildFragmentManager.FindFragmentById(stops.Resource.Id.stopfavoritfragmentfrom);

            var mainMapFragmentButtonSearch = view.FindViewById <Button>(Resource.Id.mainMapFragmentButtonSearch);

            mainMapFragmentButtonSearch.Click += (sender, e) => {
                HandleSearchClicked();
            };

            _searchFragment.Init(null, "Sök på hållplats", false, false);
            _searchFragment.Events.OnEvent += (object source, EventArgs e) => {
                var evt = (EventClassArgs)e;

                //if (evt.Name == "OnQueryTextSubmit")
                //{
                //    HandleSearchClicked();
                //}
            };

            return(view);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            var view = inflater.Inflate(Resource.Layout.StopsFavoritFragment, container, false);

            _favoritesViewModel = Stops.Setup.IoC.Container.Get <Core.ViewModels.FavoritesViewModel>();
            _favoritesViewModel.Load();


            _searchFromFragment = (SearchFragment)ChildFragmentManager.FindFragmentById(stops.Resource.Id.stopsfavoritfragmentfrom);
            _searchToFragment   = (SearchFragment)ChildFragmentManager.FindFragmentById(stops.Resource.Id.stopsfavoritfragmentto);
            _searchFromFragment.Init(null, "Sök från hållplats", false, false);
            _searchToFragment.Init(null, "Sök till hållplats", false, false);


            var mainMapFragmentButtonSearch = view.FindViewById <Button>(Resource.Id.mainMapFragmentButtonSearch);

            mainMapFragmentButtonSearch.Click += (sender, e) => {
                HandleSearchClicked();
            };

            return(view);
        }
コード例 #3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.NotificationCard, container, false);

            _favoritesViewModel = Stops.Setup.IoC.Container.Get <Core.ViewModels.FavoritesViewModel>();
            _favoritesViewModel.Load();


            Clans.Fab.FloatingActionMenu fabbutton = view.FindViewById <Clans.Fab.FloatingActionMenu>(Resource.Id.mainMapFragmentButtonFab);

            Clans.Fab.FloatingActionButton stop = view.FindViewById <Clans.Fab.FloatingActionButton>(Resource.Id.stop);

            stop.Click += (sender, e) =>
            {
                var second = new Intent(Application.Context, typeof(RootStopFavoritesActivty));;
                StartActivity(second);

                fabbutton.Close(true);
            };


            var layout = view.FindViewById <FrameLayout>(Resource.Id.notificationcardroot);


            var prms = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);

            prms.Height             = MapBridge.Instance.windowHeight;
            layout.LayoutParameters = prms;



            /*
             * Create Recyckleview
             */
            // mPhotoAlbum = new PhotoAlbum();

            mRecyclerView = view.FindViewById <RecyclerView>(Resource.Id.recyclerView);

            // Plug in the linear layout manager:
            mLayoutManager = new LinearLayoutManager(Application.Context);
            mRecyclerView.SetLayoutManager(mLayoutManager);

            // Plug in my adapter:
            mAdapter = new PhotoAlbumAdapter(_favoritesViewModel.GetList());

            mAdapter.ItemClick += (sender, e) =>
            {
                int photoNum = e;
                FavoriteBridge.Instance.Trigger("FavoriteSelected", _favoritesViewModel.GetList()[photoNum]);

                //mAdapter.NotifyDataSetChanged();
            };

            mAdapter.LongClick += (object sender, int e) => {
                _favoritesViewModel.RemoveInList(e);
                _favoritesViewModel.Load();
                mAdapter.UpdateList(_favoritesViewModel.GetList());
                mAdapter.NotifyDataSetChanged();
            };


            mRecyclerView.SetAdapter(mAdapter);

            return(view);
        }
コード例 #4
0
 /*
  * Update the list
  */
 public override void OnResumeCustom()
 {
     _favoritesViewModel.Load();
     mAdapter.UpdateList(_favoritesViewModel.GetList());
     mAdapter.NotifyDataSetChanged();
 }
コード例 #5
0
        public void Init(bool showDeparture = false)
        {
            /*
             *  Date picker field
             */
            _favoritesViewModel = Stops.Setup.IoC.Container.Get <Core.ViewModels.FavoritesViewModel>();
            _favoritesViewModel.Load();


            SetCurrentTime(true);
            var datePicker = _view.FindViewById <FrameLayout> (Resource.Id.dtmDate);

            datePicker.Click += (o, s) => {
                //
                // Start with time picker
                //
                var dialog = new TimePickerDialogFragment(Activity, _searchDate, this);
                dialog.Show(FragmentManager, null);
            };

            datePicker.LongClick += (object sender, View.LongClickEventArgs e) => {
                SetCurrentTime();
                return;
            };

            _buttonFavorite = _view.FindViewById <ImageButton>(Resource.Id.btnFavorite);
            SetFavoritButtonDark();
            _buttonFavorite.Click += (sender, e) => {
                if ((int)_buttonFavorite.Tag == Resource.Drawable.star_dark)
                {
                    SetFavoritButtonGold();
                }
                else
                {
                    SetFavoritButtonDark();
                }
                this.Events.Trigger("favoritebuttonclicked", (int)_buttonFavorite.Tag == Resource.Drawable.star_dark ? false : true);
            };

            /*
             * Show depature spinner
             */
            var dateFragmentTimeFrame      = _view.FindViewById <FrameLayout> (Resource.Id.DateFragmentTimeFrame);
            var dateFragmentDepartureFrame = _view.FindViewById <FrameLayout> (Resource.Id.DateFragmentDepartureFrame);

            if (showDeparture)
            {
                var prms = (LinearLayout.LayoutParams)dateFragmentTimeFrame.LayoutParameters;
                prms.Weight = 0.65f;
                dateFragmentTimeFrame.LayoutParameters = prms;

                prms        = (LinearLayout.LayoutParams)dateFragmentDepartureFrame.LayoutParameters;
                prms.Weight = 0.35f;
                dateFragmentDepartureFrame.LayoutParameters = prms;

                var spinner = _view.FindViewById <Spinner> (Resource.Id.DateFragmentDepartureSpinner);

                spinner.ItemSelected += (sender, e) => {
                };
                var adapter = ArrayAdapter.CreateFromResource(
                    Application.Context, Resource.Array.when_array, Resource.Layout.SpinnerText);

                adapter.SetDropDownViewResource(Resource.Layout.Spinner);
                spinner.Adapter = adapter;
            }
        }
コード例 #6
0
 public void UpdateFavoriteDataModel()
 {
     _favoritesViewModel.Load();
 }