From: Mangesh Ghiware Date: Thu, 3 Oct 2013 19:36:57 +0000 (-0700) Subject: Add methods to return Camera and Gallery launcher intents. X-Git-Tag: android-x86-7.1-r1~172^2~3^2~42^2 X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fpackages-apps-Gallery2.git;a=commitdiff_plain;h=9149879dc8c2ff6fe233d6e20858ebc081068abb Add methods to return Camera and Gallery launcher intents. Bug: 10820027 Change-Id: I340072c48832e23245aa041503649b40cbaf0bf0 --- diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index 533bbe878..4ed6309d2 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -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. diff --git a/src/com/android/gallery3d/app/Gallery.java b/src/com/android/gallery3d/app/Gallery.java index 0c1ef7999..a1b6d01c5 100644 --- a/src/com/android/gallery3d/app/Gallery.java +++ b/src/com/android/gallery3d/app/Gallery.java @@ -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. diff --git a/src_pd/com/android/gallery3d/util/IntentHelper.java b/src_pd/com/android/gallery3d/util/IntentHelper.java index 843a39f4c..13f69eb1e 100644 --- a/src_pd/com/android/gallery3d/util/IntentHelper.java +++ b/src_pd/com/android/gallery3d/util/IntentHelper.java @@ -15,13 +15,18 @@ */ 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"); + } }