protected void updateUserHeader() {
    final MenuItem userHeaderMenu =
        (mOptionsMenu != null) ? mOptionsMenu.findItem(R.id.menu_user_header) : null;
    if (userHeaderMenu != null) {
      View userHeaderView = MenuItemCompat.getActionView(userHeaderMenu);
      if (userHeaderView == null) {
        userHeaderView = getLayoutInflater().inflate(R.layout.actionbar_user_header, null, false);
        userHeaderView.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                onOptionsItemSelected(userHeaderMenu);
              }
            });
        MenuItemCompat.setShowAsAction(userHeaderMenu, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
        MenuItemCompat.setActionView(userHeaderMenu, userHeaderView);
      }
      UserHeader header = Session.getInstance().getCustomerHeader();
      if (header != null) {
        ((TextView) userHeaderView.findViewById(R.id.text1)).setText("hi");

        userHeaderMenu.setTitle(header.userName.getUserNameDisplay());
        userHeaderMenu.setVisible(true);
      } else {
        userHeaderMenu.setTitle("Login");
        userHeaderMenu.setVisible(false);
      }
    }
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_base, menu);
    setupWindowAnimations();

    MenuItem countItem = menu.findItem(R.id.pending_goals);
    MenuItemCompat.setActionView(countItem, R.layout.feed_update_count);
    if (mPendingCount > 0) {
      countItem.setVisible(true);
      buttonPending = (Button) MenuItemCompat.getActionView(countItem);
      buttonPending.setText(String.valueOf(mPendingCount));
      buttonPending.setOnClickListener(
          new View.OnClickListener() {
            public void onClick(View v) {
              Intent i = new Intent(getApplicationContext(), ReminderListActivity.class);
              startActivity(
                  i,
                  ActivityOptions.makeSceneTransitionAnimation(HistoryBaseActivity.this)
                      .toBundle());
            }
          });
    } else {
      countItem.setVisible(false);
    }
    return super.onCreateOptionsMenu(menu);
  }
Esempio n. 3
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu
    getMenuInflater().inflate(R.menu.main, menu);

    mSearchMenuItem = menu.findItem(R.id.menu_act_filter);
    MenuItemCompat.setOnActionExpandListener(
        mSearchMenuItem,
        new MenuItemCompat.OnActionExpandListener() {
          @Override
          public boolean onMenuItemActionExpand(MenuItem menuItem) {
            return true;
          }

          @Override
          public boolean onMenuItemActionCollapse(MenuItem menuItem) {
            notifyQueryChange("");
            return true;
          }
        });

    final SearchView searchView = (SearchView) MenuItemCompat.getActionView(mSearchMenuItem);
    searchView.setOnQueryTextListener(this);
    searchView.setSubmitButtonEnabled(true);
    searchView.setQueryHint(getString(R.string.search));

    mRefreshAnim.setMenuItem(menu.findItem(R.id.menu_act_refresh));
    return super.onCreateOptionsMenu(menu);
  }
Esempio n. 4
0
  @Override
  public boolean onCreateOptionsMenu(final Menu menu) {

    getMenuInflater().inflate(R.menu.menu_search, menu);

    mSearchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menu_search));

    mSearchView.setOnQueryTextListener(this);
    mSearchView.setQueryHint(getString(R.string.search_library));

    mSearchView.setIconifiedByDefault(false);
    mSearchView.setIconified(false);

    MenuItemCompat.setOnActionExpandListener(
        menu.findItem(R.id.menu_search),
        new MenuItemCompat.OnActionExpandListener() {
          @Override
          public boolean onMenuItemActionExpand(MenuItem item) {
            return true;
          }

          @Override
          public boolean onMenuItemActionCollapse(MenuItem item) {
            finish();
            return false;
          }
        });

    menu.findItem(R.id.menu_search).expandActionView();
    return super.onCreateOptionsMenu(menu);
  }
Esempio n. 5
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_bus_stops, menu);

    final MenuItem item = menu.findItem(R.id.action_search);
    final SearchView searchView = (SearchView) MenuItemCompat.getActionView(item);
    searchView.setOnQueryTextListener(this);

    MenuItemCompat.setOnActionExpandListener(
        item,
        new MenuItemCompat.OnActionExpandListener() {
          @Override
          public boolean onMenuItemActionCollapse(MenuItem item) {
            // Do something when collapsed
            return true; // Return true to collapse action view
          }

          @Override
          public boolean onMenuItemActionExpand(MenuItem item) {
            // Do something when expanded
            return true; // Return true to expand action view
          }
        });
    return true;
  }
