コード例 #1
0
ファイル: AndroidCallUtil.java プロジェクト: gaixiaochuan/BIM
  /**
   * Shows "call via" menu allowing user to selected from multiple providers.
   *
   * @param context the android context
   * @param v the View that will contain the popup menu.
   * @param destination target callee name.
   */
  private static void showCallViaMenu(final Context context, View v, final String destination) {
    PopupMenu popup = new PopupMenu(context, v);

    Menu menu = popup.getMenu();

    Iterator<ProtocolProviderService> registeredProviders =
        AccountUtils.getRegisteredProviders().iterator();

    while (registeredProviders.hasNext()) {
      final ProtocolProviderService provider = registeredProviders.next();
      String accountAddress = provider.getAccountID().getAccountAddress();

      MenuItem menuItem = menu.add(Menu.NONE, Menu.NONE, Menu.NONE, accountAddress);

      menuItem.setOnMenuItemClickListener(
          new MenuItem.OnMenuItemClickListener() {
            public boolean onMenuItemClick(MenuItem item) {
              createCall(context, destination, provider);

              return false;
            }
          });
    }

    popup.show();
  }
コード例 #2
0
  /** {@inheritDoc} */
  private void updateChecked() {
    if (menu == null) return;

    ((CompoundButton)
            menu.findItem(R.id.toggleView).getActionView().findViewById(android.R.id.toggle))
        .setChecked(model.isChecked());
  }
コード例 #3
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;
 }
コード例 #4
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   super.onCreateOptionsMenu(menu);
   final MenuItem item =
       menu.add(0, 1, Menu.NONE, myResource.getResource("menu").getResource("search").getValue());
   item.setOnMenuItemClickListener(this);
   item.setIcon(R.drawable.ic_menu_search);
   return true;
 }
コード例 #5
0
  /** {@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 onPrepareOptionsMenu(Menu menu) {
   Log.d(TAG, "Prepare menu options");
   menu.findItem(R.id.loader_menu_refresh_map_list).setVisible(mLoader < 0);
   return true;
 }