1 /***
2 * Ambient - A music player for the Android platform
3 Copyright (C) 2007 Martin Vysny
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 package sk.baka.ambient.activity.main;
19
20 import java.util.Arrays;
21 import java.util.List;
22 import java.util.Map;
23
24 import sk.baka.ambient.ActionsEnum;
25 import sk.baka.ambient.R;
26 import sk.baka.ambient.ZoomEnum;
27 import sk.baka.ambient.activity.main.cb.AbstractCollectionController;
28 import sk.baka.ambient.collection.local.MediaStoreCollection;
29 import sk.baka.ambient.views.gesturelist.GesturesListView;
30
31 /***
32 * Controls the collection view.
33 *
34 * @author Martin Vysny
35 */
36 public final class CollectionController extends AbstractCollectionController {
37
38 /***
39 * Creates new controller instance.
40 *
41 * @param parent
42 * the parent activity
43 * @param playlistView
44 * the playlist view.
45 */
46 public CollectionController(final MainActivity parent,
47 final GesturesListView playlistView) {
48 super(R.id.collectionWindow, R.id.collectionView, parent, playlistView,
49 new MediaStoreCollection(parent.getContentResolver()),
50 R.id.collectionPath);
51 initButtonBar(R.id.collectionButtons, actions);
52 updateData();
53 }
54
55 private final List<ActionsEnum> actions = Arrays.asList(ActionsEnum.Back,
56 ActionsEnum.ShowStatistics, ActionsEnum.CollectionYear);
57
58 @Override
59 protected void performZoom(final Map<ZoomEnum, Integer> zoom) {
60 super.performZoom(zoom);
61 initButtonBar(R.id.collectionButtons, actions);
62 }
63
64 @Override
65 protected void yearChanged(boolean year) {
66 checkButton(R.id.collectionButtons, 2, year);
67 }
68 }