Ejemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.ConfigTables);
            suppToolbar         = FindViewById <SupportToolbar>(Resource.Id.toolbar);
            drawerLayout        = FindViewById <DrawerLayout>(Resource.Id.Drawer);
            viewDrawer          = FindViewById <ListView>(Resource.Id.ListView);
            mUserName           = FindViewById <TextView>(Resource.Id.drawerUsername);
            mUserNameAndSurname = FindViewById <TextView>(Resource.Id.drawerUserNameSurname);

            if (SupportFragmentManager.FindFragmentByTag("Fragment1") != null)
            {
                mFragmentConfigTables = SupportFragmentManager.FindFragmentByTag("Fragment1") as FragmentConfigTablesAndColumns;
            }
            else
            {
                mFragmentConfigTables = new FragmentConfigTablesAndColumns();
                mFragmentParameters   = new FragmentParameters();

                var trans = SupportFragmentManager.BeginTransaction();
                trans.Add(Resource.Id.fragmentContainer, mFragmentConfigTables, "Fragment1");
                trans.Commit();

                mCurrentFragment = mFragmentConfigTables;
            }

            ISharedPreferences preferences = Application.Context.GetSharedPreferences("RememberMe", FileCreationMode.Private);
            string             UserName    = preferences.GetString("UserName", "");
            string             Name        = preferences.GetString("Name", "");
            string             Surname     = preferences.GetString("Surname", "");

            mUserName.Text           = UserName;
            mUserNameAndSurname.Text = Name + " " + Surname;

            listDrawer = new List <string>();
            listDrawer.Add("Configuration columns");
            listDrawer.Add("Configuration table");
            listDrawer.Add("Stats columns");
            listDrawer.Add("Stats tables");
            listDrawer.Add("User table");

            adapterDrawer      = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, listDrawer);
            viewDrawer.Adapter = adapterDrawer;

            viewDrawer.ItemClick += ViewDrawer_ItemClick;

            SetSupportActionBar(suppToolbar);

            drawerToogle = new MyActionBarDrawerToggle(this /*host*/, drawerLayout, Resource.String.open_drawer, Resource.String.close_drawer);

            drawerLayout.SetDrawerListener(drawerToogle);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            drawerToogle.SyncState();
        }
Ejemplo n.º 2
0
 public string GetFragmentParameter(string name)
 {
     return(FragmentParameters.FirstOrDefault(x => x.Key == name).Value);
 }