예제 #1
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            int id = item.ItemId;
            FragmentTransaction transaction = this.FragmentManager.BeginTransaction();


            if (id == Resource.Id.navRating)
            {
                fragment = new Rating();
                DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
                drawer.CloseDrawer(GravityCompat.Start);
                transaction.Replace(Resource.Id.FramePage, fragment);
                transaction.Commit();
            }
            else if (id == Resource.Id.navTopDriver)
            {
                fragment = new addDriverFragment();
                DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
                drawer.CloseDrawer(GravityCompat.Start);
                transaction.Replace(Resource.Id.FramePage, fragment);
                transaction.Commit();
            }
            else if (id == Resource.Id.navBalance)
            {
                fragment = new Balance();
                DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
                drawer.CloseDrawer(GravityCompat.Start);
                transaction.Replace(Resource.Id.FramePage, fragment);
                transaction.Commit();
            }
            else if (id == Resource.Id.nav_send)
            {
                auth.SignOut();
                editor = preferences.Edit();
                editor.Clear().Commit();

                if (auth.CurrentUser == null)
                {
                    StartActivity(new Intent(this, typeof(LoginActivity)));
                    Finish();
                }
            }


            return(true);
        }
예제 #2
0
        private void DisplayFragment()
        {
            Fragment            fragment = AddOrderSecondFragment.GetInstance();
            FragmentTransaction ft       = FragmentManager.BeginTransaction();

            ft.Replace(Resource.Id.frame_container, fragment, fragment.Class.Name);
            ft.AddToBackStack(null);
            ft.Commit();
        }
예제 #3
0
        //start search page fragment if search icon is clicked.
        void search_Click(object sender, EventArgs e)
        {
            FragmentTransaction  fragmentTransaction = this.Activity.FragmentManager.BeginTransaction();
            SearchFragmentActual prof = new SearchFragmentActual();

            fragmentTransaction.Replace(Resource.Id.frame, prof);
            fragmentTransaction.AddToBackStack("HomePage");
            fragmentTransaction.Commit();
        }
예제 #4
0
        private void addA_Click(object sender, EventArgs e)
        {
            Fragment_A fragmentA = new Fragment_A();

            FragmentTransaction transaction = this.FragmentManager.BeginTransaction();

            transaction.Add(Resource.Id.container, fragmentA, "fragA");
            transaction.Commit();
        }
예제 #5
0
        private void LoadAllFragments()
        {
            FragmentTransaction fragmentTx = FragmentManager.BeginTransaction();

            fragmentTx.Add(Resource.Id.fragmentFrameLayout, filmsFragment);
            fragmentTx.Add(Resource.Id.fragmentFrameLayout, pageFragment);
            fragmentTx.Detach(pageFragment);
            fragmentTx.Commit();
        }
예제 #6
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.SearchPage);

            mToolbar      = FindViewById <SupportToolbar>(Resource.Id.toolbar_search);
            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout_search);

            SetSupportActionBar(mToolbar);



            FragmentTransaction transaction = FragmentManager.BeginTransaction();
            SlidingTabsFragment fragment    = new SlidingTabsFragment();

            transaction.Replace(Resource.Id.search_fragment, fragment);
            transaction.Commit();
            try
            {
                mDrawerToggle = new MyActionBarDrawerToggle(
                    this,                                       //Host Activity
                    mDrawerLayout,                              //DrawerLayout
                    Resource.String.openDrawer,                 //Opened Message
                    Resource.String.closeDrawer                 //Closed Message
                    );
                mDrawerLayout.SetDrawerListener(mDrawerToggle); //gives drawer toggle permission to call the methods
                SupportActionBar.SetHomeButtonEnabled(true);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetDisplayShowTitleEnabled(true);
                mDrawerToggle.SyncState();
            }
            catch
            {
            }

            mNavView  = FindViewById <NavigationView>(Resource.Id.nav_view_search);
            mHomeItem = FindViewById <AdapterView>(Resource.Id.nav_home);
            mNavView.NavigationItemSelected += MNavView_NavigationItemSelected;

            if (bundle != null)
            {
                if (bundle.GetString("DrawerState") == "Opened")
                {
                    SupportActionBar.SetTitle(Resource.String.openDrawer);
                }
                else
                {
                    SupportActionBar.SetTitle(Resource.String.closeDrawer);
                }
            }
            else
            {
                //first time activity is ran
                SupportActionBar.SetTitle(Resource.String.closeDrawer);
            }
        }
