Keep history op&ed

pull/137/head
FongMi 3 years ago
parent 34d55c84a2
commit 5be4248eaf
  1. 7
      app/src/main/java/com/fongmi/android/tv/bean/History.java

@ -173,9 +173,14 @@ public class History {
AppDatabase.get().getHistoryDao().delete(cid); AppDatabase.get().getHistoryDao().delete(cid);
} }
private void copyFrom(History history) {
setOpening(history.getOpening());
setEnding(history.getEnding());
}
public History update(long duration) { public History update(long duration) {
History history = AppDatabase.get().getHistoryDao().findByName(ApiConfig.getCid(), getVodName()); History history = AppDatabase.get().getHistoryDao().findByName(ApiConfig.getCid(), getVodName());
if (history != null) AppDatabase.get().getHistoryDao().delete(ApiConfig.getCid(), history.getKey()); if (history != null) copyFrom(history.delete());
setDuration(duration); setDuration(duration);
AppDatabase.get().getHistoryDao().insertOrUpdate(this); AppDatabase.get().getHistoryDao().insertOrUpdate(this);
return this; return this;

Loading…
Cancel
Save