Esempio n. 6
0
 @Override
 public void onPause() {
   super.onPause();
   if (searchItem != null && MenuItemCompat.isActionViewExpanded(searchItem)) {
     MenuItemCompat.collapseActionView(searchItem);
   }
 }
  protected void setRefreshActionButtonState(boolean refreshing) {
    if (mOptionsMenu == null) {
      //	mPendingMenuRefreshState=refreshing;
      return;
    }

    final MenuItem refreshItem = mOptionsMenu.findItem(R.id.menu_refresh);

    if (refreshItem != null) {
      if (refreshing) {
        View actionView = MenuItemCompat.getActionView(refreshItem);
        if (actionView == null || actionView.findViewById(R.id.progress_circular_ab) == null) {
          MenuItemCompat.setActionView(refreshItem, R.layout.actionbar_indeterminate_progress);
          actionView = MenuItemCompat.getActionView(refreshItem);
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            // Framework bug https://code.google.com/p/android/issues/detail?id=162416
            ProgressBar progressBar =
                (ProgressBar) actionView.findViewById(R.id.progress_circular_ab);
            progressBar.setIndeterminate(true);
            progressBar.setIndeterminateTintMode(PorterDuff.Mode.SRC_IN);
            progressBar.setIndeterminateTintList(
                getResources().getColorStateList(R.color.action_bar_title));
            // progressBar.setBackgroundTintList(getResources().getColorStateList(R.color.action_bar_title));
          }
        }
        refreshItem.setVisible(true);
      } else {
        MenuItemCompat.setActionView(refreshItem, null);
        if (mHasFeatureIndeterminateProgress) refreshItem.setVisible(false);
      }
    }
    mPendingMenuRefreshState = null;
    // if(mHasFeatureIndeterminateProgress)
    // setSupportProgressBarIndeterminateVisibility(refreshing);
  }
Esempio n. 8
0
 @Override
 public void onPrepareOptionsMenu(Menu menu) {
   if (cargando) {
     MenuItemCompat.setActionView(mnuActualizar, R.layout.actionview_progreso);
   } else {
     MenuItemCompat.setActionView(mnuActualizar, null);
   }
   super.onPrepareOptionsMenu(menu);
 }
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   inflater.inflate(R.menu.menu_select_program, menu);
   MenuItem item = menu.findItem(R.id.action_search);
   SearchView searchView = (SearchView) MenuItemCompat.getActionView(item);
   MenuItemCompat.setOnActionExpandListener(item, this);
   searchView.setOnQueryTextListener(this);
   searchView.setOnQueryTextFocusChangeListener(this);
 }
