diff options
author | Sascha Haeberling <haeberling@google.com> | 2013-09-09 14:42:43 -0700 |
---|---|---|
committer | Sascha Haeberling <haeberling@google.com> | 2013-09-09 15:58:21 -0700 |
commit | b7639c641f2ed5d0c60546349c3aa9e90c026878 (patch) | |
tree | d6b2b70ab0f099fd338168233a93fcfd314311ac /src/com/android/camera/util/CameraUtil.java | |
parent | 08d82bae967db1cc090ab763f072e0410eb4b05e (diff) | |
download | android_packages_apps_Snap-b7639c641f2ed5d0c60546349c3aa9e90c026878.tar.gz android_packages_apps_Snap-b7639c641f2ed5d0c60546349c3aa9e90c026878.tar.bz2 android_packages_apps_Snap-b7639c641f2ed5d0c60546349c3aa9e90c026878.zip |
Make sure we switch to preview view when resuming.
Bug: 10640328
But we need to make sure to not always switch in onResume, as
some activities stared from us (like playing a video or editing)
require the UI flow to stay in filmstrip.
Change-Id: Id2911be4949de9fd9fc4cb3451dd34e3fae8becf
Diffstat (limited to 'src/com/android/camera/util/CameraUtil.java')
-rw-r--r-- | src/com/android/camera/util/CameraUtil.java | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java index c5dc71af3..ca0109ab3 100644 --- a/src/com/android/camera/util/CameraUtil.java +++ b/src/com/android/camera/util/CameraUtil.java @@ -63,6 +63,7 @@ import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.widget.Toast; +import com.android.camera.CameraActivity; import com.android.camera.CameraDisabledException; import com.android.camera.CameraHardwareException; import com.android.camera.CameraHolder; @@ -638,23 +639,6 @@ public class CameraUtil { return true; } - public static void viewUri(Uri uri, Context context) { - if (!isUriValid(uri, context.getContentResolver())) { - Log.e(TAG, "Uri invalid. uri=" + uri); - return; - } - - try { - context.startActivity(new Intent(CameraUtil.REVIEW_ACTION, uri)); - } catch (ActivityNotFoundException ex) { - try { - context.startActivity(new Intent(Intent.ACTION_VIEW, uri)); - } catch (ActivityNotFoundException e) { - Log.e(TAG, "review image fail. uri=" + uri, e); - } - } - } - public static void dumpRect(RectF rect, String msg) { Log.v(TAG, msg + "=(" + rect.left + "," + rect.top + "," + rect.right + "," + rect.bottom + ")"); @@ -826,15 +810,15 @@ public class CameraUtil { } } - public static void playVideo(Context context, Uri uri, String title) { + public static void playVideo(Activity activity, Uri uri, String title) { try { Intent intent = new Intent(Intent.ACTION_VIEW) .setDataAndType(uri, "video/*") .putExtra(Intent.EXTRA_TITLE, title) .putExtra(KEY_TREAT_UP_AS_BACK, true); - context.startActivity(intent); + activity.startActivityForResult(intent, CameraActivity.REQ_CODE_DONT_SWITCH_TO_PREVIEW); } catch (ActivityNotFoundException e) { - Toast.makeText(context, context.getString(R.string.video_err), + Toast.makeText(activity, activity.getString(R.string.video_err), Toast.LENGTH_SHORT).show(); } } @@ -843,10 +827,10 @@ public class CameraUtil { * Starts GMM with the given location shown. If this fails, and GMM could * not be found, we use a geo intent as a fallback. * - * @param context the Android context to use for starting the activities. + * @param activity the activity to use for launching the Maps intent. * @param latLong a 2-element array containing {latitude/longitude}. */ - public static void showOnMap(Context context, double[] latLong) { + public static void showOnMap(Activity activity, double[] latLong) { try { // We don't use "geo:latitude,longitude" because it only centers // the MapView to the specified location, but we need a marker @@ -858,13 +842,14 @@ public class CameraUtil { MAPS_CLASS_NAME); Intent mapsIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)).setComponent(compName); - context.startActivity(mapsIntent); + activity.startActivityForResult(mapsIntent, + CameraActivity.REQ_CODE_DONT_SWITCH_TO_PREVIEW); } catch (ActivityNotFoundException e) { // Use the "geo intent" if no GMM is installed Log.e(TAG, "GMM activity not found!", e); String url = String.format(Locale.ENGLISH, "geo:%f,%f", latLong[0], latLong[1]); Intent mapsIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); - context.startActivity(mapsIntent); + activity.startActivity(mapsIntent); } } } |