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

Commit 6b05c16f authored by PETER LIANG's avatar PETER LIANG Committed by Android (Google) Code Review
Browse files

Merge "The default position of the menu view should be on the left side under RTL mode."

parents bd2d5688 6f4bd49a
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import android.os.UserHandle;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.accessibility.AccessibilityManager;

import androidx.annotation.NonNull;
@@ -65,6 +66,9 @@ class MenuInfoRepository {
    @FloatRange(from = 0.0, to = 1.0)
    private static final float DEFAULT_MENU_POSITION_X_PERCENT = 1.0f;

    @FloatRange(from = 0.0, to = 1.0)
    private static final float DEFAULT_MENU_POSITION_X_PERCENT_RTL = 0.0f;

    @FloatRange(from = 0.0, to = 1.0)
    private static final float DEFAULT_MENU_POSITION_Y_PERCENT = 0.77f;
    private static final boolean DEFAULT_MOVE_TO_TUCKED_VALUE = false;
@@ -226,8 +230,12 @@ class MenuInfoRepository {
        final String absolutePositionString = Prefs.getString(mContext,
                Prefs.Key.ACCESSIBILITY_FLOATING_MENU_POSITION, /* defaultValue= */ null);

        final float defaultPositionXPercent =
                mConfiguration.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL
                        ? DEFAULT_MENU_POSITION_X_PERCENT_RTL
                        : DEFAULT_MENU_POSITION_X_PERCENT;
        return TextUtils.isEmpty(absolutePositionString)
                ? new Position(DEFAULT_MENU_POSITION_X_PERCENT, DEFAULT_MENU_POSITION_Y_PERCENT)
                ? new Position(defaultPositionXPercent, DEFAULT_MENU_POSITION_Y_PERCENT)
                : Position.fromString(absolutePositionString);
    }