Add refresh live list api

pull/586/head
FongMi 2 years ago
parent a507913412
commit 627b6092a4
  1. 13
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/LiveActivity.java
  2. 6
      app/src/main/java/com/fongmi/android/tv/event/RefreshEvent.java
  3. 3
      app/src/main/java/com/fongmi/android/tv/server/process/Action.java
  4. 13
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/LiveActivity.java

@ -38,6 +38,7 @@ import com.fongmi.android.tv.databinding.ActivityLiveBinding;
import com.fongmi.android.tv.event.ActionEvent;
import com.fongmi.android.tv.event.ErrorEvent;
import com.fongmi.android.tv.event.PlayerEvent;
import com.fongmi.android.tv.event.RefreshEvent;
import com.fongmi.android.tv.impl.Callback;
import com.fongmi.android.tv.impl.LiveCallback;
import com.fongmi.android.tv.impl.PassCallback;
@ -689,6 +690,18 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onRefreshEvent(RefreshEvent event) {
switch (event.getType()) {
case LIVE:
setLive(getHome());
break;
case PLAYER:
fetch();
break;
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onPlayerEvent(PlayerEvent event) {
switch (event.getState()) {

@ -35,6 +35,10 @@ public class RefreshEvent {
EventBus.getDefault().post(new RefreshEvent(Type.WALL));
}
public static void live() {
EventBus.getDefault().post(new RefreshEvent(Type.LIVE));
}
public static void detail() {
EventBus.getDefault().post(new RefreshEvent(Type.DETAIL));
}
@ -65,6 +69,6 @@ public class RefreshEvent {
}
public enum Type {
CONFIG, IMAGE, VIDEO, HISTORY, KEEP, SIZE, WALL, DETAIL, PLAYER, SUBTITLE
CONFIG, IMAGE, VIDEO, HISTORY, KEEP, SIZE, WALL, LIVE, DETAIL, PLAYER, SUBTITLE
}
}

@ -79,7 +79,8 @@ public class Action implements Process {
private void onRefresh(Map<String, String> params) {
String type = params.get("type");
String path = params.get("path");
if ("detail".equals(type)) RefreshEvent.detail();
if ("live".equals(type)) RefreshEvent.live();
else if ("detail".equals(type)) RefreshEvent.detail();
else if ("player".equals(type)) RefreshEvent.player();
else if ("subtitle".equals(type)) RefreshEvent.subtitle(path);
}

@ -40,6 +40,7 @@ import com.fongmi.android.tv.databinding.ActivityLiveBinding;
import com.fongmi.android.tv.event.ActionEvent;
import com.fongmi.android.tv.event.ErrorEvent;
import com.fongmi.android.tv.event.PlayerEvent;
import com.fongmi.android.tv.event.RefreshEvent;
import com.fongmi.android.tv.impl.Callback;
import com.fongmi.android.tv.impl.LiveCallback;
import com.fongmi.android.tv.impl.PassCallback;
@ -746,6 +747,18 @@ public class LiveActivity extends BaseActivity implements CustomKeyDownLive.List
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onRefreshEvent(RefreshEvent event) {
switch (event.getType()) {
case LIVE:
setLive(getHome());
break;
case PLAYER:
fetch();
break;
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onPlayerEvent(PlayerEvent event) {
switch (event.getState()) {

Loading…
Cancel
Save