Esempio n. 10
0
  private void performSearch(String query) {
    if (searchMenuItem == null) {
      // Store this for later when we do actually have a search menu ready to use.
      pendingSearchQuery = query;
      return;
    }

    SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem);
    MenuItemCompat.expandActionView(searchMenuItem);
    searchView.setQuery(query, true);
  }
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    if (!openAsDialog()) {
      MenuItem itemReload = menu.add(0, RELOAD_ID, 0, R.string.shared_string_refresh);
      itemReload.setIcon(R.drawable.ic_action_refresh_dark);
      MenuItemCompat.setShowAsAction(itemReload, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);

      MenuItem itemSearch = menu.add(0, SEARCH_ID, 1, R.string.shared_string_search);
      itemSearch.setIcon(R.drawable.ic_action_search_dark);
      MenuItemCompat.setShowAsAction(itemSearch, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
    }
  }
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {

    super.onCreateOptionsMenu(menu, inflater);

    inflater.inflate(R.menu.menu_timeline_fragment, menu);

    MenuItemCompat.setShowAsAction(
        menu.findItem(R.id.action_edit), MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
    MenuItemCompat.setShowAsAction(
        menu.findItem(R.id.action_refresh), MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
  }
  @Override
  protected void onStop() {
    if ((searchMenuItem != null) && (MenuItemCompat.isActionViewExpanded(searchMenuItem))) {
      MenuItemCompat.collapseActionView(searchMenuItem);
    }

    LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
    lbm.unregisterReceiver(scheduleDownloadProgressReceiver);
    lbm.unregisterReceiver(scheduleDownloadResultReceiver);

    super.onStop();
  }
Esempio n. 14
0
  void initializeLoadingIndicator(Menu OptionsMenu) {
    // Add refresh in Action Bar
    mLoadingItem = OptionsMenu.add(Menu.NONE, Menu.NONE, Menu.NONE, getString(R.string.loading));

    // Set up the view
    MenuItemCompat.setActionView(mLoadingItem, R.layout.loading);

    // Specify the show flags
    MenuItemCompat.setShowAsAction(mLoadingItem, MenuItem.SHOW_AS_ACTION_ALWAYS);

    // Hide by default
    mLoadingItem.setVisible(false);
  }
 public void setRefreshIndicationState(boolean refreshing) {
   if (optionsMenu == null) {
     return;
   }
   final MenuItem refreshItem = optionsMenu.findItem(R.id.menu_refresh);
   if (refreshItem != null) {
     if (refreshing) {
       MenuItemCompat.setActionView(refreshItem, R.layout.actionbar_indeterminate_progress);
     } else {
       MenuItemCompat.setActionView(refreshItem, null);
     }
   }
 }
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   getMenuInflater().inflate(R.menu.image, menu);
   MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar);
   if (ActionBarUtil.hasSB()) {
     MenuItemCompat.setShowAsAction(actionItem, MenuItemCompat.SHOW_AS_ACTION_NEVER);
   }
   ShareActionProvider actionProvider =
       (ShareActionProvider) MenuItemCompat.getActionProvider(actionItem);
   actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
   actionProvider.setShareIntent(createShareIntent());
   return super.onCreateOptionsMenu(menu);
 }
  @SuppressWarnings("ConstantConditions")
  private void initSearchView(final MenuItem searchMenuItem) {
    final SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem);
    searchView.setQueryHint(getString(R.string.hint_enter_user_name));
    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {

          @Override
          public boolean onQueryTextSubmit(final String s) {
            final String nickName = s.trim();
            if (USER_NAME_PATTERN.matcher(nickName).matches()) {
              MenuItemCompat.collapseActionView(searchMenuItem);
              onUserNickSelected(nickName);
            }
            return true;
          }

          @Override
          public boolean onQueryTextChange(final String s) {
            final String nickName = s.trim();
            if (USER_NAME_PATTERN.matcher(nickName).matches()) {
              onUserNickSelected(nickName);
            }
            return true;
          }
        });
    MenuItemCompat.setOnActionExpandListener(
        searchMenuItem,
        new MenuItemCompat.OnActionExpandListener() {
          @Override
          public boolean onMenuItemActionExpand(final MenuItem item) {
            mExpandMenu = true;
            return true;
          }

          @Override
          public boolean onMenuItemActionCollapse(final MenuItem item) {
            mExpandMenu = false;
            return true;
          }
        });
    if (mExpandMenu) {
      MenuItemCompat.expandActionView(searchMenuItem);
      ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE))
          .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_NOT_ALWAYS);
    } else {
      MenuItemCompat.collapseActionView(searchMenuItem);
    }
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    optionsMenu = menu;

    // 收藏按钮
    MenuItem favoriteItem = menu.add(0, FAVORITE_ITEM_ID, 100, R.string.footbar_favorite);
    favoriteItem.setIcon(R.drawable.ic_menu_favorite_n);
    MenuItemCompat.setShowAsAction(favoriteItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);

    // 分享按钮
    MenuItem shareItem = menu.add(0, SHARE_ITEM_ID, 101, R.string.footbar_share);
    MenuItemCompat.setActionProvider(shareItem, mShareActionProvider);
    MenuItemCompat.setShowAsAction(shareItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
    return true;
  }
