Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public String getPrimaryLiveTimeText(Context context) {
- if (matchMataData != null) {
- if (sport != null && sport.getPeriodCalculationType() != null) {
- switch (sport.getPeriodCalculationType()) {
- case HALF_TIME:
- return getPrimaryLiveTextForHalfTime(context);
- case SETS:
- return getPrimaryLiveTextForSets(context);
- case PERIOD:
- return getPrimaryLiveTextForPeriods(context);
- case QUARTERS:
- return getPrimaryLiveTextForQuarters(context);
- }
- }
- }
- return defaultPrimaryLiveText(context);
- }
- private String getPrimaryLiveTextForQuarters(Context context) {
- Integer currentPeriod = matchMataData.getCurrentPeriod();
- if (matchMataData.isOverTime()) {
- return context.getString(R.string.label_overtime_short);
- } else if (currentPeriod != null) {
- return context.getString(R.string.status_quarter_prefix) + currentPeriod;
- }
- return "";
- }
- private String getPrimaryLiveTextForPeriods(Context context) {
- Integer currentPeriod = matchMataData.getCurrentPeriod();
- if (matchMataData.isOverTime()) {
- return context.getString(R.string.label_overtime_short);
- } else if (currentPeriod != null) {
- return context.getString(R.string.status_period_prefix) + currentPeriod;
- }
- return "";
- }
- private String getPrimaryLiveTextForSets(Context context) {
- Integer currentPeriod = matchMataData.getCurrentPeriod();
- if (currentPeriod != null) {
- return context.getString(R.string.status_set_prefix) + currentPeriod;
- }
- return "";
- }
- private String getPrimaryLiveTextForHalfTime(Context context) {
- if (matchMataData.arePenalties()) {
- return context.getString(R.string.label_penalties_short);
- } else if (matchMataData.isOverTime()) {
- return context.getString(R.string.label_overtime_short);
- } else if (matchMataData.hasMinuteInfo()) {
- return matchMataData.getMinute() + "'";
- } else if (matchMataData.isFinished()) {
- return context.getString(R.string.result_ended);
- } else {
- return context.getString(R.string.halfTime);
- }
- }
- private String defaultPrimaryLiveText(Context context) {
- if (matchMataData != null) {
- if (matchMataData.hasMinuteInfo()) {
- return matchMataData.getMinute() + "'";
- } else if (matchMataData.getStatus() != null) {
- return context.getString(matchMataData.getStatus().getResId());
- }
- }
- return "";
- }
- @Override
- public String getSecondaryLiveTimeText(Context context) {
- if (matchMataData != null) {
- if (sport != null && sport.getPeriodCalculationType() != null) {
- switch (sport.getPeriodCalculationType()) {
- case HALF_TIME:
- return getSecondaryLiveTimeTextForHalfTime(context);
- case PERIOD:
- case QUARTERS:
- if (matchMataData.hasMinuteInfo()) {
- return matchMataData.getMinute() + "'";
- }
- }
- }
- }
- return null;
- }
- private String getSecondaryLiveTimeTextForHalfTime(Context context) {
- if (matchMataData.isOverTime() && matchMataData.hasMinuteInfo()) {
- return matchMataData.getMinute() + "'";
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement