• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 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.camera.session;
18 
19 import android.content.ContentResolver;
20 import android.location.Location;
21 
22 import java.io.File;
23 
24 /**
25  * Creates {@link StackSaver} instances.
26  */
27 public class StackSaverFactory {
28     private final String mCameraDirectory;
29     private final ContentResolver mContentResolver;
30 
31     /**
32      * Create a new stack saver factory.
33      *
34      * @param cameraDirectory the directory in which the camera stores images.
35      * @param contentResolver the Android content resolver used to include
36      *            images into the media store.
37      */
StackSaverFactory(String cameraDirectory, ContentResolver contentResolver)38     public StackSaverFactory(String cameraDirectory,
39             ContentResolver contentResolver) {
40         mCameraDirectory = cameraDirectory;
41         mContentResolver = contentResolver;
42     }
43 
44     /**
45      * Creates a new StackSaver.
46      *
47      * @param mTitle the title of this stack session.
48      * @param location the GPS location that the media in this session was
49      *            created at.
50      * @return A StackSaver that is set up to save images in a stacked location.
51      */
create(String mTitle, Location location)52     public StackSaver create(String mTitle, Location location) {
53         return new StackSaverImpl(new File(mCameraDirectory, mTitle), location, mContentResolver);
54     }
55 }
56