示例#1
0
  private void goToSection() {
    //        Intent sectionIntent = new Intent(this, SingleSheetActivity.class);
    Section sectionaux = Utils.getSectionByID(String.valueOf(value.getRef_sectionID()));
    Sheet sheetAux = Utils.getSheetByID(String.valueOf(sectionaux.getRef_SheetID()));

    Intent singlesheetIntent = new Intent(this, SingleSheetWithTabsActivity.class);
    String rootID = "";
    if (sheetAux != null) {
      rootID = sheetAux.getRef_UserID();
    }
    singlesheetIntent.putExtra("rootID", rootID);
    singlesheetIntent.putExtra("sheetID", String.valueOf(sectionaux.getRef_SheetID()));
    //        sectionIntent.putExtra("sheetID", String.valueOf(sectionaux.getRef_SheetID()));

    Intent home = new Intent(this, RootsActivity.class);
    home.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);

    TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(this);
    taskStackBuilder.addNextIntent(home);
    taskStackBuilder.addNextIntent(singlesheetIntent);
    taskStackBuilder.startActivities();
    onBackPressed();
  }
示例#2
0
  private boolean checkSheet() {
    boolean check = true;
    String name = etname.getText().toString();
    String desc = etdesc.getText().toString();
    String val = etvalue.getText().toString();
    String val2 = etvalue2.getText().toString();
    String val3 = etvalue3.getText().toString();

    switch (value.getType()) {
      case Value.VALUE_TYPE_DVALUE:
        if (!name.equals("") && !desc.equals("") && !val.equals("")) {
          check = true;
        } else {
          check = false;
        }
        break;
      case Value.VALUE_TYPE_VALUE:
        if (!name.equals("") && !val.equals("")) {
          check = true;
        } else {
          check = false;
        }
        break;
      case Value.VALUE_TYPE_DIMAGE:
        if (!name.equals("") && !desc.equals("") && !val.equals("")) {
          check = true;
        } else {
          check = false;
        }
        break;
      case Value.VALUE_TYPE_DVALUE2:
        if (!name.equals("") && !desc.equals("") && !val.equals("") && !val2.equals("")) {
          check = true;
        } else {
          check = false;
        }
        break;
      case Value.VALUE_TYPE_DVALUE3:
        if (!name.equals("")
            && !desc.equals("")
            && !val.equals("")
            && !val2.equals("")
            && !val3.equals("")) {
          check = true;
        } else {
          check = false;
        }
        break;
      case Value.VALUE_TYPE_VINT:
        if (!name.equals("") && !val.equals("")) {
          try {
            Integer.parseInt(val);
            check = true;
          } catch (NumberFormatException e) {
            Toast.makeText(getBaseContext(), "Please, input a 'number' value", Toast.LENGTH_SHORT)
                .show();
            check = false;
          }
        } else {
          check = false;
        }
        break;
      case Value.VALUE_TYPE_FORM:
        if (!name.equals("") && !desc.equals("")) {
          try {
            String res = Utils.fullSimpleOperation(desc);
            Integer.parseInt(res);
            check = true;
          } catch (NumberFormatException e) {
            Toast.makeText(getBaseContext(), "Please, input a valid formula", Toast.LENGTH_SHORT)
                .show();
            check = false;
          }
        } else {
          check = false;
        }
        break;
      default:
        break;
    }
    return check;
  }
示例#3
0
 private void addValue() {
   setValues();
   Utils.addValueDAO(value);
   //        Toast.makeText(getBaseContext(), "Section Generated", Toast.LENGTH_SHORT).show();
   goToSection();
 }