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

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

Add @TestApi PopupMenu.getMenuListView

This method returns the ListView representing the menu.
It is required to test the actual contents of a PopupMenu.

Bug: 34076597
Test: android.widget.cts.ToolbarTest#testItemViewAttributes,
          android.widget.cts.PopupMenuTest#testItemViewAttributes

Change-Id: Id72a8f482048d724d4fde15b126e0d08e1d18390
parent 9cea6840
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -48793,6 +48793,7 @@ package android.widget {
    method public int getGravity();
    method public android.view.Menu getMenu();
    method public android.view.MenuInflater getMenuInflater();
    method public android.widget.ListView getMenuListView();
    method public void inflate(int);
    method public void setGravity(int);
    method public void setOnDismissListener(android.widget.PopupMenu.OnDismissListener);
+16 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.widget;

import android.annotation.MenuRes;
import android.annotation.TestApi;
import android.content.Context;
import android.view.Gravity;
import android.view.Menu;
@@ -281,4 +282,19 @@ public class PopupMenu {
         */
        void onDismiss(PopupMenu menu);
    }

    /**
     * Returns the {@link ListView} representing the list of menu items in the currently showing
     * menu.
     *
     * @return The view representing the list of menu items.
     * @hide
     */
    @TestApi
    public ListView getMenuListView() {
        if (!mPopup.isShowing()) {
            return null;
        }
        return mPopup.getPopup().getListView();
    }
}