예제 #7
0
 private void LoadClockFragment()
 {
     using (FragmentTransaction fragmentTransaction = FragmentManager.BeginTransaction())
     {
         fragmentTransaction.Replace(Resource.Id.weatherandcLockplaceholder, clockFragment);
         fragmentTransaction.DisallowAddToBackStack();
         fragmentTransaction.Commit();
     }
 }
예제 #8
0
        public void LaunchViewBehavior(BehaviorGraph behaviorGraph)
        {
            FragmentTransaction ft       = Activity.SupportFragmentManager.BeginTransaction();
            Fragment            fragment = new ClientViewBehaviorView(behaviorGraph);

            ft.Replace(Resource.Id.fragment_container, fragment);
            ft.AddToBackStack(null);
            ft.Commit();
        }
예제 #9
0
        private void goSettings(object sender, EventArgs e)
        {
            FragmentTransaction     fragmentTransaction     = FragmentManager.BeginTransaction();
            AccountSettingsFragment accountSettingsFragment = new AccountSettingsFragment();

            fragmentTransaction.Replace(Resource.Id.content_frame, accountSettingsFragment, "accountSettingsFragment");
            fragmentTransaction.AddToBackStack(null);
            fragmentTransaction.Commit();
        }
        private void ShowDimensionBtnClicked(object sender, EventArgs e)
        {
            Fragment            packageDetails      = new PackageDetailsFragment();
            FragmentTransaction fragmentTransaction = FragmentManager.BeginTransaction();

            fragmentTransaction.SetTransition(FragmentTransit.EnterMask);
            fragmentTransaction.Replace(Resource.Id.fragment_container, packageDetails);
            fragmentTransaction.Commit();
        }
예제 #11
0
        protected void OnMyProfileClick(object sender, EventArgs e)
        {
            //ShowEmployeeCollectionView(FilterLookup.EmployeeReviews);
            DetailedUserProfileFragment userViewFragment = new DetailedUserProfileFragment();
            FragmentTransaction         transaction      = FragmentManager.BeginTransaction();

            transaction.Replace(Resource.Id.fragmentContainerID, userViewFragment);
            transaction.Commit();
        }
예제 #12
0
        private void AddA_Click(object sender, System.EventArgs e)
        {
            Log.Info("KKKKKKK", "Add A button Clicked");
            FragmentA           fragmentA   = new FragmentA();
            FragmentTransaction transaction = FragmentManager.BeginTransaction();

            transaction.Add(Resource.Id.container, fragmentA, "fragA");
            transaction.Commit();
        }
예제 #13
0
        public void removeFragment(Fragment myFrag, FragmentManager fragmentManager)
        {
            FragmentTransaction transaction = fragmentManager.BeginTransaction();

            transaction.SetCustomAnimations(Resource.Animator.slide_from_out_bottom, Resource.Animator.slide_in_bottom);
            transaction.Remove(myFrag);
            transaction.Commit();
            fragmentManager.PopBackStack();
        }
예제 #14
0
        public void replaceFragments(Fragment fragment, int idContainer, String fragmentTag, FragmentManager fragmentManager)
        {
            FragmentTransaction transaction = fragmentManager.BeginTransaction();

            transaction.SetCustomAnimations(Resource.Animator.slide_in_up, Resource.Animator.slide_in_down);
            transaction.Replace(idContainer, fragment, fragmentTag);
            transaction.AddToBackStack(null);
            transaction.Commit();
        }
