protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.CategoriesList); try { // Initialize the SampleManager and create the Sample Categories. SampleManager.Current.Initialize(); _sampleCategories = SampleManager.Current.FullTree.Items.OfType <SearchableTreeNode>().ToList(); _filteredSampleCategories = _sampleCategories; // Set up the custom ArrayAdapter for displaying the Categories. var categoriesAdapter = new CategoriesAdapter(this, _sampleCategories); _categoriesListView = FindViewById <ExpandableListView>(Resource.Id.categoriesListView); _categoriesListView.SetAdapter(categoriesAdapter); _categoriesListView.ChildClick += CategoriesListViewOnChildClick; _categoriesListView.DividerHeight = 2; _categoriesListView.SetGroupIndicator(null); // Set up the search filtering. SearchView searchBox = FindViewById <SearchView>(Resource.Id.categorySearchView); searchBox.QueryTextChange += SearchBoxOnQueryTextChange; } catch (Exception ex) { Console.WriteLine(ex.Message); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.CategoriesList); try { // Initialize the SampleManager and create the Sample Categories. SampleManager.Current.Initialize(); _sampleCategories = SampleManager.Current.FullTree.Items.OfType <SearchableTreeNode>().ToList(); // Remove AR category if device does not support AR. try { var arSession = new Session(this); _arCompatible = true; } catch (UnavailableException ex) { Console.WriteLine(ex.Message); _arCompatible = false; } if (!_arCompatible) { _sampleCategories.RemoveAll(category => category.Name == "Augmented reality"); } _filteredSampleCategories = _sampleCategories; // Set up the custom ArrayAdapter for displaying the Categories. var categoriesAdapter = new CategoriesAdapter(this, _sampleCategories); _categoriesListView = FindViewById <ExpandableListView>(Resource.Id.categoriesListView); _categoriesListView.SetAdapter(categoriesAdapter); _categoriesListView.ChildClick += CategoriesListViewOnChildClick; _categoriesListView.DividerHeight = 2; _categoriesListView.SetGroupIndicator(null); // Set up the search filtering. SearchView searchBox = FindViewById <SearchView>(Resource.Id.categorySearchView); searchBox.QueryTextChange += SearchBoxOnQueryTextChange; // Add a button that brings up settings. Button settingsButton = FindViewById <Button>(Resource.Id.settingsButton); settingsButton.Click += (s, e) => PromptForKey(); // Check the existing API key for validity. _ = CheckApiKey(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.Inflate(Resource.Layout.categoriesLayout, null); ExpandableListView ex = (ExpandableListView)v.FindViewById(Resource.Id.expandableListView1); ex.SetAdapter(mAdapter); ex.SetGroupIndicator(null); ex.GroupClick += HandleSelect; return(v); }