PhotoTableDreamSettings.java revision b8235acb0fdc33c50e864ec801b93b9750d7600c
1/*
2 * Copyright (C) 2012 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 */
16package com.android.dreams.phototable;
17
18import android.content.SharedPreferences;
19import android.app.ListActivity;
20import android.os.Bundle;
21import android.widget.ListAdapter;
22
23import java.util.LinkedList;
24
25/**
26 * Settings panel for photo flipping dream.
27 */
28public class PhotoTableDreamSettings extends ListActivity {
29    private static final String TAG = "PhotoTableDreamSettings";
30    public static final String PREFS_NAME = PhotoTableDream.TAG;
31
32    private PhotoSourcePlexor mPhotoSource;
33    private ListAdapter mAdapter;
34    private SharedPreferences mSettings;
35
36    @Override
37    protected void onCreate(Bundle savedInstanceState){
38        super.onCreate(savedInstanceState);
39
40        //setContentView(R.layout.custom_list_activity_view);
41
42        mSettings = getSharedPreferences(PREFS_NAME, 0);
43
44        mPhotoSource = new PhotoSourcePlexor(this, mSettings);
45        mAdapter = new SectionedAlbumDataAdapter(this,
46                mSettings,
47                R.layout.header,
48                R.layout.album,
49                new LinkedList<PhotoSource.AlbumData>(mPhotoSource.findAlbums()));
50        setListAdapter(mAdapter);
51        setContentView(R.layout.settingslist);
52    }
53}
54