|
|
|
|
@ -82,6 +82,7 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis |
|
|
|
|
private boolean mAutoMode; |
|
|
|
|
private boolean mUseParse; |
|
|
|
|
private boolean mLock; |
|
|
|
|
private boolean mStop; |
|
|
|
|
private int mCurrent; |
|
|
|
|
private Runnable mR1; |
|
|
|
|
private Runnable mR2; |
|
|
|
|
@ -169,11 +170,17 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis |
|
|
|
|
return mBinding = ActivityDetailBinding.inflate(getLayoutInflater()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void onNewIntent(Intent intent) { |
|
|
|
|
super.onNewIntent(intent); |
|
|
|
|
getIntent().putExtras(intent); |
|
|
|
|
getDetail(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void initView() { |
|
|
|
|
mKeyDown = CustomKeyDownVod.create(this); |
|
|
|
|
mFrameParams = mBinding.video.getLayoutParams(); |
|
|
|
|
mBinding.progressLayout.showProgress(); |
|
|
|
|
mPlayers = new Players().init(); |
|
|
|
|
mR1 = this::hideControl; |
|
|
|
|
mR2 = this::setTraffic; |
|
|
|
|
@ -213,7 +220,7 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkOrientation() { |
|
|
|
|
if (ResUtil.isLand()) enterFullscreen(); |
|
|
|
|
if (ResUtil.isLand(this)) enterFullscreen(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setRecyclerView() { |
|
|
|
|
@ -274,6 +281,7 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void getDetail() { |
|
|
|
|
mBinding.progressLayout.showProgress(); |
|
|
|
|
mViewModel.detailContent(getKey(), getId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -402,7 +410,7 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis |
|
|
|
|
setR1Callback(); |
|
|
|
|
setLock(!isLock()); |
|
|
|
|
mBinding.control.lock.setImageResource(isLock() ? R.drawable.ic_lock_on : R.drawable.ic_lock_off); |
|
|
|
|
setRequestedOrientation(isLock() ? (ResUtil.isLand() ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT) : ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR); |
|
|
|
|
setRequestedOrientation(isLock() ? (ResUtil.isLand(this) ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT) : ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void onFull() { |
|
|
|
|
@ -538,8 +546,7 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis |
|
|
|
|
mBinding.video.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)); |
|
|
|
|
App.post(mR3, 3000); |
|
|
|
|
setFullscreen(true); |
|
|
|
|
hideControl(); |
|
|
|
|
hideInfo(); |
|
|
|
|
hideAll(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void exitFullscreen() { |
|
|
|
|
@ -549,8 +556,7 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis |
|
|
|
|
mBinding.video.setLayoutParams(mFrameParams); |
|
|
|
|
App.post(mR3, 3000); |
|
|
|
|
setFullscreen(false); |
|
|
|
|
hideControl(); |
|
|
|
|
hideInfo(); |
|
|
|
|
hideAll(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void showProgress() { |
|
|
|
|
@ -602,6 +608,11 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis |
|
|
|
|
hideInfo(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void hideAll() { |
|
|
|
|
hideControl(); |
|
|
|
|
hideInfo(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setTraffic() { |
|
|
|
|
Traffic.setSpeed(mBinding.widget.traffic); |
|
|
|
|
App.post(mR2, Constant.INTERVAL_TRAFFIC); |
|
|
|
|
@ -807,6 +818,14 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis |
|
|
|
|
this.mLock = lock; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public boolean isStop() { |
|
|
|
|
return mStop; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setStop(boolean stop) { |
|
|
|
|
this.mStop = stop; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void notifyItemChanged(RecyclerView.Adapter<?> adapter) { |
|
|
|
|
adapter.notifyItemRangeChanged(0, adapter.getItemCount()); |
|
|
|
|
} |
|
|
|
|
@ -824,14 +843,6 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis |
|
|
|
|
hideControl(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onConfigurationChanged(@NonNull Configuration newConfig) { |
|
|
|
|
super.onConfigurationChanged(newConfig); |
|
|
|
|
if (isLock()) return; |
|
|
|
|
if (ResUtil.isLand()) enterFullscreen(); |
|
|
|
|
if (ResUtil.isPort()) exitFullscreen(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void onUserLeaveHint() { |
|
|
|
|
super.onUserLeaveHint(); |
|
|
|
|
@ -844,24 +855,31 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis |
|
|
|
|
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) { |
|
|
|
|
super.onPictureInPictureModeChanged(isInPictureInPictureMode); |
|
|
|
|
mBinding.progressLayout.setVisibility(isInPictureInPictureMode ? View.GONE : View.VISIBLE); |
|
|
|
|
if (isInPictureInPictureMode) { |
|
|
|
|
hideControl(); |
|
|
|
|
hideInfo(); |
|
|
|
|
} else if (!mPlayers.isPlaying()) { |
|
|
|
|
finish(); |
|
|
|
|
} |
|
|
|
|
if (isInPictureInPictureMode) hideAll(); |
|
|
|
|
else if (isStop()) finish(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onConfigurationChanged(@NonNull Configuration newConfig) { |
|
|
|
|
super.onConfigurationChanged(newConfig); |
|
|
|
|
if (Utils.hasPIP() && isInPictureInPictureMode() || isLock()) return; |
|
|
|
|
else if (ResUtil.isPort(this)) exitFullscreen(); |
|
|
|
|
else if (ResUtil.isLand(this)) enterFullscreen(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void onStart() { |
|
|
|
|
super.onStart(); |
|
|
|
|
setStop(false); |
|
|
|
|
onPlay(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void onStop() { |
|
|
|
|
onPause(false); |
|
|
|
|
super.onStop(); |
|
|
|
|
RefreshEvent.history(); |
|
|
|
|
onPause(false); |
|
|
|
|
setStop(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -873,7 +891,6 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis |
|
|
|
|
@Override |
|
|
|
|
protected void onPause() { |
|
|
|
|
super.onPause(); |
|
|
|
|
RefreshEvent.history(); |
|
|
|
|
Clock.get().release(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|