summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/MenuHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/MenuHelper.java')
-rw-r--r--src/com/android/camera/MenuHelper.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/com/android/camera/MenuHelper.java b/src/com/android/camera/MenuHelper.java
index 65b8272..1c8f0fa 100644
--- a/src/com/android/camera/MenuHelper.java
+++ b/src/com/android/camera/MenuHelper.java
@@ -29,6 +29,9 @@ import android.os.StatFs;
import android.provider.MediaStore;
import android.provider.MediaStore.Images;
import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.MenuItem.OnMenuItemClickListener;
import com.android.camera.R;
@@ -113,6 +116,25 @@ public class MenuHelper {
.show();
}
+ static void addSwitchModeMenuItem(Menu menu, boolean switchToVideo,
+ final Runnable r) {
+ int labelId = switchToVideo
+ ? R.string.switch_to_video_lable
+ : R.string.switch_to_camera_lable;
+ int iconId = switchToVideo
+ ? R.drawable.ic_menu_camera_video_view
+ : android.R.drawable.ic_menu_camera;
+ MenuItem item = menu.add(Menu.NONE, Menu.NONE,
+ POSITION_SWITCH_CAMERA_MODE, labelId)
+ .setOnMenuItemClickListener(new OnMenuItemClickListener() {
+ public boolean onMenuItemClick(MenuItem item) {
+ r.run();
+ return true;
+ }
+ });
+ item.setIcon(iconId);
+ }
+
private static void startCameraActivity(Activity activity, String action) {
Intent intent = new Intent(action);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);