List of usage examples for android.view MenuItem setActionView
public MenuItem setActionView(@LayoutRes int resId);
From source file:com.actionbarsherlock.sample.styled.MainActivityICS.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // TODO handle clicking the app icon/logo return false; case R.id.menu_refresh: // switch to a progress animation item.setActionView(R.layout.indeterminate_progress_action); return true; case R.id.menu_both: // rotation animation of green fragment // rotateLeftFrag(); return true; case R.id.menu_text: // alpha animation of blue fragment // ObjectAnimator alpha = ObjectAnimator.ofFloat(rightFrag.getView(), // "alpha", 1f, 0f); // alpha.setRepeatMode(ObjectAnimator.REVERSE); // alpha.setRepeatCount(1); // alpha.setDuration(800); // alpha.start(); return true; case R.id.menu_logo: useLogo = !useLogo;/* w w w . java 2 s. c om*/ //item.setChecked(useLogo); getActionBar().setDisplayUseLogoEnabled(useLogo); return true; case R.id.menu_up: showHomeUp = !showHomeUp; //item.setChecked(showHomeUp); getActionBar().setDisplayHomeAsUpEnabled(showHomeUp); return true; case R.id.menu_nav_tabs: item.setChecked(true); showTabsNav(); return true; // case R.id.menu_nav_label: // item.setChecked(true); // showStandardNav(); // return true; case R.id.menu_nav_drop_down: item.setChecked(true); showDropDownNav(); return true; // case R.id.menu_bak_none: // item.setChecked(true); // getSupportActionBar().setBackgroundDrawable(null); // return true; // case R.id.menu_bak_gradient: // item.setChecked(true); // getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.ad_action_bar_gradient_bak)); // return true; default: return super.onOptionsItemSelected(item); } }
From source file:fr.cph.chicago.activity.StationActivity.java
@SuppressWarnings("unchecked") @Override/*from w w w . j ava 2 s . c om*/ public final boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); return true; case R.id.action_refresh: MenuItem menuItem = item; menuItem.setActionView(R.layout.progressbar); menuItem.expandActionView(); MultiMap<String, String> params = new MultiValueMap<String, String>(); List<Integer> favorites = Preferences.getTrainFavorites(ChicagoTracker.PREFERENCE_FAVORITES_TRAIN); for (Integer fav : favorites) { params.put("mapid", String.valueOf(fav)); } MultiMap<String, String> reqParams = new MultiValueMap<String, String>(); reqParams.put("mapid", String.valueOf(mStation.getId())); new LoadData().execute(reqParams); return true; } return super.onOptionsItemSelected(item); }
From source file:com.misczak.joinmybridge.EventFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem item = menu.add("Search"); item.setIcon(R.drawable.ic_search_white_24dp); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); mSearchView = new MySearchView(getActivity()); mSearchView.setOnQueryTextListener(this); mSearchView.setOnCloseListener(this); mSearchView.setIconifiedByDefault(true); item.setActionView(mSearchView); }
From source file:fr.cph.chicago.activity.StationActivity.java
@Override public final boolean onCreateOptionsMenu(final Menu menu) { super.onCreateOptionsMenu(menu); this.mMenu = menu; MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_no_search, menu); MenuItem refreshMenuItem = menu.findItem(R.id.action_refresh); refreshMenuItem.setActionView(R.layout.progressbar); refreshMenuItem.expandActionView();/*from w w w . j a v a 2s .c om*/ return true; }
From source file:com.rowland.hashtrace.ui.fragments.subfragment.TweetListFragment.java
public void setRefreshActionButtonState(final boolean refreshing) { if (optionsMenu != null) { final MenuItem refreshItem = optionsMenu.findItem(R.id.action_refresh); if (refreshItem != null) { if (refreshing) { refreshItem.setActionView(R.layout.layout_progress); } else { refreshItem.setActionView(null); }//from w w w . j av a2s . c om } } }
From source file:org.catnut.fragment.TimelineFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.add(Menu.NONE, R.id.refresh, Menu.NONE, R.string.refresh) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); // prefer actionbar refresh menu.add(Menu.NONE, R.id.action_back_top, Menu.NONE, getString(R.string.back_to_top)) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); // ??/*from w w w .j a v a 2 s. c o m*/ MenuItem search = menu.add(android.R.string.search_go); search.setIcon(R.drawable.ic_title_search_default); search.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); mSearchView = VividSearchView.getSearchView(getActivity()); mSearchView.setOnQueryTextListener(this); mSearchView.setOnCloseListener(this); search.setActionView(mSearchView); }
From source file:io.mpos.ui.shared.view.SummaryFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { MenuItem sendItem = menu.findItem(R.id.mpu_send_receipt_action_id); if (sendItem != null) { sendItem.setActionView(R.layout.mpu_send_action_view); mSendReceiptButton = (Button) sendItem.getActionView().findViewById(R.id.mpu_menu_send_button); mSendReceiptButton.setTextColor( MposUi.getInitializedInstance().getConfiguration().getAppearance().getTextColorPrimary()); mSendReceiptButton.setOnClickListener(new View.OnClickListener() { @Override/*from w ww. j a va2s . c o m*/ public void onClick(View v) { mInteractionActivity .onSendReceiptButtonClicked(getTransactionIdentifierForSendingAndPrinting()); } }); } super.onPrepareOptionsMenu(menu); }
From source file:fr.cph.chicago.activity.MainActivity.java
/** * Load animation in menu/*from w w w. j av a2s . c o m*/ */ public final void startRefreshAnimation() { if (mMenu != null) { MenuItem refreshMenuItem = mMenu.findItem(R.id.action_refresh); refreshMenuItem.setActionView(R.layout.progressbar); refreshMenuItem.expandActionView(); } }
From source file:blackman.matt.boardlist.BoardListActivity.java
/** * When the option menu is created this handles the creation events. * * @param menu The menu being created.// www . j av a2s . c om * @return If the creation was a success. */ @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_board_list, menu); MenuItem searchItem = menu.findItem(R.id.action_search_list); mSearchView = new MySearchView(this); mSearchView.setOnQueryTextListener(this); mSearchView.setOnCloseListener(this); mSearchView.setIconified(true); //mSearchView.setBackground(R.color.post_background_color); searchItem.setActionView(mSearchView); return true; }
From source file:com.SecUpwN.AIMSICD.fragments.MapFragment.java
public void setRefreshActionButtonState(final boolean refreshing) { if (mOptionsMenu != null) { final MenuItem refreshItem = mOptionsMenu.findItem(R.id.get_opencellid); if (refreshItem != null) { if (refreshing) { refreshItem.setActionView(R.layout.actionbar_indeterminate_progress); } else { refreshItem.setActionView(null); }/*w w w . j a va2 s . co m*/ } } }