|
|
|
|
@ -47,6 +47,7 @@ import com.fongmi.android.tv.model.LiveViewModel; |
|
|
|
|
import com.fongmi.android.tv.player.ExoUtil; |
|
|
|
|
import com.fongmi.android.tv.player.Players; |
|
|
|
|
import com.fongmi.android.tv.player.Source; |
|
|
|
|
import com.fongmi.android.tv.server.Server; |
|
|
|
|
import com.fongmi.android.tv.ui.base.BaseActivity; |
|
|
|
|
import com.fongmi.android.tv.ui.custom.CustomKeyDownLive; |
|
|
|
|
import com.fongmi.android.tv.ui.custom.CustomLiveListView; |
|
|
|
|
@ -135,15 +136,16 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void initView() { |
|
|
|
|
mR0 = this::hideUI; |
|
|
|
|
mR1 = this::hideInfo; |
|
|
|
|
mR2 = this::hideControl; |
|
|
|
|
mR3 = this::setChannelActivated; |
|
|
|
|
mR4 = this::setTraffic; |
|
|
|
|
mHides = new ArrayList<>(); |
|
|
|
|
mPlayers = new Players().init(this); |
|
|
|
|
mKeyDown = CustomKeyDownLive.create(this); |
|
|
|
|
mClock = Clock.create(mBinding.widget.time); |
|
|
|
|
mKeyDown = CustomKeyDownLive.create(this); |
|
|
|
|
mPlayers = new Players().init(this); |
|
|
|
|
mHides = new ArrayList<>(); |
|
|
|
|
mR0 = this::setActivated; |
|
|
|
|
mR1 = this::hideControl; |
|
|
|
|
mR2 = this::setTraffic; |
|
|
|
|
mR3 = this::hideInfo; |
|
|
|
|
mR4 = this::hideUI; |
|
|
|
|
Server.get().start(); |
|
|
|
|
setRecyclerView(); |
|
|
|
|
setVideoView(); |
|
|
|
|
setViewModel(); |
|
|
|
|
@ -305,7 +307,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick |
|
|
|
|
resetPass(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setChannelActivated() { |
|
|
|
|
private void setActivated() { |
|
|
|
|
for (int i = 0; i < mChannelAdapter.size(); i++) ((Channel) mChannelAdapter.get(i)).setSelected(mChannel); |
|
|
|
|
notifyItemChanged(mBinding.channel, mChannelAdapter); |
|
|
|
|
fetch(); |
|
|
|
|
@ -393,7 +395,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void hideUI() { |
|
|
|
|
App.removeCallbacks(mR0); |
|
|
|
|
App.removeCallbacks(mR4); |
|
|
|
|
if (isGone(mBinding.recycler)) return; |
|
|
|
|
mBinding.recycler.setVisibility(View.GONE); |
|
|
|
|
setPosition(); |
|
|
|
|
@ -408,13 +410,13 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick |
|
|
|
|
|
|
|
|
|
private void showProgress() { |
|
|
|
|
mBinding.widget.progress.setVisibility(View.VISIBLE); |
|
|
|
|
App.post(mR4, 0); |
|
|
|
|
App.post(mR2, 0); |
|
|
|
|
hideError(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void hideProgress() { |
|
|
|
|
mBinding.widget.progress.setVisibility(View.GONE); |
|
|
|
|
App.removeCallbacks(mR4); |
|
|
|
|
App.removeCallbacks(mR2); |
|
|
|
|
Traffic.reset(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -438,7 +440,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick |
|
|
|
|
|
|
|
|
|
private void hideControl() { |
|
|
|
|
mBinding.control.getRoot().setVisibility(View.GONE); |
|
|
|
|
App.removeCallbacks(mR2); |
|
|
|
|
App.removeCallbacks(mR1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void hideCenter() { |
|
|
|
|
@ -454,7 +456,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick |
|
|
|
|
|
|
|
|
|
private void hideInfo() { |
|
|
|
|
mBinding.widget.info.setVisibility(View.GONE); |
|
|
|
|
App.removeCallbacks(mR1); |
|
|
|
|
App.removeCallbacks(mR3); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void showEpg() { |
|
|
|
|
@ -470,15 +472,15 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick |
|
|
|
|
|
|
|
|
|
private void setTraffic() { |
|
|
|
|
Traffic.setSpeed(mBinding.widget.traffic); |
|
|
|
|
App.post(mR4, Constant.INTERVAL_TRAFFIC); |
|
|
|
|
App.post(mR2, Constant.INTERVAL_TRAFFIC); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setR1Callback() { |
|
|
|
|
App.post(mR1, Constant.INTERVAL_HIDE); |
|
|
|
|
App.post(mR3, Constant.INTERVAL_HIDE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setR2Callback() { |
|
|
|
|
App.post(mR2, Constant.INTERVAL_HIDE); |
|
|
|
|
App.post(mR1, Constant.INTERVAL_HIDE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void onToggle() { |
|
|
|
|
@ -521,7 +523,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick |
|
|
|
|
if (!item.isKeep() || ++count < 5 || mHides.isEmpty()) return; |
|
|
|
|
if (Biometric.enable()) Biometric.show(this); |
|
|
|
|
else PassDialog.create().show(this); |
|
|
|
|
App.removeCallbacks(mR0); |
|
|
|
|
App.removeCallbacks(mR4); |
|
|
|
|
resetPass(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -560,7 +562,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick |
|
|
|
|
private void setChannel(Channel item) { |
|
|
|
|
mPlayers.setPlayer(getPlayerType(item.getPlayerType())); |
|
|
|
|
setArtwork(item.getLogo()); |
|
|
|
|
App.post(mR3, 100); |
|
|
|
|
App.post(mR0, 100); |
|
|
|
|
mChannel = item; |
|
|
|
|
setPlayerView(); |
|
|
|
|
showInfo(); |
|
|
|
|
@ -792,7 +794,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void setUITimer() { |
|
|
|
|
App.post(mR0, Constant.INTERVAL_HIDE); |
|
|
|
|
App.post(mR4, Constant.INTERVAL_HIDE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -937,6 +939,6 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick |
|
|
|
|
super.onDestroy(); |
|
|
|
|
mPlayers.release(); |
|
|
|
|
Source.get().stop(); |
|
|
|
|
App.removeCallbacks(mR1, mR2, mR3, mR4); |
|
|
|
|
App.removeCallbacks(mR0, mR1, mR3, mR3, mR4); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|