Esempio n. 19
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    if (weChatUtils.getIWXAPI().isWXAppInstalled()) {
      inflater.inflate(R.menu.main_wechat, menu);
    } else {
      inflater.inflate(R.menu.main, menu);
    }

    MenuItem shareItem = menu.findItem(R.id.action_share);
    android.support.v4.view.ActionProvider actionProvider =
        MenuItemCompat.getActionProvider(shareItem);
    if (null != actionProvider && actionProvider instanceof ShareActionProvider) {
      mShareActionProvider.setShareHistoryFileName(
          ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
      // mShareActionProvider.setShareIntent(Utils.getShareRawIntent(this));

      mShareActionProvider.setOnShareTargetSelectedListener(
          new ShareActionProvider.OnShareTargetSelectedListener() {
            @Override
            public boolean onShareTargetSelected(
                ShareActionProvider shareActionProvider, Intent intent) {
              updateShareIntent();
              return false;
            }
          });
      updateShareIntent();

      for (int i = 0; i < menu.size(); i++) {
        MenuItem item = menu.getItem(i);
        if (item.getItemId() == R.id.action_share) {
          View itemChooser = MenuItemCompat.getActionView(item);
          if (itemChooser != null) {
            itemChooser.setOnClickListener(
                new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                    EFLogger.i(TAG, "onClick");
                    ScreenshotUtils.shotBitmap(MainActivity.this, shareFileName);
                  }
                });
          }
        }
      }
    }

    return super.onCreateOptionsMenu(menu);
  }
Esempio n. 20
0
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.menu_words, menu);

    MenuItem searchMenuItem = menu.findItem(R.id.action_search);
    MenuItemCompat.setOnActionExpandListener(
        searchMenuItem,
        new MenuItemCompat.OnActionExpandListener() {
          @Override
          public boolean onMenuItemActionExpand(MenuItem item) {
            return true;
          }

          @Override
          public boolean onMenuItemActionCollapse(MenuItem item) {
            updateData();
            return true;
          }
        });

    mSearchView = (SearchView) searchMenuItem.getActionView();
    mSearchView.setQueryHint(getString(R.string.search_hint));

    if (mFilterText != null) {
      String query = mFilterText;
      searchMenuItem.expandActionView();
      mSearchView.setQuery(query, true);
      mSearchView.clearFocus();
    }
    setSearchViewTextChangeListener();
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater menuInflater = getMenuInflater();
    menuInflater.inflate(R.menu.activity_recent_menu, menu);

    MenuItem searchItem = menu.findItem(R.id.activity_recent_search);
    searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
    // searchView.setOnQueryTextListener(this);
    searchView.setQueryHint(getString(R.string.hint_search_activity_recent));
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    // Handle the query that user types in action bar search field
    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
            Intent intent = new Intent(RecentActivity.this, SearchResultsActivity.class);
            intent.putExtra("query", query);
            startActivity(intent);
            return false;
          }

          @Override
          public boolean onQueryTextChange(String query) {
            return false;
          }
        });

    return super.onCreateOptionsMenu(menu);
  }
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.humidor_menu, menu);
    MenuItem item = menu.findItem(R.id.menuSort);
    spinner_sort = (Spinner) MenuItemCompat.getActionView(item);
    ArrayList<String> sortList = new ArrayList<String>();
    sortList.add("Sort By: Name");
    sortList.add("Sort By: Value");
    sortList.add("Sort By: Age");
    sortList.add("Sort By: Rating");

    CustomSpinnerAdapter spinSortAdapter = new CustomSpinnerAdapter(getActivity(), sortList);

    spinner_sort.setAdapter(spinSortAdapter);

    spinner_sort.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {

          @Override
          public void onItemSelected(AdapterView<?> adapter, View v, int position, long id) {
            String item = adapter.getItemAtPosition(position).toString();

            Toast.makeText(getActivity(), "Selected  : " + item, Toast.LENGTH_LONG).show();
          }

          @Override
          public void onNothingSelected(AdapterView<?> arg0) {
            // TODO Auto-generated method stub

          }
        });
  }
Esempio n. 23
0
 @Override
 public boolean onQueryTextSubmit(String query) {
   if (TextUtils.isEmpty(query)) {
     MenuItemCompat.collapseActionView(mSearchMenuItem);
   } else {
     Intent searchIntent = new Intent(mContext, MarketSearchActivity.class);
     searchIntent.putExtra(MarketSearchActivity.EXTRA_KEYWORD, query);
     searchIntent.putExtra(MarketSearchActivity.EXTRA_EXACT, true);
     startActivity(searchIntent);
     notifyQueryChange("");
     if (mSearchMenuItem != null) {
       MenuItemCompat.collapseActionView(mSearchMenuItem);
     }
   }
   return true;
 }
