blob: 8a3af397f883319b53febdcf89b996071b0b80ea (
plain)
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
|
package com.android.testingcamera;
import android.hardware.Camera;
import android.hardware.Camera.CameraInfo;
import android.os.Bundle;
import android.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
public class InfoDialogFragment extends DialogFragment implements View.OnClickListener {
Button mOkButton;
TextView mInfoText;
String mTitleString = "";
String mInfoString = "";
public InfoDialogFragment() {
// Empty constructor required for DialogFragment
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_info, container);
mOkButton = (Button) view.findViewById(R.id.info_ok_button);
mOkButton.setOnClickListener(this);
mInfoText= (TextView) view.findViewById(R.id.info_text);
mInfoText.setText(mInfoString);
getDialog().setTitle(mTitleString);
return view;
}
@Override
public void onClick(View v) {
this.dismiss();
}
public void updateInfo(int cameraId, Camera camera) {
mTitleString = "Current camera " + cameraId + " state";
StringBuilder b = new StringBuilder();
CameraInfo cameraInfo = new CameraInfo();
Camera.getCameraInfo(cameraId, cameraInfo);
b.append("getInfo() output:\n");
b.append(" Facing: ");
b.append(cameraInfo.facing == CameraInfo.CAMERA_FACING_FRONT ? "FRONT\n" : "BACK\n");
b.append(" Orientation: ");
b.append(cameraInfo.orientation);
b.append("\n");
b.append(" Can disable shutter sound: ");
b.append(cameraInfo.canDisableShutterSound);
b.append("\n\n");
b.append("getParameters() output:\n ");
Camera.Parameters p = camera.getParameters();
String[] flatP = p.flatten().split(";");
for (String param : flatP) {
b.append(param);
b.append("\n ");
}
mInfoString = b.toString();
}
}
|