summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2010-11-11 17:09:36 +0800
committerHung-ying Tyan <tyanh@google.com>2010-11-12 18:41:45 +0800
commita2cbd31e81bf6b4a65ade4a5c34c303546d57d8c (patch)
tree780653be01d66baf367732b9e9ef04a3ea9a88cb /src
parent02ec7c0880ded5863d73d6f173ef35ab5c888dcd (diff)
downloadpackages_apps_LegacyCamera-a2cbd31e81bf6b4a65ade4a5c34c303546d57d8c.zip
packages_apps_LegacyCamera-a2cbd31e81bf6b4a65ade4a5c34c303546d57d8c.tar.gz
packages_apps_LegacyCamera-a2cbd31e81bf6b4a65ade4a5c34c303546d57d8c.tar.bz2
Move camera UI elements to their own xml files.
Hopefully with this CL, the code doesn't need to worry about the placement of the UI elements. Change details: + Move preview frame out of camera.xml and video_camera.xml. --> create preview_frame.xml and preview_frame_video.xml in both layout/ and layout-xlarge/. + Move thumbnail list view out of camera.xml and video_camera.xml. --> create thumbnail_list.xml in layout-xlarge/. + Make camera.xml and video_camera.xml a pure container which includes other UI elements. + Create camera_attach.xml and video_camera_attach.xml for the attachment scenario with its own camera control and no thumbnail list. + Camera and VideoCamera are modified accordingly. + Remove redundant RelativeLayout container in camera_control.xml. + Also fix a layout bug in PreviewFrameLayout.java. Change-Id: Ief556c9aa77b0322312bb46ce1d274df3a26aa4d
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/Camera.java18
-rw-r--r--src/com/android/camera/PreviewFrameLayout.java2
-rw-r--r--src/com/android/camera/VideoCamera.java44
3 files changed, 28 insertions, 36 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 10253f2..702be0a 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -442,7 +442,6 @@ public class Camera extends NoSearchActivity implements View.OnClickListener,
// Add gallery button to header view.
if (mThumbnailList.getHeaderViewsCount() == 0) {
- LayoutInflater inflater = getLayoutInflater();
Button b = new Button(this);
ListView.LayoutParams params = new ListView.LayoutParams(width, width);
b.setId(R.id.btn_gallery);
@@ -1061,7 +1060,12 @@ public class Camera extends NoSearchActivity implements View.OnClickListener,
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
- setContentView(R.layout.camera);
+ mIsImageCaptureIntent = isImageCaptureIntent();
+ if (mIsImageCaptureIntent) {
+ setContentView(R.layout.camera_attach);
+ } else {
+ setContentView(R.layout.camera);
+ }
mSurfaceView = (SurfaceView) findViewById(R.id.camera_preview);
mPreferences = new ComboPreferences(this);
@@ -1103,22 +1107,14 @@ public class Camera extends NoSearchActivity implements View.OnClickListener,
holder.addCallback(this);
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
- mIsImageCaptureIntent = isImageCaptureIntent();
if (mIsImageCaptureIntent) {
setupCaptureParams();
- }
- LayoutInflater inflater = getLayoutInflater();
-
- ViewGroup rootView = (ViewGroup) findViewById(R.id.camera);
- if (mIsImageCaptureIntent) {
- View controlBar = inflater.inflate(
- R.layout.attach_camera_control, rootView);
+ View controlBar = findViewById(R.id.control_bar);
controlBar.findViewById(R.id.btn_cancel).setOnClickListener(this);
controlBar.findViewById(R.id.btn_retake).setOnClickListener(this);
controlBar.findViewById(R.id.btn_done).setOnClickListener(this);
} else {
- inflater.inflate(R.layout.camera_control, rootView);
mSwitcher = ((Switcher) findViewById(R.id.camera_switch));
mSwitcher.setOnSwitchListener(this);
mSwitcher.addTouchView(findViewById(R.id.camera_switch_set));
diff --git a/src/com/android/camera/PreviewFrameLayout.java b/src/com/android/camera/PreviewFrameLayout.java
index 385bbcc..2eda53f 100644
--- a/src/com/android/camera/PreviewFrameLayout.java
+++ b/src/com/android/camera/PreviewFrameLayout.java
@@ -93,7 +93,7 @@ public class PreviewFrameLayout extends ViewGroup {
mFrame.measure(
MeasureSpec.makeMeasureSpec(frameWidth, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(frameHeight, MeasureSpec.EXACTLY));
- mFrame.layout(l + hSpace, t + vSpace, r - hSpace, b - vSpace);
+ mFrame.layout(hSpace, vSpace, frameWidth + hSpace, frameHeight + vSpace);
if (mSizeListener != null) {
mSizeListener.onSizeChanged();
}
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 28f9546..2e9b22f 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -343,7 +343,26 @@ public class VideoCamera extends NoSearchActivity
mContentResolver = getContentResolver();
requestWindowFeature(Window.FEATURE_PROGRESS);
- setContentView(R.layout.video_camera);
+ mIsVideoCaptureIntent = isVideoCaptureIntent();
+ if (mIsVideoCaptureIntent) {
+ setContentView(R.layout.video_camera_attach);
+
+ View controlBar = findViewById(R.id.control_bar);
+ controlBar.findViewById(R.id.btn_cancel).setOnClickListener(this);
+ ImageView retake =
+ (ImageView) controlBar.findViewById(R.id.btn_retake);
+ retake.setOnClickListener(this);
+ retake.setImageResource(R.drawable.btn_ic_review_retake_video);
+ controlBar.findViewById(R.id.btn_play).setOnClickListener(this);
+ controlBar.findViewById(R.id.btn_done).setOnClickListener(this);
+ } else {
+ setContentView(R.layout.video_camera);
+
+ initThumbnailButton();
+ mSwitcher = ((Switcher) findViewById(R.id.camera_switch));
+ mSwitcher.setOnSwitchListener(this);
+ mSwitcher.addTouchView(findViewById(R.id.camera_switch_set));
+ }
mPreviewFrameLayout = (PreviewFrameLayout)
findViewById(R.id.frame_layout);
@@ -360,30 +379,8 @@ public class VideoCamera extends NoSearchActivity
holder.addCallback(this);
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
- mIsVideoCaptureIntent = isVideoCaptureIntent();
mQuickCapture = getIntent().getBooleanExtra(EXTRA_QUICK_CAPTURE, false);
- ViewGroup rootView = (ViewGroup) findViewById(R.id.video_camera);
- LayoutInflater inflater = this.getLayoutInflater();
- if (!mIsVideoCaptureIntent) {
- View controlBar = inflater.inflate(
- R.layout.camera_control, rootView);
- initThumbnailButton();
- mSwitcher = ((Switcher) findViewById(R.id.camera_switch));
- mSwitcher.setOnSwitchListener(this);
- mSwitcher.addTouchView(findViewById(R.id.camera_switch_set));
- } else {
- View controlBar = inflater.inflate(
- R.layout.attach_camera_control, rootView);
- controlBar.findViewById(R.id.btn_cancel).setOnClickListener(this);
- ImageView retake =
- (ImageView) controlBar.findViewById(R.id.btn_retake);
- retake.setOnClickListener(this);
- retake.setImageResource(R.drawable.btn_ic_review_retake_video);
- controlBar.findViewById(R.id.btn_play).setOnClickListener(this);
- controlBar.findViewById(R.id.btn_done).setOnClickListener(this);
- }
-
mShutterButton = (ShutterButton) findViewById(R.id.shutter_button);
mShutterButton.setImageResource(R.drawable.btn_ic_video_record);
mShutterButton.setOnShutterButtonListener(this);
@@ -1539,7 +1536,6 @@ public class VideoCamera extends NoSearchActivity
// Add gallery button to header view.
if (mThumbnailList.getHeaderViewsCount() == 0) {
- LayoutInflater inflater = getLayoutInflater();
Button b = new Button(this);
ListView.LayoutParams params = new ListView.LayoutParams(width, width);
b.setId(R.id.btn_gallery);