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

Commit 733c39fa authored by Nick Chameyev's avatar Nick Chameyev
Browse files

Update rotation suggestion button position to align it with taskbar

This CL moves the rotation suggestion button to the middle
of the taskbar when it is visible and not stashed.
When the user stashes or unstashes the taskbar the
button's position is animated accordingly.

Test: manual
Test: atest com.android.systemui.navigationbar.gestural.FloatingRotationButtonPositionCalculatorTest
Fixes: 187410455
Change-Id: Id918e10a44631362f7c3a8a8bb624ee80bdd3c8b
parent 8b74bdca
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -14,16 +14,19 @@
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License
  -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

    <com.android.systemui.navigationbar.buttons.KeyButtonView
    xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/rotate_suggestion"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="0"
    android:scaleType="center"
    android:visibility="invisible"
        android:layout_width="@dimen/floating_rotation_button_diameter"
        android:layout_height="@dimen/floating_rotation_button_diameter"
        android:contentDescription="@string/accessibility_rotate_button"
        android:paddingStart="@dimen/navigation_key_padding"
        android:paddingEnd="@dimen/navigation_key_padding"
/>
 No newline at end of file
        android:layout_gravity="bottom|left"
        android:scaleType="center"
        android:visibility="invisible" />
</FrameLayout>
 No newline at end of file
+3 −1
Original line number Diff line number Diff line
@@ -62,7 +62,9 @@
    <item name="navigation_luminance_change_threshold" type="dimen" format="float">0.05</item>

    <dimen name="floating_rotation_button_diameter">40dp</dimen>
    <dimen name="floating_rotation_button_min_margin">4dp</dimen>
    <dimen name="floating_rotation_button_min_margin">20dp</dimen>
    <dimen name="floating_rotation_button_taskbar_left_margin">20dp</dimen>
    <dimen name="floating_rotation_button_taskbar_bottom_margin">10dp</dimen>

    <!-- Height of notification icons in the status bar -->
    <dimen name="status_bar_icon_size">@*android:dimen/status_bar_icon_size</dimen>
+4 −1
Original line number Diff line number Diff line
@@ -140,5 +140,8 @@ interface ISystemUiProxy {
    /** Notifies that a swipe-up gesture has started */
    oneway void notifySwipeUpGestureStarted() = 46;

    // Next id = 47
    /** Notifies when taskbar status updated */
    oneway void notifyTaskbarStatus(boolean visible, boolean stashed) = 47;

    // Next id = 48
}
+7 −0
Original line number Diff line number Diff line
@@ -383,6 +383,13 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
            mNavigationBarView.getRotationButtonController().setSkipOverrideUserLockPrefsOnce();
        }

        @Override
        public void onTaskbarStatusUpdated(boolean visible, boolean stashed) {
            mNavigationBarView
                    .getFloatingRotationButton()
                    .onTaskbarStateChanged(visible, stashed);
        }

        @Override
        public void onToggleRecentApps() {
            // The same case as onOverviewShown but only for 3-button navigation.
+18 −8
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.animation.Interpolators;
import com.android.systemui.model.SysUiState;
import com.android.systemui.navigationbar.RotationButton.RotationButtonUpdatesCallback;
import com.android.systemui.navigationbar.buttons.ButtonDispatcher;
import com.android.systemui.navigationbar.buttons.ContextualButton;
import com.android.systemui.navigationbar.buttons.ContextualButtonGroup;
@@ -275,13 +276,22 @@ public class NavigationBarView extends FrameLayout implements
                false /* inScreen */, false /* useNearestRegion */));
    };

    private final Consumer<Boolean> mRotationButtonListener = (visible) -> {
    private final RotationButtonUpdatesCallback mRotationButtonListener =
            new RotationButtonUpdatesCallback() {
                @Override
                public void onVisibilityChanged(boolean visible) {
                    if (visible) {
            // If the button will actually become visible and the navbar is about to hide,
            // tell the statusbar to keep it around for longer
                        // If the button will actually become visible and the navbar is about
                        // to hide, tell the statusbar to keep it around for longer
                        mAutoHideController.touchAutoHide();
                    }
                    notifyActiveTouchRegions();
                }

                @Override
                public void onPositionChanged() {
                    notifyActiveTouchRegions();
                }
            };

    private final Consumer<Boolean> mNavbarOverlayVisibilityChangeCallback = (visible) -> {
Loading