Skip to content

Commit c1ffb04

Browse files
committed
code cleanup
1 parent 9f7bb69 commit c1ffb04

File tree

14 files changed

+224
-1172
lines changed

14 files changed

+224
-1172
lines changed

app/src/main/java/at/ac/tuwien/caa/docscan/CameraActivity.java

Lines changed: 103 additions & 310 deletions
Large diffs are not rendered by default.
Lines changed: 26 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,51 @@
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+
124
package at.ac.tuwien.caa.docscan;
225

3-
import android.hardware.Camera;
426
import android.os.Bundle;
527
import android.support.v4.app.Fragment;
628
import android.view.LayoutInflater;
729
import android.view.View;
830
import android.view.ViewGroup;
931

1032
/**
11-
* Created by fabian on 19.10.2016.
33+
* Class holding the paint view and the camera preview.
1234
*/
1335
public class CameraPaintFragment extends Fragment {
1436

15-
private Camera mCamera;
16-
private Camera.CameraInfo mInfo;
17-
18-
@Override
37+
@Override
1938
public void onCreate(Bundle savedInstanceState) {
2039
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+
}
5441

5542
@Override
5643
public View onCreateView(LayoutInflater inflater, ViewGroup container,
5744
Bundle savedInstanceState) {
5845

59-
// retain this fragment
60-
// setRetainInstance(true);
61-
6246
View view = inflater.inflate(R.layout.camera_paint_view, container, false);
6347

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
7648
return view;
7749
}
7850

79-
80-
81-
82-
83-
// public interface TempCallback {
84-
//
85-
// void onCameraLoaded(Camera camera, Camera.CameraInfo info, int displayRotation);
86-
//
87-
// }
88-
89-
9051
}

app/src/main/java/at/ac/tuwien/caa/docscan/CameraPaintLayout.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import android.content.Context;
44
import android.util.AttributeSet;
5-
import android.view.View;
65
import android.widget.FrameLayout;
76

87
/**
@@ -62,14 +61,14 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
6261

6362
}
6463

65-
final int count = getChildCount();
66-
for (int i = 0; i < count; i++) {
67-
final View v = getChildAt(i);
68-
69-
v.measure(MeasureSpec.makeMeasureSpec(getMeasuredWidth(),
70-
MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(
71-
getMeasuredHeight(), MeasureSpec.EXACTLY));
72-
}
64+
// final int count = getChildCount();
65+
// for (int i = 0; i < count; i++) {
66+
// final View v = getChildAt(i);
67+
//
68+
// v.measure(MeasureSpec.makeMeasureSpec(getMeasuredWidth(),
69+
// MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(
70+
// getMeasuredHeight(), MeasureSpec.EXACTLY));
71+
// }
7372

7473
mCameraPreviewCallback.onMeasuredDimensionChange(getMeasuredWidth(), getMeasuredHeight());
7574

0 commit comments

Comments
 (0)