diff options
author | Jay Wang <jaywang@codeaurora.org> | 2016-03-14 15:52:45 -0700 |
---|---|---|
committer | codeworkx <daniel.hillenbrand@codeworkx.de> | 2017-04-09 20:44:47 +0200 |
commit | 054040364b8a4cb79b600c3c169f358333507ea9 (patch) | |
tree | 682ece7d68b3d06a163858a6ce08cad537ea0c28 | |
parent | 673547e1979ccb64a62e45277bcaba67641e676a (diff) | |
download | android_packages_apps_Snap-054040364b8a4cb79b600c3c169f358333507ea9.tar.gz android_packages_apps_Snap-054040364b8a4cb79b600c3c169f358333507ea9.tar.bz2 android_packages_apps_Snap-054040364b8a4cb79b600c3c169f358333507ea9.zip |
Snap: CaptureUI: fix ModuleSwitcher being invisible
Change-Id: If0a88140a1e73b3f8a7281274896af047af2abde
-rw-r--r-- | src/com/android/camera/CaptureUI.java | 41 | ||||
-rw-r--r-- | src/com/android/camera/ui/ModuleSwitcher.java | 9 |
2 files changed, 46 insertions, 4 deletions
diff --git a/src/com/android/camera/CaptureUI.java b/src/com/android/camera/CaptureUI.java index 6cc8e28ee..9d293581a 100644 --- a/src/com/android/camera/CaptureUI.java +++ b/src/com/android/camera/CaptureUI.java @@ -63,6 +63,7 @@ import com.android.camera.ui.CountDownView; import com.android.camera.ui.focus.FocusRing; import com.android.camera.ui.ListMenu; import com.android.camera.ui.ListSubMenu; +import com.android.camera.ui.ModuleSwitcher; import com.android.camera.ui.PieRenderer; import com.android.camera.ui.RenderOverlay; import com.android.camera.ui.RotateImageView; @@ -210,6 +211,7 @@ public class CaptureUI extends BaseUI implements PreviewGestures.SingleTapListen private ImageView mVideoButton; private RenderOverlay mRenderOverlay; private View mMenuButton; + private ModuleSwitcher mSwitcher; private CountDownView mCountDownView; private PieRenderer mPieRenderer; private ZoomRenderer mZoomRenderer; @@ -296,6 +298,19 @@ public class CaptureUI extends BaseUI implements PreviewGestures.SingleTapListen mTrackingFocusRenderer.setVisible(false); } + mSwitcher = (ModuleSwitcher) mRootView.findViewById(R.id.camera_switcher); + mSwitcher.setCurrentIndex(ModuleSwitcher.PHOTO_MODULE_INDEX); + mSwitcher.setSwitchListener(mActivity); + mSwitcher.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (mModule.getCameraState() == PhotoController.LONGSHOT) { + return; + } + mSwitcher.showPopup(); + mSwitcher.setOrientation(mOrientation, false); + } + }); mMenuButton = mRootView.findViewById(R.id.menu); mRecordingTime.setPauseListener(this); @@ -498,9 +513,11 @@ public class CaptureUI extends BaseUI implements PreviewGestures.SingleTapListen mMenuButton.setVisibility(recording ? View.GONE : View.VISIBLE); if (recording) { mVideoButton.setImageResource(R.drawable.shutter_button_video_stop); + hideSwitcher(); mMuteButton.setVisibility(View.VISIBLE); } else { mVideoButton.setImageResource(R.drawable.btn_new_shutter_video); + showSwitcher(); stopRecordingTimer(); mMuteButton.setVisibility(View.INVISIBLE); } @@ -520,6 +537,19 @@ public class CaptureUI extends BaseUI implements PreviewGestures.SingleTapListen mSceneModeSwitcher.setVisibility(View.VISIBLE); } + public void hideSwitcher() { + mSwitcher.closePopup(); + mSwitcher.setVisibility(View.INVISIBLE); + } + + public void showSwitcher() { + mSwitcher.setVisibility(View.VISIBLE); + } + + public void setSwitcherIndex() { + mSwitcher.setCurrentIndex(ModuleSwitcher.PHOTO_MODULE_INDEX); + } + public void addSceneMode() { String value = mSettingsManager.getValue(SettingsManager.KEY_SCENE_MODE); if (value == null) return; @@ -1044,6 +1074,7 @@ public class CaptureUI extends BaseUI implements PreviewGestures.SingleTapListen if (mFrontBackSwitcher != null) mFrontBackSwitcher.setVisibility(status); if (mSceneModeSwitcher != null) mSceneModeSwitcher.setVisibility(status); if (mFilterModeSwitcher != null) mFilterModeSwitcher.setVisibility(status); + if (mSwitcher != null) mSwitcher.setVisibility(status); } public boolean isCameraControlsAnimating() { @@ -1162,8 +1193,12 @@ public class CaptureUI extends BaseUI implements PreviewGestures.SingleTapListen // ignore backs while we're taking a picture return true; } - mCameraControls.collapse(); - return false; + if (mSwitcher != null && mSwitcher.showsPopup()) { + mSwitcher.closePopup(); + return true; + } else { + return false; + } } public SurfaceHolder getSurfaceHolder() { @@ -1270,7 +1305,7 @@ public class CaptureUI extends BaseUI implements PreviewGestures.SingleTapListen } public boolean collapseCameraControls() { - mCameraControls.collapse(); + mSwitcher.closePopup(); // Remove all the popups/dialog boxes boolean ret = false; removeAllMenu(); diff --git a/src/com/android/camera/ui/ModuleSwitcher.java b/src/com/android/camera/ui/ModuleSwitcher.java index c0b0e4348..cab75fa7e 100644 --- a/src/com/android/camera/ui/ModuleSwitcher.java +++ b/src/com/android/camera/ui/ModuleSwitcher.java @@ -69,6 +69,7 @@ public class ModuleSwitcher extends RotateImageView { private int[] mModuleIds; private int[][] mDrawAndDescIds; private PopupWindow mPopup; + private boolean mShowingPopup; private LinearLayout mContent; private float mTranslationX; @@ -116,7 +117,7 @@ public class ModuleSwitcher extends RotateImageView { public void setCurrentIndex(int i) { mCurrentIndex = i; - if (i == GCAM_MODULE_INDEX) { + if (i == GCAM_MODULE_INDEX || i == CAPTURE_MODULE_INDEX) { setImageResource(R.drawable.ic_switch_camera); } else { setImageResource(mDrawAndDescIds[i][0]); @@ -185,7 +186,12 @@ public class ModuleSwitcher extends RotateImageView { closePopup(); } + public boolean showsPopup() { + return mShowingPopup; + } + private void showSwitcher() { + mShowingPopup = true; mPopup = getPopup(); mPopup.showAsDropDown(this, ((getWidth() / 2) - (mContent.getMeasuredWidth() / 2)), -(mContent.getMeasuredHeight() + Math.round(0.75f * getHeight())), @@ -193,6 +199,7 @@ public class ModuleSwitcher extends RotateImageView { } public void closePopup() { + mShowingPopup = false; if (mPopup != null) { mPopup.dismiss(); mPopup = null; |