summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorAngus Kong <shkong@google.com>2011-09-28 21:00:51 +0800
committerAngus Kong <shkong@google.com>2011-09-28 21:10:33 +0800
commitc159dfe54fbc0f055a1d760f1614db4a8bcec94c (patch)
treefa383c2eb5e29576952b805bbe2205244b0b3f25 /src/com
parent0a9138eb21ca35d19f1c192076f4f77f920a4bf2 (diff)
downloadLegacyCamera-c159dfe54fbc0f055a1d760f1614db4a8bcec94c.zip
LegacyCamera-c159dfe54fbc0f055a1d760f1614db4a8bcec94c.tar.gz
LegacyCamera-c159dfe54fbc0f055a1d760f1614db4a8bcec94c.tar.bz2
Change the option menu items for Crespo.
bug: 5164126 Change-Id: I63014a3ffc24f734b08ff45e485951347c83800f
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/camera/Camera.java18
-rw-r--r--src/com/android/camera/MenuHelper.java2
-rw-r--r--src/com/android/camera/VideoCamera.java32
-rw-r--r--src/com/android/camera/panorama/PanoramaActivity.java24
4 files changed, 37 insertions, 39 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 1e23374..4bfd602 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -71,7 +71,6 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.Formatter;
import java.util.List;
@@ -198,8 +197,6 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
private ContentResolver mContentResolver;
private boolean mDidRegister = false;
- private final ArrayList<MenuItem> mGalleryItems = new ArrayList<MenuItem>();
-
private LocationManager mLocationManager;
private final ShutterCallback mShutterCallback = new ShutterCallback();
@@ -727,7 +724,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
@Override
public void onZoomChange(
int value, boolean stopped, android.hardware.Camera camera) {
- Log.v(TAG, "Zoom changed: value=" + value + ". stopped="+ stopped);
+ Log.v(TAG, "Zoom changed: value=" + value + ". stopped=" + stopped);
mZoomValue = value;
// Update the UI when we get zoom value.
@@ -1212,10 +1209,10 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
initializeCapabilities();
resetExposureCompensation();
startPreview();
- } catch(CameraHardwareException e) {
+ } catch (CameraHardwareException e) {
Util.showErrorAndFinish(this, R.string.cannot_connect_camera);
return;
- } catch(CameraDisabledException e) {
+ } catch (CameraDisabledException e) {
Util.showErrorAndFinish(this, R.string.camera_disabled);
return;
}
@@ -1835,15 +1832,6 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
switchToOtherMode(ModePicker.MODE_PANORAMA);
}
});
- MenuItem gallery = menu.add(R.string.camera_gallery_photos_text)
- .setOnMenuItemClickListener(new OnMenuItemClickListener() {
- public boolean onMenuItemClick(MenuItem item) {
- gotoGallery();
- return true;
- }
- });
- gallery.setIcon(android.R.drawable.ic_menu_gallery);
- mGalleryItems.add(gallery);
if (mNumberOfCameras > 1) {
menu.add(R.string.switch_camera_id)
diff --git a/src/com/android/camera/MenuHelper.java b/src/com/android/camera/MenuHelper.java
index ee9c7d8..2e1ec28 100644
--- a/src/com/android/camera/MenuHelper.java
+++ b/src/com/android/camera/MenuHelper.java
@@ -67,7 +67,7 @@ public class MenuHelper {
.show();
}
- static void addSwitchModeMenuItem(Menu menu, int mode,
+ public static void addSwitchModeMenuItem(Menu menu, int mode,
final Runnable r) {
int labelId, iconId;
switch(mode) {
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index abbcce2..4e2532a 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -69,7 +69,6 @@ import android.widget.Toast;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
@@ -125,7 +124,7 @@ public class VideoCamera extends ActivityBase
* and return as soon as recording is stopped.
* TODO: consider publishing by moving into MediaStore.
*/
- private final static String EXTRA_QUICK_CAPTURE =
+ private static final String EXTRA_QUICK_CAPTURE =
"android.intent.extra.quickCapture";
private boolean mSnapshotInProgress = false;
@@ -217,8 +216,6 @@ public class VideoCamera extends ActivityBase
private LocationManager mLocationManager;
- private final ArrayList<MenuItem> mGalleryItems = new ArrayList<MenuItem>();
-
private final Handler mHandler = new MainHandler();
private Parameters mParameters;
@@ -481,7 +478,7 @@ public class VideoCamera extends ActivityBase
if (effectsActive()) {
mIndicatorControlContainer.overrideSettings(
CameraSettings.KEY_VIDEO_QUALITY,
- Integer.toString(CamcorderProfile.QUALITY_480P) );
+ Integer.toString(CamcorderProfile.QUALITY_480P));
}
}
@@ -645,7 +642,7 @@ public class VideoCamera extends ActivityBase
// The preference stores values from ListPreference and is thus string type for all values.
// We need to convert it to int manually.
String defaultQuality = CameraSettings.getDefaultVideoQuality(mCameraId,
- getResources().getString(R.string.pref_video_quality_default) );
+ getResources().getString(R.string.pref_video_quality_default));
String videoQuality =
mPreferences.getString(CameraSettings.KEY_VIDEO_QUALITY,
defaultQuality);
@@ -680,7 +677,7 @@ public class VideoCamera extends ActivityBase
// When picking from gallery, mEffectParameter should have been
// initialized in onActivityResult. If not, fall back to no effect
if (mEffectType == EffectsRecorder.EFFECT_BACKDROPPER
- && ((String)mEffectParameter).equals(EFFECT_BG_FROM_GALLERY)
+ && ((String) mEffectParameter).equals(EFFECT_BG_FROM_GALLERY)
&& mEffectUriFromGallery == null) {
Log.w(TAG, "No URI from gallery, resetting to no effect");
mEffectType = EffectsRecorder.EFFECT_NONE;
@@ -692,7 +689,7 @@ public class VideoCamera extends ActivityBase
if (mIndicatorControlContainer != null) {
mIndicatorControlContainer.overrideSettings(
CameraSettings.KEY_VIDEO_QUALITY,
- null );
+ null);
}
} else {
// Set quality to 480p for effects
@@ -703,7 +700,7 @@ public class VideoCamera extends ActivityBase
if (mIndicatorControlContainer != null) {
mIndicatorControlContainer.overrideSettings(
CameraSettings.KEY_VIDEO_QUALITY,
- Integer.toString(CamcorderProfile.QUALITY_480P) );
+ Integer.toString(CamcorderProfile.QUALITY_480P));
}
}
} else {
@@ -711,7 +708,7 @@ public class VideoCamera extends ActivityBase
if (mIndicatorControlContainer != null) {
mIndicatorControlContainer.overrideSettings(
CameraSettings.KEY_VIDEO_QUALITY,
- null );
+ null);
}
}
// Read time lapse recording interval.
@@ -826,7 +823,7 @@ public class VideoCamera extends ActivityBase
private void setPreviewDisplay(SurfaceHolder holder) {
try {
- if (effectsActive() ) {
+ if (effectsActive()) {
mEffectsRecorder.setPreviewDisplay(
mSurfaceHolder,
mSurfaceWidth,
@@ -1366,16 +1363,6 @@ public class VideoCamera extends ActivityBase
switchToOtherMode(ModePicker.MODE_PANORAMA);
}
});
- MenuItem gallery = menu.add(R.string.camera_gallery_photos_text)
- .setOnMenuItemClickListener(
- new OnMenuItemClickListener() {
- public boolean onMenuItemClick(MenuItem item) {
- gotoGallery();
- return true;
- }
- });
- gallery.setIcon(android.R.drawable.ic_menu_gallery);
- mGalleryItems.add(gallery);
if (mNumberOfCameras > 1) {
menu.add(R.string.switch_camera_id)
@@ -1986,7 +1973,8 @@ public class VideoCamera extends ActivityBase
if (mEffectType == EffectsRecorder.EFFECT_NONE) return false;
if (mEffectParameter.equals(previousEffectParameter)) return false;
}
- Log.v(TAG, "New effect selection: " + mPreferences.getString(CameraSettings.KEY_VIDEO_EFFECT, "none"));
+ Log.v(TAG, "New effect selection: " + mPreferences.getString(
+ CameraSettings.KEY_VIDEO_EFFECT, "none"));
if (mEffectType == EffectsRecorder.EFFECT_NONE) {
// Stop effects and return to normal preview
diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java
index af750f1..b335249 100644
--- a/src/com/android/camera/panorama/PanoramaActivity.java
+++ b/src/com/android/camera/panorama/PanoramaActivity.java
@@ -60,6 +60,7 @@ import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.Gravity;
+import android.view.Menu;
import android.view.OrientationEventListener;
import android.view.View;
import android.view.Window;
@@ -209,6 +210,27 @@ public class PanoramaActivity extends Activity implements
}
@Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+
+ addBaseMenuItems(menu);
+ return true;
+ }
+
+ private void addBaseMenuItems(Menu menu) {
+ MenuHelper.addSwitchModeMenuItem(menu, ModePicker.MODE_CAMERA, new Runnable() {
+ public void run() {
+ switchToOtherMode(ModePicker.MODE_CAMERA);
+ }
+ });
+ MenuHelper.addSwitchModeMenuItem(menu, ModePicker.MODE_VIDEO, new Runnable() {
+ public void run() {
+ switchToOtherMode(ModePicker.MODE_VIDEO);
+ }
+ });
+ }
+
+ @Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -762,7 +784,7 @@ public class PanoramaActivity extends Activity implements
private void onBackgroundThreadFinished() {
mThreadRunning = false;
- if (mProgressDialog != null ) {
+ if (mProgressDialog != null) {
mProgressDialog.dismiss();
mProgressDialog = null;
}