OSDN Git Service

Add methods to return Camera and Gallery launcher intents.
authorMangesh Ghiware <mghiware@google.com>
Thu, 3 Oct 2013 19:36:57 +0000 (12:36 -0700)
committerMangesh Ghiware <mghiware@google.com>
Thu, 3 Oct 2013 19:36:57 +0000 (12:36 -0700)
Bug: 10820027
Change-Id: I340072c48832e23245aa041503649b40cbaf0bf0

src/com/android/camera/CameraActivity.java
src/com/android/gallery3d/app/Gallery.java
src_pd/com/android/gallery3d/util/IntentHelper.java

index 533bbe8..4ed6309 100644 (file)
@@ -26,7 +26,7 @@ public class CameraActivity extends Activity {
     @Override
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
-        Intent intent = IntentHelper.CAMERA_LAUNCHER_INTENT;
+        Intent intent = IntentHelper.getCameraIntent(CameraActivity.this);
         // Since this is being launched from a homescreen shorcut,
         // it's already in a new task. Start Camera activity and
         // reset the task to its initial state if needed.
index 0c1ef79..a1b6d01 100644 (file)
@@ -26,7 +26,7 @@ public class Gallery extends Activity {
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        Intent intent = IntentHelper.GALLERY_LAUNCHER_INTENT;
+        Intent intent = IntentHelper.getGalleryIntent(Gallery.this);
         // Since this is being launched from a homescreen shortcut,
         // it's already in a new task. Start Gallery activity and
         // reset the task to its initial state if needed.
index 843a39f..13f69eb 100644 (file)
  */
 package com.android.gallery3d.util;
 
+import android.content.Context;
 import android.content.Intent;
 
 public class IntentHelper {
 
-    public static final Intent CAMERA_LAUNCHER_INTENT = new Intent(Intent.ACTION_MAIN)
-        .setClassName("com.android.camera2", "com.android.camera.CameraActivity");
+    public static Intent getCameraIntent(Context context) {
+        return new Intent(Intent.ACTION_MAIN)
+            .setClassName("com.android.camera2", "com.android.camera.CameraActivity");
+    }
 
-    public static final Intent GALLERY_LAUNCHER_INTENT = new Intent(Intent.ACTION_MAIN)
-        .setClassName("com.android.gallery3d", "com.android.gallery3d.app.GalleryActivity");
+    public static Intent getGalleryIntent(Context context) {
+        return new Intent(Intent.ACTION_MAIN)
+            .setClassName("com.android.gallery3d", "com.android.gallery3d.app.GalleryActivity");
+    }
 }