// Builds a string with the day of the week and the word yesterday/today/tomorrow
  // before it if applicable.
  private String buildDayOfWeek() {

    Time t = new Time(mTimeZone);
    t.set(mMilliTime);
    long julianDay = Time.getJulianDay(mMilliTime, t.gmtoff);
    String dayOfWeek = null;
    mStringBuilder.setLength(0);

    if (julianDay == mTodayJulianDay) {
      dayOfWeek =
          mContext.getString(
              R.string.agenda_today,
              DateUtils.formatDateRange(
                      mContext,
                      mFormatter,
                      mMilliTime,
                      mMilliTime,
                      DateUtils.FORMAT_SHOW_WEEKDAY,
                      mTimeZone)
                  .toString());
    } else if (julianDay == mTodayJulianDay - 1) {
      dayOfWeek =
          mContext.getString(
              R.string.agenda_yesterday,
              DateUtils.formatDateRange(
                      mContext,
                      mFormatter,
                      mMilliTime,
                      mMilliTime,
                      DateUtils.FORMAT_SHOW_WEEKDAY,
                      mTimeZone)
                  .toString());
    } else if (julianDay == mTodayJulianDay + 1) {
      dayOfWeek =
          mContext.getString(
              R.string.agenda_tomorrow,
              DateUtils.formatDateRange(
                      mContext,
                      mFormatter,
                      mMilliTime,
                      mMilliTime,
                      DateUtils.FORMAT_SHOW_WEEKDAY,
                      mTimeZone)
                  .toString());
    } else {
      dayOfWeek =
          DateUtils.formatDateRange(
                  mContext,
                  mFormatter,
                  mMilliTime,
                  mMilliTime,
                  DateUtils.FORMAT_SHOW_WEEKDAY,
                  mTimeZone)
              .toString();
    }
    return dayOfWeek.toUpperCase();
  }
Пример #2
0
  private int getDefaultResolution(final List<VideoStream> videoStreams) {
    String defaultResolution =
        defaultPreferences.getString(
            activity.getString(R.string.default_resolution_key),
            activity.getString(R.string.default_resolution_value));

    for (int i = 0; i < videoStreams.size(); i++) {
      VideoStream item = videoStreams.get(i);
      if (defaultResolution.equals(item.resolution)) {
        return i;
      }
    }
    // this is actually an error,
    // but maybe there is really no stream fitting to the default value.
    return 0;
  }
Пример #3
0
  public void setupMenu(Menu menu, MenuInflater inflater) {
    this.menu = menu;

    // CAUTION set item properties programmatically otherwise it would not be accepted by
    // appcompat itemsinflater.inflate(R.menu.videoitem_detail, menu);

    defaultPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
    inflater.inflate(R.menu.videoitem_detail, menu);

    showPlayWithKodiAction(
        defaultPreferences.getBoolean(activity.getString(R.string.show_play_with_kodi_key), false));
  }
Пример #4
0
 public void setToolbarTitle(int idTitleString) {
   setToolbarTitle(mActivity.getString(idTitleString));
 }