1 /* 2 * Copyright (C) 2010 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.android.gallery3d.app; 18 19 import android.content.Context; 20 import android.content.res.Resources; 21 22 import com.android.gallery3d.R; 23 import com.android.gallery3d.ui.AlbumSetSlotRenderer; 24 import com.android.gallery3d.ui.SlotView; 25 26 final class Config { 27 public static class AlbumSetPage { 28 private static AlbumSetPage sInstance; 29 30 public SlotView.Spec slotViewSpec; 31 public AlbumSetSlotRenderer.LabelSpec labelSpec; 32 33 public static synchronized AlbumSetPage get(Context context) { 34 if (sInstance == null) { 35 sInstance = new AlbumSetPage(context); 36 } 37 return sInstance; 38 } 39 40 private AlbumSetPage(Context context) { 41 Resources r = context.getResources(); 42 43 slotViewSpec = new SlotView.Spec(); 44 slotViewSpec.rowsLand = r.getInteger(R.integer.albumset_rows_land); 45 slotViewSpec.rowsPort = r.getInteger(R.integer.albumset_rows_port); 46 slotViewSpec.slotGap = r.getDimensionPixelSize(R.dimen.albumset_slot_gap); 47 48 labelSpec = new AlbumSetSlotRenderer.LabelSpec(); 49 labelSpec.labelBackgroundHeight = r.getDimensionPixelSize( 50 R.dimen.albumset_label_background_height); 51 labelSpec.titleOffset = r.getDimensionPixelSize( 52 R.dimen.albumset_title_offset); 53 labelSpec.countOffset = r.getDimensionPixelSize( 54 R.dimen.albumset_count_offset); 55 labelSpec.titleFontSize = r.getDimensionPixelSize( 56 R.dimen.albumset_title_font_size); 57 labelSpec.countFontSize = r.getDimensionPixelSize( 58 R.dimen.albumset_count_font_size); 59 labelSpec.leftMargin = r.getDimensionPixelSize( 60 R.dimen.albumset_left_margin); 61 labelSpec.iconSize = r.getDimensionPixelSize( 62 R.dimen.albumset_icon_size); 63 } 64 } 65 66 public static class AlbumPage { 67 private static AlbumPage sInstance; 68 69 public SlotView.Spec slotViewSpec; 70 71 public static synchronized AlbumPage get(Context context) { 72 if (sInstance == null) { 73 sInstance = new AlbumPage(context); 74 } 75 return sInstance; 76 } 77 78 private AlbumPage(Context context) { 79 Resources r = context.getResources(); 80 81 slotViewSpec = new SlotView.Spec(); 82 slotViewSpec.rowsLand = r.getInteger(R.integer.album_rows_land); 83 slotViewSpec.rowsPort = r.getInteger(R.integer.album_rows_port); 84 slotViewSpec.slotGap = r.getDimensionPixelSize(R.dimen.album_slot_gap); 85 } 86 } 87 88 public static class ManageCachePage extends AlbumSetPage { 89 private static ManageCachePage sInstance; 90 91 public final int cachePinSize; 92 public final int cachePinMargin; 93 94 public static synchronized ManageCachePage get(Context context) { 95 if (sInstance == null) { 96 sInstance = new ManageCachePage(context); 97 } 98 return sInstance; 99 } 100 101 public ManageCachePage(Context context) { 102 super(context); 103 Resources r = context.getResources(); 104 cachePinSize = r.getDimensionPixelSize(R.dimen.cache_pin_size); 105 cachePinMargin = r.getDimensionPixelSize(R.dimen.cache_pin_margin); 106 } 107 } 108 } 109 110