summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngus Kong <shkong@google.com>2011-09-07 05:14:15 +0800
committerAngus Kong <shkong@google.com>2011-09-07 05:27:36 +0800
commita466abbd54caa8100a1ef6584a5b0db78224a125 (patch)
tree5b85264cb029e909bad881f404dd778af403004d
parent957e7732b2095087b25646a7d1b272b8d010a703 (diff)
downloadLegacyCamera-a466abbd54caa8100a1ef6584a5b0db78224a125.zip
LegacyCamera-a466abbd54caa8100a1ef6584a5b0db78224a125.tar.gz
LegacyCamera-a466abbd54caa8100a1ef6584a5b0db78224a125.tar.bz2
The controls stay while capturing.
Change-Id: I1f375b8526dc131ee658c38c5b5dfa62fdf05335
-rw-r--r--res/anim/slide_in_from_right.xml22
-rw-r--r--res/anim/slide_out_to_right.xml22
-rw-r--r--res/layout/pano_capture.xml51
-rw-r--r--src/com/android/camera/panorama/PanoramaActivity.java31
4 files changed, 42 insertions, 84 deletions
diff --git a/res/anim/slide_in_from_right.xml b/res/anim/slide_in_from_right.xml
deleted file mode 100644
index 567c2a1..0000000
--- a/res/anim/slide_in_from_right.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<translate xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/decelerate_interpolator"
- android:fromXDelta="100%"
- android:toXDelta="0%"
- android:duration="300">
-</translate>
diff --git a/res/anim/slide_out_to_right.xml b/res/anim/slide_out_to_right.xml
deleted file mode 100644
index 01a321b..0000000
--- a/res/anim/slide_out_to_right.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<translate xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/decelerate_interpolator"
- android:fromXDelta="0%"
- android:toXDelta="100%"
- android:duration="300">
-</translate>
diff --git a/res/layout/pano_capture.xml b/res/layout/pano_capture.xml
index 7736ddf..3af0f34 100644
--- a/res/layout/pano_capture.xml
+++ b/res/layout/pano_capture.xml
@@ -20,33 +20,42 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
- <LinearLayout android:id="@+id/pano_capture_preview"
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="vertical">
+ android:orientation="horizontal">
- <ImageView style="@style/PanoViewHorizontalGrayBar"/>
+ <LinearLayout android:id="@+id/pano_capture_preview"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:orientation="vertical">
- <com.android.camera.panorama.MosaicRendererSurfaceView
- android:id="@+id/pano_renderer"
- android:layout_gravity="center"
- android:layout_width="@dimen/pano_mosaic_surface_width"
- android:layout_height="@dimen/pano_mosaic_surface_height" />
+ <ImageView style="@style/PanoViewHorizontalGrayBar"/>
- <LinearLayout android:id="@+id/pano_capture_control"
- style="@style/PanoViewHorizontalGrayBar"
- android:gravity="right"
- android:visibility="visible"
- android:orientation="horizontal">
+ <com.android.camera.panorama.MosaicRendererSurfaceView
+ android:id="@+id/pano_renderer"
+ android:layout_gravity="center"
+ android:layout_width="@dimen/pano_mosaic_surface_width"
+ android:layout_height="@dimen/pano_mosaic_surface_height" />
- <Button android:id="@+id/pano_capture_stop_button"
- android:text="@string/pano_capture_stop"
- android:onClick="onStopButtonClicked"
- android:visibility="gone"
- android:textAppearance="?android:textAppearanceMedium"
- android:layout_width="@dimen/pano_capture_stop_button_width"
- android:layout_height="@dimen/pano_capture_stop_button_width" />
+ <LinearLayout android:id="@+id/pano_capture_control"
+ style="@style/PanoViewHorizontalGrayBar"
+ android:gravity="right"
+ android:visibility="visible"
+ android:orientation="horizontal">
+
+ <Button android:id="@+id/pano_capture_stop_button"
+ android:text="@string/pano_capture_stop"
+ android:onClick="onStopButtonClicked"
+ android:visibility="gone"
+ android:textAppearance="?android:textAppearanceMedium"
+ android:layout_width="@dimen/pano_capture_stop_button_width"
+ android:layout_height="@dimen/pano_capture_stop_button_width" />
+ </LinearLayout>
</LinearLayout>
+ <include layout="@layout/pano_control" />
+
</LinearLayout>
<com.android.camera.panorama.IndicationView
@@ -57,8 +66,6 @@
android:layout_width="@dimen/pano_indication_width"
android:layout_height="@dimen/pano_indication_height" />
- <include layout="@layout/pano_control" android:id="@+id/pano_control_layout" />
-
<TextView android:id="@+id/pano_capture_too_fast_textview"
android:text="@string/pano_too_fast_prompt"
android:textAppearance="?android:textAppearanceMedium"
diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java
index f35b77e..bfeed2a 100644
--- a/src/com/android/camera/panorama/PanoramaActivity.java
+++ b/src/com/android/camera/panorama/PanoramaActivity.java
@@ -86,8 +86,8 @@ public class PanoramaActivity extends Activity implements
private static final String TAG = "PanoramaActivity";
private static final int PREVIEW_STOPPED = 0;
private static final int PREVIEW_ACTIVE = 1;
- private static final int CAPTURE_VIEWFINDER = 0;
- private static final int CAPTURE_MOSAIC = 1;
+ private static final int CAPTURE_STATE_VIEWFINDER = 0;
+ private static final int CAPTURE_STATE_MOSAIC = 1;
// Speed is in unit of deg/sec
private static final float PANNING_SPEED_THRESHOLD = 20f;
@@ -97,7 +97,6 @@ public class PanoramaActivity extends Activity implements
private boolean mPausing;
- private View mPanoControlLayout;
private View mPanoLayout;
private View mCaptureLayout;
private Button mStopCaptureButton;
@@ -106,7 +105,6 @@ public class PanoramaActivity extends Activity implements
private IndicationView mIndicationView;
private MosaicRendererSurfaceView mMosaicView;
private TextView mTooFastPrompt;
- private Animation mSlideIn, mSlideOut;
private ProgressDialog mProgressDialog;
private String mPreparePreviewString;
@@ -208,8 +206,6 @@ public class PanoramaActivity extends Activity implements
mDialogOk = getResources().getString(R.string.dialog_ok);
Context context = getApplicationContext();
- mSlideIn = AnimationUtils.loadAnimation(context, R.anim.slide_in_from_right);
- mSlideOut = AnimationUtils.loadAnimation(context, R.anim.slide_out_to_right);
mMainHandler = new Handler() {
@Override
@@ -412,7 +408,7 @@ public class PanoramaActivity extends Activity implements
}
});
// Update the transformation matrix for mosaic pre-process.
- if (mCaptureState == CAPTURE_VIEWFINDER) {
+ if (mCaptureState == CAPTURE_STATE_VIEWFINDER) {
runViewFinder();
} else {
runMosaicCapture();
@@ -422,9 +418,7 @@ public class PanoramaActivity extends Activity implements
public void startCapture() {
// Reset values so we can do this again.
mTimeTaken = System.currentTimeMillis();
- mCaptureState = CAPTURE_MOSAIC;
- mPanoControlLayout.startAnimation(mSlideOut);
- mPanoControlLayout.setVisibility(View.GONE);
+ mCaptureState = CAPTURE_STATE_MOSAIC;
mCompassValueXStart = mCompassValueXStartBuffer;
mCompassValueYStart = mCompassValueYStartBuffer;
@@ -454,7 +448,7 @@ public class PanoramaActivity extends Activity implements
}
private void stopCapture() {
- mCaptureState = CAPTURE_VIEWFINDER;
+ mCaptureState = CAPTURE_STATE_VIEWFINDER;
mTooFastPrompt.setVisibility(View.GONE);
mMosaicFrameProcessor.setProgressListener(null);
@@ -499,7 +493,7 @@ public class PanoramaActivity extends Activity implements
private void createContentView() {
setContentView(R.layout.panorama);
- mCaptureState = CAPTURE_VIEWFINDER;
+ mCaptureState = CAPTURE_STATE_VIEWFINDER;
mCaptureLayout = (View) findViewById(R.id.pano_capture_layout);
mIndicationView = (IndicationView) findViewById(R.id.pano_capture_view);
@@ -515,7 +509,6 @@ public class PanoramaActivity extends Activity implements
mMosaicView.getRenderer().setMosaicSurfaceCreateListener(this);
mMosaicView.setVisibility(View.VISIBLE);
- mPanoControlLayout = (View) findViewById(R.id.pano_control_layout);
mModePicker = (ModePicker) findViewById(R.id.mode_picker);
mModePicker.setVisibility(View.VISIBLE);
mModePicker.setOnModeChangeListener(this);
@@ -529,7 +522,11 @@ public class PanoramaActivity extends Activity implements
// If mSurfaceTexture == null then GL setup is not finished yet.
// No buttons can be pressed.
if (mPausing || mThreadRunning || mSurfaceTexture == null) return;
- startCapture();
+ // Since this button will stay on the screen when capturing, we need to check the state
+ // right now.
+ if (mCaptureState == CAPTURE_STATE_VIEWFINDER) {
+ startCapture();
+ }
}
@OnClickAttr
@@ -640,13 +637,11 @@ public class PanoramaActivity extends Activity implements
}
private void resetToPreview() {
- mCaptureState = CAPTURE_VIEWFINDER;
+ mCaptureState = CAPTURE_STATE_VIEWFINDER;
mReviewLayout.setVisibility(View.GONE);
mStopCaptureButton.setVisibility(View.GONE);
mIndicationView.setVisibility(View.GONE);
- mPanoControlLayout.setVisibility(View.VISIBLE);
- mPanoControlLayout.startAnimation(mSlideIn);
mCaptureLayout.setVisibility(View.VISIBLE);
mMosaicFrameProcessor.reset();
@@ -717,7 +712,7 @@ public class PanoramaActivity extends Activity implements
* resources.
*/
mSensorManager.registerListener(mListener, mSensor, SensorManager.SENSOR_DELAY_UI);
- mCaptureState = CAPTURE_VIEWFINDER;
+ mCaptureState = CAPTURE_STATE_VIEWFINDER;
setupCamera();
if (mSurfaceTexture != null) {
mSurfaceTexture.setOnFrameAvailableListener(this);