Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.62 KB | None | 0 0
  1. @Override
  2.     public String getPrimaryLiveTimeText(Context context) {
  3.         if (matchMataData != null) {
  4.             if (sport != null && sport.getPeriodCalculationType() != null) {
  5.                 switch (sport.getPeriodCalculationType()) {
  6.                     case HALF_TIME:
  7.                         return getPrimaryLiveTextForHalfTime(context);
  8.                     case SETS:
  9.                         return getPrimaryLiveTextForSets(context);
  10.                     case PERIOD:
  11.                         return getPrimaryLiveTextForPeriods(context);
  12.                     case QUARTERS:
  13.                         return getPrimaryLiveTextForQuarters(context);
  14.                 }
  15.             }
  16.         }
  17.         return defaultPrimaryLiveText(context);
  18.     }
  19.  
  20.     private String getPrimaryLiveTextForQuarters(Context context) {
  21.         Integer currentPeriod = matchMataData.getCurrentPeriod();
  22.         if (currentPeriod != null) {
  23.             return context.getString(R.string.status_quarter_prefix) + currentPeriod;
  24.         }
  25.         return "";
  26.     }
  27.  
  28.     private String getPrimaryLiveTextForPeriods(Context context) {
  29.         Integer currentPeriod = matchMataData.getCurrentPeriod();
  30.         if (currentPeriod != null) {
  31.             return context.getString(R.string.status_period_prefix) + currentPeriod;
  32.         }
  33.         return "";
  34.     }
  35.  
  36.     private String getPrimaryLiveTextForSets(Context context) {
  37.         Integer currentPeriod = matchMataData.getCurrentPeriod();
  38.         if (currentPeriod != null) {
  39.             return context.getString(R.string.status_set_prefix) + currentPeriod;
  40.         }
  41.         return "";
  42.     }
  43.  
  44.     private String getPrimaryLiveTextForHalfTime(Context context) {
  45.         if (matchMataData.arePenalties()) {
  46.             return context.getString(R.string.label_penalties_short);
  47.         } else if (matchMataData.isOverTime()) {
  48.             return context.getString(R.string.label_overtime_short);
  49.         } else if (matchMataData.hasMinuteInfo()) {
  50.             return matchMataData.getMinute() + "'";
  51.         } else if (matchMataData.isFinished()) {
  52.             return context.getString(R.string.result_ended);
  53.         } else {
  54.             return context.getString(R.string.halfTime);
  55.         }
  56.     }
  57.  
  58.     private String defaultPrimaryLiveText(Context context) {
  59.         if (matchMataData != null) {
  60.             if (matchMataData.hasMinuteInfo()) {
  61.                 return matchMataData.getMinute() + "'";
  62.             } else if (matchMataData.getStatus() != null) {
  63.                 return context.getString(matchMataData.getStatus().getResId());
  64.             }
  65.         }
  66.         return "";
  67.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement