pull/21/head
FongMi 4 years ago
parent 8a13f241e4
commit 68e5b1b550
  1. 15
      app/src/main/java/com/fongmi/bear/ui/activity/DetailActivity.java
  2. 34
      app/src/main/res/layout/activity_detail.xml

@ -2,6 +2,7 @@ package com.fongmi.bear.ui.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Handler;
import android.text.Html;
import android.view.KeyEvent;
import android.view.View;
@ -89,7 +90,7 @@ public class DetailActivity extends BaseActivity implements KeyDownImpl {
@Override
protected void initView() {
mKeyDown = KeyDown.create(this);
mFrameParams = mBinding.frame.getLayoutParams();
mFrameParams = mBinding.video.getLayoutParams();
mBinding.progressLayout.showProgress();
setRecyclerView();
setVideoView();
@ -117,7 +118,7 @@ public class DetailActivity extends BaseActivity implements KeyDownImpl {
if (mEpisodeAdapter.size() > 20) mBinding.episode.setSelectedPosition(position * 20);
}
});
mBinding.frame.setOnClickListener(view -> enterFullscreen());
mBinding.video.setOnClickListener(view -> enterFullscreen());
mEpisodePresenter.setOnClickListener(this::getPlayer);
}
@ -217,16 +218,16 @@ public class DetailActivity extends BaseActivity implements KeyDownImpl {
}
private void enterFullscreen() {
mBinding.frame.setForeground(null);
mBinding.frame.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT));
mBinding.video.setForeground(null);
mBinding.video.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT));
new Handler().postDelayed(() -> mBinding.video.setUseController(true),250);
mBinding.flag.setSelectedPosition(mCurrent);
mBinding.video.setUseController(true);
mFullscreen = true;
}
private void exitFullscreen() {
mBinding.frame.setForeground(ResUtil.getDrawable(R.drawable.selector_video));
mBinding.frame.setLayoutParams(mFrameParams);
mBinding.video.setForeground(ResUtil.getDrawable(R.drawable.selector_video));
mBinding.video.setLayoutParams(mFrameParams);
mBinding.video.setUseController(false);
mFullscreen = false;
}

@ -7,8 +7,8 @@
android:layout_height="match_parent"
android:keepScreenOn="true">
<FrameLayout
android:id="@+id/frame"
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/video"
android:layout_width="360dp"
android:layout_height="200dp"
android:layout_marginStart="24dp"
@ -16,19 +16,13 @@
android:background="@color/black"
android:focusable="true"
android:focusableInTouchMode="true"
android:foreground="@drawable/selector_video">
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/video"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
app:animation_enabled="false"
app:auto_show="false"
app:controller_layout_id="@layout/view_controller_bottom"
app:resize_mode="fit"
app:surface_type="surface_view"
app:use_controller="false" />
android:foreground="@drawable/selector_video"
app:animation_enabled="false"
app:auto_show="false"
app:controller_layout_id="@layout/view_controller_bottom"
app:resize_mode="fit"
app:surface_type="surface_view"
app:use_controller="false">
<include
android:id="@+id/progress"
@ -43,7 +37,7 @@
android:layout_gravity="center"
android:visibility="gone" />
</FrameLayout>
</com.google.android.exoplayer2.ui.StyledPlayerView>
<TextView
android:id="@+id/name"
@ -52,7 +46,7 @@
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:layout_toEndOf="@+id/frame"
android:layout_toEndOf="@+id/video"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="24sp"
@ -66,7 +60,6 @@
android:layout_below="@+id/name"
android:layout_alignStart="@+id/name"
android:layout_marginEnd="24dp"
android:layout_toEndOf="@+id/frame"
android:orientation="horizontal">
<TextView
@ -122,7 +115,6 @@
android:layout_alignStart="@+id/name"
android:layout_marginTop="8dp"
android:layout_marginEnd="24dp"
android:layout_toEndOf="@+id/frame"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="16sp"
@ -136,7 +128,6 @@
android:layout_alignStart="@+id/name"
android:layout_marginTop="8dp"
android:layout_marginEnd="24dp"
android:layout_toEndOf="@+id/frame"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="16sp"
@ -150,7 +141,6 @@
android:layout_alignStart="@+id/name"
android:layout_marginTop="8dp"
android:layout_marginEnd="24dp"
android:layout_toEndOf="@+id/frame"
android:ellipsize="end"
android:lineSpacingExtra="4dp"
android:maxLines="3"
@ -162,7 +152,7 @@
android:id="@+id/flag"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/frame"
android:layout_below="@+id/video"
android:layout_marginTop="12dp"
android:clipChildren="false"
android:clipToPadding="false"

Loading…
Cancel
Save