diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-30 17:34:37 -0400 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-30 17:34:37 -0400 |
commit | afb66cac1dbe9a98ca51b031f5238d72e0f86f82 (patch) | |
tree | 244c80dc38f60ff361b061584615fd59cae54f9d | |
parent | 0f7aa4b337e25758a1b6e6ea80d2d53c3f0a4466 (diff) | |
parent | abdd8a1c1f4bd5f471b62f2927399dc23a9bd33c (diff) | |
download | LegacyCamera-afb66cac1dbe9a98ca51b031f5238d72e0f86f82.zip LegacyCamera-afb66cac1dbe9a98ca51b031f5238d72e0f86f82.tar.gz LegacyCamera-afb66cac1dbe9a98ca51b031f5238d72e0f86f82.tar.bz2 |
Merge change I12b84853 into eclair
* changes:
Another candidate for on screen settings UI (opaque).
-rw-r--r-- | res/anim/on_screen_menu_appear.xml | 20 | ||||
-rw-r--r-- | res/anim/on_screen_menu_disappear.xml | 20 | ||||
-rw-r--r-- | res/layout/on_screen_menu.xml | 2 | ||||
-rw-r--r-- | res/values/styles.xml | 4 | ||||
-rw-r--r-- | src/com/android/camera/Camera.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/OnScreenSettings.java | 62 | ||||
-rw-r--r-- | src/com/android/camera/VideoCamera.java | 2 |
7 files changed, 63 insertions, 49 deletions
diff --git a/res/anim/on_screen_menu_appear.xml b/res/anim/on_screen_menu_appear.xml new file mode 100644 index 0000000..c870521 --- /dev/null +++ b/res/anim/on_screen_menu_appear.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2009 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<translate xmlns:android="http://schemas.android.com/apk/res/android" + android:fromXDelta="-100%" + android:toXDelta="0" + android:duration="500" /> diff --git a/res/anim/on_screen_menu_disappear.xml b/res/anim/on_screen_menu_disappear.xml new file mode 100644 index 0000000..f71c3da --- /dev/null +++ b/res/anim/on_screen_menu_disappear.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2009 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<translate xmlns:android="http://schemas.android.com/apk/res/android" + android:fromXDelta="0" + android:toXDelta="-100%" + android:duration="500" /> diff --git a/res/layout/on_screen_menu.xml b/res/layout/on_screen_menu.xml index 496dfb8..0aa4d48 100644 --- a/res/layout/on_screen_menu.xml +++ b/res/layout/on_screen_menu.xml @@ -16,7 +16,7 @@ <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main_panel" - android:background="#88333333" + android:background="@drawable/camera_background" android:layout_width="fill_parent" android:layout_height="wrap_content"> <FrameLayout android:layout_width="fill_parent" diff --git a/res/values/styles.xml b/res/values/styles.xml index c6de7f7..ae5d16a 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -82,4 +82,8 @@ parent="@android:style/Theme.Black.NoTitleBar.Fullscreen"> <item name="android:windowAnimationStyle">@style/NoEnterExitAnimation</item> </style> + <style name="Animation_OnScreenMenu"> + <item name="android:windowEnterAnimation">@anim/on_screen_menu_appear</item> + <item name="android:windowExitAnimation">@anim/on_screen_menu_disappear</item> + </style> </resources> diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index c02c0ce..ae00df8 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -980,7 +980,7 @@ public class Camera extends Activity implements View.OnClickListener, .getPreferenceScreen(R.xml.camera_preferences)); mSettings.setOnVisibilityChangedListener(this); } - mSettings.expandPanel(); + mSettings.setVisible(true); } public void onClick(View v) { diff --git a/src/com/android/camera/OnScreenSettings.java b/src/com/android/camera/OnScreenSettings.java index 6bfc88c..b1f1a10 100644 --- a/src/com/android/camera/OnScreenSettings.java +++ b/src/com/android/camera/OnScreenSettings.java @@ -10,6 +10,7 @@ import android.preference.PreferenceGroup; import android.preference.PreferenceScreen; import android.view.animation.Animation; import android.view.animation.Animation.AnimationListener; +import android.view.Display; import android.view.Gravity; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -33,8 +34,7 @@ import java.util.ArrayList; public class OnScreenSettings { @SuppressWarnings("unused") private static final String TAG = "OnScreenSettings"; - private static final int MSG_POST_SET_HIDE = 1; - private static final int MSG_POST_SET_VISIBLE = 2; + private static final int MSG_POST_SET_VISIBLE = 1; public interface OnVisibilityChangedListener { public void onVisibilityChanged(boolean visibility); @@ -58,8 +58,8 @@ public class OnScreenSettings { @Override public void handleMessage(Message msg) { switch (msg.what) { - case MSG_POST_SET_HIDE: - setVisible(false); + case MSG_POST_SET_VISIBLE: + setVisible(true); break; } } @@ -110,13 +110,12 @@ public class OnScreenSettings { if (mContainerLayoutParams.token == null) { mContainerLayoutParams.token = mOwnerView.getWindowToken(); } + mSubMenu.setVisibility(View.INVISIBLE); + mMainMenu.setVisibility(View.VISIBLE); mWindowManager.addView(mContainer, mContainerLayoutParams); updateLayout(); } else { // Reset the two menus - mSubMenu.setAdapter(null); - mSubMenu.setVisibility(View.INVISIBLE); - mMainMenu.setVisibility(View.VISIBLE); mWindowManager.removeView(mContainer); } @@ -125,46 +124,16 @@ public class OnScreenSettings { } } - 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) { - } - }); - } - public void updateLayout() { // if the mOwnerView is detached from window then skip. if (mOwnerView.getWindowToken() == null) return; + Display display = mWindowManager.getDefaultDisplay(); - // Position the zoom controls on the bottom of the owner view. - int ownerHeight = mOwnerView.getHeight(); - int ownerWidth = mOwnerView.getWidth(); + mContainerLayoutParams.x = 0; + mContainerLayoutParams.y = 0; - // Calculate the owner view's bounds - int[] mOwnerViewRawLocation = new int[2]; - mOwnerView.getLocationOnScreen(mOwnerViewRawLocation); - - // lp.x and lp.y should be relative to the owner's window top-left - mContainerLayoutParams.x = mOwnerViewRawLocation[0]; - mContainerLayoutParams.y = mOwnerViewRawLocation[1]; - - mContainerLayoutParams.width = ownerWidth * 2 / 3; - mContainerLayoutParams.height = ownerHeight; + mContainerLayoutParams.width = display.getWidth() / 2; + mContainerLayoutParams.height = display.getHeight(); if (mIsVisible) { mWindowManager.updateViewLayout(mContainer, mContainerLayoutParams); @@ -190,7 +159,8 @@ public class OnScreenSettings { lp.height = LayoutParams.WRAP_CONTENT; lp.width = LayoutParams.WRAP_CONTENT; lp.type = LayoutParams.TYPE_APPLICATION_PANEL; - lp.format = PixelFormat.TRANSPARENT; + lp.format = PixelFormat.OPAQUE; + lp.windowAnimations = R.style.Animation_OnScreenMenu; mContainerLayoutParams = lp; @@ -215,7 +185,7 @@ public class OnScreenSettings { case MotionEvent.ACTION_DOWN: return true; case MotionEvent.ACTION_UP: - collapsePanel(); + setVisible(false); return true; } return false; @@ -227,7 +197,7 @@ public class OnScreenSettings { case KeyEvent.KEYCODE_BACK: case KeyEvent.KEYCODE_MENU: if (event.getAction() == KeyEvent.ACTION_UP) { - collapsePanel(); + setVisible(false); return true; } } @@ -446,7 +416,7 @@ public class OnScreenSettings { public boolean onTouchEvent(MotionEvent event) { if (super.onTouchEvent(event)) return true; if (event.getAction() == MotionEvent.ACTION_DOWN) { - collapsePanel(); + setVisible(false); return true; } return false; diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index e938590..0042dc0 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -1053,7 +1053,7 @@ public class VideoCamera extends Activity implements View.OnClickListener, mSettings.setPreferenceScreen(screen); mSettings.setOnVisibilityChangedListener(this); } - mSettings.expandPanel(); + mSettings.setVisible(true); } private PreferenceScreen filterPreferenceScreenByIntent( |