Esempio n. 24
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   MenuItem searchItem = menu.findItem(R.id.action_search);
   SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
   searchView.setOnQueryTextListener(this);
 }
Esempio n. 25
0
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.book_detail, menu);

    MenuItem menuItem = menu.findItem(R.id.action_share);
    shareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(menuItem);
  }
Esempio n. 26
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_imageviewer, menu);

    if (getIntent() != null && getIntent().getDataString() != null) {
      Intent intent =
          new Intent(
              Intent.ACTION_SEND,
              Uri.parse(
                  getIntent()
                      .getDataString()
                      .replace(getResources().getString(R.string.IMAGE_SCHEME), "http")));
      intent.setType("text/plain");
      intent.putExtra(
          Intent.EXTRA_TEXT,
          getIntent()
              .getDataString()
              .replace(getResources().getString(R.string.IMAGE_SCHEME), "http"));
      intent.putExtra(ShareCompat.EXTRA_CALLING_PACKAGE, getPackageName());
      intent.putExtra(
          ShareCompat.EXTRA_CALLING_ACTIVITY,
          getPackageManager().getLaunchIntentForPackage(getPackageName()).getComponent());
      intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET | Intent.FLAG_ACTIVITY_NEW_TASK);

      MenuItem shareItem = menu.findItem(R.id.action_share);
      ShareActionProviderHax share =
          (ShareActionProviderHax) MenuItemCompat.getActionProvider(shareItem);
      share.onShareActionProviderSubVisibilityChangedListener = this;
      share.setShareIntent(intent);
    }
    return true;
  }
Esempio n. 27
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);
    if (fdroidApp.bluetoothAdapter == null) {
      // ignore on devices without Bluetooth
      MenuItem btItem = menu.findItem(R.id.action_bluetooth_apk);
      btItem.setVisible(false);
    }

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    searchMenuItem = menu.findItem(R.id.action_search);
    SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    // LayoutParams.MATCH_PARENT does not work, use a big value instead
    searchView.setMaxWidth(1000000);
    searchView.setOnQueryTextListener(this);

    // If we were asked to execute a search before getting around to building the options
    // menu, then we should deal with that now that the options menu is all sorted out.
    if (pendingSearchQuery != null) {
      performSearch(pendingSearchQuery);
      pendingSearchQuery = null;
    }

    return super.onCreateOptionsMenu(menu);
  }
Esempio n. 28
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);

    SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
    searchView.setOnQueryTextListener(this);
    MenuItemCompat.setOnActionExpandListener(
        menu.findItem(R.id.action_search),
        new MenuItemCompat.OnActionExpandListener() {
          @Override
          public boolean onMenuItemActionExpand(MenuItem item) {
            mPreviousList = new ArrayList<Track>(mTracks);
            return true;
          }

          @Override
          public boolean onMenuItemActionCollapse(MenuItem item) {
            getTracks(mPreviousList);
            return true;
          }
        });

    mSoundcloudLink = (TextView) menu.findItem(R.id.soundcloud_url).getActionView();
    mSoundcloudLink.setTextIsSelectable(true);

    return true;
  }
Esempio n. 29
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   inflater.inflate(R.menu.detail, menu);
   MenuItem menuItem = menu.findItem(R.id.action_share);
   mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(menuItem);
   if (mVideos != null) mShareActionProvider.setShareIntent(createShareIntent());
 }
Esempio n. 30
0
 private static void tintShareIconIfPresent(int color, MenuItem item) {
   if (MenuItemCompat.getActionView(item) != null) {
     final View actionView = MenuItemCompat.getActionView(item);
     final View expandActivitiesButton = actionView.findViewById(R.id.expand_activities_button);
     if (expandActivitiesButton != null) {
       final ImageView image = (ImageView) expandActivitiesButton.findViewById(R.id.image);
       if (image != null) {
         final Drawable drawable = image.getDrawable();
         final Drawable wrapped = DrawableCompat.wrap(drawable);
         drawable.mutate();
         DrawableCompat.setTint(wrapped, color);
         image.setImageDrawable(drawable);
       }
     }
   }
 }