Owen Lin | a2fba68 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 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 | |
Owen Lin | a2fba68 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 19 | import android.content.Context; |
| 20 | import android.content.res.Resources; |
| 21 | |
Owen Lin | 73a04ff | 2012-03-14 17:27:24 +0800 | [diff] [blame] | 22 | import com.android.gallery3d.R; |
| 23 | import com.android.gallery3d.ui.AlbumSetView; |
| 24 | import com.android.gallery3d.ui.SlotView; |
| 25 | |
Owen Lin | a2fba68 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 26 | final class Config { |
| 27 | public static class AlbumSetPage { |
| 28 | private static AlbumSetPage sInstance; |
| 29 | |
Chih-Chung Chang | 07069de | 2011-09-14 20:50:28 +0800 | [diff] [blame] | 30 | public SlotView.Spec slotViewSpec; |
| 31 | public AlbumSetView.LabelSpec labelSpec; |
Owen Lin | a2fba68 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 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(); |
Chih-Chung Chang | 07069de | 2011-09-14 20:50:28 +0800 | [diff] [blame] | 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 AlbumSetView.LabelSpec(); |
Chih-Chung Chang | 70a73a7 | 2011-09-19 11:09:39 +0800 | [diff] [blame] | 49 | labelSpec.labelBackgroundHeight = r.getDimensionPixelSize( |
| 50 | R.dimen.albumset_label_background_height); |
Chih-Chung Chang | 07069de | 2011-09-14 20:50:28 +0800 | [diff] [blame] | 51 | labelSpec.titleOffset = r.getDimensionPixelSize( |
| 52 | R.dimen.albumset_title_offset); |
Chih-Chung Chang | 70a73a7 | 2011-09-19 11:09:39 +0800 | [diff] [blame] | 53 | labelSpec.countOffset = r.getDimensionPixelSize( |
| 54 | R.dimen.albumset_count_offset); |
Chih-Chung Chang | 07069de | 2011-09-14 20:50:28 +0800 | [diff] [blame] | 55 | labelSpec.titleFontSize = r.getDimensionPixelSize( |
| 56 | R.dimen.albumset_title_font_size); |
Chih-Chung Chang | 70a73a7 | 2011-09-19 11:09:39 +0800 | [diff] [blame] | 57 | labelSpec.countFontSize = r.getDimensionPixelSize( |
| 58 | R.dimen.albumset_count_font_size); |
Chih-Chung Chang | 07069de | 2011-09-14 20:50:28 +0800 | [diff] [blame] | 59 | labelSpec.leftMargin = r.getDimensionPixelSize( |
| 60 | R.dimen.albumset_left_margin); |
| 61 | labelSpec.iconSize = r.getDimensionPixelSize( |
| 62 | R.dimen.albumset_icon_size); |
Owen Lin | a2fba68 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 63 | } |
| 64 | } |
| 65 | |
| 66 | public static class AlbumPage { |
| 67 | private static AlbumPage sInstance; |
| 68 | |
Chih-Chung Chang | 07069de | 2011-09-14 20:50:28 +0800 | [diff] [blame] | 69 | public SlotView.Spec slotViewSpec; |
Owen Lin | a2fba68 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 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(); |
Chih-Chung Chang | 07069de | 2011-09-14 20:50:28 +0800 | [diff] [blame] | 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); |
Owen Lin | a2fba68 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 85 | } |
| 86 | } |
| 87 | |
| 88 | public static class ManageCachePage extends AlbumSetPage { |
| 89 | private static ManageCachePage sInstance; |
| 90 | |
Chih-Chung Chang | 32a8c90 | 2011-09-21 14:04:34 +0800 | [diff] [blame] | 91 | public final int cachePinSize; |
| 92 | public final int cachePinMargin; |
Owen Lin | a2fba68 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 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(); |
Chih-Chung Chang | 32a8c90 | 2011-09-21 14:04:34 +0800 | [diff] [blame] | 104 | cachePinSize = r.getDimensionPixelSize(R.dimen.cache_pin_size); |
| 105 | cachePinMargin = r.getDimensionPixelSize(R.dimen.cache_pin_margin); |
Owen Lin | a2fba68 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 106 | } |
| 107 | } |
| 108 | |
| 109 | public static class PhotoPage { |
| 110 | private static PhotoPage sInstance; |
| 111 | |
| 112 | // These are all height values. See the comment in FilmStripView for |
| 113 | // the meaning of these values. |
| 114 | public final int filmstripTopMargin; |
| 115 | public final int filmstripMidMargin; |
| 116 | public final int filmstripBottomMargin; |
| 117 | public final int filmstripThumbSize; |
| 118 | public final int filmstripContentSize; |
| 119 | public final int filmstripGripSize; |
| 120 | public final int filmstripBarSize; |
| 121 | |
| 122 | // These are width values. |
| 123 | public final int filmstripGripWidth; |
| 124 | |
| 125 | public static synchronized PhotoPage get(Context context) { |
| 126 | if (sInstance == null) { |
| 127 | sInstance = new PhotoPage(context); |
| 128 | } |
| 129 | return sInstance; |
| 130 | } |
| 131 | |
| 132 | public PhotoPage(Context context) { |
| 133 | Resources r = context.getResources(); |
| 134 | filmstripTopMargin = r.getDimensionPixelSize(R.dimen.filmstrip_top_margin); |
| 135 | filmstripMidMargin = r.getDimensionPixelSize(R.dimen.filmstrip_mid_margin); |
| 136 | filmstripBottomMargin = r.getDimensionPixelSize(R.dimen.filmstrip_bottom_margin); |
| 137 | filmstripThumbSize = r.getDimensionPixelSize(R.dimen.filmstrip_thumb_size); |
| 138 | filmstripContentSize = r.getDimensionPixelSize(R.dimen.filmstrip_content_size); |
| 139 | filmstripGripSize = r.getDimensionPixelSize(R.dimen.filmstrip_grip_size); |
| 140 | filmstripBarSize = r.getDimensionPixelSize(R.dimen.filmstrip_bar_size); |
| 141 | filmstripGripWidth = r.getDimensionPixelSize(R.dimen.filmstrip_grip_width); |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | |