Exemple #1
0
        public LiveOrdersLayout(Context context) : base(context)
        {
            this.Orientation = Orientation.Horizontal;
            this.SetBackgroundColor(Color.White);

            FrameLayout leftFrame = new FrameLayout(context);

            leftFrame.Id = 1;
            leftFrame.SetMinimumHeight(500);
            leftFrame.SetMinimumWidth(700);
            leftFrame.SetBackgroundColor(Color.White);
            this.AddView(leftFrame);

            FrameLayout rightFrame = new FrameLayout(context);

            rightFrame.Id = 2;
            rightFrame.SetMinimumHeight(700);
            rightFrame.SetMinimumWidth(1190);
            rightFrame.SetBackgroundColor(Color.White);

            this.AddView(rightFrame);

            ordersFragment = new LiveOrdersFragment();
            orderFragment  = new OrderFragment();

            Activity activity = (Activity)context;

            FragmentTransaction ft = activity.FragmentManager.BeginTransaction();

            ft.Add(leftFrame.Id, ordersFragment);
            ft.Add(rightFrame.Id, orderFragment);
            ft.Commit();
        }
        public override View OnCreateView(LayoutInflater Inflater, ViewGroup container,
                                          Bundle savedInstanceState)
        {
            View v = Inflater.Inflate(R.Layouts.fragment_menu, container, false);

            // Make sure the two menu fragments are created.
            FragmentManager     fm = GetChildFragmentManager();
            FragmentTransaction ft = fm.BeginTransaction();

            mFragment1 = fm.FindFragmentByTag("f1");
            if (mFragment1 == null)
            {
                mFragment1 = new FragmentMenuSupport.MenuFragment();
                ft.Add(mFragment1, "f1");
            }
            mFragment2 = fm.FindFragmentByTag("f2");
            if (mFragment2 == null)
            {
                mFragment2 = new FragmentMenuSupport.Menu2Fragment();
                ft.Add(mFragment2, "f2");
            }
            ft.Commit();

            // Watch check box clicks.
            mCheckBox1        = (CheckBox)v.FindViewById(R.Ids.menu1);
            mCheckBox1.Click += (o, a) => UpdateFragmentVisibility();
            mCheckBox2        = (CheckBox)v.FindViewById(R.Ids.menu2);
            mCheckBox2.Click += (o, a) => UpdateFragmentVisibility();

            // Make sure fragments start out with correct visibility.
            UpdateFragmentVisibility();

            return(v);
        }
Exemple #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(R.Layouts.fragment_menu);

            // Make sure the two menu fragments are created.
            FragmentManager     fm = GetSupportFragmentManager();
            FragmentTransaction ft = fm.BeginTransaction();

            mFragment1 = fm.FindFragmentByTag("f1");
            if (mFragment1 == null)
            {
                mFragment1 = new MenuFragment();
                ft.Add(mFragment1, "f1");
            }
            mFragment2 = fm.FindFragmentByTag("f2");
            if (mFragment2 == null)
            {
                mFragment2 = new Menu2Fragment();
                ft.Add(mFragment2, "f2");
            }
            ft.Commit();

            // Watch check box clicks.
            mCheckBox1        = (CheckBox)FindViewById(R.Ids.menu1);
            mCheckBox1.Click += (o, a) => UpdateFragmentVisibility();
            mCheckBox2        = (CheckBox)FindViewById(R.Ids.menu2);
            mCheckBox2.Click += (o, a) => UpdateFragmentVisibility();

            // Make sure fragments start out with correct visibility.
            UpdateFragmentVisibility();
        }
Exemple #4
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();
        }
