|
|
|
|
@ -30,6 +30,7 @@ import com.fongmi.android.tv.R; |
|
|
|
|
import com.fongmi.android.tv.Setting; |
|
|
|
|
import com.fongmi.android.tv.api.LiveConfig; |
|
|
|
|
import com.fongmi.android.tv.bean.Channel; |
|
|
|
|
import com.fongmi.android.tv.bean.Config; |
|
|
|
|
import com.fongmi.android.tv.bean.Epg; |
|
|
|
|
import com.fongmi.android.tv.bean.Group; |
|
|
|
|
import com.fongmi.android.tv.bean.Keep; |
|
|
|
|
@ -39,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.impl.Callback; |
|
|
|
|
import com.fongmi.android.tv.impl.LiveCallback; |
|
|
|
|
import com.fongmi.android.tv.impl.PassCallback; |
|
|
|
|
import com.fongmi.android.tv.impl.SubtitleCallback; |
|
|
|
|
@ -95,7 +97,11 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick |
|
|
|
|
private int count; |
|
|
|
|
|
|
|
|
|
public static void start(Context context) { |
|
|
|
|
if (!LiveConfig.isEmpty()) context.startActivity(new Intent(context, LiveActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); |
|
|
|
|
if (!LiveConfig.isEmpty()) context.startActivity(new Intent(context, LiveActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("empty", false)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean isEmpty() { |
|
|
|
|
return getIntent().getBooleanExtra("empty", true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private PlayerView getExo() { |
|
|
|
|
@ -142,7 +148,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick |
|
|
|
|
setRecyclerView(); |
|
|
|
|
setVideoView(); |
|
|
|
|
setViewModel(); |
|
|
|
|
getLive(); |
|
|
|
|
checkLive(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -224,6 +230,28 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkLive() { |
|
|
|
|
if (isEmpty()) { |
|
|
|
|
LiveConfig.load(Config.live(), getCallback()); |
|
|
|
|
} else { |
|
|
|
|
getLive(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Callback getCallback() { |
|
|
|
|
return new Callback() { |
|
|
|
|
@Override |
|
|
|
|
public void success() { |
|
|
|
|
getLive(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void error(String msg) { |
|
|
|
|
Notify.show(msg); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void getLive() { |
|
|
|
|
mBinding.control.home.setText(getHome().getName()); |
|
|
|
|
mPlayers.setPlayer(getPlayerType(-1)); |
|
|
|
|
|