Exemplo n.º 1
0
        private void selectItem(int position)
        {
            // update the main content by replacing fragments
            var fragment = DisplayFragment.NewInstance();

            if (position == 0)
            {
                fragment = DisplayFragment.NewInstance();
            }
            else if (position == 1)
            {
                fragment = SettingsFragment.NewInstance();
            }
            else if (position == 2)
            {
                fragment = HelpFragment.NewInstance();
            }

            var fragmentManager = this.FragmentManager;
            var ft = fragmentManager.BeginTransaction();

            ft.Replace(Resource.Id.content_frame, fragment);
            ft.Commit();

            // update selected item title, then close the drawer
            mDrawerLayout.CloseDrawer(mDrawerList);
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // If a setting that requires changes to the main activity has changed
            // return a result telling it to recreate.
            _shouldRecreateMain = savedInstanceState != null && savedInstanceState.GetBoolean("shouldRecreateMain", false);
            _preferences        = new PreferenceWrapper(this);

            SetContentView(Resource.Layout.activitySettings);
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            SupportActionBar.SetTitle(Resource.String.settings);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_action_arrow_back);

            var prefs = PreferenceManager.GetDefaultSharedPreferences(this);

            prefs.RegisterOnSharedPreferenceChangeListener(this);

            _fragment = new SettingsFragment();
            _fragment.PreferencesCreated += delegate
            {
                UpdateBackupRemindersEnabled(prefs);
                UpdateSecuritySettingsEnabled();
            };

            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.layoutFragment, _fragment)
            .Commit();
        }
Exemplo n.º 3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            global::Xamarin.Forms.Forms.Init(this, bundle);
            SetContentView(Resource.Layout.Main);
            //  SQLiteClientBase<GlobalOption> globalOption = new SQLiteClientBase<GlobalOption>();


            //  var root = FindViewById<LinearLayout>(Resource.Id.ll_main_layout);

            /**
             * Intial view */
            InitView();


            navigationView.NavigationItemSelected += OnNavigationItemSelected;

            homeFragment         = new HomeFragment(this);
            settingsFragment     = new SettingsFragment(this);
            registrationFragment = new RegistrationFragment(this);
            mStackFragments      = new Stack <SupportFragment>();

            var trans = SupportFragmentManager.BeginTransaction();

            trans.Add(Resource.Id.fragmentContainer, homeFragment, "homeFragment");
            trans.Commit();

            mCurrentFragment = homeFragment;

            /**
             * get the theme
             */
        }
