android.widget.ActionMenuView Java Examples

The following examples show how to use android.widget.ActionMenuView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserGuide.java    From island with Apache License 2.0 5 votes vote down vote up
private static View findProperTarget(final View view) {
	if (! (view instanceof Toolbar)) return view;
	final ViewGroup group = (ViewGroup) view;
	for (int i = 0; i < group.getChildCount(); i ++) {
		final View child = group.getChildAt(i);
		if (child instanceof ActionMenuView) return ((ActionMenuView) child).getChildAt(0);	// ActionMenuItemView
	}
	return view;
}
 
Example #2
Source File: MenuProcessor.java    From droidtestrec with Apache License 2.0 5 votes vote down vote up
private void processMenuView(ViewGroup viewGroup) {
    for (int i = 0; i < viewGroup.getChildCount(); i++) {
        View child = viewGroup.getChildAt(i);

        try {
            if (child instanceof ActionMenuView) {
                processActionMenuView((ActionMenuView) child);
            } else if (child instanceof android.support.v7.widget.ActionMenuView) {
                processSupportActionMenuView((android.support.v7.widget.ActionMenuView) child);
            }
        } catch (NoClassDefFoundError e) {
            // not a error com.android.support:appcompat-v7 is not used in project
        }
    }
}
 
Example #3
Source File: MenuBindingAdapter.java    From deagle with Apache License 2.0 5 votes vote down vote up
@BindingAdapter("menu") public static void inflateMenu(final ActionMenuView amv, final @MenuRes int old_menu, final @MenuRes int new_menu) {
	if (SDK_INT < LOLLIPOP) return;
	if (new_menu == old_menu) return;
	final Menu menu = amv.getMenu();
	menu.clear();
	new MenuInflater(amv.getContext()).inflate(new_menu, menu);
}
 
Example #4
Source File: MenuProcessor.java    From droidtestrec with Apache License 2.0 4 votes vote down vote up
private void processSupportActionMenuView(android.support.v7.widget.ActionMenuView menuView) {
    Menu menu = menuView.getMenu();
    processMenu(menu);
}
 
Example #5
Source File: MenuProcessor.java    From droidtestrec with Apache License 2.0 4 votes vote down vote up
@TargetApi(21)
private void processActionMenuView(ActionMenuView menuView) {
    Menu menu = menuView.getMenu();
    processMenu(menu);
}