예제 #15
0
        public void LoadMovieFragment()
        {
            FragmentTransaction fragmentTx = FragmentManager.BeginTransaction();

            fragmentTx.Detach(filmsFragment);
            fragmentTx.Attach(pageFragment);
            fragmentTx.AddToBackStack(null);
            fragmentTx.Commit();
        }
예제 #16
0
        public void InitMap()
        {
            // Maps
            var mapFragment = MapFragment.NewInstance();
            FragmentTransaction fragmentTransaction = FragmentManager.BeginTransaction();

            fragmentTransaction.Add(Resource.Id.mapContainer, mapFragment);
            fragmentTransaction.Commit();
        }
예제 #17
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.CustomMap);

            _toolbar = FindViewById <Toolbar>(Resource.Id.tv_cm_toolbar);
            SetSupportActionBar(_toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            _setPlaceButton = FindViewById <Button>(Resource.Id.btn_cm_setCoordinates);
            PlaceAutocompleteFragment autocompleteFragment =
                (PlaceAutocompleteFragment)FragmentManager.FindFragmentById(Resource.Id.place_autocomplete_fragment);

            var content = Intent.GetStringExtra("place");

            _isEditable = Intent.GetBooleanExtra("isEditable", false);
            if (!_isEditable)
            {
                autocompleteFragment.View.Visibility = ViewStates.Gone;
                _setPlaceButton.Visibility           = ViewStates.Gone;
            }
            else
            {
                autocompleteFragment.SetOnPlaceSelectedListener(this);
                autocompleteFragment.SetBoundsBias(new LatLngBounds(
                                                       new LatLng(4.5931, -74.1552),
                                                       new LatLng(4.6559, -74.0837)));
                _setPlaceButton.Click += SetPlaceButton_Click;
            }

            if (!string.IsNullOrWhiteSpace(content))
            {
                _markerPosition = JsonConvert.DeserializeObject <Coordinates>(content);
            }

            _fusedLocationProviderClient = LocationServices.GetFusedLocationProviderClient(this);
            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_mapFragment == null)
            {
                Location location = await _fusedLocationProviderClient.GetLastLocationAsync();

                var myPosition = new LatLng(location.Latitude, location.Longitude);// (20.5, 20.5);
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeNormal)
                                              .InvokeZoomControlsEnabled(true)
                                              .InvokeMapToolbarEnabled(true)
                                              .InvokeCamera(new CameraPosition(myPosition, 10, 0, 0))
                                              .InvokeCompassEnabled(true);
                FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.Commit();
            }

            _mapFragment.GetMapAsync(this);
        }
예제 #18
0
        private void Work_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            swipe.Refreshing = false;
            BoxActivity         content      = new BoxActivity();
            FragmentTransaction transaction1 = this.FragmentManager.BeginTransaction();

            transaction1.Replace(Resource.Id.frameDriverlayout, content);
            transaction1.Commit();
        }
예제 #19
0
        private void ShowlastFragment(ManageStockPostApiResponse res)
        {
            FragmentTransaction ft       = FragmentManager.BeginTransaction();
            MvxFragmentBase     fragment = new FragmentManageStockComplete();

            fragment.SetArgument(FragmentManageStockComplete.AllocatedProductResponseKey, res);
            ft.Replace(Resource.Id.main_content, fragment, ManageStockView.MainContentFragmentTag);
            ft.Commit();
        }