Exemple #5
0
        public void OnTabSelected(ActionBar.Tab tab, FragmentTransaction ft)
        {
            switch (tab.Text)
            {
            case "Login":
                if (fragTab1 == null)
                {
                    fragTab1 = new LoginTabFragment(xmppClient);
                    ft.Add(Resource.Id.fragmentContainer, fragTab1);
                }
                else
                {
                    ft.Show(fragTab1);
                }

                break;

            case "Contacts":
                if (fragTabContacts == null)
                {
                    fragTabContacts = new ContactsTabFragment(xmppClient);
                    ft.Add(Resource.Id.fragmentContainer, fragTabContacts);
                }
                else
                {
                    ft.Show(fragTabContacts);
                }

                break;

            case "XML Log":
                if (fragTab2 == null)
                {
                    fragTab2 = new LogTabFragment(xmppClient);
                    ft.Add(Resource.Id.fragmentContainer, fragTab2);
                }
                else
                {
                    ft.Show(fragTab2);
                }

                break;

            case "Events":
                if (fragTab3 == null)
                {
                    fragTab3 = new EventsTabFragment(xmppClient);
                    ft.Add(Resource.Id.fragmentContainer, fragTab3);
                }
                else
                {
                    ft.Show(fragTab3);
                }

                break;
            }
        }
Exemple #6
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            game = new GameLogic();

            // Detect the orientation: landscape or portrait
            // Only the dual pane layout (landscape) has fragContainer2
            View fragContainer2 = FindViewById <View> (Resource.Id.fragContainer2);

            if (fragContainer2 != null)
            {
                isDualPane = true;
            }

            // Load the fragment used by both layouts (landscape and portrait)
            // Note: The fragment has the ID of its container
            FragmentTransaction ft = FragmentManager.BeginTransaction();
            var fragment1          = FragmentManager.FindFragmentById(Resource.Id.fragContainer1);

            if (fragment1 != null)
            {
                ft.Remove(fragment1);
            }
            var handFrag = new HandFrag();

            ft.Add(Resource.Id.fragContainer1, handFrag);
            ft.Commit();

            if (!isDualPane)
            {
                // Only the portrait layout (single pane) has a translate button
                Button translateButton = FindViewById <Button> (Resource.Id.translateButton);
                translateButton.Click += delegate(object sender, EventArgs e) {
                    var intent = new Intent();
                    intent.SetClass(this, typeof(TranslateActivity));
                    intent.PutExtra("hand_position_name", game.HandName);
                    StartActivity(intent);
                };
            }
            else
            {
                // Only add the Text fragment for landscape orientation (dual panes)
                ft = FragmentManager.BeginTransaction();
                var fragment2 = FragmentManager.FindFragmentById(Resource.Id.fragContainer2);
                if (fragment2 != null)
                {
                    ft.Remove(fragment2);
                }
                ft.Add(Resource.Id.fragContainer2, new TextFrag());
                ft.Commit();
            }
        }
Exemple #7
0
        //单击事件
        public void onClick(View v)
        {
            FragmentTransaction fTransaction = FragmentManager.BeginTransaction();

            hideAllFragment(fTransaction);
            switch (v.Id)
            {
            case Resource.Id.tab_recharge:
                setSelected();
                tab_recharge.Selected = true;

                if (fg1 == null)
                {
                    fg1 = new MyFragment("开卡Fragment");
                    fTransaction.Add(Resource.Id.ly_content, fg1);
                }
                else
                {
                    fTransaction.Show(fg1);
                }
                break;

            case Resource.Id.tab_openccard:
                setSelected();
                tab_openccard.Selected = true;

                if (fg2 == null)
                {
                    fg2 = new OpenCardFragment();
                    fTransaction.Add(Resource.Id.ly_content, fg2);
                }
                else
                {
                    fTransaction.Show(fg2);
                }
                break;

            case Resource.Id.tab_personal:
                setSelected();
                tab_personal.Selected = true;

                if (personalFragment == null)
                {
                    personalFragment = new PersonalFragment();
                    fTransaction.Add(Resource.Id.ly_content, personalFragment);
                }
                else
                {
                    fTransaction.Show(personalFragment);
                }
                break;
            }
            fTransaction.Commit();
        }
