summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xres/drawable-hdpi/btn_gripper.pngbin0 -> 374 bytes
-rw-r--r--res/drawable-hdpi/gripper_handle.9.pngbin0 -> 411 bytes
-rw-r--r--res/drawable-mdpi/btn_gripper.pngbin0 -> 379 bytes
-rw-r--r--res/drawable-mdpi/gripper_handle.9.pngbin0 -> 320 bytes
-rw-r--r--res/drawable/btn_drawer.pngbin0 -> 308 bytes
-rw-r--r--res/layout/attach_camera_control.xml2
-rw-r--r--res/layout/camera.xml74
-rw-r--r--res/layout/camera_control.xml2
-rw-r--r--res/layout/on_screen_menu.xml36
-rw-r--r--res/layout/video_camera.xml79
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/com/android/camera/Camera.java47
-rw-r--r--src/com/android/camera/OnScreenSettings.java89
-rw-r--r--src/com/android/camera/Util.java6
-rw-r--r--src/com/android/camera/VideoCamera.java44
15 files changed, 249 insertions, 132 deletions
diff --git a/res/drawable-hdpi/btn_gripper.png b/res/drawable-hdpi/btn_gripper.png
new file mode 100755
index 0000000..f5020c4
--- /dev/null
+++ b/res/drawable-hdpi/btn_gripper.png
Binary files differ
diff --git a/res/drawable-hdpi/gripper_handle.9.png b/res/drawable-hdpi/gripper_handle.9.png
new file mode 100644
index 0000000..e7a2c20
--- /dev/null
+++ b/res/drawable-hdpi/gripper_handle.9.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_gripper.png b/res/drawable-mdpi/btn_gripper.png
new file mode 100644
index 0000000..93fcd89
--- /dev/null
+++ b/res/drawable-mdpi/btn_gripper.png
Binary files differ
diff --git a/res/drawable-mdpi/gripper_handle.9.png b/res/drawable-mdpi/gripper_handle.9.png
new file mode 100644
index 0000000..b599583
--- /dev/null
+++ b/res/drawable-mdpi/gripper_handle.9.png
Binary files differ
diff --git a/res/drawable/btn_drawer.png b/res/drawable/btn_drawer.png
new file mode 100644
index 0000000..1de52fc
--- /dev/null
+++ b/res/drawable/btn_drawer.png
Binary files differ
diff --git a/res/layout/attach_camera_control.xml b/res/layout/attach_camera_control.xml
index 36a0a61..b209ce3 100644
--- a/res/layout/attach_camera_control.xml
+++ b/res/layout/attach_camera_control.xml
@@ -18,7 +18,7 @@
android:id="@+id/control_bar"
android:layout_height="fill_parent"
android:layout_width="wrap_content"
- android:layout_marginRight="4dp"
+ android:layout_marginRight="0dp"
android:layout_marginTop="13dp"
android:layout_marginBottom="10dp"
android:layout_alignParentRight="true">
diff --git a/res/layout/camera.xml b/res/layout/camera.xml
index a910d7b..d6fa9a9 100644
--- a/res/layout/camera.xml
+++ b/res/layout/camera.xml
@@ -20,41 +20,53 @@
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
-
<RelativeLayout android:layout_width="0px"
- android:layout_height="fill_parent"
- android:layout_weight="1">
- <FrameLayout android:layout_width="wrap_content"
+ android:layout_height="fill_parent"
+ android:layout_weight="1">
+ <LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
- android:background="@drawable/border_view_finder">
- <com.android.camera.VideoPreview
- android:id="@+id/camera_preview"
- android:layout_width="384dp"
- android:layout_height="288dp"/>
- <com.android.camera.FocusRectangle
- android:id="@+id/focus_rectangle"
- android:layout_width="384dp"
- android:layout_height="288dp"/>
- <ImageView
- android:id="@+id/gps_indicator"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+ <ImageView android:id="@+id/btn_gripper"
+ android:layout_marginRight="1dp"
+ android:background="@drawable/btn_gripper"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"/>
+ <FrameLayout android:id="@+id/frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:visibility="invisible"
- android:clickable="false"
- android:focusable="false"
- android:layout_marginLeft="5dp"
- android:layout_marginTop="5dp"/>
- <com.android.camera.FlashButton
- android:id="@+id/flash_button"
- android:layout_width="64dp"
- android:layout_height="64dp"
- android:layout_gravity="left|bottom"
- android:visibility="invisible"
- android:clickable="true"
- android:focusable="false"
- android:layout_marginBottom="5dp"/>
- </FrameLayout>
+ android:layout_centerVertical="true"
+ android:background="@drawable/border_view_finder">
+ <com.android.camera.VideoPreview
+ android:id="@+id/camera_preview"
+ android:layout_width="384dp"
+ android:layout_height="288dp"/>
+ <com.android.camera.FocusRectangle
+ android:id="@+id/focus_rectangle"
+ android:layout_width="384dp"
+ android:layout_height="288dp"/>
+ <ImageView
+ android:id="@+id/gps_indicator"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:visibility="invisible"
+ android:clickable="false"
+ android:focusable="false"
+ android:layout_marginLeft="5dp"
+ android:layout_marginTop="5dp"/>
+ <com.android.camera.FlashButton
+ android:id="@+id/flash_button"
+ android:layout_width="64dp"
+ android:layout_height="64dp"
+ android:layout_gravity="left|bottom"
+ android:visibility="invisible"
+ android:clickable="true"
+ android:focusable="false"
+ android:layout_marginBottom="5dp"/>
+ </FrameLayout>
+ </LinearLayout>
</RelativeLayout>
-
</LinearLayout>
diff --git a/res/layout/camera_control.xml b/res/layout/camera_control.xml
index 9ed2467..982d707 100644
--- a/res/layout/camera_control.xml
+++ b/res/layout/camera_control.xml
@@ -19,7 +19,7 @@
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="wrap_content"
- android:layout_marginRight="4dp"
+ android:layout_marginRight="0dp"
android:layout_marginTop="13dp"
android:layout_marginBottom="10dp"
android:layout_alignParentRight="true">
diff --git a/res/layout/on_screen_menu.xml b/res/layout/on_screen_menu.xml
index 26a9400..496dfb8 100644
--- a/res/layout/on_screen_menu.xml
+++ b/res/layout/on_screen_menu.xml
@@ -14,19 +14,27 @@
limitations under the License.
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:padding="10dip"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/main_panel"
+ android:background="#88333333"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
- <ListView android:id="@+id/menu_view"
- android:background="#88333333"
- android:cacheColorHint="#00000000"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content" />
- <ListView android:id="@+id/sub_menu"
- android:background="#88333333"
- android:visibility="invisible"
- android:cacheColorHint="#00000000"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content" />
-</FrameLayout>
+ <FrameLayout android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_toLeftOf="@+id/btn_gripper">
+ <ListView android:id="@+id/menu_view"
+ android:cacheColorHint="#00000000"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent" />
+ <ListView android:id="@+id/sub_menu"
+ android:visibility="invisible"
+ android:cacheColorHint="#00000000"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent" />
+ </FrameLayout>
+ <ImageView android:id="@+id/btn_gripper"
+ android:layout_height="fill_parent"
+ android:layout_width="wrap_content"
+ android:background="@drawable/gripper_handle"
+ android:layout_alignParentRight="true"/>
+</RelativeLayout>
diff --git a/res/layout/video_camera.xml b/res/layout/video_camera.xml
index 76e9441..678869e 100644
--- a/res/layout/video_camera.xml
+++ b/res/layout/video_camera.xml
@@ -24,41 +24,54 @@
<RelativeLayout android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_weight="1">
- <FrameLayout android:layout_width="wrap_content"
+ <LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
- android:background="@drawable/border_view_finder">
- <com.android.camera.VideoPreview
- android:id="@+id/camera_preview"
- android:layout_width="352dp"
- android:layout_height="288dp"/>
- <ImageView
- android:id="@+id/video_frame"
- android:layout_width="352dp"
- android:layout_height="288dp"
- android:visibility="gone" />
- <!-- Note: In this TextView the paddingRight="2"
- attribute is required because otherwise the
- text's drop shadow will be clipped. -->
- <TextView
- android:id="@+id/recording_time"
- android:layout_width="180dp"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+ <ImageView android:id="@+id/btn_gripper"
+ android:layout_marginRight="1dp"
+ android:background="@drawable/btn_gripper"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="left|bottom"
- android:layout_marginBottom="13dp"
- android:layout_marginLeft="17dp"
- android:paddingRight="2dp"
- android:drawablePadding="8dp"
- android:drawableLeft="@drawable/ic_recording_indicator"
- android:shadowColor="#c0000000"
- android:shadowDx="1"
- android:shadowDy="1"
- android:shadowRadius="1"
- android:gravity="left|center_vertical"
- android:textColor="@color/recording_time_elapsed_text"
- android:textSize="23dp"
- android:textStyle="bold"
- android:visibility="gone"/>
- </FrameLayout>
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"/>
+ <FrameLayout android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true"
+ android:background="@drawable/border_view_finder">
+ <com.android.camera.VideoPreview
+ android:id="@+id/camera_preview"
+ android:layout_width="352dp"
+ android:layout_height="288dp"/>
+ <ImageView
+ android:id="@+id/video_frame"
+ android:layout_width="352dp"
+ android:layout_height="288dp"
+ android:visibility="gone" />
+ <!-- Note: In this TextView the paddingRight="2"
+ attribute is required because otherwise the
+ text's drop shadow will be clipped. -->
+ <TextView
+ android:id="@+id/recording_time"
+ android:layout_width="180dp"
+ android:layout_height="wrap_content"
+ android:layout_gravity="left|bottom"
+ android:layout_marginBottom="13dp"
+ android:layout_marginLeft="17dp"
+ android:paddingRight="2dp"
+ android:drawablePadding="8dp"
+ android:drawableLeft="@drawable/ic_recording_indicator"
+ android:shadowColor="#c0000000"
+ android:shadowDx="1"
+ android:shadowDy="1"
+ android:shadowRadius="1"
+ android:gravity="left|center_vertical"
+ android:textColor="@color/recording_time_elapsed_text"
+ android:textSize="23dp"
+ android:textStyle="bold"
+ android:visibility="gone"/>
+ </FrameLayout>
+ </LinearLayout>
</RelativeLayout>
</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 221e51a..eb12c3e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -316,7 +316,7 @@
<string name="pref_gallery_slideshow_shuffle_summary">Show pictures in random order</string>
<!-- Settings screen, setting title text -->
- <string name="pref_camera_recordlocation_title">Store location in pictures</string>
+ <string name="pref_camera_recordlocation_title">Store location</string>
<!-- Settings screen, setting summary text -->
<string name="pref_camera_recordlocation_summary">Record location in picture data</string>
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index e037f39..7511d95 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -85,6 +85,7 @@ import java.util.List;
public class Camera extends Activity implements View.OnClickListener,
ShutterButton.OnShutterButtonListener, SurfaceHolder.Callback,
Switcher.OnSwitchListener, FlashButton.ModeChangeListener,
+ OnScreenSettings.OnVisibilityChangedListener,
OnSharedPreferenceChangeListener {
private static final String TAG = "camera";
@@ -386,6 +387,13 @@ public class Camera extends Activity implements View.OnClickListener,
});
}
+ public void onVisibilityChanged(boolean visible) {
+ // When the on-screen setting is not displayed, we show the gripper.
+ // When the on-screen setting is displayed, we hide the gripper.
+ findViewById(R.id.btn_gripper).setVisibility(
+ visible ? View.INVISIBLE : View.VISIBLE);
+ }
+
private void zoomToLevel(String type) {
if (type == null) {
Log.e(TAG, "Zoom type is null.");
@@ -895,6 +903,8 @@ public class Camera extends Activity implements View.OnClickListener,
mSwitcher.setOnSwitchListener(this);
mSwitcher.addTouchView(findViewById(R.id.camera_switch_set));
}
+ findViewById(R.id.btn_gripper)
+ .setOnTouchListener(new GripperTouchListener());
// Make sure preview is started.
try {
@@ -911,6 +921,19 @@ public class Camera extends Activity implements View.OnClickListener,
resizeForPreviewAspectRatio(mSurfaceView);
}
+ private class GripperTouchListener implements View.OnTouchListener {
+ public boolean onTouch(View view, MotionEvent event) {
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ return true;
+ case MotionEvent.ACTION_UP:
+ showOnScreenSettings();
+ return true;
+ }
+ return false;
+ }
+ }
+
@Override
public void onStart() {
super.onStart();
@@ -928,6 +951,18 @@ public class Camera extends Activity implements View.OnClickListener,
updateStorageHint(mPicturesRemaining);
}
+ private void showOnScreenSettings() {
+ if (mSettings == null) {
+ mSettings = new OnScreenSettings(
+ findViewById(R.id.camera_preview));
+ CameraSettings helper = new CameraSettings(this, mParameters);
+ mSettings.setPreferenceScreen(helper
+ .getPreferenceScreen(R.xml.camera_preferences));
+ mSettings.setOnVisibilityChangedListener(this);
+ }
+ mSettings.expandPanel();
+ }
+
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_retake:
@@ -1043,7 +1078,7 @@ public class Camera extends Activity implements View.OnClickListener,
}
Intent cropIntent = new Intent();
- cropIntent.setClass(Camera.this, CropImage.class);
+ cropIntent.setClass(this, CropImage.class);
cropIntent.setData(tempUri);
cropIntent.putExtras(newExtras);
@@ -1776,15 +1811,7 @@ public class Camera extends Activity implements View.OnClickListener,
MenuHelper.POSITION_CAMERA_SETTING, R.string.settings)
.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
- if (mSettings == null) {
- mSettings = new OnScreenSettings(
- findViewById(R.id.camera_preview));
- CameraSettings helper =
- new CameraSettings(Camera.this, mParameters);
- mSettings.setPreferenceScreen(helper
- .getPreferenceScreen(R.xml.camera_preferences));
- }
- mSettings.setVisible(true);
+ showOnScreenSettings();
return true;
}
});
diff --git a/src/com/android/camera/OnScreenSettings.java b/src/com/android/camera/OnScreenSettings.java
index b61e6a7..4107900 100644
--- a/src/com/android/camera/OnScreenSettings.java
+++ b/src/com/android/camera/OnScreenSettings.java
@@ -10,9 +10,12 @@ import android.preference.Preference;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.util.Log;
+import android.view.animation.Animation;
+import android.view.animation.Animation.AnimationListener;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
+import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
@@ -32,7 +35,8 @@ import java.util.ArrayList;
// information about adding window to WindowManager.
public class OnScreenSettings {
private static final String TAG = "OnScreenSettings";
- private static final int MSG_POST_SET_VISIBLE = 1;
+ private static final int MSG_POST_SET_HIDE = 1;
+ private static final int MSG_POST_SET_VISIBLE = 2;
public interface OnVisibilityChangedListener {
public void onVisibilityChanged(boolean visibility);
@@ -45,26 +49,19 @@ public class OnScreenSettings {
private final View mOwnerView;
private ListView mMainMenu;
private ListView mSubMenu;
+ private View mMainPanel;
private boolean mIsVisible = false;
private OnVisibilityChangedListener mVisibilityListener;
private MainMenuAdapter mMainAdapter;
- /**
- * When showing the on-screen settings, we add the view as a new window.
- * However, there is logic that needs to know the size of the zoom which
- * is determined after it's laid out. Therefore, we must post this logic
- * onto the UI thread so it will be exceuted AFTER the layout. This is
- * the logic.
- */
- private Runnable mPostedVisibleInitializer;
private final LayoutInflater mInflater;
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
- case MSG_POST_SET_VISIBLE:
- setVisible(true);
+ case MSG_POST_SET_HIDE:
+ setVisible(false);
break;
}
}
@@ -91,6 +88,7 @@ public class OnScreenSettings {
}
public void setVisible(boolean visible) {
+ mHandler.removeMessages(MSG_POST_SET_VISIBLE);
if (visible) {
if (mOwnerView.getWindowToken() == null) {
/*
@@ -98,9 +96,7 @@ public class OnScreenSettings {
* window hasn't been created yet but it will have been by the
* time the looper is idle, so post the setVisible(true) call.
*/
- if (!mHandler.hasMessages(MSG_POST_SET_VISIBLE)) {
- mHandler.sendEmptyMessage(MSG_POST_SET_VISIBLE);
- }
+ mHandler.sendEmptyMessage(MSG_POST_SET_VISIBLE);
return;
}
}
@@ -116,15 +112,8 @@ public class OnScreenSettings {
if (mContainerLayoutParams.token == null) {
mContainerLayoutParams.token = mOwnerView.getWindowToken();
}
- if (mPostedVisibleInitializer == null) {
- mPostedVisibleInitializer = new Runnable() {
- public void run() {
- refreshPositioningVariables();
- }
- };
- }
mWindowManager.addView(mContainer, mContainerLayoutParams);
- mHandler.post(mPostedVisibleInitializer);
+ refreshPositioningVariables();
} else {
// Reset the two menus
mSubMenu.setAdapter(null);
@@ -132,13 +121,34 @@ public class OnScreenSettings {
mMainMenu.setVisibility(View.VISIBLE);
mWindowManager.removeView(mContainer);
- mHandler.removeCallbacks(mPostedVisibleInitializer);
}
if (mVisibilityListener != null) {
mVisibilityListener.onVisibilityChanged(mIsVisible);
}
}
+ public void expandPanel() {
+ setVisible(true);
+ Util.slideIn(mMainPanel, Util.DIRECTION_LEFT);
+ }
+
+ public void collapsePanel() {
+ Util.slideOut(mMainPanel, Util.DIRECTION_LEFT)
+ .setAnimationListener(new AnimationListener() {
+ public void onAnimationEnd(Animation animation) {
+ // Cannot setVisible(false) here, GC will recycle something
+ // still in use and result in SEGFAULT in skia
+ mHandler.sendEmptyMessage(MSG_POST_SET_HIDE);
+ }
+
+ public void onAnimationStart(Animation animation) {
+ }
+
+ public void onAnimationRepeat(Animation animation) {
+ }
+ });
+ }
+
private void refreshPositioningVariables() {
// if the mOwnerView is detached from window then skip.
if (mOwnerView.getWindowToken() == null) return;
@@ -157,8 +167,8 @@ public class OnScreenSettings {
mContainerLayoutParams.x = mOwnerViewRawLocation[0];
mContainerLayoutParams.y = mOwnerViewRawLocation[1];
- mContainerLayoutParams.width = ownerWidth * 4 / 5;
- mContainerLayoutParams.height = ownerHeight - 10;
+ mContainerLayoutParams.width = ownerWidth * 2 / 3;
+ mContainerLayoutParams.height = ownerHeight;
if (mIsVisible) {
mWindowManager.updateViewLayout(mContainer, mContainerLayoutParams);
@@ -193,16 +203,43 @@ public class OnScreenSettings {
mInflater.inflate(R.layout.on_screen_menu, container);
+ mMainPanel = container.findViewById(R.id.main_panel);
mMainMenu = (ListView) container.findViewById(R.id.menu_view);
mSubMenu = (ListView) container.findViewById(R.id.sub_menu);
+
+ container.findViewById(R.id.btn_gripper)
+ .setOnTouchListener(new GripperTouchListener());
+
return container;
}
+ private class GripperTouchListener implements View.OnTouchListener {
+ public boolean onTouch(View view, MotionEvent event) {
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ return true;
+ case MotionEvent.ACTION_UP:
+ collapsePanel();
+ return true;
+ }
+ return false;
+ }
+ }
+
private boolean onContainerKey(KeyEvent event) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
if (event.getAction() == KeyEvent.ACTION_UP) {
- setVisible(false);
+ if (mSubMenu.getVisibility() == View.VISIBLE) {
+ closeSubMenu();
+ } else {
+ collapsePanel();
+ }
+ return true;
+ }
+ case KeyEvent.KEYCODE_MENU:
+ if (event.getAction() == KeyEvent.ACTION_UP) {
+ collapsePanel();
return true;
}
}
diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java
index da9caf6..c4dff80 100644
--- a/src/com/android/camera/Util.java
+++ b/src/com/android/camera/Util.java
@@ -539,7 +539,7 @@ public class Util {
.show();
}
- public static void slideOut(View view, int to) {
+ public static Animation slideOut(View view, int to) {
view.setVisibility(View.INVISIBLE);
Animation anim;
switch (to) {
@@ -560,9 +560,10 @@ public class Util {
}
anim.setDuration(500);
view.startAnimation(anim);
+ return anim;
}
- public static void slideIn(View view, int from) {
+ public static Animation slideIn(View view, int from) {
view.setVisibility(View.VISIBLE);
Animation anim;
switch (from) {
@@ -583,6 +584,7 @@ public class Util {
}
anim.setDuration(500);
view.startAnimation(anim);
+ return anim;
}
public static <T> T checkNotNull(T object) {
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 21affac..df106ff 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -50,6 +50,7 @@ import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.View;
import android.view.ViewGroup;
@@ -298,6 +299,8 @@ public class VideoCamera extends Activity implements View.OnClickListener,
mShutterButton.setImageResource(R.drawable.btn_ic_video_record);
mShutterButton.setOnShutterButtonListener(this);
mShutterButton.requestFocus();
+ findViewById(R.id.btn_gripper)
+ .setOnTouchListener(new GripperTouchListener());
// Make sure preview is started.
try {
@@ -1018,25 +1021,40 @@ public class VideoCamera extends Activity implements View.OnClickListener,
MenuHelper.POSITION_CAMERA_SETTING, R.string.settings)
.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
- if (mSettings == null) {
- mSettings = new OnScreenSettings(
- findViewById(R.id.camera_preview));
- if (mParameters == null) {
- mParameters = mCameraDevice.getParameters();
- }
- CameraSettings helper = new CameraSettings(
- VideoCamera.this, mParameters);
- mSettings.setOnVisibilityChangedListener(VideoCamera.this);
- mSettings.setPreferenceScreen(helper
- .getPreferenceScreen(R.xml.video_preferences));
- }
- mSettings.setVisible(true);
+ showOnScreenSettings();
return true;
}});
item.setIcon(android.R.drawable.ic_menu_preferences);
}
+ private void showOnScreenSettings() {
+ if (mSettings == null) {
+ mSettings = new OnScreenSettings(
+ findViewById(R.id.camera_preview));
+ CameraSettings helper = new CameraSettings(this, mParameters);
+ mSettings.setPreferenceScreen(helper
+ .getPreferenceScreen(R.xml.camera_preferences));
+ mSettings.setOnVisibilityChangedListener(this);
+ }
+ mSettings.expandPanel();
+ }
+
+ private class GripperTouchListener implements View.OnTouchListener {
+ public boolean onTouch(View view, MotionEvent event) {
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ return true;
+ case MotionEvent.ACTION_UP:
+ showOnScreenSettings();
+ return true;
+ }
+ return false;
+ }
+ }
+
public void onVisibilityChanged(boolean visible) {
+ findViewById(R.id.btn_gripper).setVisibility(
+ visible ? View.INVISIBLE : View.VISIBLE);
if (visible) {
releaseMediaRecorder();
} else {