1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.example.android.hcgallery; 18 19 public class Directory { 20 private static DirectoryCategory[] mCategories; 21 initializeDirectory()22 public static void initializeDirectory() { 23 mCategories = new DirectoryCategory[] { 24 new DirectoryCategory("Balloons", new DirectoryEntry[] { 25 new DirectoryEntry("Red Balloon", R.drawable.red_balloon), 26 new DirectoryEntry("Green Balloon", R.drawable.green_balloon), 27 new DirectoryEntry("Blue Balloon", R.drawable.blue_balloon)}), 28 new DirectoryCategory("Bikes", new DirectoryEntry[] { 29 new DirectoryEntry("Old school huffy", R.drawable.blue_bike), 30 new DirectoryEntry("New Bikes", R.drawable.rainbow_bike), 31 new DirectoryEntry("Chrome Fast", R.drawable.chrome_wheel)}), 32 new DirectoryCategory("Androids", new DirectoryEntry[] { 33 new DirectoryEntry("Steampunk Android", R.drawable.punk_droid), 34 new DirectoryEntry("Stargazing Android", R.drawable.stargazer_droid), 35 new DirectoryEntry("Big Android", R.drawable.big_droid) }), 36 new DirectoryCategory("Pastries", new DirectoryEntry[] { 37 new DirectoryEntry("Cupcake", R.drawable.cupcake), 38 new DirectoryEntry("Donut", R.drawable.donut), 39 new DirectoryEntry("Eclair", R.drawable.eclair), 40 new DirectoryEntry("Froyo", R.drawable.froyo), }), }; 41 42 } 43 getCategoryCount()44 public static int getCategoryCount() { 45 return mCategories.length; 46 } 47 getCategory(int i)48 public static DirectoryCategory getCategory(int i) { 49 return mCategories[i]; 50 } 51 } 52