Exemplo n.º 4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            _settingsFragment = new SettingsFragment();

            _settingsFragment.DidChangedRepoEventHandler += (s, repoId) =>
            {
                Intent returnIntent = new Intent();
                returnIntent.PutExtra("didChangeRepo", repoId != 0);
                returnIntent.PutExtra("repoId", repoId);
                SetResult(Result.Ok, returnIntent);
                this.Finish();
            };

            _settingsFragment.DidEraseData += (s, a) =>
            {
                var i = BaseContext.PackageManager.GetLaunchIntentForPackage(BaseContext.PackageName);
                i.SetFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask | ActivityFlags.ClearTask);
                StartActivity(i);
            };



            SupportFragmentManager.BeginTransaction()
            .Replace(Android.Resource.Id.Content, _settingsFragment)
            .Commit();
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            if (_drawerToggle.OnOptionsItemSelected(item))
            {
                return(true);
            }

            switch (item.ItemId)
            {
            case Resource.Id.action_websearch:
            {
                var intent = new Intent(Intent.ActionWebSearch);
                intent.PutExtra(SearchManager.Query, ActionBar.Title);

                if ((intent.ResolveActivity(PackageManager)) != null)
                {
                    StartActivity(intent);
                }
                else
                {
                    Toast.MakeText(this, Resource.String.app_not_available, ToastLength.Long).Show();
                }
                return(true);
            }

            case Resource.Id.action_login:
            {
                var intent = new Intent(this, typeof(AccLogInAct));
                intent.AddFlags(ActivityFlags.ClearTop);
                StartActivity(intent);
                return(true);
            }

            case Resource.Id.action_settings:
            {
                //Для deselect'а в NavDrawer'е
                string visibleFragmentTag   = FragmentManager.FindFragmentById(Resource.Id.content_frame).Tag;
                var    fragmentTagMenuArray = Resources.GetStringArray(Resource.Array.FragmentTagMenuArray);
                int    index = Array.IndexOf(fragmentTagMenuArray, visibleFragmentTag);
                _drawerList.SetItemChecked(index, false);

                var settingsFragmentTag = "settingsfragment";
                var fragment            = new SettingsFragment();
                FragmentManager.BeginTransaction()
                .Replace(Resource.Id.content_frame, fragment, settingsFragmentTag)
                .AddToBackStack(settingsFragmentTag)
                .SetTransition(FragmentTransit.FragmentFade)
                .Commit();

                //actionBarState = Array.IndexOf(fragmentTagMenuArray, settingsFragmentTag);
                //InvalidateOptionsMenu();
                return(true);
            }

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }
Exemplo n.º 6
0
        static Config()
        {
            settings = new SynchronizedSettings("Phoenix");
            userSettings = new SettingsFragment(settings, "UserSettings");
            profile = null;
            packetLogging = new PacketLogging(settings);

            groundFindDistance = new SettingInt32Entry(settings, 8, "FindDistance", "Config", "World");
            resyncInterval = new SettingInt32Entry(settings, 5, "ResyncInterval", "Config");
            resyncInterval.Changed += new EventHandler(resyncInterval_Changed);
        }
Exemplo n.º 7
0
        static Config()
        {
            settings      = new SynchronizedSettings("Phoenix");
            userSettings  = new SettingsFragment(settings, "UserSettings");
            profile       = null;
            packetLogging = new PacketLogging(settings);

            groundFindDistance      = new SettingInt32Entry(settings, 8, "FindDistance", "Config", "World");
            resyncInterval          = new SettingInt32Entry(settings, 5, "ResyncInterval", "Config");
            resyncInterval.Changed += new EventHandler(resyncInterval_Changed);
        }
Exemplo n.º 8
0
        public override Android.Support.V4.App.Fragment GetItem(int position)
        {
            switch (position)
            {
            case 0: return(VplanFragment.NewInstance(true));

            case 1: return(VplanFragment.NewInstance(false));

            case 2: return(SettingsFragment.NewInstance());
            }
            return(null);
        }
Exemplo n.º 9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            mCheckoutFragment     = new CheckoutFragment();
            mProductsFragment     = new ProductsFragment();
            mCustomersFragment    = new CustomersFragment();
            mTransactionsFragment = new TransactionsFragment();
            mSettingsFragment     = new SettingsFragment();
            mStackFragment        = new Stack <SupportFragment>();

            SupportToolbar toolBar = FindViewById <SupportToolbar>(Resource.Id.main_toolbar);

            SetSupportActionBar(toolBar);

            SupportActionBar ab = SupportActionBar;

            ab.SetHomeAsUpIndicator(Resource.Drawable.menu_icon_small);
            ab.SetDisplayHomeAsUpEnabled(true);
            ab.SetTitle(Resource.String.checkout_title);

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

            NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            if (navigationView != null)
            {
                SetUpDrawerContent(navigationView);
            }

            var trans = SupportFragmentManager.BeginTransaction();

            trans.Add(Resource.Id.fragmentContainer, mSettingsFragment, "SettingsFragment");
            trans.Hide(mSettingsFragment);
            trans.Add(Resource.Id.fragmentContainer, mTransactionsFragment, "TransactionsFragment");
            trans.Hide(mTransactionsFragment);
            trans.Add(Resource.Id.fragmentContainer, mCustomersFragment, "CustomersFragment");
            trans.Hide(mCustomersFragment);
            trans.Add(Resource.Id.fragmentContainer, mProductsFragment, "ProductsFragment");
            trans.Hide(mProductsFragment);

            trans.Add(Resource.Id.fragmentContainer, mCheckoutFragment, "CheckoutFragment");

            trans.Commit();

            mCurrentFragment = mCheckoutFragment;
        }
