blob: 3cc045ccd48a1a2ffed5ac24784712a0ecaacf88 [file] [log] [blame]
Owen Lina2fba682011-08-17 22:07:43 +08001/*
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
17package com.android.gallery3d.app;
18
Owen Lina2fba682011-08-17 22:07:43 +080019import android.content.Context;
20import android.content.res.Resources;
21
Owen Lin73a04ff2012-03-14 17:27:24 +080022import com.android.gallery3d.R;
23import com.android.gallery3d.ui.AlbumSetView;
24import com.android.gallery3d.ui.SlotView;
25
Owen Lina2fba682011-08-17 22:07:43 +080026final class Config {
27 public static class AlbumSetPage {
28 private static AlbumSetPage sInstance;
29
Chih-Chung Chang07069de2011-09-14 20:50:28 +080030 public SlotView.Spec slotViewSpec;
31 public AlbumSetView.LabelSpec labelSpec;
Owen Lina2fba682011-08-17 22:07:43 +080032
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 Chang07069de2011-09-14 20:50:28 +080042
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 Chang70a73a72011-09-19 11:09:39 +080049 labelSpec.labelBackgroundHeight = r.getDimensionPixelSize(
50 R.dimen.albumset_label_background_height);
Chih-Chung Chang07069de2011-09-14 20:50:28 +080051 labelSpec.titleOffset = r.getDimensionPixelSize(
52 R.dimen.albumset_title_offset);
Chih-Chung Chang70a73a72011-09-19 11:09:39 +080053 labelSpec.countOffset = r.getDimensionPixelSize(
54 R.dimen.albumset_count_offset);
Chih-Chung Chang07069de2011-09-14 20:50:28 +080055 labelSpec.titleFontSize = r.getDimensionPixelSize(
56 R.dimen.albumset_title_font_size);
Chih-Chung Chang70a73a72011-09-19 11:09:39 +080057 labelSpec.countFontSize = r.getDimensionPixelSize(
58 R.dimen.albumset_count_font_size);
Chih-Chung Chang07069de2011-09-14 20:50:28 +080059 labelSpec.leftMargin = r.getDimensionPixelSize(
60 R.dimen.albumset_left_margin);
61 labelSpec.iconSize = r.getDimensionPixelSize(
62 R.dimen.albumset_icon_size);
Owen Lina2fba682011-08-17 22:07:43 +080063 }
64 }
65
66 public static class AlbumPage {
67 private static AlbumPage sInstance;
68
Chih-Chung Chang07069de2011-09-14 20:50:28 +080069 public SlotView.Spec slotViewSpec;
Owen Lina2fba682011-08-17 22:07:43 +080070
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 Chang07069de2011-09-14 20:50:28 +080080
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 Lina2fba682011-08-17 22:07:43 +080085 }
86 }
87
88 public static class ManageCachePage extends AlbumSetPage {
89 private static ManageCachePage sInstance;
90
Chih-Chung Chang32a8c902011-09-21 14:04:34 +080091 public final int cachePinSize;
92 public final int cachePinMargin;
Owen Lina2fba682011-08-17 22:07:43 +080093
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 Chang32a8c902011-09-21 14:04:34 +0800104 cachePinSize = r.getDimensionPixelSize(R.dimen.cache_pin_size);
105 cachePinMargin = r.getDimensionPixelSize(R.dimen.cache_pin_margin);
Owen Lina2fba682011-08-17 22:07:43 +0800106 }
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