@Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    if (mUnfoldableView.isUnfolded()) {
      inflater.inflate(R.menu.detail_bar, menu);
    } else {
      inflater.inflate(R.menu.main_bar, menu);
      SearchManager searchManager =
          (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
      SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
      searchView.setIconifiedByDefault(true);
      int id =
          searchView
              .getContext()
              .getResources()
              .getIdentifier("android:id/search_close_btn", null, null);
      ((ImageView) Views.find(searchView, id)).setImageResource(R.drawable.ab_search_clear);
      int searchId =
          searchView
              .getContext()
              .getResources()
              .getIdentifier("android:id/search_mag_icon", null, null);
      //            SearchView.SearchAutoComplete autoComplete =
      // (SearchView.SearchAutoComplete)ll3.getChildAt(0);
      //            Drawable drawable= getResources().getDrawable(R.drawable.ic_action_search);
      //            drawable.setBounds(0, 0, drawable.getMinimumWidth(),
      // drawable.getMinimumHeight());
      ((ImageView) Views.find(searchView, searchId)).setImageResource(R.drawable.ic_action_search);
      int searchId2 =
          searchView
              .getContext()
              .getResources()
              .getIdentifier("android:id/search_button", null, null);
      ((ImageView) Views.find(searchView, searchId2))
          .setBackgroundResource(R.drawable.ic_action_search);
      searchView.setSearchableInfo(
          searchManager.getSearchableInfo(getActivity().getComponentName()));

      try {
        Field searchField = SearchView.class.getDeclaredField("mSearchButton");
        searchField.setAccessible(true);
        ImageView searchBtn = (ImageView) searchField.get(searchView);
        searchBtn.setImageResource(R.drawable.ic_action_search);
        searchField = SearchView.class.getDeclaredField("mSearchPlate");
        searchField.setAccessible(true);
        //                LinearLayout searchPlate = (LinearLayout)searchField.get(searchView);
        //                Drawable drawable=
        // getResources().getDrawable(R.drawable.ic_action_search);
        //                drawable.setBounds(0, 0, drawable.getMinimumWidth(),
        // drawable.getMinimumHeight());
        //
        // ((TextView)searchPlate.getChildAt(0)).setCompoundDrawables(drawable,null,null,null);
        //                searchPlate.setBackgroundResource(R.drawable.edit_text_bkg);
      } catch (NoSuchFieldException e) {
        Log.e(TAG, e.getMessage(), e);
      } catch (IllegalAccessException e) {
        Log.e(TAG, e.getMessage(), e);
      }
    }
  }
Beispiel #2
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();

    if (isSliderOpen) {
      inflater.inflate(R.menu.accounts, menu);
    } else {
      inflater.inflate(R.menu.main, menu);
    }

    return true;
  }
Beispiel #3
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);
  }
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   // Inflate the menu; this adds items to the action bar if it is present.
   MenuInflater inflater = getMenuInflater();
   inflater.inflate(R.menu.main, menu);
   return true;
 }
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   MenuInflater inflater = getMenuInflater();
   inflater.inflate(R.menu.menu_action_bar_attempt, menu);
   // write here your filter method
   return super.onCreateOptionsMenu(menu);
 }
Beispiel #6
0
  /** Called when the menu is created. */
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.optionsmenu, menu);

    return true;
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater mi = new MenuInflater(this);
    mi.inflate(R.menu.option_menu, menu);

    return true;
  }
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   super.onCreateContextMenu(menu, v, menuInfo);
   MenuInflater inflater = getMenuInflater();
   inflater.inflate(R.menu.context_menu, menu);
   mSelectedSubject = (SubjectCard) v;
 }
Beispiel #9
0
 /** {@inheritDoc} */
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   MenuInflater menuInflater = getMenuInflater();
   menuInflater.inflate(R.menu.editor, menu);
   mSaveAction = menu.findItem(R.id.mnu_save);
   mWordWrapAction = menu.findItem(R.id.mnu_word_wrap);
   return super.onCreateOptionsMenu(menu);
 }
Beispiel #10
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   Log.d(TAG, "Create menu options");
   MenuInflater inflater = getMenuInflater();
   inflater.inflate(R.menu.loader_menu, menu);
   menu.findItem(R.id.loader_menu_refresh_map_list).setVisible(mLoader < 0);
   return true;
 }
Beispiel #11
0
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    MenuInflater inflater = getMenuInflater();

    long noteId = ((AdapterContextMenuInfo) menuInfo).id;
    dialogPosition = ((AdapterContextMenuInfo) menuInfo).position;

    Uri intentUri = Uri.parse(Tomdroid.CONTENT_URI + "/" + noteId);
    dialogNote = NoteManager.getNote(this, intentUri);

    if (dialogNote.getTags().contains("system:deleted"))
      inflater.inflate(R.menu.main_longclick_deleted, menu);
    else inflater.inflate(R.menu.main_longclick, menu);

    menu.setHeaderTitle(getString(R.string.noteOptions));
    super.onCreateContextMenu(menu, v, menuInfo);
  }
  /**
   * When the activity first starts, the system populates the action bar and overflow menu by
   * calling onCreateOptionsMenu() for your activity.
   *
   * @param menu
   * @return true
   */
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.actions, menu);

    configureActionItem(menu);

    return (super.onCreateOptionsMenu(menu));
  }
