當前位置: 首頁>>代碼示例>>Java>>正文


Java MenuBuilder.Callback方法代碼示例

本文整理匯總了Java中android.support.v7.view.menu.MenuBuilder.Callback方法的典型用法代碼示例。如果您正苦於以下問題:Java MenuBuilder.Callback方法的具體用法?Java MenuBuilder.Callback怎麽用?Java MenuBuilder.Callback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v7.view.menu.MenuBuilder的用法示例。


在下文中一共展示了MenuBuilder.Callback方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setMenuCallbacks

import android.support.v7.view.menu.MenuBuilder; //導入方法依賴的package包/類
public void setMenuCallbacks(Callback pcb, MenuBuilder.Callback mcb) {
    this.mActionMenuPresenterCallback = pcb;
    this.mMenuBuilderCallback = mcb;
    if (this.mMenuView != null) {
        this.mMenuView.setMenuCallbacks(pcb, mcb);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:8,代碼來源:Toolbar.java

示例2: setMenuCallbacks

import android.support.v7.view.menu.MenuBuilder; //導入方法依賴的package包/類
public void setMenuCallbacks(Callback pcb, MenuBuilder.Callback mcb) {
    this.mActionMenuPresenterCallback = pcb;
    this.mMenuBuilderCallback = mcb;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:5,代碼來源:ActionMenuView.java

示例3: setMenuCallbacks

import android.support.v7.view.menu.MenuBuilder; //導入方法依賴的package包/類
public void setMenuCallbacks(MenuPresenter.Callback actionMenuPresenterCallback, MenuBuilder.Callback menuBuilderCallback) {
    this.mToolbar.setMenuCallbacks(actionMenuPresenterCallback, menuBuilderCallback);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:4,代碼來源:ToolbarWidgetWrapper.java

示例4: setToolbarContentColor

import android.support.v7.view.menu.MenuBuilder; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public static void setToolbarContentColor(@NonNull Context context, Toolbar toolbar, @Nullable Menu menu, final @ColorInt int toolbarContentColor, final @ColorInt int titleTextColor, final @ColorInt int subtitleTextColor, final @ColorInt int menuWidgetColor) {
    if (toolbar == null) return;

    if (menu == null) {
        menu = toolbar.getMenu();
    }

    toolbar.setTitleTextColor(titleTextColor);
    toolbar.setSubtitleTextColor(subtitleTextColor);

    if (toolbar.getNavigationIcon() != null) {
        // Tint the toolbar navigation icon (e.g. back, drawer, etc.)
        toolbar.setNavigationIcon(TintHelper.createTintedDrawable(toolbar.getNavigationIcon(), toolbarContentColor));
    }

    InternalToolbarContentTintUtil.tintMenu(toolbar, menu, toolbarContentColor);
    InternalToolbarContentTintUtil.applyOverflowMenuTint(context, toolbar, menuWidgetColor);

    if (context instanceof Activity) {
        InternalToolbarContentTintUtil.setOverflowButtonColor((Activity) context, toolbarContentColor);
    }

    try {
        // Tint immediate overflow menu items
        final Field menuField = Toolbar.class.getDeclaredField("mMenuBuilderCallback");
        menuField.setAccessible(true);
        final Field presenterField = Toolbar.class.getDeclaredField("mActionMenuPresenterCallback");
        presenterField.setAccessible(true);
        final Field menuViewField = Toolbar.class.getDeclaredField("mMenuView");
        menuViewField.setAccessible(true);

        final MenuPresenter.Callback currentPresenterCb = (MenuPresenter.Callback) presenterField.get(toolbar);
        if (!(currentPresenterCb instanceof ATHMenuPresenterCallback)) {
            final ATHMenuPresenterCallback newPresenterCb = new ATHMenuPresenterCallback(context, menuWidgetColor, currentPresenterCb, toolbar);
            final MenuBuilder.Callback currentMenuCb = (MenuBuilder.Callback) menuField.get(toolbar);
            toolbar.setMenuCallbacks(newPresenterCb, currentMenuCb);
            ActionMenuView menuView = (ActionMenuView) menuViewField.get(toolbar);
            if (menuView != null)
                menuView.setMenuCallbacks(newPresenterCb, currentMenuCb);
        }

        // OnMenuItemClickListener to tint submenu items
        final Field menuItemClickListener = Toolbar.class.getDeclaredField("mOnMenuItemClickListener");
        menuItemClickListener.setAccessible(true);
        Toolbar.OnMenuItemClickListener currentClickListener = (Toolbar.OnMenuItemClickListener) menuItemClickListener.get(toolbar);
        if (!(currentClickListener instanceof ATHOnMenuItemClickListener)) {
            final ATHOnMenuItemClickListener newClickListener = new ATHOnMenuItemClickListener(context, menuWidgetColor, currentClickListener, toolbar);
            toolbar.setOnMenuItemClickListener(newClickListener);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:punchup,項目名稱:Superuser-UI,代碼行數:55,代碼來源:ToolbarContentTintHelper.java

示例5: setMenuCallback

import android.support.v7.view.menu.MenuBuilder; //導入方法依賴的package包/類
/**
 * Set the callback that will be called when menu
 * items a selected.
 */
public void setMenuCallback(final MenuBuilder.Callback menuCallback) {
    this.mMenuCallback = menuCallback;
}
 
開發者ID:lurbas,項目名稱:ListItemView,代碼行數:8,代碼來源:MenuView.java

示例6: setMenuCallback

import android.support.v7.view.menu.MenuBuilder; //導入方法依賴的package包/類
/**
 * Set the callback that will be called when menu
 * items a selected.
 *
 * @param menuCallback
 */
public void setMenuCallback(MenuBuilder.Callback menuCallback) {
    this.mMenuCallback = menuCallback;
}
 
開發者ID:JasonChow1989,項目名稱:Floatingsearchview-master,代碼行數:10,代碼來源:MenuView.java

示例7: setMenuCallbacks

import android.support.v7.view.menu.MenuBuilder; //導入方法依賴的package包/類
void setMenuCallbacks(Callback callback, MenuBuilder.Callback callback2); 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:2,代碼來源:DecorToolbar.java


注:本文中的android.support.v7.view.menu.MenuBuilder.Callback方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。