summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2010-09-28 20:51:10 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-09-28 20:51:10 -0700
commit2d96a8e256c556816a27e22d9f1e27a4595255d1 (patch)
tree15208cc6e85d2cbafb8dbddd33e12c3982036814 /src
parent655327c6eb292b0647c603bfcf0c677a21a92fc6 (diff)
parent12a37600880bacb5207520eb74a857a75e2cddef (diff)
downloadLegacyCamera-2d96a8e256c556816a27e22d9f1e27a4595255d1.zip
LegacyCamera-2d96a8e256c556816a27e22d9f1e27a4595255d1.tar.gz
LegacyCamera-2d96a8e256c556816a27e22d9f1e27a4595255d1.tar.bz2
Merge "Hardcode package/class to switch between camera and camcorder." into gingerbread
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/MenuHelper.java24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/com/android/camera/MenuHelper.java b/src/com/android/camera/MenuHelper.java
index 17755f9..629cf87 100644
--- a/src/com/android/camera/MenuHelper.java
+++ b/src/com/android/camera/MenuHelper.java
@@ -21,8 +21,8 @@ import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
-import android.content.Intent;
import android.content.DialogInterface.OnClickListener;
+import android.content.Intent;
import android.net.Uri;
import android.os.Environment;
import android.os.StatFs;
@@ -33,8 +33,6 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
-import com.android.camera.R;
-
import java.io.Closeable;
/**
@@ -72,6 +70,8 @@ public class MenuHelper {
public static final int RESULT_COMMON_MENU_CROP = 490;
private static final int NO_ANIMATION = 0;
+ private static final String CAMERA_CLASS = "com.android.camera.Camera";
+ private static final String VIDEO_CAMERA_CLASS = "com.android.camera.VideoCamera";
public static void closeSilently(Closeable c) {
if (c != null) {
@@ -122,26 +122,34 @@ public class MenuHelper {
item.setIcon(iconId);
}
- private static void startCameraActivity(Activity activity, String action) {
+ private static void startCameraActivity(Activity activity, String action,
+ String className) {
Intent intent = new Intent(action);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+ intent.setClassName(activity.getPackageName(), className);
// Keep the camera instance for a while.
// This avoids re-opening the camera and saves time.
CameraHolder.instance().keep();
- activity.startActivity(intent);
+ try {
+ activity.startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ intent.setComponent(null);
+ activity.startActivity(intent);
+ }
activity.overridePendingTransition(NO_ANIMATION, NO_ANIMATION);
}
public static void gotoVideoMode(Activity activity) {
- startCameraActivity(activity, MediaStore.INTENT_ACTION_VIDEO_CAMERA);
+ startCameraActivity(activity, MediaStore.INTENT_ACTION_VIDEO_CAMERA,
+ VIDEO_CAMERA_CLASS);
}
public static void gotoCameraMode(Activity activity) {
- startCameraActivity(
- activity, MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
+ startCameraActivity(activity,
+ MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA, CAMERA_CLASS);
}
public static void gotoCameraImageGallery(Activity activity) {