Exemplo n.º 10
0
        public override Fragment GetItem(int position)
        {
            switch ((MainTabTypes)position)
            {
            case MainTabTypes.MyLibrary:
                return(MyLibraryFragment.Instantiate());

            case MainTabTypes.Network:
                return(NetworkFragment.Instantiate());

            case MainTabTypes.Settings:
                return(SettingsFragment.Instantiate());
            }

            throw new ArgumentOutOfRangeException("Could not handle position " + position);
        }
Exemplo n.º 11
0
        internal ProfileConfig(string profilesFolder)
        {
            profileChanged = new DefaultPublicEvent();

            loader = new SettingsLoader(profilesFolder);
            profileName = null;
            settings = new SynchronizedSettings("Profile");
            userSettings = new SettingsFragment(settings, "UserSettings");

            maxJournalLen = new SettingInt32Entry(settings, 500, "MaxJournalLen", "Config");
            overrideSpeechColor = new SettingBoolEntry(settings, false, "OverrideSpeechColor", "Config");

            colors = new ColorsConfig(settings);
            window = new WindowConfig(settings);

            fpsLimit = new SettingInt32Entry(settings, 0, "fps", "Config", "FpsLimiter");
        }
Exemplo n.º 12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            this.RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait;
            SetContentView(Resource.Layout.Tabs);

            m_TabLayout              = FindViewById <TabLayout>(Resource.Id.mainTabLayout);
            m_TabLayout.TabSelected += TabLayout_TabSelected;
            createTabLayoutIconsAndText();

            // create fragments
            m_ExploreFragment  = new ExploreFragment();
            m_MapFragment      = new MapFragment();
            m_SettingsFragment = new SettingsFragment();
            m_MyMarksFragment  = new MyMarksFragment();
            navigateToFragment(m_ExploreFragment);
        }
Exemplo n.º 13
0
        internal ProfileConfig(string profilesFolder)
        {
            profileChanged = new DefaultPublicEvent();

            loader       = new SettingsLoader(profilesFolder);
            profileName  = null;
            settings     = new SynchronizedSettings("Profile");
            userSettings = new SettingsFragment(settings, "UserSettings");

            maxJournalLen       = new SettingInt32Entry(settings, 500, "MaxJournalLen", "Config");
            overrideSpeechColor = new SettingBoolEntry(settings, false, "OverrideSpeechColor", "Config");

            colors = new ColorsConfig(settings);
            window = new WindowConfig(settings);

            fpsLimit = new SettingInt32Entry(settings, 0, "fps", "Config", "FpsLimiter");
        }
Exemplo n.º 14
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Settings);

            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            if (savedInstanceState == null)
            {
                //Fragment manager / transaction
                var fragTx = this.FragmentManager.BeginTransaction();
                SettingsFragment settingsFragment = new SettingsFragment();

                fragTx.Add(Resource.Id.SettingsContentFrame, settingsFragment);
                fragTx.Commit();
            }
        }
