Exemplo n.º 1
0
  @Override
  public boolean onCreateOptionsMenu(android.view.Menu menu) {
    super.onCreateOptionsMenu(menu);
    try {
      if (processBA.subExists("activity_actionbarhomeclick")) {
        Class.forName("android.app.ActionBar")
            .getMethod("setHomeButtonEnabled", boolean.class)
            .invoke(getClass().getMethod("getActionBar").invoke(this), true);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    if (menuItems == null) return false;
    for (B4AMenuItem bmi : menuItems) {
      android.view.MenuItem mi = menu.add(bmi.title);
      if (bmi.drawable != null) mi.setIcon(bmi.drawable);
      if (android.os.Build.VERSION.SDK_INT >= 11) {
        try {
          if (bmi.addToBar) {
            android.view.MenuItem.class.getMethod("setShowAsAction", int.class).invoke(mi, 1);
          }
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
      mi.setOnMenuItemClickListener(
          new B4AMenuItemsClickListener(bmi.eventName.toLowerCase(BA.cul)));
    }

    return true;
  }
Exemplo n.º 2
0
 @Override
 public boolean onOptionsItemSelected(android.view.MenuItem item) {
   if (item.getItemId() == 16908332) {
     processBA.raiseEvent(null, "activity_actionbarhomeclick");
     return true;
   } else return super.onOptionsItemSelected(item);
 }
Exemplo n.º 3
0
 public boolean onMenuItemClick(android.view.MenuItem item) {
   processBA.raiseEvent(item.getTitle(), eventName + "_click");
   return true;
 }