Merge "Stabilize hideybar confirmation toast."
diff --git a/packages/SystemUI/res/values-land/refs.xml b/packages/SystemUI/res/values-land/refs.xml
new file mode 100644
index 0000000..f5e79b9
--- /dev/null
+++ b/packages/SystemUI/res/values-land/refs.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (c) 2013, 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.
+*/
+-->
+<resources>
+ <item type="string" name="hideybar_confirmation_message">@string/hideybar_confirmation_message_long</item>
+</resources>
diff --git a/packages/SystemUI/res/values-sw600dp-port/refs.xml b/packages/SystemUI/res/values-sw600dp-port/refs.xml
new file mode 100644
index 0000000..f5e79b9
--- /dev/null
+++ b/packages/SystemUI/res/values-sw600dp-port/refs.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (c) 2013, 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.
+*/
+-->
+<resources>
+ <item type="string" name="hideybar_confirmation_message">@string/hideybar_confirmation_message_long</item>
+</resources>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 9498fe4..a462465 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -517,12 +517,9 @@
<!-- Body of help text shown when the notification panel is pulled down for the very first time. [CHAR LIMIT=NONE] -->
<string name="status_bar_help_text">Access them anytime by swiping down.\nSwipe down again for system controls.</string>
- <!-- Toast bar message when hiding the navigation bar on bottom -->
- <string name="hideybar_confirmation_message_bottom">Swipe up from bottom of screen to reveal system bar</string>
+ <!-- Toast bar message when hiding the navigation bar -->
+ <string name="hideybar_confirmation_message">Swipe edge of screen to reveal bar</string>
- <!-- Shorter version of toast bar message when hiding the navigation bar on bottom -->
- <string name="hideybar_confirmation_message_bottom_short">Swipe bottom of screen to reveal bar</string>
-
- <!-- Toast bar message when hiding the navigation bar on right -->
- <string name="hideybar_confirmation_message_right">Swipe from right of screen to reveal system bar</string>
+ <!-- Longer version of toast bar message when hiding the navigation bar (if room) -->
+ <string name="hideybar_confirmation_message_long">Swipe from edge of screen to reveal system bar</string>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index a54c435..4b30c86 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -1959,13 +1959,8 @@
private void setHideybarConfirmationVisible(boolean visible) {
if (DEBUG) Log.d(TAG, "setHideybarConfirmationVisible " + visible);
if (visible && mHideybarConfirmation == null && !mHideybarConfirmationDismissed) {
- // create the confirmation toast bar with the correct message for this config
- float widthDp = mCurrentDisplaySize.x /
- (mDisplayMetrics.densityDpi / (float) DisplayMetrics.DENSITY_DEFAULT);
- int msg = mNavigationBarView.isVertical() ?
- R.string.hideybar_confirmation_message_right :
- widthDp < 600 ? R.string.hideybar_confirmation_message_bottom_short :
- R.string.hideybar_confirmation_message_bottom;
+ // create the confirmation toast bar
+ int msg = R.string.hideybar_confirmation_message;
mHideybarConfirmation = Toast.makeBar(mContext, msg, Toast.LENGTH_INFINITE)
.setAction(com.android.internal.R.string.ok, mHideybarConfirmationAction);
View v = mHideybarConfirmation.getView();
@@ -1975,13 +1970,6 @@
// dismiss on outside touch if globally confirmed
v.setOnTouchListener(mDismissHideybarConfirmationOnTouchOutside);
}
- // position at the bottom like normal toasts, but use top gravity
- // to avoid jumping around when showing/hiding the nav bar
- v.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
- int offsetY = mContext.getResources().getDimensionPixelSize(
- com.android.internal.R.dimen.toast_y_offset);
- mHideybarConfirmation.setGravity(Gravity.TOP, 0,
- mCurrentDisplaySize.y - v.getMeasuredHeight() / 2 - offsetY);
// show the confirmation
mHideybarConfirmation.show();
} else if (!visible) {