Exemplo n.º 15
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            AndroidX.Fragment.App.Fragment existingFragment;
            existingFragment = SupportFragmentManager.FindFragmentByTag("CHK");
            if (existingFragment != null)
            {
                SupportFragmentManager.PopBackStackImmediate(existingFragment.Id, 0);
            }
            existingFragment = SupportFragmentManager.FindFragmentByTag("STS");
            if (existingFragment != null)
            {
                SupportFragmentManager.PopBackStackImmediate(existingFragment.Id, 0);
            }
            existingFragment = SupportFragmentManager.FindFragmentByTag("ABT");
            if (existingFragment != null)
            {
                SupportFragmentManager.PopBackStackImmediate(existingFragment.Id, 0);
            }

            AndroidX.Fragment.App.Fragment fragment;
            if (item.ItemId == Resource.Id.menu_about)
            {
                _fragmentTag = "ABT";
                fragment     = AboutFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.aboutTitle);
                _navigation.Visibility = ViewStates.Gone;
                _menu.FindItem(Resource.Id.menu_share).SetVisible(false);
                SupportFragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, fragment, _fragmentTag).Commit();
            }

            if (item.ItemId == Resource.Id.menu_settings)
            {
                _fragmentTag = "SET";
                fragment     = SettingsFragment.NewInstance(_settingsService, Container.Resolve <IWorkerService>());
                SupportActionBar.SetTitle(Resource.String.settingsTitle);
                _navigation.Visibility = ViewStates.Gone;
                _menu.FindItem(Resource.Id.menu_share).SetVisible(false);
                SupportFragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, fragment, _fragmentTag).Commit();
            }

            _eventService.OnMenuItemPressedEvent(new MenuItemPressedEventArgs(item.TitleFormatted.ToString(), _fragmentTag));
            //_eventService.OnSpareEvent(new EventArgs());
            return(base.OnOptionsItemSelected(item));
        }
Exemplo n.º 16
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            RequestedOrientation = ScreenOrientation.Portrait;
            SetContentView(Resource.Layout.activity_settings);

            var toolbar = FindViewById <Toolbar>(Resource.Id.main_toolbar);

            SetSupportActionBar(toolbar);

            SupportActionBar.Title = "Settings";
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(false);

            FragmentManager.BeginTransaction()
            .AddToBackStack(null)
            .Add(Resource.Id.frame_layout, SettingsFragment.Instantiate())
            .Commit();
        }
Exemplo n.º 17
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.actv_Settings);

            SetupToolbar(Resource.Id.settingsActv_toolbar);
            SetupNavigationMenu(Resource.Id.settingsActv_navigationDrawer);

            if (_settingsFrag == null)
            {
                _settingsFrag = new SettingsFragment();
                AndroidHelper.AddSupportFragment(SupportFragmentManager, _settingsFrag, Resource.Id.settingsActv_fragmentContainer, TagsType.SettingsFragment);
            }

            var adView    = FindViewById <Android.Gms.Ads.AdView>(Resource.Id.settingsActv_adView);
            var adRequest = new Android.Gms.Ads.AdRequest.Builder().Build();

            adView.LoadAd(adRequest);
        }
Exemplo n.º 18
0
        private Android.Support.V4.App.Fragment CreateNewFragment(int position)
        {
            Android.Support.V4.App.Fragment fragment;

            switch (position)
            {
            case 0:
                fragment = ActualFragment.Instance(ActualMatches.Where(m => m.State == StateEnum.Playing), ActualMatches.Where(m => m.State != StateEnum.Playing), ActualTeams, Leagues);
                break;

            case 1:
                fragment = Fragments.ListFragment.Instance(UoW.LeagueRepo.GetAllYear().Select(l => new ListModel {
                    Text = l.ToString(), Object = l
                }), "leagues", Resources.GetString(Resource.String.leagueSeasons));
                break;

            case 2:
                fragment = Fragments.ListFragment.Instance(UoW.LeagueRepo.GetAllYear().Select(l => new ListModel {
                    Text = l.ToString(), Object = l
                }), "teams", Resources.GetString(Resource.String.teamSeasons));
                break;

            case 3:
                fragment = PlayersFragment.Instance();
                break;

            case 4:
                fragment = RefereesFragment.Instance();
                break;

            case 5:
                fragment = SettingsFragment.Instance();

                break;

            default:
                fragment = null;
                break;
            }

            return(fragment);
        }
