예제 #1
0
  /** Called when the menu is created. */
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.optionsmenu, menu);

    return true;
  }
예제 #2
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;
 }
예제 #3
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.
 }
예제 #4
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);
  }
  /** {@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();
  }
예제 #6
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   MenuInflater myMenuInflater = getMenuInflater();
   myMenuInflater.inflate(R.menu.menu, menu);
   return super.onCreateOptionsMenu(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.screen_list, menu);
   super.onCreateOptionsMenu(menu, inflater);
 }