コード例 #1
0
 // region override
 @Override
 public String getStartAtErrorMessage() {
   if (episodeInput.isEmpty()) {
     return "Missing data: Episodes";
   }
   return "";
 }
コード例 #2
0
  private void setup() {
    // Model
    setModel();

    // Episode
    registerKeyboardListener(episodeInput);
    episodeInput.setOnFocusChangeListener(
        new NumericInputField.OnFocusChangeListener() {
          @Override
          public void onFocusLost(EditText source, boolean hasValidInput, int value) {
            setStartAtInputEnabled(hasValidInput);
            if (hasValidInput) {
              model.setSeasonEpisodeCount(value);
              if (model.getCurrentEpisode() > value) {
                model.setCurrentEpisode(value);
                updateStartAt();
              }
            }
          }
        });

    // Start at
    startAtLabel.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            CellGridDialogBuilder.create(getChildFragmentManager(), model.getSeasonEpisodeCount())
                .header("Season ", "Episodes")
                .select(model.getCurrentEpisode() - 1)
                .onAcceptListener(WatchAddEntryMode3PagerFragment.this)
                .show();
          }
        });
  }
コード例 #3
0
 private void setModel() {
   setStartAtInputEnabled(model != null);
   if (model == null) {
     model = new WatchModel();
     model.setEpisodesOnly(true);
   } else {
     episodeInput.setText(String.valueOf(model.getSeasonEpisodeCount()));
   }
 }