Exemple #8
0
 public void Show()
 {
     //var transaction = FragmentManager.BeginTransaction();
     //transaction.Add(Resource.Id.MainLayout_Body, fragments[fragmentI]);
     transaction.Add(Resource.Id.MainLayout_Body, fragments[3]);
     transaction.Add(Resource.Id.MainLayout_Body, fragments[1]);
     transaction.Add(Resource.Id.MainLayout_Body, fragments[0]);
     transaction.Add(Resource.Id.MainLayout_Body, fragments[2]);
     transaction.Commit();
     fragmentI = 3;
 }
Exemple #9
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            transaction = FragmentManager.BeginTransaction();
            hideAllFragment(transaction);
            switch (item.ItemId)
            {
            case Resource.Id.navigation_home:
                if (f1 == null)
                {
                    f1 = new cityFragment();
                    transaction.Add(Resource.Id.myfragment, f1);
                }
                else
                {
                    transaction.Show(f1);
                }
                break;

            case Resource.Id.navigation_dashboard:
                if (f2 == null)
                {
                    f2 = new MyFragment();
                    transaction.Add(Resource.Id.myfragment, f2);
                }
                else
                {
                    transaction.Show(f2);
                }
                break;

            //textMessage.SetText(Resource.String.title_dashboard);
            //return true;
            case Resource.Id.navigation_notifications:
                // textMessage.SetText(Resource.String.title_notifications);
                // return true;
                if (f3 == null)
                {
                    f3 = new MyFragment();
                    transaction.Add(Resource.Id.myfragment, f3);
                }
                else
                {
                    transaction.Show(f3);
                }
                break;
            }
            transaction.Commit();
            return(false);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);

            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Extra_BeSmart_MainView);

            SupportActionBar.SetDisplayShowCustomEnabled(true);
            SupportActionBar.SetCustomView(Resource.Layout.Extra_BeSmart_ActionBar);
            SupportActionBar.NavigationMode = Convert.ToInt32(ActionBarNavigationMode.Tabs);
            SupportActionBar.SetHomeButtonEnabled(false);
            SupportActionBar.SetDisplayShowHomeEnabled(false);
            SupportActionBar.SetBackgroundDrawable(new ColorDrawable(Android.Graphics.Color.Rgb(213, 219, 254)));
            SupportActionBar.SetStackedBackgroundDrawable(new ColorDrawable(Android.Graphics.Color.Rgb(213, 219, 254)));

            var tab1 = SupportActionBar.NewTab();

            tab1.SetText("Cauta produs");
            tab1.SetTabListener(this);

            var tab2 = SupportActionBar.NewTab();

            tab2.SetText("Cauta magazin");
            tab2.SetTabListener(this);

            SupportActionBar.AddTab(tab1);
            SupportActionBar.AddTab(tab2);

            {
                ImageView ActionBarIcon  = SupportActionBar.CustomView.FindViewById <ImageView>(Resource.Id.imageView1);
                TextView  ActionBarPromo = SupportActionBar.CustomView.FindViewById <TextView>(Resource.Id.textView1);

                SetBeatingAnimation(ActionBarIcon);
                SetTypeface.Normal.SetTypeFace(this, ActionBarPromo);
            }

            FragmentContainer = FindViewById <FrameLayout>(Resource.Id.frameLayout1);
            FragmentTransaction transact = FragmentManager.BeginTransaction();

            CautaMagazinFragment = new BeSmart_Main_CautaMagazinFragment();
            CautaProdusFragment  = new BeSmart_Main_CautaProdusFragment();

            transact.Add(FragmentContainer.Id, CautaMagazinFragment, "CautaMagazin");
            transact.Hide(CautaMagazinFragment);
            transact.Add(FragmentContainer.Id, CautaProdusFragment, "CautaProdus");

            transact.Commit();
        }
        private void SetUpMap()
        {
            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_mapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeHybrid)
                                              .InvokeZoomControlsEnabled(true)
                                              .InvokeCompassEnabled(true);

                FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.Commit();

                var mapReadyCallback = new MyOnMapReady();
                mapReadyCallback.MapReady += (sender, args) =>
                {
                    _gettingMap = false;
                    _map        = ((MyOnMapReady)sender).Map;

                    MoveCamera();
                };

                _gettingMap = true;

                _mapFragment.GetMapAsync(mapReadyCallback);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            if (savedInstanceState == null)
            {
                //Se genera la instancia del fragment "inicial"
                Fragment first = FirstFragment.NewInstance();

                //Se obtiene una referencia del "FragmentManager"
                FragmentManager manager = this.FragmentManager;

                //Se inicia una transacción con ayuda del "FragmentManager"
                FragmentTransaction transaction = manager.BeginTransaction();

                //Se agrega el Fragment a la interfaz
                transaction.Add(Resource.Id.contenedor, first);

                //Se confirma la transacción ;P
                transaction.Commit();
            }
        }
