package com.startimes.radio.activity; import com.ximalaya.ting.android.opensdk.model.live.radio.Radio; /** * 当时需求:添加显示的节目,如果准添加节目已有,将其放到第一个位置,并去掉重复的。 */ public class NewRadio implements Comparable<NewRadio>{ private int[] supportBitrates; private String coverUrlSmall; private String coverUrlLarge; private String programName; private String radioName; private String radioDesc; private long scheduleID; private long startTime; private long endTime; private String rate24AacUrl; private String rate24TsUrl; private String rate64AacUrl; private String rate64TsUrl; private int radioPlayCount; private long updateAt; private String shareUrl; private boolean isActivityLive = false; private long activityId; private long dataId; private String kind; private int lastPlayedMills = -1; //添加的属性 private long playSystemTime; //父类 private Radio mRadio; public NewRadio() { } public NewRadio(Radio radio) { this.mRadio=radio; this.supportBitrates = radio.getSupportBitrates(); this.coverUrlSmall = radio.getCoverUrlSmall(); this.coverUrlLarge = radio.getCoverUrlLarge(); this.programName = radio.getProgramName(); this.radioName = radio.getRadioName(); this.radioDesc = radio.getRadioDesc(); this.scheduleID = radio.getScheduleID(); this.startTime = radio.getStartTime(); this.endTime = radio.getEndTime(); this.rate24AacUrl = radio.getRate24AacUrl(); this.rate24TsUrl = radio.getRate24TsUrl(); this.rate64AacUrl = radio.getRate64AacUrl(); this.rate64TsUrl = radio.getRate64TsUrl(); this.radioPlayCount =radio.getRadioPlayCount(); this.updateAt = radio.getUpdateAt(); this.shareUrl = radio.getShareUrl(); this.isActivityLive =radio.isActivityLive(); this.activityId = radio.getActivityId(); this.dataId =radio.getDataId(); this.kind =radio.getKind(); this.lastPlayedMills =radio.getLastPlayedMills(); //获取系统时间 this.playSystemTime=System.currentTimeMillis(); } public int[] getSupportBitrates() { return supportBitrates; } public void setSupportBitrates(int[] supportBitrates) { this.supportBitrates = supportBitrates; } public String getCoverUrlSmall() { return coverUrlSmall; } public void setCoverUrlSmall(String coverUrlSmall) { this.coverUrlSmall = coverUrlSmall; } public String getCoverUrlLarge() { return coverUrlLarge; } public void setCoverUrlLarge(String coverUrlLarge) { this.coverUrlLarge = coverUrlLarge; } public String getProgramName() { return programName; } public void setProgramName(String programName) { this.programName = programName; } public String getRadioName() { return radioName; } public void setRadioName(String radioName) { this.radioName = radioName; } public String getRadioDesc() { return radioDesc; } public void setRadioDesc(String radioDesc) { this.radioDesc = radioDesc; } public long getScheduleID() { return scheduleID; } public void setScheduleID(long scheduleID) { this.scheduleID = scheduleID; } public long getStartTime() { return startTime; } public void setStartTime(long startTime) { this.startTime = startTime; } public long getEndTime() { return endTime; } public void setEndTime(long endTime) { this.endTime = endTime; } public String getRate24AacUrl() { return rate24AacUrl; } public void setRate24AacUrl(String rate24AacUrl) { this.rate24AacUrl = rate24AacUrl; } public String getRate24TsUrl() { return rate24TsUrl; } public void setRate24TsUrl(String rate24TsUrl) { this.rate24TsUrl = rate24TsUrl; } public String getRate64AacUrl() { return rate64AacUrl; } public void setRate64AacUrl(String rate64AacUrl) { this.rate64AacUrl = rate64AacUrl; } public String getRate64TsUrl() { return rate64TsUrl; } public void setRate64TsUrl(String rate64TsUrl) { this.rate64TsUrl = rate64TsUrl; } public int getRadioPlayCount() { return radioPlayCount; } public void setRadioPlayCount(int radioPlayCount) { this.radioPlayCount = radioPlayCount; } public long getUpdateAt() { return updateAt; } public void setUpdateAt(long updateAt) { this.updateAt = updateAt; } public String getShareUrl() { return shareUrl; } public void setShareUrl(String shareUrl) { this.shareUrl = shareUrl; } public boolean isActivityLive() { return isActivityLive; } public void setActivityLive(boolean activityLive) { isActivityLive = activityLive; } public long getActivityId() { return activityId; } public void setActivityId(long activityId) { this.activityId = activityId; } public long getDataId() { return dataId; } public void setDataId(long dataId) { this.dataId = dataId; } public String getKind() { return kind; } public void setKind(String kind) { this.kind = kind; } public int getLastPlayedMills() { return lastPlayedMills; } public void setLastPlayedMills(int lastPlayedMills) { this.lastPlayedMills = lastPlayedMills; } public long getPlaySystemTime() { return playSystemTime; } public void setPlaySystemTime(long playSystemTime) { this.playSystemTime = playSystemTime; } public Radio getmRadio() { return mRadio; } public void setmRadio(Radio mRadio) { this.mRadio = mRadio; } //比较,防止重复。 @Override public int compareTo(NewRadio n) { if (this.getDataId()==n.getDataId()) { n.setPlaySystemTime(this.getPlaySystemTime()); return 0; } else { if (this.getPlaySystemTime() < n.getPlaySystemTime()) { return 1; } if (this.getPlaySystemTime() > n.getPlaySystemTime()) { return -1; } } return 0; } }