Exemplo n.º 19
0
    protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);
        SetContentView(Resource.Layout.layout_mainactivity);

        // create our fragments and initialise them early.
        if (FragmentList == null)
        {
            FragmentList = new Dictionary <string, Fragment>
            {
                { "main", MainFragment.NewInstance() },
                { "bugreport", BugReportFragment.NewInstance() },
                { "settings", SettingsFragment.NewInstance() }
            };
        }

        navigation = FindViewById <BottomNavigationView>(Resource.Id.bottom_nav);
        navigation.SetOnNavigationItemSelectedListener(this);
        navigation.SelectedItemId = Resource.Id.navigation_main;
    }
Exemplo n.º 20
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            AndroidX.Fragment.App.Fragment selectedFragment = null;
            switch (item.ItemId)
            {
            case Resource.Id.navigation_home:
                selectedFragment = new HomeFragment();
                break;

            case Resource.Id.cardSet_dashboard:
                selectedFragment = new CardSetsFragment();
                break;

            case Resource.Id.setting_dashboard:
                selectedFragment = new SettingsFragment();
                break;
            }
            this.SupportFragmentManager.BeginTransaction().Replace(Resource.Id.fragment_container, selectedFragment).Commit();
            return(true);
        }
Exemplo n.º 21
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            Fragment f;
            var      title = FindViewById <TextView>(Resource.Id.titlebar_title);

            switch (item.ItemId)
            {
            case Resource.Id.navigation_home:
                // textMessage.SetText(Resource.String.title_home);
                f = new RecommendationsFragment();
                FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, f).Commit();
                title.Text = "Рекомендации";
                return(true);

            case Resource.Id.navigation_tracks:
                f = new TracksFragment();
                FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, f).Commit();
                title.Text = "Ваша музыка";
                return(true);

            case Resource.Id.navigation_popular:
                f = new ToDoFragment();
                FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, f).Commit();
                title.Text = "Популярное";
                return(true);

            case Resource.Id.navigation_search:
                f = new SearchFragment();
                FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, f).Commit();
                title.Text = "Поиск";
                return(true);

            case Resource.Id.navigation_settings:
                f = new SettingsFragment();
                FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, f).Commit();
                title.Text = "Настройки";
                return(true);
            }
            return(false);
        }
Exemplo n.º 22
0
        private Fragment getCachedFragment(int itemId)
        {
            if (fragments.TryGetValue(itemId, out var fragment))
            {
                return(fragment);
            }

            switch (itemId)
            {
            case Resource.Id.MainTabTimerItem:
                fragment = new MainFragment {
                    ViewModel = getTabViewModel <MainViewModel>()
                };
                break;

            case Resource.Id.MainTabReportsItem:
                fragment = new ReportsFragment {
                    ViewModel = getTabViewModel <ReportsViewModel>()
                };
                break;

            case Resource.Id.MainTabCalendarItem:
                fragment = new CalendarFragment {
                    ViewModel = getTabViewModel <CalendarViewModel>()
                };
                break;

            case Resource.Id.MainTabSettinsItem:
                fragment = new SettingsFragment {
                    ViewModel = getTabViewModel <SettingsViewModel>()
                };
                break;

            default:
                throw new ArgumentException($"Unexpected item id {itemId}");
            }
            fragments[itemId] = fragment;
            return(fragment);
        }
Exemplo n.º 23
0
        private Fragment getCachedFragment(int itemId)
        {
            if (fragments.TryGetValue(itemId, out var fragment))
            {
                return(fragment);
            }

            switch (itemId)
            {
            case Resource.Id.MainTabTimerItem:
                var mainFragment = new MainFragment();
                mainFragment.ViewModel = ViewModel.Tabs[0] as MainViewModel;
                fragment = mainFragment;
                break;

            case Resource.Id.MainTabReportsItem:
                var reportsFragment = new ReportsFragment();
                reportsFragment.ViewModel = ViewModel.Tabs[1] as ReportsViewModel;
                fragment = reportsFragment;
                break;

            case Resource.Id.MainTabCalendarItem:
                var calendarFragment = new CalendarFragment();
                calendarFragment.ViewModel = ViewModel.Tabs[2] as CalendarViewModel;
                fragment = calendarFragment;
                break;

            case Resource.Id.MainTabSettinsItem:
                var settingsFragment = new SettingsFragment();
                settingsFragment.ViewModel = ViewModel.Tabs[3] as SettingsViewModel;
                fragment = settingsFragment;
                break;

            default:
                throw new ArgumentException($"Unexpected item id {itemId}");
            }
            fragments[itemId] = fragment;
            return(fragment);
        }