Beispiel #13
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   MenuInflater menuInflater = getMenuInflater();
   menuInflater.inflate(R.menu.main_menu, menu);
   menu.add("添加").setIcon(R.drawable.menu_add);
   menu.add("帮助").setIcon(R.drawable.menu_help);
   menu.add("联系").setIcon(R.drawable.menu_contact);
   return super.onCreateOptionsMenu(
       menu); // To change body of overridden methods use File | Settings | File Templates.
 }
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   inflater.inflate(R.menu.actionbar_menu_friendstimelinefragment, menu);
   name = menu.findItem(R.id.group_name);
   if (selectedId.equals("0")) {
     name.setTitle(userBean.getScreen_name());
   }
   if (selectedId.equals("1")) {
     name.setTitle(getString(R.string.bilateral));
   } else {
     for (GroupBean b : GlobalContext.getInstance().getGroup().getLists()) {
       if (b.getIdstr().equals(selectedId)) {
         name.setTitle(b.getName());
         return;
       }
     }
   }
 }
Beispiel #15
0
  @TargetApi(11)
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {

    // Create the menu based on what is defined in res/menu/main.xml
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main, menu);

    String sortOrder = NoteManager.getSortOrder();
    if (sortOrder == null) {
      menu.findItem(R.id.menuSort).setTitle(R.string.sortByTitle);
    } else if (sortOrder.equals("sort_title")) {
      menu.findItem(R.id.menuSort).setTitle(R.string.sortByDate);
    } else {
      menu.findItem(R.id.menuSort).setTitle(R.string.sortByTitle);
    }

    // Calling super after populating the menu is necessary here to ensure that the
    // action bar helpers have a chance to handle this event.
    return super.onCreateOptionsMenu(menu);
  }
Beispiel #16
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   inflater.inflate(R.menu.main, menu);
   MenuItem deselectItem = menu.findItem(R.id.menu_main_deselect);
   MenuItem stateItem = menu.findItem(R.id.menu_main_state);
   if (((AppsAdapter) lvApps.getAdapter()).hasSelectedItem()) {
     if (fragmentMode == Statics.FRAGMENT_ENABLED) {
       stateItem.setTitle(getResources().getString(R.string.disable_app));
       stateItem.setTitleCondensed(getResources().getString(R.string.disable));
       stateItem.setIcon(getResources().getDrawable(R.drawable.ic_disable, null));
     } else {
       stateItem.setTitle(getResources().getString(R.string.enable_app));
       stateItem.setTitleCondensed(getResources().getString(R.string.enable));
       stateItem.setIcon(getResources().getDrawable(R.drawable.ic_enable, null));
     }
     deselectItem.setVisible(true);
     stateItem.setVisible(true);
   } else {
     deselectItem.setVisible(false);
     stateItem.setVisible(false);
   }
   super.onCreateOptionsMenu(menu, inflater);
 }
  /** {@inheritDoc} */
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

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

    // Binds the button
    CompoundButton cBox =
        (CompoundButton)
            menu.findItem(R.id.toggleView).getActionView().findViewById(android.R.id.toggle);
    cBox.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          public void onCheckedChanged(CompoundButton cb, boolean checked) {
            model.setChecked(checked);
          }
        });

    // Set label text
    ((TextView) menu.findItem(R.id.toggleView).getActionView().findViewById(android.R.id.text1))
        .setText(getArguments().getString(ARG_LABEL_TEXT));

    this.menu = menu;
    updateChecked();
  }
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.menu_manage_inserts, menu);

    final MenuItem searchItem = menu.findItem(R.id.menu_search_inserts);

    final SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
    searchView.setQueryHint(getString(R.string.insert_query_hint));
    searchView.setOnQueryTextListener(this);

    searchView.setOnQueryTextFocusChangeListener(
        new View.OnFocusChangeListener() {
          @Override
          public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) {
              MenuItemCompat.collapseActionView(searchItem);
              searchView.setQuery("", false);
            }
          }
        });

    MenuItemCompat.setOnActionExpandListener(
        searchItem,
        new MenuItemCompat.OnActionExpandListener() {
          @Override
          public boolean onMenuItemActionExpand(MenuItem item) {
            return true;
          }

          @Override
          public boolean onMenuItemActionCollapse(MenuItem item) {
            adapter.refreshAdapter();
            return true;
          }
        });
  }
Beispiel #19
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   inflater.inflate(R.menu.menu, menu);
 }
Beispiel #20
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   inflater.inflate(R.menu.recent, menu);
   super.onCreateOptionsMenu(menu, inflater);
 }
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   inflater.inflate(R.menu.place_description_menu, menu);
   super.onCreateOptionsMenu(menu, inflater);
 }
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   MenuInflater inflater = getMenuInflater();
   inflater.inflate(R.menu.home_menu, menu);
   return super.onCreateOptionsMenu(menu);
 }
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   inflater.inflate(R.menu.movie_details_fragment, menu);
 }
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   MenuInflater inflater = mode.getMenuInflater();
   inflater.inflate(R.menu.selected_screen, menu);
   return true;
 }
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   inflater.inflate(R.menu.actionbar_menu_filterfragment, menu);
 }
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   inflater.inflate(R.menu.tools_menu, menu);
   Helpers.addItems2Menu(
       menu, NEW_MENU_ID, getString(R.string.menu_tab), (ViewPager) getView().getParent());
 }
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   inflater.inflate(R.menu.fragment_crime, menu);
 }