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

Commit 43f65905 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Replace Contextual Rotation Button with Floating Action Button" into main

parents 15949163 1187fd81
Loading
Loading
Loading
Loading
+21 −32
Original line number Diff line number Diff line
@@ -317,14 +317,14 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
            mPropertyHolders.add(new StatePropertyHolder(
                    mControllers.taskbarDragLayerController.getNavbarBackgroundAlpha(),
                    flags -> (flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0));

            // Rotation button
            RotationButton rotationButton = new RotationButtonImpl(
                    addButton(mEndContextualContainer, R.id.rotate_suggestion,
                            R.layout.taskbar_contextual_button));
            rotationButton.hide();
            mControllers.rotationButtonController.setRotationButton(rotationButton, null);
        } else {
        } else if (!mIsImeRenderingNavButtons) {
            View imeDownButton = addButton(R.drawable.ic_sysbar_back, BUTTON_BACK,
                    mStartContextualContainer, mControllers.navButtonController, R.id.back);
            imeDownButton.setRotation(Utilities.isRtl(resources) ? 90 : -90);
            // Only show when IME is visible.
            mPropertyHolders.add(new StatePropertyHolder(imeDownButton,
                    flags -> (flags & FLAG_IME_VISIBLE) != 0));
        }
        mFloatingRotationButton = new FloatingRotationButton(
                ENABLE_TASKBAR_NAVBAR_UNIFICATION ? mNavigationBarPanelContext : mContext,
                R.string.accessibility_rotate_button,
@@ -340,16 +340,6 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
        mControllers.rotationButtonController.setRotationButton(mFloatingRotationButton,
                mRotationButtonListener);

            if (!mIsImeRenderingNavButtons) {
                View imeDownButton = addButton(R.drawable.ic_sysbar_back, BUTTON_BACK,
                        mStartContextualContainer, mControllers.navButtonController, R.id.back);
                imeDownButton.setRotation(Utilities.isRtl(resources) ? 90 : -90);
                // Only show when IME is visible.
                mPropertyHolders.add(new StatePropertyHolder(imeDownButton,
                        flags -> (flags & FLAG_IME_VISIBLE) != 0));
            }
        }

        applyState();
        mPropertyHolders.forEach(StatePropertyHolder::endAnimation);

@@ -791,7 +781,6 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
            NavButtonLayoutter navButtonLayoutter =
                    NavButtonLayoutFactory.Companion.getUiLayoutter(
                            dp, mNavButtonsView, mImeSwitcherButton,
                            mControllers.rotationButtonController.getRotationButton(),
                            mA11yButton, mSpace, res, isInKidsMode, isInSetup, isThreeButtonNav,
                            mContext.isPhoneMode(), mWindowManagerProxy.getRotation(mContext));
            navButtonLayoutter.layoutButtons(mContext, isA11yButtonPersistent());
+22 −17
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import android.widget.Space
import com.android.launcher3.R
import com.android.launcher3.Utilities
import com.android.launcher3.taskbar.navbutton.NavButtonLayoutFactory.NavButtonLayoutter
import com.android.systemui.shared.rotation.RotationButton

