|
|
|
|
@ -1,5 +1,8 @@ |
|
|
|
|
package com.fongmi.android.tv.bean; |
|
|
|
|
|
|
|
|
|
import android.text.TextUtils; |
|
|
|
|
import android.view.View; |
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull; |
|
|
|
|
import androidx.room.Entity; |
|
|
|
|
import androidx.room.PrimaryKey; |
|
|
|
|
@ -199,12 +202,16 @@ public class History { |
|
|
|
|
this.cid = cid; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public String getSiteName() { |
|
|
|
|
return ApiConfig.getSiteName(getSiteKey()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public String getSiteKey() { |
|
|
|
|
return getKey().substring(0, getKey().lastIndexOf(AppDatabase.SYMBOL)); |
|
|
|
|
return getKey().split(AppDatabase.SYMBOL)[0]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public String getVodId() { |
|
|
|
|
return getKey().substring(getKey().lastIndexOf(AppDatabase.SYMBOL) + AppDatabase.SYMBOL.length()); |
|
|
|
|
return getKey().split(AppDatabase.SYMBOL)[1]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Vod.Flag getFlag() { |
|
|
|
|
@ -215,6 +222,10 @@ public class History { |
|
|
|
|
return new Vod.Flag.Episode(getVodRemarks(), getEpisodeUrl()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public int getSiteVisible() { |
|
|
|
|
return TextUtils.isEmpty(getSiteName()) ? View.GONE : View.VISIBLE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public int getRevPlayText() { |
|
|
|
|
return isRevPlay() ? R.string.play_backward : R.string.play_forward; |
|
|
|
|
} |
|
|
|
|
@ -254,6 +265,12 @@ public class History { |
|
|
|
|
update(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public History update(int cid) { |
|
|
|
|
setCid(cid); |
|
|
|
|
update(); |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public History update() { |
|
|
|
|
checkMerge(AppDatabase.get().getHistoryDao().findByName(ApiConfig.getCid(), getVodName())); |
|
|
|
|
AppDatabase.get().getHistoryDao().insertOrUpdate(this); |
|
|
|
|
@ -265,11 +282,6 @@ public class History { |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public History cid(int cid) { |
|
|
|
|
setCid(cid); |
|
|
|
|
return update(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void findEpisode(List<Vod.Flag> flags) { |
|
|
|
|
setVodFlag(flags.get(0).getFlag()); |
|
|
|
|
setVodRemarks(flags.get(0).getEpisodes().get(0).getName()); |
|
|
|
|
|