Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75d71b7e authored by John Spurlock's avatar John Spurlock Committed by Android (Google) Code Review
Browse files

Merge "Stabilize hideybar confirmation toast."

parents fbf7a9ae e804cb56
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
<?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>
+20 −0
Original line number Diff line number Diff line
<?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>
+4 −7
Original line number Diff line number Diff line
@@ -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>
+2 −14
Original line number Diff line number Diff line
@@ -1959,13 +1959,8 @@ public class PhoneStatusBar extends BaseStatusBar {
    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 @@ public class PhoneStatusBar extends BaseStatusBar {
                // 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) {