|
|
|
|
@ -145,6 +145,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
private boolean useParse; |
|
|
|
|
private int currentFlag; |
|
|
|
|
private int toggleCount; |
|
|
|
|
private int groupSize; |
|
|
|
|
private Runnable mR1; |
|
|
|
|
private Runnable mR2; |
|
|
|
|
private Runnable mR3; |
|
|
|
|
@ -283,6 +284,11 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
return Setting.getEpisode() == 0 ? mBinding.episodeHori : mBinding.episodeVert; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setEpisodeSelectedPosition(int position) { |
|
|
|
|
if (Setting.getEpisode() == 1) position += 3 * mEpisodePresenter.getNumColumns();//temporary solution
|
|
|
|
|
getEpisodeView().setSelectedPosition(position); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean isReplay() { |
|
|
|
|
return Setting.getReset() == 1; |
|
|
|
|
} |
|
|
|
|
@ -370,7 +376,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
mBinding.array.addOnChildViewHolderSelectedListener(new OnChildViewHolderSelectedListener() { |
|
|
|
|
@Override |
|
|
|
|
public void onChildViewHolderSelected(@NonNull RecyclerView parent, @Nullable RecyclerView.ViewHolder child, int position, int subposition) { |
|
|
|
|
if (mEpisodeAdapter.size() > 20 && position > 1) getEpisodeView().setSelectedPosition((position - 2) * 20); |
|
|
|
|
if (mEpisodeAdapter.size() > getGroupSize() && position > 1) setEpisodeSelectedPosition((position - 2) * getGroupSize() + 1); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
@ -645,7 +651,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
if (Setting.getFlag() == 1) { |
|
|
|
|
episode.setActivated(true); |
|
|
|
|
getEpisodeView().requestFocus(); |
|
|
|
|
getEpisodeView().setSelectedPosition(getEpisodePosition()); |
|
|
|
|
setEpisodeSelectedPosition(getEpisodePosition()); |
|
|
|
|
episode.setActivated(false); |
|
|
|
|
} else { |
|
|
|
|
mHistory.setVodRemarks(episode.getName()); |
|
|
|
|
@ -658,7 +664,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
if (shouldEnterFullscreen(item)) return; |
|
|
|
|
setCurrentFlag(mBinding.flag.getSelectedPosition()); |
|
|
|
|
for (int i = 0; i < mFlagAdapter.size(); i++) ((Flag) mFlagAdapter.get(i)).toggle(getCurrentFlag() == i, item); |
|
|
|
|
getEpisodeView().setSelectedPosition(getEpisodePosition()); |
|
|
|
|
setEpisodeSelectedPosition(getEpisodePosition()); |
|
|
|
|
notifyItemChanged(getEpisodeView(), mEpisodeAdapter); |
|
|
|
|
if (mEpisodeAdapter.size() == 0) return; |
|
|
|
|
if (isFullscreen()) Notify.show(getString(R.string.play_ready, item.getName())); |
|
|
|
|
@ -684,7 +690,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
private void reverseEpisode(boolean scroll) { |
|
|
|
|
for (int i = 0; i < mFlagAdapter.size(); i++) Collections.reverse(((Flag) mFlagAdapter.get(i)).getEpisodes()); |
|
|
|
|
setEpisodeAdapter(getFlag().getEpisodes()); |
|
|
|
|
if (scroll) getEpisodeView().setSelectedPosition(getEpisodePosition()); |
|
|
|
|
if (scroll) setEpisodeSelectedPosition(getEpisodePosition()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setParseActivated(Parse item) { |
|
|
|
|
@ -694,12 +700,15 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setArrayAdapter(int size) { |
|
|
|
|
if (size > 200) setGroupSize(100); |
|
|
|
|
else if (size > 100) setGroupSize(40); |
|
|
|
|
else setGroupSize(20); |
|
|
|
|
List<String> items = new ArrayList<>(); |
|
|
|
|
items.add(getString(R.string.play_reverse)); |
|
|
|
|
items.add(getString(mHistory.getRevPlayText())); |
|
|
|
|
mBinding.array.setVisibility(size > 1 ? View.VISIBLE : View.GONE); |
|
|
|
|
if (mHistory.isRevSort()) for (int i = size; i > 0; i -= 20) items.add(i + "-" + Math.max(i - 19, 1)); |
|
|
|
|
else for (int i = 0; i < size; i += 20) items.add((i + 1) + "-" + Math.min(i + 20, size)); |
|
|
|
|
if (mHistory.isRevSort()) for (int i = size; i > 0; i -= getGroupSize()) items.add(i + "-" + Math.max(i - (getGroupSize() - 1), 1)); |
|
|
|
|
else for (int i = 0; i < size; i += getGroupSize()) items.add((i + 1) + "-" + Math.min(i + getGroupSize(), size)); |
|
|
|
|
mArrayAdapter.setItems(items, null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1013,15 +1022,23 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void showInfo() { |
|
|
|
|
mBinding.widget.center.setVisibility(View.VISIBLE); |
|
|
|
|
mBinding.widget.info.setVisibility(View.VISIBLE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void hideInfo() { |
|
|
|
|
mBinding.widget.center.setVisibility(View.GONE); |
|
|
|
|
mBinding.widget.info.setVisibility(View.GONE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void showInfoAndCenter() { |
|
|
|
|
showInfo(); |
|
|
|
|
mBinding.widget.center.setVisibility(View.VISIBLE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void hideInfoAndCenter() { |
|
|
|
|
hideInfo(); |
|
|
|
|
mBinding.widget.center.setVisibility(View.GONE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void showControl(View view) { |
|
|
|
|
mBinding.control.danmu.setVisibility(mBinding.danmaku.isPrepared() ? View.VISIBLE : View.GONE); |
|
|
|
|
mBinding.control.getRoot().setVisibility(View.VISIBLE); |
|
|
|
|
@ -1030,6 +1047,11 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void hideControl() { |
|
|
|
|
hideControl(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void hideControl(boolean hideInfo) { |
|
|
|
|
if (hideInfo) hideInfo(); |
|
|
|
|
mBinding.control.text.setText(R.string.play_track_text); |
|
|
|
|
mBinding.control.getRoot().setVisibility(View.GONE); |
|
|
|
|
App.removeCallbacks(mR1); |
|
|
|
|
@ -1037,7 +1059,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
|
|
|
|
|
private void hideCenter() { |
|
|
|
|
mBinding.widget.action.setImageResource(R.drawable.ic_widget_play); |
|
|
|
|
hideInfo(); |
|
|
|
|
mBinding.widget.center.setVisibility(View.GONE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void showPreview(Drawable preview) { |
|
|
|
|
@ -1427,8 +1449,8 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
private void onPaused(boolean visible) { |
|
|
|
|
mBinding.widget.exoDuration.setText(mPlayers.getDurationTime()); |
|
|
|
|
mBinding.widget.exoPosition.setText(mPlayers.getPositionTime(0)); |
|
|
|
|
if (visible) showInfo(); |
|
|
|
|
else hideInfo(); |
|
|
|
|
if (visible) showInfoAndCenter(); |
|
|
|
|
else hideInfoAndCenter(); |
|
|
|
|
mPlayers.pause(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1501,6 +1523,14 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
this.toggleCount = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public int getGroupSize() { |
|
|
|
|
return groupSize; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setGroupSize(int size) { |
|
|
|
|
groupSize = size; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private View getFocus1() { |
|
|
|
|
return mFocus1 == null ? mBinding.video : mFocus1; |
|
|
|
|
} |
|
|
|
|
@ -1587,6 +1617,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
public void onKeyUp() { |
|
|
|
|
long current = mPlayers.getPosition(); |
|
|
|
|
long half = mPlayers.getDuration() / 2; |
|
|
|
|
showInfo(); |
|
|
|
|
showControl(current < half ? mBinding.control.opening : mBinding.control.ending); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1597,9 +1628,13 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onKeyCenter() { |
|
|
|
|
if (mPlayers.isPlaying()) onPaused(true); |
|
|
|
|
else onPlay(); |
|
|
|
|
hideControl(); |
|
|
|
|
if (mPlayers.isPlaying()) { |
|
|
|
|
onPaused(true); |
|
|
|
|
hideControl(false); |
|
|
|
|
} else { |
|
|
|
|
onPlay(); |
|
|
|
|
hideControl(true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|