コード例 #1
0
  public void onCategorySelected(
      String categoryId, String categoryOptionId, String categoryOptionName) {
    for (CategoryState state : mState.getCategoryStates()) {
      if (state.getCategoryId().equals(categoryId)) {
        state.setCategoryOptionId(categoryOptionId);
        state.setCategoryOptionName(categoryOptionName);
        break;
      }
    }

    onCategoriesSelected(mState.getCategoryStates());
  }
コード例 #2
0
  private boolean areAllCategoriesChosen() {
    List<CategoryState> categoryStates = mState.getCategoryStates();

    if (categoryStates == null || categoryStates.isEmpty()) {
      return false;
    }
    for (CategoryState categoryState : categoryStates) {
      if (!categoryState.isCategoryOptionSelected()) {
        return false;
      }
    }
    return true;
  }
コード例 #3
0
  public void onRestoreInstanceState() {
    AggregateReportFragmentState backedUpState = new AggregateReportFragmentState(mState);
    if (!backedUpState.isOrgUnitEmpty()) {
      onUnitSelected(backedUpState.getOrgUnitId(), backedUpState.getOrgUnitLabel());

      if (!backedUpState.isDataSetEmpty()) {
        onDataSetSelected(
            backedUpState.getDataSetId(),
            backedUpState.getDataSetLabel(),
            backedUpState.getDataSetCategoryComboId());

        if (!backedUpState.isPeriodEmpty()) {
          onPeriodSelected(backedUpState.getPeriod(), false);

          if (!backedUpState.areCategoryStatesEmpty()) {
            onCategoriesSelected(backedUpState.getCategoryStates());
          }
        }
      }
    }
  }