Exemple #13
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            // return inflater.Inflate(Resource.Layout.YourFragment, container, false);

            View view = inflater.Inflate(Resource.Layout.fg_openCard, container, false);
            //Button opencardButton = view.FindViewById<Button>(Resource.Id.opencard_btn);
            //TextView numberLabel = view.FindViewById<TextView>(Resource.Id.opencard_text_number);

            //opencardButton.Click += delegate
            //{
            //    numberLabel.Text = "Hello";
            //    Console.WriteLine("Hello fox");
            //};


            TextView opencard_submit = (TextView)view.FindViewById <TextView>(Resource.Id.opencard_submit);

            opencard_submit.Click += delegate
            {
                FragmentTransaction fTransaction = FragmentManager.BeginTransaction();
                //FragmentManager mannger=fTransaction
                OpenCardStep2Fragment openCardStep2Fragment = new OpenCardStep2Fragment();

                fTransaction.Add(Resource.Id.ly_content, openCardStep2Fragment);
                fTransaction.Commit();
            };
            return(view);
        }
Exemple #14
0
        /**
         * This method animates the image fragment into the background by both
         * scaling and rotating the fragment's view, as well as adding a
         * translucent dark hover view to inform the user that it is inactive.
         */
        public void SlideBack()
        {
            View movingFragmentView = mImageFragment.View;

            PropertyValuesHolder rotateX = PropertyValuesHolder.OfFloat("rotationX", 40f);
            PropertyValuesHolder scaleX  = PropertyValuesHolder.OfFloat("scaleX", 0.8f);
            PropertyValuesHolder scaleY  = PropertyValuesHolder.OfFloat("scaleY", 0.8f);
            ObjectAnimator       movingFragmentAnimator = ObjectAnimator.
                                                          OfPropertyValuesHolder(movingFragmentView, rotateX, scaleX, scaleY);

            ObjectAnimator darkHoverViewAnimator = ObjectAnimator.
                                                   OfFloat(mDarkHoverView, "alpha", 0.0f, 0.5f);

            ObjectAnimator movingFragmentRotator = ObjectAnimator.
                                                   OfFloat(movingFragmentView, "rotationX", 0);

            movingFragmentRotator.StartDelay = Resources.GetInteger(Resource.Integer.half_slide_up_down_duration);

            AnimatorSet s = new AnimatorSet();

            s.PlayTogether(movingFragmentAnimator, darkHoverViewAnimator, movingFragmentRotator);
            s.AnimationEnd += delegate
            {
                FragmentTransaction transaction = FragmentManager.BeginTransaction();
                transaction.SetCustomAnimations(Resource.Animator.slide_fragment_in, 0, 0, Resource.Animator.slide_fragment_out);
                transaction.Add(Resource.Id.move_to_back_container, mTextFragment);
                transaction.AddToBackStack(null);
                transaction.Commit();
            };
            s.Start();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            AppCenter.Start("e6414a2f-72c6-4844-8034-202f3821061b",
                            typeof(Analytics), typeof(Crashes));
            AppCenter.Start("e6414a2f-72c6-4844-8034-202f3821061b", typeof(Analytics), typeof(Crashes));
            AppCenter.Start("e6414a2f-72c6-4844-8034-202f3821061b", typeof(Distribute));

            // Set our view from the "main" layout resource
            // Set our view from the "main" layout resource

            SetContentView(Resource.Layout.Main);
            var btn  = FindViewById <Button>(Resource.Id.button1);
            var btn2 = FindViewById <Button>(Resource.Id.button2);

            btn.Click  += Btn_Click;
            btn2.Click += Btn2_Click;
            // Create a new fragment and a transaction.
            FragmentTransaction fm            = this.FragmentManager.BeginTransaction();
            FirstFragment       firstFragment = new FirstFragment();

            // The fragment will have the ID of Resource.Id.fragment_container.
            fm.Add(Resource.Id.frameLayout1, firstFragment);
            fm.AddToBackStack("First");

            // Commit the transaction.
            fm.Commit();
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            //this.OverridePendingTransition(Resource.Animation.SlideInRight, Resource.Animation.SlideOutLeft);
            this.Window.AddFlags(WindowManagerFlags.Fullscreen);

            /*ActionBar.SetDisplayHomeAsUpEnabled(false);
            *  ActionBar.SetDisplayShowHomeEnabled(false);*/

            var par = (RelativeLayout.LayoutParams)_btnClose.LayoutParameters;

            par.AddRule(LayoutRules.AlignParentRight, 0);
            par.AddRule(LayoutRules.AlignParentLeft);

            _btnClose.LayoutParameters = par;

            _Mappa = JsonConvert.DeserializeObject <Mappa>(Intent.GetStringExtra("mappa"));           //(Mappa)ActivitiesBringe.GetObject();

            _MapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_MapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeNormal)
                                              .InvokeZoomControlsEnabled(false)
                                              .InvokeCompassEnabled(true);

                FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _MapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(_contentView.Id, _MapFragment, "map");
                fragTx.Commit();
            }

            SetupMapIfNeeded();
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View root = inflater.Inflate(Resource.Layout.MatchDetail, container, false);

            root.FindViewById <TextView>(Resource.Id.leagueName).Text = League.Name + " " + Match.Round.ToString() + ". forduló";

            int resourceId = Context.Resources.GetIdentifier(League.Country.ToString().ToLower(), "drawable", Context.PackageName);

            if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                root.FindViewById <ImageView>(Resource.Id.countryFlag).SetImageDrawable(Context.Resources.GetDrawable(resourceId, Context.ApplicationContext.Theme));
            }
            else
            {
                root.FindViewById <ImageView>(Resource.Id.countryFlag).SetImageDrawable(Context.Resources.GetDrawable(resourceId));
            }

            root.FindViewById <TextView>(Resource.Id.date).Text           = Match.Date.ToShortDateString();
            root.FindViewById <TextView>(Resource.Id.stadiumName).Text    = Stadium.Name;
            root.FindViewById <TextView>(Resource.Id.stadiumAddress).Text = Stadium.Address;

            FragmentManager     fm = Activity.SupportFragmentManager;
            FragmentTransaction ft = fm.BeginTransaction();

            Fragment fragment = ListFragment.Instance(Referees.Select(r => new ListModel {
                Text = r.Name, Object = r
            }), "referees");

            ft.Add(Resource.Id.refereees_container, fragment);
            ft.Commit();

            return(root);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(R.Layout.fragment_stack);

            // Watch for button clicks.
            Button button = (Button)FindViewById(R.Id.new_fragment);

            button.Click += (s, x) => AddFragmentToStack();

            button        = (Button)FindViewById(R.Id.home);
            button.Click += (s, x) =>
            {
                // If there is a back stack, pop it all.
                FragmentManager fm = GetSupportFragmentManager();
                if (fm.GetBackStackEntryCount() > 0)
                {
                    fm.PopBackStack(fm.GetBackStackEntryAt(0).GetId(),
                                    Android.Support.V4.App.FragmentManager.POP_BACK_STACK_INCLUSIVE);
                }
            };

            if (savedInstanceState == null)
            {
                // Do first time initialization -- Add initial fragment.
                Fragment            newFragment = CountingFragment.NewInstance(mStackLevel);
                FragmentTransaction ft          = GetSupportFragmentManager().BeginTransaction();
                ft.Add(R.Id.simple_fragment, newFragment).Commit();
            }
            else
            {
                mStackLevel = savedInstanceState.GetInt("level");
            }
        }
        /// <summary>
        /// Ons the create.
        /// </summary>
        /// <param name="savedInstanceState">Saved instance state.</param>
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            //Layout gets inflated here
            base.OnCreate(savedInstanceState);

            viewModel = new MovieExplorerViewModel();

            await viewModel.LoadModels(AppConfig.TopRated);

            await viewModel.LoadModels(AppConfig.Popular);

            await viewModel.LoadModels(AppConfig.NowPlaying);

            // Create a new fragment and a transaction.
            FragmentTransaction  fragmentTx = this.FragmentManager.BeginTransaction();
            MovieCategoryAdapter adapter    = new MovieCategoryAdapter(this, viewModel);

            MovieCategoryFragment <MovieExplorerViewModel> aCategoryFragment = new MovieCategoryFragment <MovieExplorerViewModel>(viewModel, adapter, async() =>
            {
                viewModel.Categories.Clear();
                await viewModel.LoadModels(AppConfig.TopRated);
                await viewModel.LoadModels(AppConfig.Popular);
                await viewModel.LoadModels(AppConfig.NowPlaying);
            });

            // The fragment will have the ID of Resource.Id.fragment_container.
            fragmentTx.Add(Resource.Id.movie_explorer_container, aCategoryFragment);

            // Commit the transaction.
            fragmentTx.Commit();

            //Turn off back arrows
            SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            SupportActionBar.SetHomeButtonEnabled(false);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Load the fragment used by both layouts (landscape and portrait)
            // Note: The fragment has the ID of its container
            FragmentTransaction ft        = FragmentManager.BeginTransaction();
            Fragment            helloFrag = FragmentManager.FindFragmentById(Resource.Id.fragLayout);

            if (helloFrag != null)
            {
                ft.Remove(helloFrag);
            }
            helloFrag = new HelloFrag();
            ft.Add(Resource.Id.fragLayout, helloFrag);
            ft.Commit();

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button> (Resource.Id.myButton);

            button.Click += delegate {
                button.Text = string.Format("{0} clicks!", count++);
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += FabOnClick;

            FloatingActionButton fabReport = FindViewById <FloatingActionButton>(Resource.Id.fabReport);

            fabReport.Click += FabReportOnClick;

            Android.Content.Res.ColorStateList csl = new Android.Content.Res.ColorStateList(new int[][] { new int[0] }, new int[] { Android.Graphics.Color.ParseColor("#c62828") });
            fabReport.BackgroundTintList = csl;

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

            navigation.SetOnNavigationItemSelectedListener(this);

            ft = FragmentManager.BeginTransaction();
            ft.SetCustomAnimations(Resource.Animator.enter_from_left, Resource.Animator.exit_to_right);
            ft.AddToBackStack(null);
            ft.Add(Resource.Id.FrameLayout, new MapsFragment());
            ft.Commit();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.UsersActivity);

            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            toolbar.Title = "Knock Detector";
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.NavigationClick += (s, e) =>
            {
                OnBackPressed();
            };

            FragmentTransaction transaction   = FragmentManager.BeginTransaction();
            UsersFragment       usersFragment = new UsersFragment();

            transaction.Add(Resource.Id.container, usersFragment, "USERS_FRAGMENT");
            transaction.Commit();


            FragmentManager.BackStackChanged += (s, e) =>
            {
                if (FragmentManager.BackStackEntryCount > 0)
                {
                    SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                }
                else
                {
                    SupportActionBar.SetDisplayHomeAsUpEnabled(false);
                }
            };
        }