예제 #20
0
 /// <summary>
 /// Helper method to hide the map
 /// </summary>
 private void HideMap()
 {
     if (map != null)
     {
         FragmentTransaction tx = FragmentManager.BeginTransaction();
         tx.Hide(map);
         tx.Commit();
     }
 }
        private void GoChangePassword(object sender, EventArgs e)
        {
            FragmentTransaction    ft = FragmentManager.BeginTransaction();
            ChangePasswordFragment changePasswordFragment = new ChangePasswordFragment();

            ft.Replace(Resource.Id.content_frame, changePasswordFragment, "f4");
            ft.AddToBackStack(null);
            ft.Commit();
        }
        private void LoadAndDisplayFile()
        {
            FragmentTransaction     fragmentTransaction = FragmentManager.BeginTransaction();
            DisplayTextFileFragment fragment            = new DisplayTextFileFragment(directory);

            fragmentTransaction.Replace(Resource.Id.main_area, fragment);
            fragmentTransaction.AddToBackStack(null);
            fragmentTransaction.Commit();
        }
예제 #23
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            View     view     = inflater.Inflate(Resource.Layout.AddBet, null);
            EditText teamName = view.FindViewById <EditText>(Resource.Id.teamName);
            EditText firstBet = view.FindViewById <EditText>(Resource.Id.firstBet);
            EditText betType  = view.FindViewById <EditText>(Resource.Id.betType);
            Button   saveBet  = view.FindViewById <Button>(Resource.Id.addBetBtn);

            firstBet.FixDigits();


            saveBet.Click += delegate
            {
                if (teamName.Text != string.Empty && firstBet.Text != string.Empty &&
                    betType.Text != string.Empty)
                {
                    Team t = new Team();
                    t.Name        = teamName.Text;
                    t.Bet         = betType.Text;
                    t.Id          = Guid.NewGuid();
                    t.Status      = false;
                    t.Win         = 0;
                    t.BetProvider = ApplicationState.ActiveProvider;


                    if (AWSDataAccess.InsertTeam(t) != Guid.Empty)
                    {
                        BetDetails betDetails = new BetDetails();
                        betDetails.Id       = Guid.NewGuid();
                        betDetails.Quantity = Convert.ToDecimal(firstBet.Text);
                        betDetails.Team_Id  = t.Id;
                        if (AWSDataAccess.InsertBetDetails(betDetails) != Guid.Empty)
                        {
                            Toast.MakeText(Activity, "Bet added", ToastLength.Long).Show();
                            FragmentTransaction ft = FragmentManager.BeginTransaction();
                            ft.Replace(Resource.Id.frameLayout1, new HomeFragment());
                            ft.Commit();
                        }
                        else
                        {
                            Toast.MakeText(Activity, "Error in bet saving", ToastLength.Long).Show();
                        }
                    }
                    else
                    {
                        Toast.MakeText(Activity, "Error in bet saving", ToastLength.Long).Show();
                    }
                }
            };



            return(view);
            //return base.OnCreateView(inflater, container, savedInstanceState);
        }
예제 #24
0
 void OnClick(NavBarAdapterClickEventArgs args)
 {
     if (items[args.Position].fragment != null)
     {
         FragmentTransaction transaction = c.FragmentManager.BeginTransaction();
         transaction.Replace(Resource.Id.fragmentContainer, FragmentHome.Get());
         transaction.Commit();
         c.Drawer.CloseDrawers();
     }
 }
        public void LaunchViewJournal(JournalEntry journal)
        {
            Logger.Log("LaunchViewJournal");
            FragmentTransaction ft       = Activity.SupportFragmentManager.BeginTransaction();
            Fragment            fragment = new ClientViewJournalView(journal);

            ft.Replace(Resource.Id.fragment_container, fragment);
            ft.AddToBackStack(null);
            ft.Commit();
        }
예제 #26
0
        public bool Previous()
        {
            FragmentTransaction ft   = FragmentManager.BeginTransaction();
            Fragment            frag = new FragmentProductsInStock();

            ft.Replace(Resource.Id.main_content, frag, ManageStockView.MainContentFragmentTag);
            ft.Commit();

            return(true);
        }
