向下转换问题的解决策略

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;
    }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值