Exemple #23
0
        //Marker _firstMarker;
        //Marker _secondMarker;
        //Marker _thirdMarker;

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Maps);

            _pDialog = new ProgressDialog(this);
            _pDialog.Indeterminate = true;
            _pDialog.SetProgressStyle(ProgressDialogStyle.Spinner);
            _pDialog.SetMessage("Chargement...");
            _pDialog.SetCancelable(true);
            _pDialog.Show();

            _locationManager = GetSystemService(Context.LocationService) as LocationManager;

            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_mapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeSatellite)
                                              .InvokeZoomControlsEnabled(false)
                                              .InvokeCompassEnabled(true);

                FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.Commit();
            }
            _mapFragment.GetMapAsync(this);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);


            // Create ActionBarDrawerToggle button and add it to the toolbar
            var toolbar = FindViewById <V7Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);


            var drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.drawer_open, Resource.String.drawer_close);

            drawerLayout.SetDrawerListener(drawerToggle);
            drawerToggle.SyncState();


            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            SetupDrawerContent(navigationView);
            drawerLayout.CloseDrawers();
            FragmentTransaction transcation = FragmentManager.BeginTransaction();

            src.Fragments.HomeFragment signup = new src.Fragments.HomeFragment();
            transcation.Add(Resource.Id.container, signup);
            transcation.Commit();
        }
