示例#1
0
  public String getFullName() {
    switch (type) {
      case BaseItem:
      case LiveTvProgram:
      case LiveTvRecording:
        return Utils.GetFullName(baseItem);
      case Person:
        return person.getName();
      case Chapter:
        return chapterInfo.getName();
      case Server:
        return serverInfo.getName();
      case User:
        return user.getName();
      case LiveTvChannel:
        return channelInfo.getName();
      case GridButton:
        return gridButton.getText();
      case SearchHint:
        return (searchHint.getSeries() != null ? searchHint.getSeries() + " - " : "")
            + searchHint.getName();
    }

    return TvApp.getApplication().getString(R.string.lbl_bracket_unknown);
  }
示例#2
0
  public String getSubText() {
    switch (type) {
      case BaseItem:
        return Utils.GetSubName(baseItem);
      case Person:
        return person.getRole();
      case Chapter:
        Long pos = chapterInfo.getStartPositionTicks() / 10000;
        return Utils.formatMillis(pos.intValue());
      case Server:
        return serverInfo.getLocalAddress().substring(7);
      case LiveTvChannel:
        return channelInfo.getNumber();
      case LiveTvProgram:
        Calendar start = Calendar.getInstance();
        start.setTime(Utils.convertToLocalDate(baseItem.getStartDate()));
        int day = start.get(Calendar.DAY_OF_YEAR);
        return baseItem.getChannelName()
            + " - "
            + (baseItem.getEpisodeTitle() != null ? baseItem.getEpisodeTitle() : "")
            + " "
            + ((day != Calendar.getInstance().get(Calendar.DAY_OF_YEAR)
                    ? new SimpleDateFormat("d MMM").format(start.getTime()) + " "
                    : "")
                + android.text.format.DateFormat.getTimeFormat(TvApp.getApplication())
                    .format(start.getTime())
                + "-"
                + android.text.format.DateFormat.getTimeFormat(TvApp.getApplication())
                    .format(Utils.convertToLocalDate(baseItem.getEndDate())));
      case LiveTvRecording:
        return (baseItem.getChannelName() != null ? baseItem.getChannelName() + " - " : "")
            + (baseItem.getEpisodeTitle() != null ? baseItem.getEpisodeTitle() : "")
            + " "
            + new SimpleDateFormat("d MMM")
                .format(Utils.convertToLocalDate(baseItem.getStartDate()))
            + " "
            + (android.text.format.DateFormat.getTimeFormat(TvApp.getApplication())
                    .format(Utils.convertToLocalDate(baseItem.getStartDate()))
                + "-"
                + android.text.format.DateFormat.getTimeFormat(TvApp.getApplication())
                    .format(Utils.convertToLocalDate(baseItem.getEndDate())));
      case User:
        Date date = user.getLastActivityDate();
        return date != null
            ? DateUtils.getRelativeTimeSpanString(Utils.convertToLocalDate(date).getTime())
                .toString()
            : TvApp.getApplication().getString(R.string.lbl_never);
      case SearchHint:
        return searchHint.getType();
    }

    return "";
  }
示例#3
0
  public String getItemId() {
    switch (type) {
      case BaseItem:
      case LiveTvProgram:
      case LiveTvRecording:
        return baseItem.getId();
      case Person:
        return person.getId();
      case Chapter:
        return chapterInfo.getItemId();
      case Server:
        return serverInfo.getId();
      case User:
        return user.getId();
      case LiveTvChannel:
        return channelInfo.getId();
      case GridButton:
        return null;
      case SearchHint:
        return searchHint.getItemId();
    }

    return null;
  }