예제 #27
0
        public bool Next()
        {
            FragmentTransaction ft = FragmentManager.BeginTransaction();
            var fragment           = new FragmentSelectedUnits();

            ft.Replace(Resource.Id.main_content, fragment, ManageStockView.MainContentFragmentTag);
            ft.Commit();

            return(true);
        }
예제 #28
0
        private void BLogin_Click(object sender, EventArgs e)
        {
            MyFragmentManager.activity.InitWebSocket();
            MyFragmentManager.InitWebSocket(MyFragmentManager.activity.webSocket);
            FragmentTransaction transaction = FragmentManager.BeginTransaction();

            transaction.Replace(Resource.Id.main_activity_fragment_placeholder,
                                new FragmentRA());
            transaction.Commit();
        }
예제 #29
0
        private void HandleImageToVoice(object sender, EventArgs e)
        {
            FragmentTransaction            fragmentManager = this.FragmentManager.BeginTransaction();
            DescribeImageWithVoiceFragment voice           = new DescribeImageWithVoiceFragment();

            fragmentManager.Replace(Resource.Id.parent_fragment, voice);
            fragmentManager.SetTransition(FragmentTransit.FragmentOpen);
            fragmentManager.AddToBackStack(null);
            fragmentManager.Commit();
        }
예제 #30
0
        private void HandleCheckSimilarity(object sender, EventArgs e)
        {
            FragmentTransaction     fragmentManager         = this.FragmentManager.BeginTransaction();
            CheckSimilarityFragment checkSimilarityFragment = new CheckSimilarityFragment();

            fragmentManager.Replace(Resource.Id.parent_fragment, checkSimilarityFragment);
            fragmentManager.SetTransition(FragmentTransit.FragmentOpen);
            fragmentManager.AddToBackStack(null);
            fragmentManager.Commit();
        }
		/**
		 * Replaces the old fragment with the new one and adds the old to the backstack,
		 *if bool addToBackStack is set to true
		 **/
		public void switchFragment(string oldFragmentTag, string newFragmentTag, Fragment newFragment, bool addToBackStack) {
			menu.Opened = false;
			activeFragment = newFragmentTag;
			trans = FragmentManager.BeginTransaction();
			Fragment oldFragment = FragmentManager.FindFragmentByTag(oldFragmentTag);

			if(addToBackStack && oldFragment != null)
				trans.AddToBackStack(oldFragmentTag);

			if(oldFragment != null)
				trans.Remove(oldFragment);
			trans.Add(Resource.Id.fragmentContainer, newFragment, newFragmentTag);
			trans.Commit();
		}
예제 #32
0
        private async void SetupMapIfNeeded()
        {
            if (_map == null && !_gettingMap)
            {
                // TODO À quoi sert cette variable ? On peut supprimer je pense.
                // a priori SetupMapIfNeeded peut-être appelé pluiseurs fois d'affilé, c'est pour prévenir ça
                _gettingMap = true;
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                    .InvokeMapType(GoogleMap.MapTypeNormal)
                    //.InvokeZoomControlsEnabled(true)
                    //.InvokeMapToolbarEnabled(true)
                    .InvokeCompassEnabled(true)
                    .InvokeCamera(await GetStartingCameraPosition());

                _fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragmentExtended.NewInstance(mapOptions);
                _fragTx.Add(Resource.Id.map, _mapFragment, "map");
                _fragTx.Commit();
                _mapFragment.GetMapAsync(this);
            }

        }
예제 #33
0
        private void SetView(int fragmentResource, Fragment view, bool retainView)
        {
            _DrawerToggle.SetClosedResource(_CurrentViewTitle);

            _FragmentManager = FragmentManager.BeginTransaction();
            _FragmentManager.Replace(fragmentResource, view);

            // If true, allows the user to return to that fragment.
            // Otherwise it is destroyed.
            if(retainView)
            {
                _FragmentManager.AddToBackStack(null);
        }

            _FragmentManager.Commit();

            _DrawerLayout.CloseDrawers();
        }