private void SetUpRecyclerView(RecyclerView projectsRecyclerView)
        {
            var projects = ProjectsLogic.DownloadProjects();

            projectsRecyclerView.SetLayoutManager(new LinearLayoutManager(projectsRecyclerView.Context));
            projectsRecyclerView.SetAdapter(new ProjectRecyclerViewAdapter(Activity, projects));
        }
 public override void OnCreate(Bundle savedInstanceState)
 {
     if (savedInstanceState != null)
     {
         _project = ProjectsLogic.DownloadProjects()
                    .Find(p => p.Name == savedInstanceState.GetString("projectName"));
     }
     base.OnCreate(savedInstanceState);
 }
Esempio n. 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            SetContentView(Resource.Layout.activity_main);

            SupportToolbar toolbar = FindViewById <SupportToolbar>(Resource.Id.mainToolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            _drawerLayout   = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            _navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            if (_navigationView != null)
            {
                SetupDrawerContent(_navigationView);
            }

            var projectName      = savedInstanceState?.GetString("projectName");
            var previousMenuItem = savedInstanceState?.GetInt("menuItem");

            if (projectName != null)
            {
                CurrentProject = ProjectsLogic.DownloadProjects().Find(p => p.Name == projectName);
                CurrentProject.ProjectRules = RulesHelper.DownloadRules(Assets);
                ActivateProjectSubmenu(CurrentProject);
            }

            if (previousMenuItem != null && _navigationView != null)
            {
                _previousMenuItem = _navigationView.Menu.FindItem((int)previousMenuItem);
                _previousMenuItem.SetChecked(true);
            }

            _searchQuery = savedInstanceState?.GetString("searchQuery") ?? string.Empty;

            base.OnCreate(savedInstanceState);
            if (savedInstanceState == null)
            {
                LoadProjectsListFragment();
            }
        }