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

Commit f1a36648 authored by John Spurlock's avatar John Spurlock
Browse files

Implement new SYSTEM_UI_FLAG_IMMERSIVE_STICKY.

Migrate transient bar mode to IMMERSIVE_STICKY, and
introduce new behavior for IMMERSIVE: namely the
opaque bars are revealed by clearing the flags on swipe.

Remove low-profile optimization that confuses api demos
and other apps using low-profile as a signal.

TransientNavigationConfirmation renamed to
ImmersiveModeConfirmation, and its associated resources,
since the confirmation is now shown when the nav bar is
shown in either of the two immersive modes.

Remove unused Toast.makeBar and associated hidden framework
bits now that the confirmation uses a cling instead.

Bug:11062108
Change-Id: Iae49d31973940b9bee9f5b1827756db5eaa76aa3
parent 69f49434
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4379,7 +4379,7 @@ public final class Settings {
        public static final String BAR_SERVICE_COMPONENT = "bar_service_component";

        /** @hide */
        public static final String TRANSIENT_NAV_CONFIRMATIONS = "transient_nav_confirmations";
        public static final String IMMERSIVE_MODE_CONFIRMATIONS = "immersive_mode_confirmations";

        /**
         * This is the query URI for finding a print service to install.
+2 −67
Original line number Diff line number Diff line
@@ -75,9 +75,6 @@ public class Toast {
     */
    public static final int LENGTH_LONG = 1;

    /** @hide */
    public static final int LENGTH_INFINITE = 2;

    final Context mContext;
    final TN mTN;
    int mDuration;
@@ -294,61 +291,6 @@ public class Toast {
        tv.setText(s);
    }

    /** @hide */
    public static Toast makeBar(Context context, int resId, int duration) {
        return makeBar(context, context.getResources().getText(resId), duration);
    }

    /** @hide */
    public static Toast makeBar(Context context, CharSequence text, int duration) {
        Toast result = new Toast(context);

        LayoutInflater inflate = (LayoutInflater)
                context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View v = inflate.inflate(com.android.internal.R.layout.toast_bar, null);
        ((TextView)v.findViewById(android.R.id.message)).setText(text);
        v.findViewById(android.R.id.button1).setVisibility(View.GONE);

        result.mNextView = v;
        result.mDuration = duration;
        result.mTN.mParams.alpha = 0.9f;
        result.mTN.mParams.windowAnimations = com.android.internal.R.style.Animation_ToastBar;

        return result;
    }

    /** @hide */
    public Toast setAction(int resId, Runnable action) {
        return setAction(mContext.getResources().getText(resId), action);
    }

    /** @hide */
    public Toast setAction(CharSequence actionText, final Runnable action) {
        if (mNextView != null) {
            TextView text1 = (TextView)mNextView.findViewById(android.R.id.text1);
            View button1 =  mNextView.findViewById(android.R.id.button1);
            if (text1 != null && button1 != null) {
                text1.setText(actionText);
                button1.setVisibility(View.VISIBLE);
                button1.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        if (action != null) {
                            action.run();
                        }
                    }});
                return setInteractive(true);
            }
        }
        throw new RuntimeException("This Toast was not created with Toast.makeBar()");
    }

    /** @hide */
    public Toast setInteractive(boolean interactive) {
        mTN.setInteractive(interactive);
        return this;
    }

    // =======================================================================================
    // All the gunk below is the interaction with the Notification Service, which handles
    // the proper ordering of these system-wide.
@@ -405,16 +347,9 @@ public class Toast {
            params.windowAnimations = com.android.internal.R.style.Animation_Toast;
            params.type = WindowManager.LayoutParams.TYPE_TOAST;
            params.setTitle("Toast");
            setInteractive(false);
        }

        private void setInteractive(boolean interactive) {
            mParams.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
            params.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
                    | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                    | (interactive
                            ? (WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
                                    | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH)
                            : WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
                    | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
        }

        /**
+0 −27
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
** Copyright 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.
*/
-->

<set xmlns:android="http://schemas.android.com/apk/res/android"
        android:shareInterpolator="false">
    <translate android:fromYDelta="10%" android:toYDelta="0"
            android:interpolator="@interpolator/decelerate_quint"
            android:duration="@android:integer/config_shortAnimTime"/>
    <alpha android:fromAlpha="0.5" android:toAlpha="1.0"
            android:interpolator="@interpolator/decelerate_cubic"
            android:duration="@android:integer/config_shortAnimTime" />
</set>
+0 −26
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
** Copyright 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.
*/
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false">
    <translate android:fromYDelta="0" android:toYDelta="10%"
            android:interpolator="@interpolator/accelerate_quint"
            android:duration="@android:integer/config_shortAnimTime"/>
    <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
            android:interpolator="@interpolator/accelerate_cubic"
            android:duration="@android:integer/config_shortAnimTime"/>
</set>
−599 B
Loading image diff...
Loading