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 import android.content.res.Resources; 20 import android.graphics.Bitmap; 21 import android.graphics.BitmapFactory; 22 import android.graphics.drawable.Drawable; 23 24 public class DirectoryEntry { 25 private String name; 26 private int resID; 27 DirectoryEntry(String name, int resID)28 public DirectoryEntry(String name, int resID) { 29 this.name = name; 30 this.resID = resID; 31 } 32 getName()33 public String getName() { 34 return name; 35 } 36 getDrawable(Resources res)37 public Drawable getDrawable(Resources res) { 38 return res.getDrawable(resID); 39 } 40 getBitmap(Resources res)41 public Bitmap getBitmap(Resources res) { 42 return BitmapFactory.decodeResource(res, resID); 43 } 44 } 45