コード例 #1
0
  private void showNextEntry(@Nonnull final Iterator<CreditsList> iterator) {
    if (!iterator.hasNext()) {
      gotoNextScreen();
      return;
    }

    final CreditsList list = iterator.next();
    if (Lang.getInstance().isGerman()) {
      titleLabel.setText(list.getNameGerman());
    } else {
      titleLabel.setText(list.getNameEnglish());
    }

    final List<String> names = new ArrayList<String>();
    for (final CreditsPerson person : list) {
      names.add(person.getName());
    }
    final StringBuilder builder = new StringBuilder();
    final int nameCount = names.size();
    for (int i = 0; i < nameCount; i++) {
      builder.append(names.get(i));
      if (i < (nameCount - 2)) {
        builder.append(", ");
      } else if (i < (nameCount - 1)) {
        if (Lang.getInstance().isGerman()) {
          builder.append(" und ");
        } else {
          builder.append(" and ");
        }
      }
    }
    nameLabel.setText(builder.toString());
    displayParent.layoutElements();

    displayParent.show(
        new EndNotify() {
          @Override
          public void perform() {
            displayParent.hide(
                new EndNotify() {
                  @Override
                  public void perform() {
                    showNextEntry(iterator);
                  }
                });
          }
        });
  }
コード例 #2
0
ファイル: Item.java プロジェクト: Illarion-eV/Illarion-Java
  /**
   * Set number of stacked items.
   *
   * @param newCount the number of items on this stack, in case its more then one a text is
   *     displayed next to the item that shown how many items are on the stack
   */
  public void setCount(@Nullable ItemCount newCount) {
    count = newCount;

    // write number to text for display
    if (ItemCount.isGreaterOne(count)) {
      number = new TextTag(count.getShortText(Lang.getInstance().getLocale()), Color.YELLOW);
    } else {
      number = null;
    }
  }