CameraPreview.java
3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package com.bitstrips.imoji.ui.views;
import android.content.Context;
import android.hardware.Camera;
import android.hardware.Camera.Parameters;
import android.hardware.Camera.Size;
import android.util.AttributeSet;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceHolder.Callback;
import android.view.SurfaceView;
import android.view.View.MeasureSpec;
import java.io.IOException;
public class CameraPreview
extends SurfaceView
implements SurfaceHolder.Callback
{
private SurfaceHolder a = getHolder();
private Camera b;
public CameraPreview(Context paramContext)
{
super(paramContext);
}
public CameraPreview(Context paramContext, AttributeSet paramAttributeSet)
{
super(paramContext, paramAttributeSet);
}
public void attachCamera(Camera paramCamera)
{
this.b = paramCamera;
this.a.addCallback(this);
try
{
if (!this.a.isCreating())
{
this.b.setPreviewDisplay(this.a);
this.b.startPreview();
}
requestLayout();
return;
}
catch (IOException paramCamera)
{
for (;;)
{
Log.e("CameraPreview", "Error setting camera preview: " + paramCamera.getMessage());
}
}
catch (RuntimeException paramCamera)
{
for (;;)
{
Log.e("CameraPreview", "Runtime error setting camera preview: " + paramCamera.getMessage());
}
}
catch (Exception paramCamera)
{
for (;;)
{
Log.e("CameraPreview", "Some error setting camera preview: " + paramCamera.getMessage());
}
}
}
protected void onMeasure(int paramInt1, int paramInt2)
{
if (this.b == null)
{
super.onMeasure(paramInt1, paramInt2);
return;
}
paramInt1 = View.MeasureSpec.getSize(paramInt1);
paramInt2 = View.MeasureSpec.getSize(paramInt2);
Camera.Size localSize = this.b.getParameters().getPreviewSize();
if (localSize.height >= localSize.width) {}
int j;
for (float f = localSize.width / localSize.height;; f = localSize.height / localSize.width)
{
int i = (int)(paramInt2 * f);
j = (int)(paramInt1 / f);
if (i <= paramInt1) {
break;
}
setMeasuredDimension(i, paramInt2);
return;
}
setMeasuredDimension(paramInt1, j);
}
public void releaseCamera()
{
this.a.removeCallback(this);
this.b = null;
}
public void surfaceChanged(SurfaceHolder paramSurfaceHolder, int paramInt1, int paramInt2, int paramInt3) {}
public void surfaceCreated(SurfaceHolder paramSurfaceHolder)
{
try
{
this.b.setPreviewDisplay(paramSurfaceHolder);
this.b.startPreview();
return;
}
catch (IOException paramSurfaceHolder)
{
Log.e("CameraPreview", "Error setting camera preview: " + paramSurfaceHolder.getMessage());
}
}
public void surfaceDestroyed(SurfaceHolder paramSurfaceHolder) {}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/ui/views/CameraPreview.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/