Exemple #25
0
        public void OnCheckedChanged(RadioGroup group, int checkedId)
        {
            for (int i = 0; i < rgs.ChildCount; i++)
            {
                if (rgs.GetChildAt(i).Id == checkedId)
                {
                    Fragment            fragment = fragments[i];
                    FragmentTransaction ft       = obtainFragmentTransaction(i);

                    GetCurrentFragment().OnPause();
                    if (fragment.IsAdded)
                    {
                        fragment.OnResume();
                    }
                    else
                    {
                        ft.Add(fragmentcontentid, fragment);
                    }
                    showTab(i);// 显示目标tab
                    ft.Commit();

                    if (null != onRgsExtraCheckedChangedListener)
                    {
                        onRgsExtraCheckedChangedListener.OnRgsExtraCheckedChanged(group, checkedId, i);
                    }
                }
            }
        }
 public void ShowLogin()
 {
     Transaction = FragmentManager.BeginTransaction();
     LoginDialog.SetStyle(DialogFragmentStyle.Normal, Resource.Style.Theme_Dialog);
     Transaction.Add(LoginDialog, "Login");
     Transaction.CommitAllowingStateLoss();
 }
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            MyView myholder = holder as MyView;

            myholder.Task.Text = Mitems[position].Task_name;
            //  myholder.Description.Text = Mitems[position].Description;
            myholder.Deadline_date.Text = Mitems[position].deadline_date.ToString();
            DateTime dateTime = DateTime.Parse(Mitems[position].deadline_date);

            //   myholder.Mark_to.Text = Mitems[position].mark_to;
            //myholder.Task_status.Text = Mitems[position].task_status;
            myholder.Description.Text = Mitems[position].mark_to;
            var local = new LocalOnClickListener();

            myholder.Linear.SetOnClickListener(local);
            local.HandleOnClick = () =>
            {
                string id = Mitems[position].Task_id;
                ComplainceFrag_OutBox nextFrag = new ComplainceFrag_OutBox();
                FragmentTransaction   ft       = fragment.BeginTransaction();
                ft.Hide(fragment.FindFragmentByTag("MainFrag"));
                ft.Add(Resource.Id.container, nextFrag, "ComplainceFrag_OutBox");
                ft.AddToBackStack(null);
                ft.SetTransition(FragmentTransaction.TransitFragmentOpen);
                ft.Commit();
                // fragment.BeginTransaction().Replace(Resource.Id.container, nextFrag).Commit();
                Bundle bundle = new Bundle();
                bundle.PutString("task_id", id);
                nextFrag.Arguments = bundle;
            };
            myholder.time_left.Text = date_difference(DateTime.Now, dateTime);
            //  myholder.time_left.Text = date_difference(DateTime.Now, Mitems[position].deadlineDate);
        }
