Пример #1
0
  private void addChapters(List<Chapter> chapterList) {
    Collections.sort(chapterList, mLocationComparator);
    mChapterAdapter.clear();
    mChapterAdapter.addAll(chapterList);

    mChapterSpinnerView.setAdapter(mChapterAdapter);

    if (mSelectedChapter == null) {
      // if the location is available, select the first chapter by default.
      if (App.getInstance().getLastLocation() != null && chapterList.size() > 0) {
        mSelectedChapter = chapterList.get(0);
      }
    }
    if (mSelectedChapter != null) {
      mChapterSpinnerView.setText(mSelectedChapter.toString());
    } else {
      mChapterSpinnerView.showDropDown();
      mConfirmButton.setEnabled(false);
    }
  }