summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/camera/ui/CameraSwitcher.java46
-rw-r--r--src_pd/com/android/camera/util/PhotoSphereHelper.java17
-rw-r--r--src_pd/com/android/camera/util/RefocusHelper.java22
3 files changed, 71 insertions, 14 deletions
diff --git a/src/com/android/camera/ui/CameraSwitcher.java b/src/com/android/camera/ui/CameraSwitcher.java
index f9e78f069..4a05622bc 100644
--- a/src/com/android/camera/ui/CameraSwitcher.java
+++ b/src/com/android/camera/ui/CameraSwitcher.java
@@ -36,6 +36,7 @@ import android.widget.LinearLayout;
import com.android.camera.Util;
import com.android.camera.util.PhotoSphereHelper;
+import com.android.camera.util.RefocusHelper;
import com.android.camera.util.UsageStatistics;
import com.android.camera2.R;
import com.android.gallery3d.common.ApiHelper;
@@ -56,8 +57,10 @@ public class CameraSwitcher extends RotateImageView
R.drawable.ic_switch_photosphere,
R.drawable.ic_switch_refocus
};
+
public interface CameraSwitchListener {
public void onCameraSelected(int i);
+
public void onShowSwitcherPopup();
}
@@ -96,16 +99,25 @@ public class CameraSwitcher extends RotateImageView
}
public void initializeDrawables(Context context) {
- int totaldrawid = (PhotoSphereHelper.hasLightCycleCapture(context)
- ? DRAW_IDS.length : DRAW_IDS.length - 1);
+ int numDrawIds = DRAW_IDS.length;
- int[] drawids = new int[totaldrawid];
- int[] moduleids = new int[totaldrawid];
+ if (!PhotoSphereHelper.hasLightCycleCapture(context)) {
+ --numDrawIds;
+ }
+ if (!RefocusHelper.hasRefocusCapture(context)) {
+ --numDrawIds;
+ }
+
+ int[] drawids = new int[numDrawIds];
+ int[] moduleids = new int[numDrawIds];
int ix = 0;
for (int i = 0; i < DRAW_IDS.length; i++) {
if (i == LIGHTCYCLE_MODULE_INDEX && !PhotoSphereHelper.hasLightCycleCapture(context)) {
continue; // not enabled, so don't add to UI
}
+ if (i == REFOCUS_MODULE_INDEX && !RefocusHelper.hasRefocusCapture(context)) {
+ continue; // not enabled, so don't add to UI
+ }
moduleids[ix] = i;
drawids[ix++] = DRAW_IDS[i];
}
@@ -155,7 +167,8 @@ public class CameraSwitcher extends RotateImageView
(ViewGroup) getParent());
LinearLayout content = (LinearLayout) mParent.findViewById(R.id.content);
mPopup = content;
- // Set the gravity of the popup, so that it shows up at the right position
+ // Set the gravity of the popup, so that it shows up at the right
+ // position
// on screen
LayoutParams lp = ((LayoutParams) mPopup.getLayoutParams());
lp.gravity = ((LayoutParams) mParent.findViewById(R.id.camera_switcher)
@@ -172,7 +185,9 @@ public class CameraSwitcher extends RotateImageView
item.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- if (showsPopup()) onCameraSelected(index);
+ if (showsPopup()) {
+ onCameraSelected(index);
+ }
}
});
switch (mDrawIds[i]) {
@@ -206,7 +221,9 @@ public class CameraSwitcher extends RotateImageView
}
public boolean isInsidePopup(MotionEvent evt) {
- if (!showsPopup()) return false;
+ if (!showsPopup()) {
+ return false;
+ }
int topLeft[] = new int[2];
mPopup.getLocationOnScreen(topLeft);
int left = topLeft[0];
@@ -265,7 +282,9 @@ public class CameraSwitcher extends RotateImageView
public void setOrientation(int degree, boolean animate) {
super.setOrientation(degree, animate);
ViewGroup content = (ViewGroup) mPopup;
- if (content == null) return;
+ if (content == null) {
+ return;
+ }
for (int i = 0; i < content.getChildCount(); i++) {
RotateImageView iv = (RotateImageView) content.getChildAt(i);
iv.setOrientation(degree, animate);
@@ -282,14 +301,14 @@ public class CameraSwitcher extends RotateImageView
mTranslationY = h / 3;
} else if (orientation == 90) {
mTranslationX = w / 3;
- mTranslationY = - h / 3;
+ mTranslationY = -h / 3;
mPopup.layout(getRight() - w, getTop(), getRight(), getTop() + h);
} else if (orientation == 180) {
- mTranslationX = - w / 3;
- mTranslationY = - h / 3;
+ mTranslationX = -w / 3;
+ mTranslationY = -h / 3;
mPopup.layout(getLeft(), getTop(), getLeft() + w, getTop() + h);
} else {
- mTranslationX = - w / 3;
+ mTranslationX = -w / 3;
mTranslationY = h - getHeight();
mPopup.layout(getLeft(), getBottom() - h, getLeft() + w, getBottom());
}
@@ -358,7 +377,8 @@ public class CameraSwitcher extends RotateImageView
// Verify that we weren't canceled
if (showsPopup()) {
setVisibility(View.INVISIBLE);
- // request layout to make sure popup is laid out correctly on ICS
+ // request layout to make sure popup is laid out
+ // correctly on ICS
mPopup.requestLayout();
}
}
diff --git a/src_pd/com/android/camera/util/PhotoSphereHelper.java b/src_pd/com/android/camera/util/PhotoSphereHelper.java
index 570e95ff7..2b9016d72 100644
--- a/src_pd/com/android/camera/util/PhotoSphereHelper.java
+++ b/src_pd/com/android/camera/util/PhotoSphereHelper.java
@@ -1,5 +1,20 @@
-package com.android.camera.util;
+/*
+ * Copyright (C) 2012 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.
+ */
+package com.android.camera.util;
import android.app.Activity;
import android.content.ContentResolver;
diff --git a/src_pd/com/android/camera/util/RefocusHelper.java b/src_pd/com/android/camera/util/RefocusHelper.java
index 4de7d1a8c..3640a70ca 100644
--- a/src_pd/com/android/camera/util/RefocusHelper.java
+++ b/src_pd/com/android/camera/util/RefocusHelper.java
@@ -1,5 +1,22 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
package com.android.camera.util;
+import android.content.Context;
import com.android.camera.CameraModule;
@@ -7,4 +24,9 @@ public class RefocusHelper {
public static CameraModule createRefocusModule() {
return null;
}
+
+ public static boolean hasRefocusCapture(Context context) {
+ return false;
+ }
+
}