Exemplo n.º 24
0
        private void LoadScreen(SettingsCategory category)
        {
            PreferenceFragmentCompat newFragment;

            switch (category)
            {
            case SettingsCategory.Main:
                newFragment = new SettingsFragment();
                break;

            case SettingsCategory.Developer:
                newFragment = new DeveloperSettingsFragment();
                break;

            default:
                Log.Error(nameof(SettingsFragment), "Not implemented Settings category");
                return;
            }

            currentCategory = category;
            SupportFragmentManager.BeginTransaction().Replace(Resource.Id.fragment_container,
                                                              newFragment).Commit();
        }
Exemplo n.º 25
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            this.SetTheme(ChangeTheme.getTheme());
            SetContentView(Resource.Layout.Settings);

            var transaction = FragmentManager.BeginTransaction();
            var setFragment = new SettingsFragment();

            transaction.Replace(Resource.Id.container, setFragment);
            transaction.Commit();

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);
            ActionBar.Title = "Asetukset";

            ActionBar.SetHomeButtonEnabled(true); // Takaisin-painike päällä
            ActionBar.SetDisplayHomeAsUpEnabled(true);

            ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext);

            prefs.RegisterOnSharedPreferenceChangeListener(this);
        }
Exemplo n.º 26
0
        private void selectItem(int position)
        {
            switch (position)
            {
            case 0:
            {
                //Dashboard
                fragment = DashboardFragment.NewInstance();
                var fragmentManager = this.FragmentManager;
                var ft = FragmentManager.BeginTransaction();
                ft.Replace(Resource.Id.content_frame, fragment);
                ft.Commit();
                break;
            }

            case 1:
            {
                //Settings
                var fragment        = SettingsFragment.NewInstance();
                var fragmentManager = this.FragmentManager;
                var ft = FragmentManager.BeginTransaction();
                ft.Replace(Resource.Id.content_frame, fragment);
                ft.Commit();
                break;
            }

            case 2:
                //Logout
                LogoutAsync();
                break;
            }

            // update selected item title, then close the drawer
            Title = mOptionsTitles [position];
            mDrawerLayout.CloseDrawer(mDrawerList);
        }
