Exemplo n.º 1
0
  @Override
  public void onDetach() {
    super.onDetach();
    mCallbacks = null;

    mWizardModel.unregisterListener(this);
  }
Exemplo n.º 2
0
  @Override
  public void onAttach(Activity activity) {
    super.onAttach(activity);

    if (!(activity instanceof Callbacks)) {
      throw new ClassCastException("Activity must implement fragment's callbacks");
    }

    mCallbacks = (Callbacks) activity;

    mWizardModel = mCallbacks.onGetModel();
    mWizardModel.registerListener(this);
    onPageTreeChanged();
  }
Exemplo n.º 3
0
  @Override
  public void onPageDataChanged(Page changedPage) {
    ArrayList<ReviewItem> reviewItems = new ArrayList<ReviewItem>();
    for (Page page : mWizardModel.getCurrentPageSequence()) {
      page.getReviewItems(reviewItems);
    }
    Collections.sort(
        reviewItems,
        new Comparator<ReviewItem>() {
          @Override
          public int compare(ReviewItem a, ReviewItem b) {
            return a.getWeight() > b.getWeight() ? +1 : a.getWeight() < b.getWeight() ? -1 : 0;
          }
        });
    mCurrentReviewItems = reviewItems;

    if (mReviewAdapter != null) {
      mReviewAdapter.notifyDataSetInvalidated();
    }
  }