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

Commit a725df99 authored by Vladislav Kaznacheev's avatar Vladislav Kaznacheev
Browse files

Add ViewConfiguration.shouldShowMenuShortcutsWhenKeyboardPresent

This method returns config_showMenuShortcutsWhenKeyboardPresent value.
It is necessary for the correct support library implementation of menus.

Bug: 31045453
Test: build and flash Android
Change-Id: Ibdd354b2d00f0c5f5ed91aa4840e942d772516ef
parent 2102bf63
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -48086,6 +48086,7 @@ package android.view {
    method public static deprecated int getWindowTouchSlop();
    method public static long getZoomControlsTimeout();
    method public boolean hasPermanentMenuKey();
    method public boolean shouldShowMenuShortcutsWhenKeyboardPresent();
  }
  public class ViewDebug {
+15 −0
Original line number Diff line number Diff line
@@ -303,6 +303,7 @@ public class ViewConfiguration {
    private final long mGlobalActionsKeyTimeout;
    private final float mVerticalScrollFactor;
    private final float mHorizontalScrollFactor;
    private final boolean mShowMenuShortcutsWhenKeyboardPresent;

    private boolean sHasPermanentMenuKey;
    private boolean sHasPermanentMenuKeySet;
@@ -335,6 +336,7 @@ public class ViewConfiguration {
        mGlobalActionsKeyTimeout = GLOBAL_ACTIONS_KEY_TIMEOUT;
        mHorizontalScrollFactor = HORIZONTAL_SCROLL_FACTOR;
        mVerticalScrollFactor = VERTICAL_SCROLL_FACTOR;
        mShowMenuShortcutsWhenKeyboardPresent = false;
    }

    /**
@@ -428,6 +430,10 @@ public class ViewConfiguration {
                com.android.internal.R.dimen.config_horizontalScrollFactor);
        mVerticalScrollFactor = res.getDimensionPixelSize(
                com.android.internal.R.dimen.config_verticalScrollFactor);

        mShowMenuShortcutsWhenKeyboardPresent = res.getBoolean(
            com.android.internal.R.bool.config_showMenuShortcutsWhenKeyboardPresent);

    }

    /**
@@ -909,6 +915,15 @@ public class ViewConfiguration {
        return sHasPermanentMenuKey;
    }

    /**
     * Check if shortcuts should be displayed in menus.
     *
     * @return {@code True} if shortcuts should be displayed in menus.
     */
    public boolean shouldShowMenuShortcutsWhenKeyboardPresent() {
        return mShowMenuShortcutsWhenKeyboardPresent;
    }

    /**
     * @hide
     * @return Whether or not marquee should use fading edges.
+2 −2
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.ViewConfiguration;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -753,8 +754,7 @@ public class MenuBuilder implements Menu {
    private void setShortcutsVisibleInner(boolean shortcutsVisible) {
        mShortcutsVisible = shortcutsVisible
                && mResources.getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS
                && mResources.getBoolean(
                        com.android.internal.R.bool.config_showMenuShortcutsWhenKeyboardPresent);
                && ViewConfiguration.get(mContext).shouldShowMenuShortcutsWhenKeyboardPresent();
    }

    /**