summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2010-09-28 21:55:17 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-28 21:55:17 -0700
commit3b3b87324579d979d210b18a21600fb25ed71bfa (patch)
tree2a2cf1dd9c1534cc654e3c31a2e16e15061e49d5 /src
parentf746543692b971ce8fc41dddb646ddea07b63cb6 (diff)
parent2d96a8e256c556816a27e22d9f1e27a4595255d1 (diff)
downloadLegacyCamera-3b3b87324579d979d210b18a21600fb25ed71bfa.zip
LegacyCamera-3b3b87324579d979d210b18a21600fb25ed71bfa.tar.gz
LegacyCamera-3b3b87324579d979d210b18a21600fb25ed71bfa.tar.bz2
am 2d96a8e2: Merge "Hardcode package/class to switch between camera and camcorder." into gingerbread
Merge commit '2d96a8e256c556816a27e22d9f1e27a4595255d1' * commit '2d96a8e256c556816a27e22d9f1e27a4595255d1': Hardcode package/class to switch between camera and camcorder.
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 b5e4a13..a90726b 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;
/**
@@ -73,6 +71,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) {
@@ -123,26 +123,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) {