Exemplo n.º 27
0
        void SetFragment(FRAGMENT_TYPE FragmentType)
        {
            if (FragmentType == CURRENT_FRAGMENT)
            {
                return;
            }
            CURRENT_FRAGMENT = FragmentType;
            SetToolbarTitle(GetString(TOOLBAR_TITLE[(int)FragmentType + 1]));
            Android.Support.V4.App.Fragment f = null;
            switch (FragmentType)
            {
            case FRAGMENT_TYPE.FRAGMENT_CHAT:
                SetToolbarTitle(StringResource.GetValueOrDefault("menuChats"));
                ShowHideSearchIcon(true);
                f = ChatListFragment.GetInstance();
                break;

            case FRAGMENT_TYPE.FRAGMENT_CALL:
                SetToolbarTitle(StringResource.GetValueOrDefault("menuCalls"));
                ShowHideSearchIcon(true);
                f = CallListFragment.GetInstance();
                break;

            case FRAGMENT_TYPE.FRAGMENT_ABOUT:
                ShowHideSearchIcon(false);
                break;

            case FRAGMENT_TYPE.FRAGMENT_EMPTY:
                ShowHideSearchIcon(false);
                break;

            //case FRAGMENT_TYPE.FRAGMENT_FAVOR:
            //SetToolbarTitle(StringResource.GetValueOrDefault("menuFavorite"));
            //ShowHideSearchIcon(false);
            //f = FavoriteFragment.GetInstance();
            //break;
            case FRAGMENT_TYPE.FRAGMENT_GROUP:
                SetToolbarTitle(StringResource.GetValueOrDefault("menuGroup"));
                ShowHideSearchIcon(true);
                f = GroupListFragment.GetInstance();
                break;

            case FRAGMENT_TYPE.FRAGMENT_STATUS:
                SetToolbarTitle(StringResource.GetValueOrDefault("menuStatus"));
                ShowHideSearchIcon(false);
                f = StatusFragment.GetInstance();
                break;

            case FRAGMENT_TYPE.FRAGMENT_ACCOUNT:
                SetToolbarTitle(StringResource.GetValueOrDefault("menuAccount"));
                ShowHideSearchIcon(false);
                f = AccountFragment.GetInstance();
                break;

            case FRAGMENT_TYPE.FRAGMENT_CONTACT:
                SetToolbarTitle(StringResource.GetValueOrDefault("menuContact"));
                ShowHideSearchIcon(true);
                f = ContactListFragment.GetInstance();
                break;

            case FRAGMENT_TYPE.FRAGMENT_SETTING:
                SetToolbarTitle(StringResource.GetValueOrDefault("menuSetting"));
                ShowHideSearchIcon(false);
                f = SettingsFragment.GetInstance();
                break;

            case FRAGMENT_TYPE.FRAGMENT_FEEDBACK:
                break;

            default:
                break;
            }

            AttachFragment(f);
        }
Exemplo n.º 28
0
        private void ListItemClicked(int position)
        {
            Android.Support.V4.App.Fragment fragment = null;
            string Tag = "";

            switch (position)
            {
            case 0:

                //Console.WriteLine ("Canvass clickkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
                fragment = new CanvassesFragment();
                Tag      = "canvassesFragment";
                SupportFragmentManager.PopBackStack();

//				try {
//					Console.WriteLine (" checking");
//					Android.Support.V4.App.FragmentTransaction ft = SupportFragmentManager.BeginTransaction ();
//					Console.WriteLine (" Fragments found"+SupportFragmentManager.Fragments.Count);
//					foreach (var item in SupportFragmentManager.Fragments) {
//						Console.WriteLine (" item"+item.ToString());
//						if (item.IsAdded) {
//							Console.WriteLine ("Deattaching item"+item.ToString());
//							ft.Detach (item);
//							Console.WriteLine ("done item"+item.ToString());
//						}
//
//					}
//					ft.Add(Resource.Id.content_frame, new CanvassesFragment(), "canvassesFragment");
//
//					ft.AddToBackStack (null);
//					ft.Commit ();
//				} catch (Exception ex) {
//					Console.WriteLine (" exception"+ex.Message);
//				}
//


                break;

            case 1:

                fragment = new mapFragment();
                SupportFragmentManager.PopBackStack();
                Tag = "mapFragment";
                break;

            case 2:
                fragment = new RegisterFragment();
                SupportFragmentManager.PopBackStack();
                Tag = "registerFragment";
                break;

            case 3:
                fragment = new SettingsFragment();
                SupportFragmentManager.PopBackStack();

                Tag = "settingsFragment";
                break;
            }
            try
            {
                SupportFragmentManager.BeginTransaction()
                .Replace(Resource.Id.content_frame, fragment, Tag)
                .Commit();
            }
            catch (Exception ex)
            {
                //Console.WriteLine ("Exception : " + ex.ToString());
            }

            this.m_DrawerList.SetItemChecked(position, true);
            SupportActionBar.Title = this.m_Title = Sections[position];
            this.m_Drawer.CloseDrawer(this.m_DrawerList);
        }
Exemplo n.º 29
0
        public void Inject(SettingsFragment fragment)
        {
            var container = Container.Create(modules);

            container.Inject(fragment);
        }
Exemplo n.º 30
0
            public static Fragment NewInstance()
            {
                Fragment fragment = new SettingsFragment();

                return(fragment);
            }
