Exemple #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;
  }
Exemple #2
0
  private void afterFirstLayout() {
    if (this != mostCurrent) return;
    activityBA =
        new BA(
            this, layout, processBA, "metube.mncplaymedia.com", "metube.mncplaymedia.com.register");

    processBA.sharedProcessBA.activityBA = new java.lang.ref.WeakReference<BA>(activityBA);
    anywheresoftware.b4a.objects.ViewWrapper.lastId = 0;
    _activity = new ActivityWrapper(activityBA, "activity");
    anywheresoftware.b4a.Msgbox.isDismissing = false;
    if (BA.isShellModeRuntimeCheck(processBA)) {
      if (isFirst) processBA.raiseEvent2(null, true, "SHELL", false);
      processBA.raiseEvent2(
          null,
          true,
          "CREATE",
          true,
          "metube.mncplaymedia.com.register",
          processBA,
          activityBA,
          _activity,
          anywheresoftware.b4a.keywords.Common.Density,
          mostCurrent);
      _activity.reinitializeForShell(activityBA, "activity");
    }
    initializeProcessGlobals();
    initializeGlobals();

    BA.LogInfo("** Activity (register) Create, isFirst = " + isFirst + " **");
    processBA.raiseEvent2(null, true, "activity_create", false, isFirst);
    isFirst = false;
    if (this != mostCurrent) return;
    processBA.setActivityPaused(false);
    BA.LogInfo("** Activity (register) Resume **");
    processBA.raiseEvent(null, "activity_resume");
    if (android.os.Build.VERSION.SDK_INT >= 11) {
      try {
        android.app.Activity.class.getMethod("invalidateOptionsMenu").invoke(this, (Object[]) null);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }