public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            courseCategoryManager = new CourseCategoryManager();

            this.Title = "Categories";

            // get a reference to the tableView we're controlling
            UITableView tableView = this.View as UITableView;
            tableView.Source = new CategoryViewSource(courseCategoryManager);
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Create your application here

            //List<string> categoryTitles = new List<string>() { "Category a", "Category b", "Category c" };
            //ListAdapter= new ArrayAdapter<String>(this,Android.Resource.Layout.SimpleListItem1 , categoryTitles);

            courseCategoryManager = new CourseCategoryManager();
            ListAdapter = new CourseCategoryManagerAdapter(this, Android.Resource.Layout.SimpleListItem1, courseCategoryManager);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // load the main layout
            SetContentView(Resource.Layout.CourseActivity);

            courseCategoryManager = new CourseCategoryManager();
            courseCategoryManager.MoveFirst();
            String displayCategoryTitle = courseCategoryManager.Current.Title;

            //String displayCategoryTitle = DEFAULT_CATEGORY_TITLE;

            //Intent startupIntent = this.Intent;

            //if (startupIntent != null)
            //{
            //    String displayCategoryTitleExtra = startupIntent.GetStringExtra(DISPLAY_CATEGORY_TITLE_EXTRA);

            //    if (displayCategoryTitleExtra != null)
            //    {
            //        displayCategoryTitle = displayCategoryTitleExtra;
            //    }
            //}

            // create courseManager and move to start of courseList
            courseManager = new CourseManager(displayCategoryTitle);
            courseManager.MoveFirst();

            // coursePagerAdapter is used to link together the fragments and the data
            // SupportFragmentManager is a member of FragmentActivity, and allows us to manage fragments
            coursePagerAdapter = new CoursePagerAdapter(SupportFragmentManager, courseManager);

            // Sets the layout for each fragment
            viewPager = FindViewById<ViewPager>(Resource.Id.coursePager);

            viewPager.Adapter = coursePagerAdapter;

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

            categoryDrawerListView = FindViewById<ListView>(Resource.Id.categoryDrawerListView);

            categoryDrawerListView.Adapter = new CourseCategoryManagerAdapter(this, Resource.Layout.CourseCategoryItem, courseCategoryManager);

            categoryDrawerListView.SetItemChecked(0, true);

            categoryDrawerListView.ItemClick += categoryDrawerListView_ItemClick;
        }
Ejemplo n.º 4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.CourseActivity);

            //code with drawer
            courseCategoryManager = new CourseCategoryManager();
            courseCategoryManager.MoveFirst();

               String displayCategoryTitle = courseCategoryManager.Current.CategoryTitle;

              // String displayCategoryTitle = DEFAULT_CATEGORY_TITLE;

            //Intent startupIntent = this.Intent;
            //if (startupIntent != null)
            //{
            //    String displayCategoryTitleExtra = startupIntent.GetStringExtra(DISPLAY_CATEGORY_TITLE_EXTRA);
            //    if (displayCategoryTitleExtra != null)
            //        displayCategoryTitle = displayCategoryTitleExtra;
            //}

            courseManager = new CourseManager(displayCategoryTitle);
            courseManager.MoveFirst();

            coursePagerAdapter = new CoursePagerAdapter(SupportFragmentManager, courseManager);
            viewPager = FindViewById<ViewPager>(Resource.Id.coursePager);
            viewPager.Adapter = coursePagerAdapter;

            //drawer

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

            //categoryDrawerListView.Adapter =
            //    new CourseCategoryManagerAdapter(this, Android.Resource.Layout.SimpleListItem1, courseCategoryManager);

            categoryDrawerListView.Adapter =
                    new CourseCategoryManagerAdapter(this,Resource.Layout.CourseCategoryItem, courseCategoryManager);

            //android selected as default
            categoryDrawerListView.SetItemChecked(0, true);

            //click event for categories
            categoryDrawerListView.ItemClick += categoryDrawerListView_ItemClick;
        }
 public CategoryViewSource(CourseCategoryManager courseCategoryManager)
 {
     this.courseCategoryManager = courseCategoryManager;
 }