Exemple #28
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.navigation_home:

                FragmentManager.BeginTransaction().Remove(FragmentManager.FindFragmentById(Resource.Id.FrameLayout)).Commit();
                ft = FragmentManager.BeginTransaction();
                ft.SetCustomAnimations(Resource.Animator.enter_from_left, Resource.Animator.exit_to_right);
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.FrameLayout, new HomeFragment());
                ft.Commit();

                return(true);


            case Resource.Id.navigation_notifications:

                FragmentManager.BeginTransaction().Remove(FragmentManager.FindFragmentById(Resource.Id.FrameLayout)).Commit();
                ft = FragmentManager.BeginTransaction();
                ft.SetCustomAnimations(Resource.Animator.enter_from_left, Resource.Animator.exit_to_right);
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.FrameLayout, new NotificationFragment());
                ft.Commit();

                return(true);
            }
            return(false);
        }
        protected virtual void PushChildFragment(FragmentManager fragmentManager, FragmentTransaction fragmentTransaction, string fragmentName, IMvxViewModel viewModel)
        {
            var newFragment = fragmentManager.FindFragmentByTag(fragmentName);

            if (newFragment != null)
            {
                if (newFragment.IsDetached)
                {
                    if (newFragment is IMvxFragmentView mvxFragment)
                    {
                        mvxFragment.ViewModel = viewModel;
                    }

                    fragmentTransaction.Attach(newFragment);
                }
            }
            else
            {
                var fragment = CreateFragment(fragmentName);
                fragment.ViewModel = viewModel;

                var fragmentView = fragment as Fragment;

                if (fragmentView != null)
                {
                    fragmentTransaction.Add(FragmentContentId, fragmentView, fragmentName);
                }
            }
        }
