//private Android.Support.V7.Widget.SearchView _searchView; //dfdfds protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); string text = Intent.GetStringExtra("Account") ?? "Emeri"; string workMode = Intent.GetStringExtra("Password") ?? "Data not available"; //TO DO //if (workMode == "q") { WorkingInetAndSQL.DeleteRowsInDBIfNeed("events.sqlite"); }; FragmentLaunched = "main"; try { SetContentView(Resource.Layout.MainOld); } catch (Exception e) { var a = e; throw; } SupportActionBar.SetDisplayShowHomeEnabled(true); if (FragmentLaunched == "main") { try { FragmentManager.BeginTransaction() .Remove(_lastFragment); _lastFragment.Dispose(); } catch (Exception e) { var k = e.Message; } } //Первоначальная загрузка _flyOut = FindViewById <FlyOutContainer>(Resource.Id.FlyOutContainer); //ГЛАВНОЕ МЕНЮ контейнера var menuButton = FindViewById(Resource.Id.MenuButton); menuButton.Click += (sender, e) => { _flyOut.AnimatedOpened = !_flyOut.AnimatedOpened; }; // mess with fragments begin // var eventsListFragment = new EventsListFragment(); _lastFragment = eventsListFragment; var arguments = new Bundle(); arguments.PutString(EventsListFragment.Account, "Emeri"); arguments.PutString(EventsListFragment.Password, "Emeri"); eventsListFragment.Arguments = arguments; FragmentManager.BeginTransaction() .Add(Resource.Id.content_frame, eventsListFragment) .Commit(); //Избавляемся от фрагмента, если открываем профиль аккаунта - ProfileFragments var profileTextView = FindViewById <TextView>(Resource.Id.textView6); profileTextView.Click += (sender, args) => { var profileFragment = new ProfileFragment(); FragmentManager.BeginTransaction() .Remove(_lastFragment) .Add(Resource.Id.content_frame, profileFragment) .Commit(); _lastFragment.Dispose(); _lastFragment = profileFragment; _flyOut.ExternalyClosed(); }; //Избавляемся от фрагмента, если открываем события - EventListFragments var eventsListTextView = FindViewById <TextView>(Resource.Id.textView1); eventsListTextView.Click += (sender, args) => { var eventsListFragment2 = new EventsListFragment(); FragmentManager.BeginTransaction() .Remove(_lastFragment) .Add(Resource.Id.content_frame, eventsListFragment2) .Commit(); _lastFragment.Dispose(); _lastFragment = eventsListFragment2; _flyOut.ExternalyClosed(); }; }
//Switch для обработки выбора пунктов Navigation Drawer private void SelectItem(int position) { switch (position) { //Мероприятия case 0: { if (fragments[position] == null) { var fragment = new EventsListFragment(); fragments[position] = fragment; //_lastFragment = fragment; var arguments = new Bundle(); arguments.PutString(EventsListFragment.Account, "Emeri"); arguments.PutString(EventsListFragment.Password, "Emeri"); fragment.Arguments = arguments; FragmentManager.BeginTransaction() .Replace(Resource.Id.content_frame, fragment, "eventfragment") .AddToBackStack("eventfragment") .SetTransition(FragmentTransit.FragmentFade).Commit(); } else if (fragments[position].IsVisible) { } else { //var xyz = fragments[position].Tag; var fragmentTag = Resources.GetStringArray(Resource.Array.FragmentTagMenuArray)[position]; ChangeFragment(fragmentTag, position); } break; } //Календарь case 1: { if (fragments[position] == null) { var fragment = new CalendarFragment(); fragments[position] = fragment; var fragmentTag = Resources.GetStringArray(Resource.Array.FragmentTagMenuArray)[position]; ChangeFragment(fragmentTag, position); } else if (fragments[position].IsVisible) { } else { //var xyz = fragments[position].Tag; var fragmentTag = Resources.GetStringArray(Resource.Array.FragmentTagMenuArray)[position]; ChangeFragment(fragmentTag, position); } break; } //Мои события case 2: { if (fragments[position] == null) { var fragment = new MyEventsFragment(); fragments[position] = fragment; var fragmentTag = Resources.GetStringArray(Resource.Array.FragmentTagMenuArray)[position]; ChangeFragment(fragmentTag, position); } else if (fragments[position].IsVisible) { } else { //var xyz = fragments[position].Tag; var fragmentTag = Resources.GetStringArray(Resource.Array.FragmentTagMenuArray)[position]; ChangeFragment(fragmentTag, position); } break; } //Фильтрация case 3: { if (fragments[position] == null) { var fragment = new FiltrationFragment(); fragments[position] = fragment; var fragmentTag = Resources.GetStringArray(Resource.Array.FragmentTagMenuArray)[position]; ChangeFragment(fragmentTag, position); } else if (fragments[position].IsVisible) { } else { //var xyz = fragments[position].Tag; var fragmentTag = Resources.GetStringArray(Resource.Array.FragmentTagMenuArray)[position]; ChangeFragment(fragmentTag, position); } break; } //Профиль case 4: { if (fragments[position] == null) { var fragment = new ProfileFragment(); fragments[position] = fragment; var fragmentTag = Resources.GetStringArray(Resource.Array.FragmentTagMenuArray)[position]; ChangeFragment(fragmentTag, position); } else if (fragments[position].IsVisible) { } else { //var xyz = fragments[position].Tag; var fragmentTag = Resources.GetStringArray(Resource.Array.FragmentTagMenuArray)[position]; ChangeFragment(fragmentTag, position); } break; } default: break; } _drawerList.SetItemChecked(position, true); //ActionBar.Title = _title = _menuTitles[position]; _title = _menuTitles[position]; _drawer.CloseDrawer(_drawerList); }