release
FongMi 2 years ago
parent b5666b01d9
commit 6d7579f5dd
  1. 14
      app/src/main/java/com/fongmi/android/tv/api/config/LiveConfig.java
  2. 5
      app/src/main/java/com/fongmi/android/tv/model/LiveViewModel.java

@ -164,13 +164,12 @@ public class LiveConfig {
parseConfig(object, null);
}
public void setKeep(Live live) {
if (live.getGroups().isEmpty() || live.getGroups().get(0).isKeep()) return;
live.getGroups().add(0, Group.create(R.string.keep));
setKeep(live.getGroups());
public void setKeep(Channel channel) {
if (home == null || channel.getGroup().isHidden() || channel.getUrls().isEmpty()) return;
Setting.putKeep(home.getName() + AppDatabase.SYMBOL + channel.getGroup().getName() + AppDatabase.SYMBOL + channel.getName() + AppDatabase.SYMBOL + channel.getCurrent());
}
private void setKeep(List<Group> items) {
public void setKeep(List<Group> items) {
List<String> key = new ArrayList<>();
for (Keep keep : Keep.getLive()) key.add(keep.getKey());
for (Group group : items) {
@ -183,11 +182,6 @@ public class LiveConfig {
}
}
public void setKeep(Channel channel) {
if (home == null || channel.getGroup().isHidden() || channel.getUrls().isEmpty()) return;
Setting.putKeep(home.getName() + AppDatabase.SYMBOL + channel.getGroup().getName() + AppDatabase.SYMBOL + channel.getName() + AppDatabase.SYMBOL + channel.getCurrent());
}
public int[] find(List<Group> items) {
String[] splits = Setting.getKeep().split(AppDatabase.SYMBOL);
if (splits.length < 4 || !getHome().getName().equals(splits[0])) return new int[]{1, 0};

@ -4,6 +4,7 @@ import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.fongmi.android.tv.Constant;
import com.fongmi.android.tv.R;
import com.fongmi.android.tv.api.EpgParser;
import com.fongmi.android.tv.api.LiveParser;
import com.fongmi.android.tv.api.config.LiveConfig;
@ -98,7 +99,9 @@ public class LiveViewModel extends ViewModel {
private void verify(Live item) {
Iterator<Group> iterator = item.getGroups().iterator();
while (iterator.hasNext()) if (iterator.next().isEmpty()) iterator.remove();
LiveConfig.get().setKeep(item);
if (item.getGroups().isEmpty() || item.getGroups().get(0).isKeep()) return;
item.getGroups().add(0, Group.create(R.string.keep));
LiveConfig.get().setKeep(item.getGroups());
}
private void execute(int type, Callable<?> callable) {

Loading…
Cancel
Save