Exemplo n.º 31
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            try
            {
                SetContentView(Resource.Layout.activity_settings);

                var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
                SetSupportActionBar(toolbar);

                var extraTitleId = Intent.GetIntExtra(ExtraToolbarTitleId, -1);
                var extraTitle   = Intent.GetStringExtra(ExtraToolbarTitle);

                if (extraTitleId > 0)
                {
                    SupportActionBar.SetTitle(extraTitleId);
                }
                else if (!string.IsNullOrEmpty(extraTitle))
                {
                    SupportActionBar.Title = extraTitle;
                }
                else
                {
                    SupportActionBar.SetTitle(Resource.String.PreferencesTitle);
                }

                var widgetId      = Intent.GetIntExtra(AppWidgetManager.ExtraAppwidgetId, AppWidgetManager.InvalidAppwidgetId);
                var validWidgetId = widgetId != AppWidgetManager.InvalidAppwidgetId;
                _isActionAppwidGetConfigure = Intent.Action == AppWidgetManager.ActionAppwidgetConfigure;
                if (_isActionAppwidGetConfigure)
                {
                    if (!validWidgetId)
                    {
                        Finish();
                        return;
                    }

                    Intent.PutExtra(SettingsFragment.ExtraPreferenceXmlId, Resource.Xml.preferences_appwidget);

                    AppSettings.Default.DeleteAppWidgetSettings(new[] { widgetId });

                    _settings = AppSettings.Default.CreateAppWidgetSettings(widgetId);
                    AppSettings.Default.SaveAppWidgetSettings(_settings);

                    var intent = new Intent();
                    intent.PutExtra(AppWidgetManager.ExtraAppwidgetId, _settings.WidgetId);
                    SetResult(Result.Canceled, intent);
                }
                else
                {
                    if (Intent.GetBooleanExtra(ExtraWidget, false) && validWidgetId)
                    {
                        _widgetId = widgetId;
                    }
                }

                if (savedInstanceState == null)
                {
                    var fragment = new SettingsFragment();
                    using (var transaction = SupportFragmentManager.BeginTransaction())
                    {
                        transaction.Replace(Resource.Id.settingsContent, fragment);
                        transaction.Commit();
                    }
                }

                var usehomemenu = !_isActionAppwidGetConfigure;
                SupportActionBar.SetDisplayHomeAsUpEnabled(usehomemenu);
                SupportActionBar.SetHomeButtonEnabled(usehomemenu);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }
        private void ListItemClicked(int position)
        {
            //this way we don't load twice, but you might want to modify this a bit.
            if (position == oldPosition)
            {
                return;
            }

            oldPosition = position;

            Fragment fragment = null;

            switch (position)
            {
            case 0:
                fragment = FuelOrderFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.fuel_order_title);
                break;

            case 1:
                fragment = FuelCheckFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.fuel_check_title);
                break;

            case 2:
                fragment = BaggageDistributionFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.baggage_distribution_title);
                break;

            case 3:
                fragment = BrakeCoolingFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.brake_cooling_title);
                break;

            case 4:
                fragment = CircuitBreakerFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.circuit_breaker_title);
                break;

            case 5:
                fragment = ChecklistsFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.checklists_title);
                break;

            case 6:
                fragment = ManouversFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.manouvers_title);
                break;

            case 7:
                fragment = LimitationsFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.limitations_title);
                break;

            case 8:
                fragment = SettingsFragment.NewInstance();
                SupportActionBar.SetTitle(Resource.String.settings_title);
                break;
            }
            eventService.OnForceFragmentBackStackEvent(new System.EventArgs());
            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.content_frame, fragment)
            .Commit();

            //var fragmentManagerTransaction = SupportFragmentManager.BeginTransaction();
            //fragmentManagerTransaction.Replace(Resource.Id.content_frame, fragment);
            //fragmentManagerTransaction.AddToBackStack(null);
            //fragmentManagerTransaction.Commit();
        }