summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/PhotoController.java2
-rw-r--r--src/com/android/camera/PhotoModule.java29
-rw-r--r--src/com/android/camera/PhotoUI.java36
3 files changed, 43 insertions, 24 deletions
diff --git a/src/com/android/camera/PhotoController.java b/src/com/android/camera/PhotoController.java
index 47c17218a..bc824d917 100644
--- a/src/com/android/camera/PhotoController.java
+++ b/src/com/android/camera/PhotoController.java
@@ -60,4 +60,6 @@ public interface PhotoController extends OnShutterButtonListener {
public void onScreenSizeChanged(int width, int height, int previewWidth, int previewHeight);
public void updateCameraOrientation();
+
+ public void enableRecordingLocation(boolean enable);
}
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 7c4487b90..6ca26aa3e 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -18,11 +18,9 @@ package com.android.camera;
import android.annotation.TargetApi;
import android.app.Activity;
-import android.app.AlertDialog;
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences.Editor;
import android.content.res.Configuration;
@@ -462,29 +460,12 @@ public class PhotoModule
// If there is no back camera, do not show the prompt.
return;
}
+ mUI.showLocationDialog();
+ }
- new AlertDialog.Builder(mActivity)
- .setTitle(R.string.remember_location_title)
- .setMessage(R.string.remember_location_prompt)
- .setPositiveButton(R.string.remember_location_yes, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int arg1) {
- setLocationPreference(RecordLocationPreference.VALUE_ON);
- }
- })
- .setNegativeButton(R.string.remember_location_no, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int arg1) {
- dialog.cancel();
- }
- })
- .setOnCancelListener(new DialogInterface.OnCancelListener() {
- @Override
- public void onCancel(DialogInterface dialog) {
- setLocationPreference(RecordLocationPreference.VALUE_OFF);
- }
- })
- .show();
+ public void enableRecordingLocation(boolean enable) {
+ setLocationPreference(enable ? RecordLocationPreference.VALUE_ON
+ : RecordLocationPreference.VALUE_OFF);
}
private void setLocationPreference(String value) {
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index 96d21f017..22fcc059e 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -20,6 +20,8 @@ package com.android.camera;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
import android.graphics.Matrix;
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
@@ -94,6 +96,7 @@ public class PhotoUI implements PieListener,
private PhotoMenu mMenu;
private CameraSwitcher mSwitcher;
private CameraControls mCameraControls;
+ private AlertDialog mLocationDialog;
// Small indicators which show the camera settings in the viewfinder.
private OnScreenIndicators mOnScreenIndicators;
@@ -426,6 +429,35 @@ public class PhotoUI implements PieListener,
}
}
+ public void showLocationDialog() {
+ mLocationDialog = new AlertDialog.Builder(mActivity)
+ .setTitle(R.string.remember_location_title)
+ .setMessage(R.string.remember_location_prompt)
+ .setPositiveButton(R.string.remember_location_yes,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int arg1) {
+ mController.enableRecordingLocation(true);
+ mLocationDialog = null;
+ }
+ })
+ .setNegativeButton(R.string.remember_location_no,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int arg1) {
+ dialog.cancel();
+ }
+ })
+ .setOnCancelListener(new DialogInterface.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ mController.enableRecordingLocation(false);
+ mLocationDialog = null;
+ }
+ })
+ .show();
+ }
+
public void initializeZoom(Camera.Parameters params) {
if ((params == null) || !params.isZoomSupported()
|| (mZoomRenderer == null)) return;
@@ -756,6 +788,10 @@ public class PhotoUI implements PieListener,
collapseCameraControls();
if (mFaceView != null) mFaceView.clear();
+ if (mLocationDialog != null && mLocationDialog.isShowing()) {
+ mLocationDialog.dismiss();
+ }
+ mLocationDialog = null;
mPreviewWidth = 0;
mPreviewHeight = 0;
}