@Override public void addView(View child, int index, ViewGroup.LayoutParams params) { super.addView(child, index, params); if (child instanceof AppCompatImageButton) { mThemeComponent.addColorProperty(R.attr.actionBarTextColorPrimary, (c) -> ImageViewCompat.setImageTintList((ImageView) child, ColorStateList.valueOf(c))); } else if (child instanceof ActionMenuView) { mThemeComponent.addColorProperty(R.attr.actionBarTextColorPrimary, (c) -> { ActionMenuView ch = (ActionMenuView) child; Drawable d = DrawableCompat.wrap(ch.getOverflowIcon()).mutate(); DrawableCompat.setTint(d, c); ch.setOverflowIcon(d); }); } }
public void setUpMenu(final ActionMenuView actionMenu, final DrawerLayout drawerLayout, final View bookmarksPanel) { this.drawerLayout = drawerLayout; this.bookmarksPanel = bookmarksPanel; this.actionMenu = actionMenu; actionMenu.setOnMenuItemClickListener(this); // Enable special buttons Menu menu = actionMenu.getMenu(); PackageManager pm = context.getPackageManager(); menu.findItem(R.id.action_backgroundPlay).setChecked(sp.getBoolean(BackgroundPlayHelper.PREF_BACKGROUND_PLAY_ENABLED, true)); menu.findItem(R.id.action_accept_cookies).setChecked(sp.getBoolean(PREF_COOKIES_ENABLED, true)); // Tor button if (OrbotHelper.isOrbotInstalled(context.getApplicationContext())) { menu.findItem(R.id.action_tor) .setEnabled(true) .setChecked(sp.getBoolean(TorHelper.PREF_TOR_ENABLED, false)); } // Add Kodi button try { pm.getPackageInfo("org.xbmc.kore", PackageManager.GET_ACTIVITIES); menu.findItem(R.id.action_cast_to_kodi).setEnabled(true); } catch (PackageManager.NameNotFoundException e) { /* Kodi is not installed */ } }
for (int j = 0; j < ((ActionMenuView) view).getChildCount(); j++) { final View innerView = ((ActionMenuView) view).getChildAt(j);
getMenuInflater().inflate(R.menu.menu_main, actionMenu.getMenu()); menuHelper.setUpMenu(actionMenu, drawerLayout, findViewById(R.id.bookmarks_panel)); actionMenu.setOverflowIcon(getResources().getDrawable(R.drawable.ic_dots_vertical_white_24dp));
@Override public void onGlobalLayout() { final ArrayList<View> outViews = new ArrayList<View>(); decorView.findViewsWithText(outViews, overflowDescription, View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION); if (outViews.isEmpty()) { return; } final ActionMenuView overflowViewParent = (ActionMenuView) outViews.get(0).getParent(); overflowViewParent.getOverflowIcon().setColorFilter(colorFilter); removeOnGlobalLayoutListener(decorView, this); } });
final MenuItem cookieItem = actionMenu.getMenu().findItem(R.id.action_accept_cookies); try { if (sp.getBoolean(TorHelper.PREF_TOR_ENABLED, false)) {
ActionMenuView menuView = (ActionMenuView) menuViewField.get(toolbar); if (menuView != null) { menuView.setMenuCallbacks(newPresenterCb, currentMenuCb);
for (int j = 0; j < ((ActionMenuView) v).getChildCount(); j++) { final View innerView = ((ActionMenuView) v).getChildAt(j); if (innerView instanceof ActionMenuItemView) { for (int k = 0; k < ((ActionMenuItemView) innerView).getCompoundDrawables().length; k++) {