Merge "Add CameraProvider methods to check camera facing." into gb-ub-photos-denali
diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml
index 1617750..dc27eb2 100644
--- a/res/layout/activity_main.xml
+++ b/res/layout/activity_main.xml
@@ -31,6 +31,5 @@
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent" />
- <include layout="@layout/mode_list_layout" />
</com.android.camera.ui.MainActivityLayout>
diff --git a/res/layout/camera.xml b/res/layout/camera.xml
index 6f1c111..90060c7 100644
--- a/res/layout/camera.xml
+++ b/res/layout/camera.xml
@@ -13,9 +13,15 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
+<!-- TODO: Now camera root gets cleared during mode switch. We need to move mode
+ switcher into camera root when refactor is finished. -->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/camera_app_root"
android:layout_width="match_parent"
android:layout_height="match_parent" >
+ <FrameLayout
+ android:id="@+id/camera_app_root"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+ <include layout="@layout/mode_list_layout" />
</FrameLayout>
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 14a55b0..cd53ad4 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -149,6 +149,7 @@
private static final int MSG_CLEAR_SCREEN_ON_FLAG = 2;
private static final long SHOW_ACTION_BAR_TIMEOUT_MS = 3000;
private static final long SCREEN_DELAY_MS = 2 * 60 * 1000; // 2 mins.
+ private static final int SHIMMY_DELAY_MS = 1000;
/**
* Whether onResume should reset the view to the preview.
@@ -183,7 +184,6 @@
private CameraModule mCurrentModule;
private ModuleManagerImpl mModuleManager;
private FrameLayout mAboveFilmstripControlLayout;
- private FrameLayout mCameraModuleRootView;
private FilmstripController mFilmstripController;
private ProgressBar mBottomProgress;
private View mPanoStitchingPanel;
@@ -860,7 +860,7 @@
@Override
public FrameLayout getModuleLayoutRoot() {
- return mCameraModuleRootView;
+ return mCameraAppUI.getModuleRootView();
}
@Override
@@ -1167,7 +1167,6 @@
.getGcamProcessingManager();
mPanoramaManager.addTaskListener(mStitchingListener);
mPlaceholderManager.addTaskListener(mPlaceholderListener);
- mCameraModuleRootView = (FrameLayout) findViewById(R.id.camera_app_root);
mPanoStitchingPanel = findViewById(R.id.pano_stitching_progress_panel);
mBottomProgress = (ProgressBar) findViewById(R.id.pano_stitching_progress_bar);
mFilmstripController = ((FilmstripView) findViewById(R.id.filmstrip_view)).getController();
@@ -1181,10 +1180,8 @@
new ColorDrawable(getResources().getColor(R.color.photo_placeholder)));
mFilmstripController.setListener(mFilmStripListener);
- // TODO: Remove the 3rd parameter once mCameraModuleRoot is moved out of filmstrip
mCameraAppUI = new CameraAppUI(this,
(MainActivityLayout) findViewById(R.id.activity_root_view),
- mCameraModuleRootView,
isSecureCamera(), isCaptureIntent());
mLocationManager = new LocationManager(this,
@@ -1377,6 +1374,7 @@
if (mResetToPreviewOnResume) {
// Go to the preview on resume.
mFilmstripController.goToFirstItem();
+ mModeListView.startAccordionAnimationWithDelay(SHIMMY_DELAY_MS);
}
// Default is showing the preview, unless disabled by explicitly
// starting an activity we want to return from to the filmstrip rather
@@ -1396,7 +1394,6 @@
keepScreenOnForAWhile();
- mModeListView.startAccordionAnimation();
}
@Override
diff --git a/src/com/android/camera/app/CameraAppUI.java b/src/com/android/camera/app/CameraAppUI.java
index 1b0e6a8..fbf95e1 100644
--- a/src/com/android/camera/app/CameraAppUI.java
+++ b/src/com/android/camera/app/CameraAppUI.java
@@ -27,16 +27,15 @@
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
+import android.widget.FrameLayout;
import android.widget.ImageView;
import com.android.camera.AnimationManager;
-import com.android.camera.ui.CameraControls;
import com.android.camera.ui.FilmstripLayout;
import com.android.camera.ui.MainActivityLayout;
import com.android.camera.ui.ModeListView;
import com.android.camera.ui.ModeTransitionView;
import com.android.camera.ui.PreviewOverlay;
-import com.android.camera.ui.RenderOverlay;
import com.android.camera2.R;
/**
@@ -75,12 +74,10 @@
private final ModeTransitionView mModeTransitionView;
private final MainActivityLayout mAppRootView;
private final ModeListView mModeListView;
- private final View mFilmstripView;
private final FilmstripLayout mFilmstripLayout;
private TextureView mTextureView;
- private CameraControls mCameraControls;
private View mFlashOverlay;
- private ViewGroup mModuleUI;
+ private FrameLayout mModuleUI;
private GestureDetector mGestureDetector;
private int mSwipeState = IDLE;
@@ -156,7 +153,6 @@
}
public CameraAppUI(AppController controller, MainActivityLayout appRootView,
- ViewGroup cameraRoot,
boolean isSecureCamera, boolean isCaptureIntent) {
mSlop = ViewConfiguration.get(controller.getAndroidContext()).getScaledTouchSlop();
mController = controller;
@@ -164,9 +160,8 @@
mIsCaptureIntent = isCaptureIntent;
mAppRootView = appRootView;
- mFilmstripView = appRootView.findViewById(R.id.filmstrip_view);
mFilmstripLayout = (FilmstripLayout) appRootView.findViewById(R.id.filmstrip_layout);
- mCameraRootView = cameraRoot;
+ mCameraRootView = (ViewGroup) appRootView.findViewById(R.id.camera_app_root);
mModeTransitionView = (ModeTransitionView)
mAppRootView.findViewById(R.id.mode_transition_view);
mGestureDetector = new GestureDetector(controller.getAndroidContext(),
@@ -246,15 +241,13 @@
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.generic_module, mCameraRootView, true);
- mModuleUI = (ViewGroup) mCameraRootView.findViewById(R.id.module_layout);
+ mModuleUI = (FrameLayout) mCameraRootView.findViewById(R.id.module_layout);
mTextureView = (TextureView) mCameraRootView.findViewById(R.id.preview_content);
mPreviewOverlay = (PreviewOverlay) mCameraRootView.findViewById(R.id.preview_overlay);
mPreviewOverlay.setOnTouchListener(new MyTouchListener());
mFlashOverlay = mCameraRootView.findViewById(R.id.flash_overlay);
mPreviewThumbView = (ImageView) mCameraRootView.findViewById(R.id.preview_thumb);
- // TODO: Remove camera controls.
- mCameraControls = (CameraControls) mCameraRootView.findViewById(R.id.camera_controls);
}
// TODO: Remove this when refactor is done.
@@ -265,7 +258,6 @@
mTextureView = null;
mPreviewOverlay = null;
mFlashOverlay = null;
- mCameraControls = null;
}
/**
@@ -274,7 +266,7 @@
*
* @return a view group for modules to attach views to
*/
- public ViewGroup getModuleRootView() {
+ public FrameLayout getModuleRootView() {
return mModuleUI;
}
diff --git a/src/com/android/camera/ui/ModeListView.java b/src/com/android/camera/ui/ModeListView.java
index 1795218..edc0d17 100644
--- a/src/com/android/camera/ui/ModeListView.java
+++ b/src/com/android/camera/ui/ModeListView.java
@@ -400,6 +400,20 @@
}
/**
+ * This starts the accordion animation with a delay.
+ *
+ * @param delay delay in milliseconds before starting animation
+ */
+ public void startAccordionAnimationWithDelay(int delay) {
+ postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ startAccordionAnimation();
+ }
+ }, delay);
+ }
+
+ /**
* Resets the visible width of all the mode selectors to 0.
*/
private void resetModeSelectors() {