Revert "TestingCamera: Add camera info, camcorder profiles, improve UI"
This reverts commit 4ae1a87883045d820ffd6e1b8a95c13b1919e00a
Change-Id: Iabbf18b84b331bc9679b2000058f62ff062ffbb4
diff --git a/apps/TestingCamera/.classpath b/apps/TestingCamera/.classpath
index 3f9691c..a4763d1 100644
--- a/apps/TestingCamera/.classpath
+++ b/apps/TestingCamera/.classpath
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
- <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
diff --git a/apps/TestingCamera/Android.mk b/apps/TestingCamera/Android.mk
index 132679c..d7e00d1 100644
--- a/apps/TestingCamera/Android.mk
+++ b/apps/TestingCamera/Android.mk
@@ -22,8 +22,6 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4
-
LOCAL_PACKAGE_NAME := TestingCamera
include $(BUILD_PACKAGE)
diff --git a/apps/TestingCamera/AndroidManifest.xml b/apps/TestingCamera/AndroidManifest.xml
index bb48524..a897e9d 100644
--- a/apps/TestingCamera/AndroidManifest.xml
+++ b/apps/TestingCamera/AndroidManifest.xml
@@ -22,7 +22,7 @@
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="16"/>
+ <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="16"/>
<uses-feature android:name="android.hardware.camera.front" android:required="false"/>
<application
android:icon="@mipmap/launcher_testingcamera"
diff --git a/apps/TestingCamera/res/layout/fragment_info.xml b/apps/TestingCamera/res/layout/fragment_info.xml
deleted file mode 100644
index c3d229e..0000000
--- a/apps/TestingCamera/res/layout/fragment_info.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical" >
-
- <ScrollView
- android:id="@+id/info_text_scroll"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1" >
-
- <TextView
- android:id="@+id/info_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingLeft="3dp"
- android:paddingRight="3dp" />
-
- </ScrollView>
-
- <Button
- android:id="@+id/info_ok_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:text="@string/info_ok_button_label" />
-
-</LinearLayout>
\ No newline at end of file
diff --git a/apps/TestingCamera/res/layout/fragment_snapshot.xml b/apps/TestingCamera/res/layout/fragment_snapshot.xml
deleted file mode 100644
index faf141f..0000000
--- a/apps/TestingCamera/res/layout/fragment_snapshot.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/layout_root"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical"
- android:padding="10dp" >
-
- <ImageView
- android:id="@+id/snapshot_image"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginRight="10dp"
- android:layout_weight="4"
- android:contentDescription="@string/still_image_description" />
-
- <TextView
- android:id="@+id/snapshot_text"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/snapshot_text_default"
- android:textColor="#FFF" />
-
- <Button
- android:id="@+id/snapshot_ok"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/snapshot_ok_label" />
-
-</LinearLayout>
diff --git a/apps/TestingCamera/res/layout/main.xml b/apps/TestingCamera/res/layout/main.xml
index 06f3628..5485f42 100644
--- a/apps/TestingCamera/res/layout/main.xml
+++ b/apps/TestingCamera/res/layout/main.xml
@@ -44,27 +44,14 @@
android:id="@+id/control_bar"
android:layout_width="0px"
android:layout_height="match_parent"
- android:layout_weight="2"
- android:fadingEdgeLength="100dp"
- android:requiresFadingEdge="vertical"
- android:scrollbarAlwaysDrawVerticalTrack="true" >
+ android:layout_weight="2" >
<LinearLayout
android:id="@+id/control_bar_contents"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginLeft="5dp"
android:orientation="vertical" >
- <TextView
- android:id="@+id/camera_spinner_label"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:layout_weight="1"
- android:text="@string/camera_selection_prompt"
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
<Spinner
android:id="@+id/camera_spinner"
android:layout_width="fill_parent"
@@ -72,29 +59,6 @@
android:layout_weight="1"
android:prompt="@string/camera_selection_prompt" />
- <Button
- android:id="@+id/info_button"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/show_info" />
-
- <View
- android:id="@+id/horizontal_rule_1"
- android:layout_width="fill_parent"
- android:layout_height="1dip"
- android:layout_marginBottom="@dimen/horiz_rule_btm_margin"
- android:layout_marginTop="@dimen/horiz_rule_top_margin"
- android:background="@color/horiz_rule_color" />
-
- <TextView
- android:id="@+id/preview_size_spinner_label"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/preview_resolution_prompt"
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
<Spinner
android:id="@+id/preview_size_spinner"
android:layout_width="fill_parent"
@@ -107,33 +71,9 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:textColorLink="@android:color/holo_blue_light"
android:textOff="@string/preview_off_label"
android:textOn="@string/preview_on_label" />
- <View
- android:id="@+id/horizontal_rule_2"
- android:layout_width="fill_parent"
- android:layout_height="1dip"
- android:layout_marginBottom="@dimen/horiz_rule_btm_margin"
- android:layout_marginTop="@dimen/horiz_rule_top_margin"
- android:layout_weight="1"
- android:background="@color/horiz_rule_color" />
-
- <TextView
- android:id="@+id/textView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/snapshot_size_spinner_label"
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
- <Spinner
- android:id="@+id/snapshot_size_spinner"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1" />
-
<Button
android:id="@+id/take_picture"
android:layout_width="fill_parent"
@@ -141,37 +81,6 @@
android:layout_weight="1"
android:text="@string/take_picture_label" />
- <View
- android:id="@+id/horizontal_rule_3"
- android:layout_width="fill_parent"
- android:layout_height="1dip"
- android:layout_marginBottom="@dimen/horiz_rule_btm_margin"
- android:layout_marginTop="@dimen/horiz_rule_top_margin"
- android:layout_weight="1"
- android:background="@color/horiz_rule_color" />
-
- <TextView
- android:id="@+id/camcorder_profile_spinner_label"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/camcorder_profile_prompt"
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
- <Spinner
- android:id="@+id/camcorder_profile_spinner"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1" />
-
- <ToggleButton
- android:id="@+id/start_record"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:textColorLink="@android:color/holo_red_dark"
- android:textOff="@string/record_off_label"
- android:textOn="@string/record_on_label" />
</LinearLayout>
</ScrollView>
diff --git a/apps/TestingCamera/res/layout/snapshot_dialog.xml b/apps/TestingCamera/res/layout/snapshot_dialog.xml
new file mode 100644
index 0000000..1e84b14
--- /dev/null
+++ b/apps/TestingCamera/res/layout/snapshot_dialog.xml
@@ -0,0 +1,18 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/layout_root"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:padding="10dp"
+ >
+ <ImageView android:id="@+id/snapshot_image"
+ android:layout_width="wrap_content"
+ android:layout_height="fill_parent"
+ android:layout_marginRight="10dp"
+ />
+ <TextView android:id="@+id/snapshot_text"
+ android:layout_width="wrap_content"
+ android:layout_height="fill_parent"
+ android:textColor="#FFF"
+ />
+</LinearLayout>
diff --git a/apps/TestingCamera/res/values/colors.xml b/apps/TestingCamera/res/values/colors.xml
deleted file mode 100644
index 8e09e17..0000000
--- a/apps/TestingCamera/res/values/colors.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <color name="horiz_rule_color">#777777</color>
-
-</resources>
\ No newline at end of file
diff --git a/apps/TestingCamera/res/values/dimens.xml b/apps/TestingCamera/res/values/dimens.xml
deleted file mode 100644
index dbea0fa..0000000
--- a/apps/TestingCamera/res/values/dimens.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <dimen name="horiz_rule_top_margin">8dp</dimen>
- <dimen name="horiz_rule_btm_margin">4dp</dimen>
-</resources>
diff --git a/apps/TestingCamera/res/values/strings.xml b/apps/TestingCamera/res/values/strings.xml
index 69c57da..45ddaa2 100644
--- a/apps/TestingCamera/res/values/strings.xml
+++ b/apps/TestingCamera/res/values/strings.xml
@@ -21,17 +21,7 @@
<string name="preview_on_label">Preview On</string>
<string name="preview_off_label">Preview Off</string>
<string name="take_picture_label">Take picture</string>
- <string name="preview_resolution_prompt">Preview size</string>
- <string name="camera_selection_prompt">Camera ID</string>
+ <string name="preview_resolution_prompt">Select preview resolution</string>
+ <string name="camera_selection_prompt">Select camera</string>
<string name="default_camera_entry">No cameras found</string>
- <string name="snapshot_text_default">Snapshot text</string>
- <string name="snapshot_size_spinner_label">Still capture size</string>
- <string name="record_on_label">Recording on</string>
- <string name="record_off_label">Recording off</string>
- <string name="camcorder_profile_prompt">Camcorder profile</string>
- <string name="horiz_rule_color">#777777</string>
- <string name="show_info">Info</string>
- <string name="info_ok_button_label">OK</string>
- <string name="snapshot_ok_label">OK</string>
- <string name="still_image_description">Captured still image</string>
</resources>
diff --git a/apps/TestingCamera/src/com/android/testingcamera/InfoDialogFragment.java b/apps/TestingCamera/src/com/android/testingcamera/InfoDialogFragment.java
deleted file mode 100644
index ce76f6b..0000000
--- a/apps/TestingCamera/src/com/android/testingcamera/InfoDialogFragment.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.android.testingcamera;
-
-import android.hardware.Camera;
-import android.hardware.Camera.CameraInfo;
-import android.os.Bundle;
-import android.support.v4.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\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();
- }
-
-}
diff --git a/apps/TestingCamera/src/com/android/testingcamera/SnapshotDialogFragment.java b/apps/TestingCamera/src/com/android/testingcamera/SnapshotDialogFragment.java
deleted file mode 100644
index 2fe82e6..0000000
--- a/apps/TestingCamera/src/com/android/testingcamera/SnapshotDialogFragment.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.android.testingcamera;
-import com.android.testingcamera.R;
-
-import android.graphics.Bitmap;
-import android.os.Bundle;
-import android.support.v4.app.DialogFragment;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-public class SnapshotDialogFragment extends DialogFragment implements View.OnClickListener{
-
- private ImageView mInfoImage;
- private TextView mInfoText;
- private Button mOkButton;
-
- private Bitmap mImage;
- private String mImageString;
-
-
- public SnapshotDialogFragment() {
- // Empty constructor required for DialogFragment
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.fragment_snapshot, container);
-
- mOkButton = (Button) view.findViewById(R.id.snapshot_ok);
- mOkButton.setOnClickListener(this);
-
- mInfoImage = (ImageView) view.findViewById(R.id.snapshot_image);
- mInfoImage.setImageBitmap(mImage);
- mInfoText= (TextView) view.findViewById(R.id.snapshot_text);
- mInfoText.setText(mImageString);
-
- getDialog().setTitle("Snapshot result");
- return view;
- }
-
- @Override
- public void onClick(View v) {
- // TODO Auto-generated method stub
- this.dismiss();
- }
-
- public void updateImage(Bitmap image) {
- mImage = image;
- }
-}
diff --git a/apps/TestingCamera/src/com/android/testingcamera/TestingCamera.java b/apps/TestingCamera/src/com/android/testingcamera/TestingCamera.java
index cefb8a4..645dc61 100644
--- a/apps/TestingCamera/src/com/android/testingcamera/TestingCamera.java
+++ b/apps/TestingCamera/src/com/android/testingcamera/TestingCamera.java
@@ -21,12 +21,10 @@
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.hardware.Camera;
-import android.media.CamcorderProfile;
import android.os.Bundle;
import android.view.View;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
-import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
@@ -36,8 +34,6 @@
import android.widget.CompoundButton;
import android.widget.TextView;
import android.widget.ToggleButton;
-import android.support.v4.app.FragmentActivity;
-import android.support.v4.app.FragmentManager;
import android.util.Log;
import java.io.IOException;
@@ -52,20 +48,19 @@
* The goal of this application is to allow all camera API features to be
* excercised, and all information provided by the API to be shown.
*/
-public class TestingCamera extends FragmentActivity implements SurfaceHolder.Callback {
+public class TestingCamera extends Activity implements SurfaceHolder.Callback {
/** UI elements */
private SurfaceView mPreviewView;
private SurfaceHolder mPreviewHolder;
private Spinner mCameraSpinner;
- private Button mInfoButton;
private Spinner mPreviewSizeSpinner;
private ToggleButton mPreviewToggle;
- private Spinner mSnapshotSizeSpinner;
private Button mTakePictureButton;
- private Spinner mCamcorderProfileSpinner;
- private ToggleButton mRecordToggle;
+
+ private TextView mSnapshotText;
+ private ImageView mSnapshotImg;
/** Camera state */
private int mCameraId = 0;
@@ -73,10 +68,6 @@
private Camera.Parameters mParams;
private List<Camera.Size> mPreviewSizes;
private int mPreviewSize = 0;
- private List<Camera.Size> mSnapshotSizes;
- private int mSnapshotSize = 0;
- private List<CamcorderProfile> mCamcorderProfiles;
- private int mCamcorderProfile = 0;
private static final int CAMERA_UNINITIALIZED = 0;
private static final int CAMERA_OPEN = 1;
@@ -101,27 +92,15 @@
mCameraSpinner = (Spinner) findViewById(R.id.camera_spinner);
mCameraSpinner.setOnItemSelectedListener(mCameraSpinnerListener);
- mInfoButton = (Button) findViewById(R.id.info_button);
- mInfoButton.setOnClickListener(mInfoButtonListener);
-
mPreviewSizeSpinner = (Spinner) findViewById(R.id.preview_size_spinner);
mPreviewSizeSpinner.setOnItemSelectedListener(mPreviewSizeListener);
mPreviewToggle = (ToggleButton) findViewById(R.id.start_preview);
mPreviewToggle.setOnClickListener(mPreviewToggleListener);
- mSnapshotSizeSpinner = (Spinner) findViewById(R.id.snapshot_size_spinner);
- mSnapshotSizeSpinner.setOnItemSelectedListener(mSnapshotSizeListener);
-
mTakePictureButton = (Button) findViewById(R.id.take_picture);
mTakePictureButton.setOnClickListener(mTakePictureListener);
- mCamcorderProfileSpinner = (Spinner) findViewById(R.id.camcorder_profile_spinner);
- mCamcorderProfileSpinner.setOnItemSelectedListener(mCamcorderProfileListener);
-
- mRecordToggle = (ToggleButton) findViewById(R.id.start_record);
- mRecordToggle.setOnClickListener(mRecordToggleListener);
-
int numCameras = Camera.getNumberOfCameras();
String[] cameraNames = new String[numCameras];
for (int i = 0; i < numCameras; i++) {
@@ -148,6 +127,21 @@
mState = CAMERA_UNINITIALIZED;
}
+ protected Dialog onCreateDialog(int id) {
+ Dialog dialog = new Dialog(this);
+ dialog.setContentView(R.layout.snapshot_dialog);
+ dialog.setTitle("Snapshot");
+
+ mSnapshotText =
+ (TextView) dialog.findViewById(R.id.snapshot_text);
+ mSnapshotText.setText("Snapshot title");
+
+ mSnapshotImg =
+ (ImageView) dialog.findViewById(R.id.snapshot_image);
+
+ return dialog;
+ }
+
// SurfaceHolder.Callback methods
@Override
public void surfaceChanged(SurfaceHolder holder,
@@ -180,31 +174,19 @@
// UI listeners
private AdapterView.OnItemSelectedListener mCameraSpinnerListener =
- new AdapterView.OnItemSelectedListener() {
- public void onItemSelected(AdapterView<?> parent,
+ new AdapterView.OnItemSelectedListener() {
+ public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
- if (mCameraId != pos) {
+ if (mCameraId != pos) {
mCameraId = pos;
setUpCamera();
- }
- }
-
- public void onNothingSelected(AdapterView parent) {
-
- }
- };
-
- private OnClickListener mInfoButtonListener = new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- FragmentManager fm = getSupportFragmentManager();
- InfoDialogFragment infoDialog = new InfoDialogFragment();
- infoDialog.updateInfo(mCameraId, mCamera);
- infoDialog.show(fm, "info_dialog_fragment");
+ }
}
- };
+ public void onNothingSelected(AdapterView parent) {
+
+ }
+ };
private AdapterView.OnItemSelectedListener mPreviewSizeListener =
new AdapterView.OnItemSelectedListener() {
@@ -259,26 +241,6 @@
}
};
- private AdapterView.OnItemSelectedListener mSnapshotSizeListener =
- new AdapterView.OnItemSelectedListener() {
- public void onItemSelected(AdapterView<?> parent,
- View view, int pos, long id) {
- if (pos == mSnapshotSize) return;
- Log.d(TAG, "Switching snapshot sizes");
-
- mSnapshotSize = pos;
- int width = mSnapshotSizes.get(mSnapshotSize).width;
- int height = mSnapshotSizes.get(mSnapshotSize).height;
- mParams.setPictureSize(width, height);
-
- mCamera.setParameters(mParams);
- }
-
- public void onNothingSelected(AdapterView parent) {
-
- }
- };
-
private View.OnClickListener mTakePictureListener =
new View.OnClickListener() {
public void onClick(View v) {
@@ -297,24 +259,6 @@
}
};
- private AdapterView.OnItemSelectedListener mCamcorderProfileListener =
- new AdapterView.OnItemSelectedListener() {
- public void onItemSelected(AdapterView<?> parent,
- View view, int pos, long id) {
- mCamcorderProfile = pos;
- }
-
- public void onNothingSelected(AdapterView parent) {
-
- }
- };
-
- private View.OnClickListener mRecordToggleListener =
- new View.OnClickListener() {
- public void onClick(View v) {
- }
- };
-
private Camera.ShutterCallback mShutterCb = new Camera.ShutterCallback() {
public void onShutter() {
Log.d(TAG, "Shutter cb fired");
@@ -336,12 +280,11 @@
private Camera.PictureCallback mJpegCb = new Camera.PictureCallback() {
public void onPictureTaken(byte[] data, Camera camera) {
Log.d(TAG, "JPEG cb fired");
- FragmentManager fm = getSupportFragmentManager();
- SnapshotDialogFragment snapshotDialog = new SnapshotDialogFragment();
+
+ showDialog(1);
Bitmap img = BitmapFactory.decodeByteArray(data, 0, data.length);
- snapshotDialog.updateImage(img);
- snapshotDialog.show(fm, "snapshot_dialog_fragment");
+ mSnapshotImg.setImageBitmap(img);
mPreviewToggle.setEnabled(true);
@@ -363,16 +306,13 @@
mState = CAMERA_OPEN;
mParams = mCamera.getParameters();
-
- // Set up preview size selection
mPreviewSizes = mParams.getSupportedPreviewSizes();
String[] availableSizeNames = new String[mPreviewSizes.size()];
- int i = 0;
- for (Camera.Size previewSize: mPreviewSizes) {
- availableSizeNames[i++] =
- Integer.toString(previewSize.width) + " x " +
- Integer.toString(previewSize.height);
+ for (int i = 0; i < mPreviewSizes.size(); i++) {
+ availableSizeNames[i] =
+ Integer.toString(mPreviewSizes.get(i).width) + " x " +
+ Integer.toString(mPreviewSizes.get(i).height);
}
mPreviewSizeSpinner.setAdapter(
new ArrayAdapter<String>(
@@ -384,32 +324,6 @@
int height = mPreviewSizes.get(mPreviewSize).height;
mParams.setPreviewSize(width, height);
- // Set up snapshot size selection
-
- mSnapshotSizes = mParams.getSupportedPictureSizes();
-
- availableSizeNames = new String[mSnapshotSizes.size()];
- i = 0;
- for (Camera.Size snapshotSize : mSnapshotSizes) {
- availableSizeNames[i++] =
- Integer.toString(snapshotSize.width) + " x " +
- Integer.toString(snapshotSize.height);
- }
- mSnapshotSizeSpinner.setAdapter(
- new ArrayAdapter<String>(
- this, R.layout.spinner_item, availableSizeNames));
-
- mSnapshotSize = 0;
-
- width = mSnapshotSizes.get(mSnapshotSize).width;
- height = mSnapshotSizes.get(mSnapshotSize).height;
- mParams.setPictureSize(width, height);
-
- // Set up camcorder profile selection
- updateCamcorderProfile(mCameraId);
-
- // Update parameters based on above defaults
-
mCamera.setParameters(mParams);
if (mPreviewHolder != null) {
@@ -432,61 +346,6 @@
}
}
- private void updateCamcorderProfile(int cameraId) {
- // Have to query all of these individually,
- final int PROFILES[] = new int[] {
- CamcorderProfile.QUALITY_1080P,
- CamcorderProfile.QUALITY_480P,
- CamcorderProfile.QUALITY_720P,
- CamcorderProfile.QUALITY_CIF,
- CamcorderProfile.QUALITY_HIGH,
- CamcorderProfile.QUALITY_LOW,
- CamcorderProfile.QUALITY_QCIF,
- CamcorderProfile.QUALITY_QVGA,
- CamcorderProfile.QUALITY_TIME_LAPSE_1080P,
- CamcorderProfile.QUALITY_TIME_LAPSE_480P,
- CamcorderProfile.QUALITY_TIME_LAPSE_720P,
- CamcorderProfile.QUALITY_TIME_LAPSE_CIF,
- CamcorderProfile.QUALITY_TIME_LAPSE_HIGH,
- CamcorderProfile.QUALITY_TIME_LAPSE_LOW,
- CamcorderProfile.QUALITY_TIME_LAPSE_QCIF,
- CamcorderProfile.QUALITY_TIME_LAPSE_QVGA
- };
-
- final String PROFILE_NAMES[] = new String[] {
- "1080P",
- "480P",
- "720P",
- "CIF",
- "HIGH",
- "LOW",
- "QCIF",
- "QVGA",
- "TIME_LAPSE_1080P",
- "TIME_LAPSE_480P",
- "TIME_LAPSE_720P",
- "TIME_LAPSE_CIF",
- "TIME_LAPSE_HIGH",
- "TIME_LAPSE_LOW",
- "TIME_LAPSE_QCIF",
- "TIME_LAPSE_QVGA"
- };
-
- List<String> availableCamcorderProfileNames = new ArrayList<String>();
- mCamcorderProfiles = new ArrayList<CamcorderProfile>();
-
- for (int i = 0; i < PROFILES.length; i++) {
- if (CamcorderProfile.hasProfile(cameraId, PROFILES[i])) {
- availableCamcorderProfileNames.add(PROFILE_NAMES[i]);
- mCamcorderProfiles.add(CamcorderProfile.get(cameraId, PROFILES[i]));
- }
- }
- String[] nameArray = (String[])availableCamcorderProfileNames.toArray(new String[0]);
- mCamcorderProfileSpinner.setAdapter(
- new ArrayAdapter<String>(
- this, R.layout.spinner_item, nameArray));
- }
-
void resizePreview(int width, int height) {
if (mPreviewHolder != null) {
int viewHeight = mPreviewView.getHeight();