Exemple #30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="bundle"></param>
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.activity_main);
            Bundle           args         = new Bundle();
            MainMenuFragment mainMenuFrag = MainMenuFragment.NewInstance(args);

            FragmentTransaction transaction = FragmentManager.BeginTransaction();

            transaction.Add(Resource.Id.main_menu_container, mainMenuFrag).Commit();
            _nfcAdapter = NfcAdapter.GetDefaultAdapter(this);
            _bluetooth  = new Bluetooth
            {
                Adapter = BluetoothAdapter.DefaultAdapter
            };

            string operation = Intent.GetStringExtra("Operation");
            string activity  = Intent.GetStringExtra("Activity");

            //if (activity == null)
            //    activity = "NFCUtilities";
            //if (operation == null)
            //    operation = "Application Run";
            //Toast.MakeText(Application.Context, string.Format("MainActivity {0} {1} {2} {3}", "Launch Intent Activity=", activity, ", Operation=", operation), ToastLength.Long).Show();

            LauchActivity(activity);
        }
		/**
		 * 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();
		}
        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);
            }

        }
		private void initalizeFragment(string activeFragmentTag, Fragment frag) {
			activeFragment = activeFragmentTag;
			trans = FragmentManager.BeginTransaction();
			trans.Add(Resource.Id.teamDetailsFragmentContainer, frag, activeFragmentTag);
			trans.CommitAllowingStateLoss();
		}