/** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    CBResource.contextCBActivity = this;

    mIsValidDevice = CBValidityChecker.isValid(CBActivity.this);

    mGridViewActivityIntent = new Intent();
    mGridViewActivityIntent.setClass(CBActivity.this, GridViewActivity.class);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_manage);

    InitAsyncTask initTask = new InitAsyncTask();
    initTask.execute((Object) null);

    mButtonNewOrder = (CBDialogButton) this.findViewById(R.id.button_newOrder);
    mButtonNewOrder.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            if (mIsValidDevice == false) {
              showValidateCheckingFailedDialog();
              return;
            }

            showOrderPrepareDialog();
          }
        });

    mButtonOrdersList = (CBDialogButton) this.findViewById(R.id.button_ordersList);
    mButtonOrdersList.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            if (mIsValidDevice == false) {
              showValidateCheckingFailedDialog();
              return;
            }

            showOrderedListDialog();
          }
        });

    mButtonQuit = (CBDialogButton) this.findViewById(R.id.button_quit);
    mButtonQuit.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            showQuitingDialog();
          }
        });

    if (CBTrialCtrl.isTrialVersion()) CBTrialCtrl.showTrialWarningDialog(this);
  }
  private CBMenuEngine initMenuEngine() {

    CBMenuItemsSet set = null;

    if (CBTrialCtrl.isTrialVersion() == false) {
      CBDishesScanner scanner =
          new CBDishesScanner(CBSettings.getStringValue(CBSettings.CB_SETTINGS_SOURCE_DIR_DISHES));
      set = scanner.scan();
    } else {
      set = CBTrialCtrl.loadTrialDishes(this);
    }

    CBBitmapFactory.setMenuItemsSetIcons(set, this);
    CBResource.menuEngine = new CBMenuEngine();
    CBResource.menuEngine.setMenuSet(set);

    return CBResource.menuEngine;
  }
  public void showQuitingDialog() {
    ConfirmDialog confirmDialog = new ConfirmDialog(this);
    confirmDialog.setTitle(R.string.confirm_dialog_title_warning);
    confirmDialog.setMessage(R.string.warning_quiting);

    confirmDialog.setCallback(
        new ConfirmDialog.Callback() {
          public void onConfirm() {
            finishCBActivity();
          }

          public void onCancel() {}
        });

    confirmDialog.show();

    if (CBTrialCtrl.isTrialVersion()) {
      CBTrialCtrl.showTrialWarningDialog(this);
    }
  }
 private void finishCBActivity() {
   if (CBTrialCtrl.isTrialVersion() == false) CBSettings.save();
   finish();
 }