public void onDataSetSelected(String dataSetId, String dataSetLabel, String categoryComboId) {
    mDataSetButton.setText(dataSetLabel);
    mPeriodButton.setEnabled(true);

    mState.setDataSet(dataSetId, dataSetLabel, categoryComboId);
    mState.resetPeriod();
    mState.resetCategoryStates();
    handleViews(1);
  }
  public void onUnitSelected(String orgUnitId, String orgUnitLabel) {
    mOrgUnitButton.setText(orgUnitLabel);
    mDataSetButton.setEnabled(true);

    mState.setOrgUnit(orgUnitId, orgUnitLabel);
    mState.resetDataSet();
    mState.resetPeriod();
    mState.resetCategoryStates();
    handleViews(0);
  }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    mOrgUnitButton.setEnabled(false);
    mDataSetButton.setEnabled(false);
    mPeriodButton.setEnabled(false);
    mButton.hide(false);

    if (savedInstanceState != null && savedInstanceState.getParcelable(STATE) != null) {
      mState = savedInstanceState.getParcelable(STATE);
    }

    if (mState == null) {
      mState = new AggregateReportFragmentState();
    }

    mAdapter =
        new CategoryAdapter(LayoutInflater.from(getActivity()), getChildFragmentManager(), this);
    mCategoriesList.setAdapter(mAdapter);

    mProgressBar.setVisibility(mState.isSyncInProcess() ? View.VISIBLE : View.INVISIBLE);
  }
 private void handleViews(int level) {
   switch (level) {
     case 0:
       mPeriodButton.setEnabled(false);
     case 1:
       mAdapter.swapData(null);
     case 2:
       mButton.hide(true);
       break;
     case 3:
       mButton.show(true);
   }
 }