/**
 * Meant to be a simple container for data subclasses will need
@@ -46,7 +45,6 @@ abstract class AbstractNavButtonLayoutter(
    protected val endContextualContainer: ViewGroup,
    protected val startContextualContainer: ViewGroup,
    protected val imeSwitcher: ImageView?,
        protected val rotationButton: RotationButton?,
    protected val a11yButton: ImageView?,
    protected val space: Space?
) : NavButtonLayoutter {
@@ -66,17 +64,24 @@ abstract class AbstractNavButtonLayoutter(
    }

    fun getParamsToCenterView(): FrameLayout.LayoutParams {
        val params = FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
        val params =
            FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT
            )
        params.gravity = Gravity.CENTER
        return params;
        return params
    }

    open fun repositionContextualContainer(contextualContainer: ViewGroup, buttonSize: Int,
                                           barAxisMarginStart: Int, barAxisMarginEnd: Int,
                                           gravity: Int) {
        val contextualContainerParams = FrameLayout.LayoutParams(
                buttonSize, ViewGroup.LayoutParams.MATCH_PARENT)
    open fun repositionContextualContainer(
        contextualContainer: ViewGroup,
        buttonSize: Int,
        barAxisMarginStart: Int,
        barAxisMarginEnd: Int,
        gravity: Int
    ) {
        val contextualContainerParams =
            FrameLayout.LayoutParams(buttonSize, ViewGroup.LayoutParams.MATCH_PARENT)
        contextualContainerParams.apply {
            marginStart = barAxisMarginStart
            marginEnd = barAxisMarginEnd
+23 −25
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import android.widget.Space
import com.android.launcher3.R
import com.android.launcher3.taskbar.TaskbarActivityContext
import com.android.launcher3.taskbar.navbutton.LayoutResourceHelper.*
import com.android.systemui.shared.rotation.RotationButton

class KidsNavLayoutter(
    resources: Resources,
@@ -37,7 +36,6 @@ class KidsNavLayoutter(
    endContextualContainer: ViewGroup,
    startContextualContainer: ViewGroup,
    imeSwitcher: ImageView?,
        rotationButton: RotationButton?,
    a11yButton: ImageView?,
    space: Space?
) :
@@ -47,7 +45,6 @@ class KidsNavLayoutter(
        endContextualContainer,
        startContextualContainer,
        imeSwitcher,
            rotationButton,
        a11yButton,
        space
    ) {
@@ -105,11 +102,16 @@ class KidsNavLayoutter(
        endContextualContainer.removeAllViews()
        startContextualContainer.removeAllViews()

        val contextualMargin = resources.getDimensionPixelSize(
                R.dimen.taskbar_contextual_button_padding)
        val contextualMargin =
            resources.getDimensionPixelSize(R.dimen.taskbar_contextual_button_padding)
        repositionContextualContainer(endContextualContainer, WRAP_CONTENT, 0, 0, Gravity.END)
        repositionContextualContainer(startContextualContainer, WRAP_CONTENT, contextualMargin,
                contextualMargin, Gravity.START)
        repositionContextualContainer(
            startContextualContainer,
            WRAP_CONTENT,
            contextualMargin,
            contextualMargin,
            Gravity.START
        )

        if (imeSwitcher != null) {
            startContextualContainer.addView(imeSwitcher)
@@ -119,9 +121,5 @@ class KidsNavLayoutter(
            endContextualContainer.addView(a11yButton)
            a11yButton.layoutParams = getParamsToCenterView()
        }
        if (rotationButton != null) {
            endContextualContainer.addView(rotationButton.currentView)
            rotationButton.currentView.layoutParams = getParamsToCenterView()
        }
    }
}
+3 −10
Original line number Diff line number Diff line
@@ -25,10 +25,11 @@ import android.widget.LinearLayout
import android.widget.Space
import com.android.launcher3.DeviceProfile
import com.android.launcher3.taskbar.TaskbarActivityContext
import com.android.launcher3.taskbar.navbutton.LayoutResourceHelper.*
import com.android.launcher3.taskbar.navbutton.LayoutResourceHelper.ID_END_CONTEXTUAL_BUTTONS
import com.android.launcher3.taskbar.navbutton.LayoutResourceHelper.ID_END_NAV_BUTTONS
import com.android.launcher3.taskbar.navbutton.LayoutResourceHelper.ID_START_CONTEXTUAL_BUTTONS
import com.android.launcher3.taskbar.navbutton.NavButtonLayoutFactory.Companion
import com.android.launcher3.taskbar.navbutton.NavButtonLayoutFactory.NavButtonLayoutter
import com.android.systemui.shared.rotation.RotationButton

/**
 * Select the correct layout for nav buttons
@@ -58,7 +59,6 @@ class NavButtonLayoutFactory {
            deviceProfile: DeviceProfile,
            navButtonsView: NearestTouchFrame,
            imeSwitcher: ImageView?,
            rotationButton: RotationButton?,
            a11yButton: ImageView?,
            space: Space?,
            resources: Resources,
@@ -86,7 +86,6 @@ class NavButtonLayoutFactory {
                            endContextualContainer,
                            startContextualContainer,
                            imeSwitcher,
                            rotationButton,
                            a11yButton,
                            space
                        )
@@ -98,7 +97,6 @@ class NavButtonLayoutFactory {
                            endContextualContainer,
                            startContextualContainer,
                            imeSwitcher,
                            rotationButton,
                            a11yButton,
                            space
                        )
@@ -110,7 +108,6 @@ class NavButtonLayoutFactory {
                            endContextualContainer,
                            startContextualContainer,
                            imeSwitcher,
                            rotationButton,
                            a11yButton,
                            space
                        )
@@ -123,7 +120,6 @@ class NavButtonLayoutFactory {
                        endContextualContainer,
                        startContextualContainer,
                        imeSwitcher,
                        rotationButton,
                        a11yButton,
                        space
                    )
@@ -138,7 +134,6 @@ class NavButtonLayoutFactory {
                                endContextualContainer,
                                startContextualContainer,
                                imeSwitcher,
                                rotationButton,
                                a11yButton,
                                space
                            )
@@ -150,7 +145,6 @@ class NavButtonLayoutFactory {
                                endContextualContainer,
                                startContextualContainer,
                                imeSwitcher,
                                rotationButton,
                                a11yButton,
                                space
                            )
@@ -162,7 +156,6 @@ class NavButtonLayoutFactory {
                                endContextualContainer,
                                startContextualContainer,
                                imeSwitcher,
                                rotationButton,
                                a11yButton,
                                space
                            )
+16 −19
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.Space
import com.android.launcher3.taskbar.TaskbarActivityContext
import com.android.systemui.shared.rotation.RotationButton

/** Layoutter for showing gesture navigation on phone screen. No buttons here, no-op container */
class PhoneGestureLayoutter(
@@ -31,7 +30,6 @@ class PhoneGestureLayoutter(
    endContextualContainer: ViewGroup,
    startContextualContainer: ViewGroup,
    imeSwitcher: ImageView?,
        rotationButton: RotationButton?,
    a11yButton: ImageView?,
    space: Space?
) :
@@ -41,7 +39,6 @@ class PhoneGestureLayoutter(
        endContextualContainer,
        startContextualContainer,
        imeSwitcher,
                rotationButton,
        a11yButton,
        space
    ) {
Loading