okjack
okjack 2 years ago
parent 35f8903c4c
commit 950783bb2e
  1. 20
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/VideoActivity.java
  2. 13
      app/src/leanback/res/layout/activity_video.xml

@ -154,6 +154,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
private Clock mClock;
private View mFocus1;
private View mFocus2;
private boolean hasKeyEvent;
public static void push(FragmentActivity activity, String text) {
if (FileChooser.isValid(activity, Uri.parse(text))) file(activity, FileChooser.getPathFromUri(activity, Uri.parse(text)));
@ -366,7 +367,10 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
mBinding.flag.addOnChildViewHolderSelectedListener(new OnChildViewHolderSelectedListener() {
@Override
public void onChildViewHolderSelected(@NonNull RecyclerView parent, @Nullable RecyclerView.ViewHolder child, int position, int subposition) {
if (mFlagAdapter.size() > 0) setFlagActivated((Flag) mFlagAdapter.get(position));
if (mFlagAdapter.size() > 0) {
setFlagActivated((Flag) mFlagAdapter.get(position));
hasKeyEvent = false;
}
}
});
getEpisodeView().addOnChildViewHolderSelectedListener(new OnChildViewHolderSelectedListener() {
@ -378,7 +382,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() > getGroupSize() && position > 1) setEpisodeSelectedPosition((position - 2) * getGroupSize());
if (mEpisodeAdapter.size() > getGroupSize() && position > 1 && hasKeyEvent) setEpisodeSelectedPosition((position - 2) * getGroupSize());
}
});
}
@ -623,7 +627,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
if (isVisible(mBinding.episodeVert)) setEpisodeView(items);
mEpisodeAdapter.setItems(items, null);
setArrayAdapter(items.size());
setR2Callback();
setR2Callback(50);
}
private void setEpisodeView(List<Episode> items) {
@ -682,7 +686,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
private void setQualityVisible(boolean visible) {
mBinding.quality.setVisibility(visible ? View.VISIBLE : View.GONE);
setR2Callback();
setR2Callback(100);
}
private void setQualityActivated(Result result) {
@ -744,6 +748,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
notifyItemChanged(getEpisodeView(), mEpisodeAdapter);
notifyItemChanged(mBinding.quality, mQualityAdapter);
notifyItemChanged(mBinding.part, mPartAdapter);
notifyItemChanged(mBinding.array, mArrayAdapter);
notifyItemChanged(mBinding.flag, mFlagAdapter);
}
@ -1114,8 +1119,8 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
App.post(mR1, Constant.INTERVAL_HIDE);
}
private void setR2Callback() {
App.post(mR2, 500);
private void setR2Callback(long delayMillis) {
App.post(mR2, delayMillis);
}
private void setArtwork(String url) {
@ -1163,7 +1168,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
private void setPartAdapter(List<String> items) {
mBinding.part.setVisibility(View.VISIBLE);
mPartAdapter.setItems(items, null);
setR2Callback();
setR2Callback(1000);
}
private void checkFlag(Vod item) {
@ -1573,6 +1578,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
hasKeyEvent = true;
if (isFullscreen() && KeyUtil.isMenuKey(event) && Setting.getFullscreenMenuKey() == 0) onToggle();
if (isFullscreen() && KeyUtil.isMenuKey(event) && Setting.getFullscreenMenuKey() == 1) onEpisodes();
if (isVisible(mBinding.control.getRoot())) setR1Callback();

@ -264,6 +264,7 @@
android:clipChildren="false"
android:clipToPadding="false"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:visibility="gone" />
@ -286,7 +287,7 @@
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:visibility="gone" />
@ -297,7 +298,7 @@
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:focusable="false"
@ -311,7 +312,7 @@
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:visibility="gone" />
@ -322,7 +323,7 @@
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:focusable="false"
@ -336,7 +337,7 @@
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:visibility="gone" />
@ -345,7 +346,7 @@
android:id="@+id/quick"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:clipChildren="false"
android:clipToPadding="false"
android:paddingStart="24dp"

Loading…
Cancel
Save