--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<merge xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <com.android.camera.ui.TopRightWeightedLayout
+ android:id="@+id/bottombar_intent_review"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal"
+ android:gravity="center"
+ android:visibility="invisible"
+ android:background="@null" >
+ <ImageButton
+ android:id="@+id/cancel_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="right|center_vertical"
+ android:paddingTop="24dp"
+ android:src="@drawable/ic_cancel"
+ android:background="@null"
+ android:contentDescription="@string/cancel_button_description" />
+ <ImageButton
+ android:id="@+id/done_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:src="@drawable/ic_confirm"
+ android:layout_weight="1"
+ android:background="@null"
+ android:contentDescription="@string/done_button_description" />
+ <ImageButton
+ android:id="@+id/retake_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="left|center_vertical"
+ android:paddingBottom="24dp"
+ android:src="@drawable/ic_back"
+ android:background="@null"
+ android:contentDescription="@string/retake_button_description" />
+ </com.android.camera.ui.TopRightWeightedLayout>
+</merge>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<merge xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <com.android.camera.ui.TopRightWeightedLayout
+ android:id="@+id/bottombar_intent_review"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal"
+ android:gravity="center"
+ android:visibility="invisible"
+ android:background="@null" >
+ <ImageButton
+ android:id="@+id/retake_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="left|center_vertical"
+ android:paddingLeft="24dp"
+ android:src="@drawable/ic_back"
+ android:background="@null"
+ android:contentDescription="@string/retake_button_description" />
+ <ImageButton
+ android:id="@+id/done_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:src="@drawable/ic_confirm"
+ android:layout_weight="1"
+ android:background="@null"
+ android:contentDescription="@string/done_button_description" />
+ <ImageButton
+ android:id="@+id/cancel_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="right|center_vertical"
+ android:paddingRight="24dp"
+ android:src="@drawable/ic_cancel"
+ android:background="@null"
+ android:contentDescription="@string/cancel_button_description" />
+ </com.android.camera.ui.TopRightWeightedLayout>
+</merge>
\ No newline at end of file
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible" >
- <ImageButton
- android:id="@+id/shutter_cancel_button"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center"
- android:scaleType="center"
- android:clickable="true"
- android:contentDescription="@string/accessibility_cancel_button"
- android:focusable="true"
- android:background="@null"
- android:src="@drawable/ic_cancel" />
- </FrameLayout>
-
-
- <com.android.camera.ui.TopRightWeightedLayout
- android:id="@+id/bottombar_intent_review"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal"
- android:gravity="center"
- android:visibility="invisible"
- android:background="@null" >
- <ImageButton
- android:id="@+id/retake_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left|center_vertical"
- android:paddingLeft="24dp"
- android:src="@drawable/ic_back"
- android:background="@null"
- android:contentDescription="@string/retake_button_description" />
- <ImageButton
- android:id="@+id/done_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ <ImageButton
+ android:id="@+id/shutter_cancel_button"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:layout_gravity="center"
- android:src="@drawable/ic_confirm"
- android:layout_weight="1"
- android:background="@null"
- android:contentDescription="@string/done_button_description" />
- <ImageButton
- android:id="@+id/cancel_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="right|center_vertical"
- android:paddingRight="24dp"
- android:src="@drawable/ic_cancel"
+ android:scaleType="center"
+ android:clickable="true"
+ android:contentDescription="@string/accessibility_cancel_button"
+ android:focusable="true"
android:background="@null"
- android:contentDescription="@string/cancel_button_description" />
- </com.android.camera.ui.TopRightWeightedLayout>
+ android:src="@drawable/ic_cancel" />
+ </FrameLayout>
+
+ <include layout="@layout/retake_done_cancel_layout" />
</merge>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<ImageView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/intent_review_imageview"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="fitCenter"
+ android:background="@android:color/black"
+ android:visibility="invisible" />
return;
}
mUI.hidePostCaptureAlert();
+ mUI.hideIntentReviewImageView();
setupPreview();
}
import android.app.Dialog;
import android.content.DialogInterface;
import android.graphics.Bitmap;
+import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.graphics.SurfaceTexture;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
import com.android.camera.FocusOverlayManager.FocusUI;
import com.android.camera.cameradevice.CameraManager;
private int mPreviewHeight = 0;
private float mAspectRatio = UNSET;
+ private ImageView mIntentReviewImageView;
+
private final GestureDetector.OnGestureListener mPreviewGestureListener
= new GestureDetector.SimpleOnGestureListener() {
@Override
if (isCancelled()) {
return;
}
+
+ mIntentReviewImageView.setImageBitmap(bitmap);
+ showIntentReviewImageView();
+
mDecodeTaskForReview = null;
}
}
mFocusUI = (FocusUI) mRootView.findViewById(R.id.focus_overlay);
mPreviewOverlay = (PreviewOverlay) mRootView.findViewById(R.id.preview_overlay);
mCountdownView = (CountDownView) mRootView.findViewById(R.id.count_down_view);
+
+ if (mController.isImageCaptureIntent()) {
+ createIntentReviewImageView();
+ }
+ }
+
+ private void createIntentReviewImageView() {
+ ViewGroup parentViewGroup = (ViewGroup) mRootView;
+ mIntentReviewImageView = (ImageView) mActivity.getLayoutInflater()
+ .inflate(R.layout.intent_review_imageview, parentViewGroup, false);
+ parentViewGroup.addView(mIntentReviewImageView);
+ mIntentReviewImageView.bringToFront();
+
+ mActivity.getCameraAppUI().addPreviewAreaChangedListener(
+ new PreviewStatusListener.PreviewAreaChangedListener() {
+ @Override
+ public void onPreviewAreaChanged(RectF previewArea) {
+ FrameLayout.LayoutParams params =
+ (FrameLayout.LayoutParams) mIntentReviewImageView.getLayoutParams();
+ params.width = (int) previewArea.width();
+ params.height = (int) previewArea.height();
+ params.setMargins((int) previewArea.left, (int) previewArea.top, 0, 0);
+ mIntentReviewImageView.setLayoutParams(params);
+ }
+ });
}
+ /**
+ * Show the image review over the live preview for intent captures.
+ */
+ public void showIntentReviewImageView() {
+ if (mIntentReviewImageView != null) {
+ mIntentReviewImageView.setVisibility(View.VISIBLE);
+ }
+ }
+
+ /**
+ * Hide the image review over the live preview for intent captures.
+ */
+ public void hideIntentReviewImageView() {
+ if (mIntentReviewImageView != null) {
+ mIntentReviewImageView.setVisibility(View.INVISIBLE);
+ }
+ }
+
+
public FocusUI getFocusUI() {
return mFocusUI;
}
/**
* This takes a matrix to apply to the texture view and uses the screen
* aspect ratio as the target aspect ratio
- *
+ *
* @param matrix the matrix to apply
* @param aspectRatio the aspectRatio that the preview should be
*/
}
/**
- * Perform a transition to the global intent layout. The current
- * layout state of the bottom bar is irrelevant.
+ * Perform a transition to the global intent layout.
+ * The current layout state of the bottom bar is irrelevant.
*/
public void transitionToIntentCaptureLayout() {
mIntentReviewLayout.setVisibility(View.INVISIBLE);
mCaptureLayout.setVisibility(View.VISIBLE);
mCancelLayout.setVisibility(View.INVISIBLE);
-
mMode = MODE_INTENT;
}