|
| 1 | +/********************************************************************************* |
| 2 | + * DocScan is a Android app for document scanning. |
| 3 | + * |
| 4 | + * Author: Fabian Hollaus, Florian Kleber, Markus Diem |
| 5 | + * Organization: TU Wien, Computer Vision Lab |
| 6 | + * Date created: 19. October 2016 |
| 7 | + * |
| 8 | + * This file is part of DocScan. |
| 9 | + * |
| 10 | + * DocScan is free software: you can redistribute it and/or modify |
| 11 | + * it under the terms of the GNU Lesser General Public License as published by |
| 12 | + * the Free Software Foundation, either version 3 of the License, or |
| 13 | + * (at your option) any later version. |
| 14 | + * |
| 15 | + * DocScan is distributed in the hope that it will be useful, |
| 16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | + * GNU General Public License for more details. |
| 19 | + * |
| 20 | + * You should have received a copy of the GNU Lesser General Public License |
| 21 | + * along with DocScan. If not, see <http://www.gnu.org/licenses/>. |
| 22 | + *********************************************************************************/ |
| 23 | + |
1 | 24 | package at.ac.tuwien.caa.docscan; |
2 | 25 |
|
3 | | -import android.hardware.Camera; |
4 | 26 | import android.os.Bundle; |
5 | 27 | import android.support.v4.app.Fragment; |
6 | 28 | import android.view.LayoutInflater; |
7 | 29 | import android.view.View; |
8 | 30 | import android.view.ViewGroup; |
9 | 31 |
|
10 | 32 | /** |
11 | | - * Created by fabian on 19.10.2016. |
| 33 | + * Class holding the paint view and the camera preview. |
12 | 34 | */ |
13 | 35 | public class CameraPaintFragment extends Fragment { |
14 | 36 |
|
15 | | - private Camera mCamera; |
16 | | - private Camera.CameraInfo mInfo; |
17 | | - |
18 | | - @Override |
| 37 | + @Override |
19 | 38 | public void onCreate(Bundle savedInstanceState) { |
20 | 39 | super.onCreate(savedInstanceState); |
21 | | - |
22 | | -// TempCallback c = (TempCallback) getActivity(); |
23 | | -// |
24 | | -// Camera camera = getCameraInstance(0); |
25 | | -// Camera.CameraInfo info = new Camera.CameraInfo(); |
26 | | -// Camera.getCameraInfo(0, info); |
27 | | -// |
28 | | -// // Get the rotation of the screen to adjust the preview image accordingly. |
29 | | -// int displayRotation = getActivity().getWindowManager().getDefaultDisplay().getRotation(); |
30 | | -// |
31 | | -// c.onCameraLoaded(camera, info, displayRotation); |
32 | | -// |
33 | | -// mCamera = camera; |
34 | | -// mInfo = info; |
35 | | -// |
36 | | -// |
37 | | -// // retain this fragment |
38 | | -// setRetainInstance(true); |
39 | | - } |
40 | | - |
41 | | - private Camera getCameraInstance(int cameraId) { |
42 | | - Camera c = null; |
43 | | - try { |
44 | | - c = Camera.open(cameraId); // attempt to get a Camera instance |
45 | | - } catch (Exception e) { |
46 | | -// // Camera is not available (in use or does not exist) |
47 | | -// Toast.makeText(this, "Camera " + cameraId + " is not available: " + e.getMessage(), |
48 | | -// Toast.LENGTH_SHORT).show(); |
49 | | - } |
50 | | - return c; // returns null if camera is unavailable |
51 | | - } |
52 | | - |
53 | | - |
| 40 | + } |
54 | 41 |
|
55 | 42 | @Override |
56 | 43 | public View onCreateView(LayoutInflater inflater, ViewGroup container, |
57 | 44 | Bundle savedInstanceState) { |
58 | 45 |
|
59 | | - // retain this fragment |
60 | | -// setRetainInstance(true); |
61 | | - |
62 | 46 | View view = inflater.inflate(R.layout.camera_paint_view, container, false); |
63 | 47 |
|
64 | | -// CameraPreview cameraPreview = (CameraPreview) view.findViewById(R.id.camera_view); |
65 | | -// int displayRotation = getActivity().getWindowManager().getDefaultDisplay().getRotation(); |
66 | | -// cameraPreview.setCamera(mCamera, mInfo, displayRotation); |
67 | | - |
68 | | -// Camera camera = getCameraInstance(0); |
69 | | -// Camera.CameraInfo info = new Camera.CameraInfo(); |
70 | | -// Camera.getCameraInfo(0, info); |
71 | | -// cameraPreview.setCamera(camera, info, displayRotation); |
72 | | - |
73 | | - |
74 | | - |
75 | | - // Inflate the layout for this fragment |
76 | 48 | return view; |
77 | 49 | } |
78 | 50 |
|
79 | | - |
80 | | - |
81 | | - |
82 | | - |
83 | | -// public interface TempCallback { |
84 | | -// |
85 | | -// void onCameraLoaded(Camera camera, Camera.CameraInfo info, int displayRotation); |
86 | | -// |
87 | | -// } |
88 | | - |
89 | | - |
90 | 51 | } |
0 commit comments