|
|
|
|
@ -358,6 +358,8 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
mBinding.control.opening.setDownListener(this::onOpeningSub); |
|
|
|
|
mBinding.control.loop.setOnClickListener(view -> onLoop()); |
|
|
|
|
mBinding.control.danmu.setOnClickListener(view -> onDanmu()); |
|
|
|
|
mBinding.control.danmu.setUpListener(this::onDanmuAdd); |
|
|
|
|
mBinding.control.danmu.setDownListener(this::onDanmuSub); |
|
|
|
|
mBinding.control.next.setOnClickListener(view -> checkNext()); |
|
|
|
|
mBinding.control.prev.setOnClickListener(view -> checkPrev()); |
|
|
|
|
mBinding.control.episodes.setOnClickListener(view -> onEpisodes()); |
|
|
|
|
@ -452,19 +454,24 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
setSubtitle(16); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setDanmuView() { |
|
|
|
|
int maxLine = Setting.getDanmuLine(3); |
|
|
|
|
mPlayers.setDanmuView(mBinding.danmaku); |
|
|
|
|
private void setDanmuViewSettings() { |
|
|
|
|
float[] range = {2.4f, 1.8f, 1.2f, 0.8f}; |
|
|
|
|
float speed = range[Setting.getDanmuSpeed()]; |
|
|
|
|
float alpha = Setting.getDanmuAlpha() / 100.0f; |
|
|
|
|
float sizeScale = Setting.getDanmuSize(); |
|
|
|
|
float sizeScale = isFullscreen() ? 1.2f * Setting.getDanmuSize() : 0.8f * Setting.getDanmuSize(); |
|
|
|
|
int maxLine = Setting.getDanmuLine(3); |
|
|
|
|
HashMap<Integer, Integer> maxLines = new HashMap<>(); |
|
|
|
|
maxLines.put(BaseDanmaku.TYPE_FIX_TOP, maxLine); |
|
|
|
|
maxLines.put(BaseDanmaku.TYPE_SCROLL_RL, maxLine); |
|
|
|
|
maxLines.put(BaseDanmaku.TYPE_SCROLL_LR, maxLine); |
|
|
|
|
maxLines.put(BaseDanmaku.TYPE_FIX_BOTTOM, maxLine); |
|
|
|
|
mDanmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 3).setMaximumLines(maxLines).setScrollSpeedFactor(speed).setDanmakuTransparency(alpha).setDanmakuMargin(12).setScaleTextSize(sizeScale); |
|
|
|
|
mDanmakuContext.setMaximumLines(maxLines).setScrollSpeedFactor(speed).setDanmakuTransparency(alpha).setScaleTextSize(sizeScale); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setDanmuView() { |
|
|
|
|
mPlayers.setDanmuView(mBinding.danmaku); |
|
|
|
|
setDanmuViewSettings(); |
|
|
|
|
mDanmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 3).setDanmakuMargin(8); |
|
|
|
|
mBinding.control.danmu.setActivated(Setting.isDanmu()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -881,6 +888,22 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
showDanmu(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void onDanmuAdd() { |
|
|
|
|
int line = Setting.getDanmuLine(3); |
|
|
|
|
line = Math.min(line + 1, 15); |
|
|
|
|
Setting.putDanmuLine(line); |
|
|
|
|
mBinding.control.danmu.setText(line + ResUtil.getString(R.string.lines)); |
|
|
|
|
setDanmuViewSettings(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void onDanmuSub() { |
|
|
|
|
int line = Setting.getDanmuLine(3); |
|
|
|
|
line = Math.max(line - 1, 1); |
|
|
|
|
Setting.putDanmuLine(line); |
|
|
|
|
mBinding.control.danmu.setText(line + ResUtil.getString(R.string.lines)); |
|
|
|
|
setDanmuViewSettings(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void showDanmu() { |
|
|
|
|
if (Setting.isDanmu()) mBinding.danmaku.show(); |
|
|
|
|
else mBinding.danmaku.hide(); |
|
|
|
|
@ -1104,11 +1127,27 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
mBinding.widget.center.setVisibility(View.GONE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setControlNextFocus() { |
|
|
|
|
int count = mBinding.control.actionLayout.getChildCount(); |
|
|
|
|
for(int i=0; i<count-1; i++) { |
|
|
|
|
View btn = mBinding.control.actionLayout.getChildAt(i); |
|
|
|
|
if (btn == null || !isVisible(btn)) continue; |
|
|
|
|
for(int j=i+1; j<count; j++) { |
|
|
|
|
View next = mBinding.control.actionLayout.getChildAt(j); |
|
|
|
|
if (next == null || !isVisible(next)) continue; |
|
|
|
|
btn.setNextFocusRightId(next.getId()); |
|
|
|
|
next.setNextFocusLeftId(btn.getId()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void showControl(View view) { |
|
|
|
|
mBinding.control.danmu.setVisibility(mBinding.danmaku.isPrepared() ? View.VISIBLE : View.GONE); |
|
|
|
|
mBinding.control.getRoot().setVisibility(View.VISIBLE); |
|
|
|
|
mBinding.control.episodes.setVisibility(Setting.getFullscreenMenuKey() == 0 ? View.VISIBLE : View.GONE); |
|
|
|
|
view.requestFocus(); |
|
|
|
|
setControlNextFocus(); |
|
|
|
|
setR1Callback(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|