Parcourir la source

添加 视频详情页面全屏的封面

zengjiebin il y a 7 ans
Parent
commit
0248ebecef

+ 6 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/ActVideoDetail.java

@@ -61,6 +61,8 @@ public class ActVideoDetail extends BaseUMActivity implements MediaPlayer.OnInfo
     //播放
     @BindView(R.id.videoView)
     VideoView videoView;
+    @BindView(R.id.videoCoverIv)
+    ImageView videoCoverIv;
     @BindView(R.id.video_loading)
     View video_loading;
 
@@ -130,6 +132,8 @@ public class ActVideoDetail extends BaseUMActivity implements MediaPlayer.OnInfo
             ViewUtil.setVisibility2(video_focus_iv, false);
             return;
         }
+        ViewUtil.setVisibility(videoCoverIv, true);
+        ViewUtil.setImage(videoCoverIv, discoveryVideo.getCover());
         ViewUtil.setAvatar(video_avatar_iv, discoveryVideo.getAvatar());
         ViewUtil.setText(video_like_tv, discoveryVideo.getLike());
         ViewUtil.setText(video_title_tv, discoveryVideo.getTitle());
@@ -535,6 +539,7 @@ public class ActVideoDetail extends BaseUMActivity implements MediaPlayer.OnInfo
                 LogUtil.println("ActPlayVideo", "onInfo", "缓冲完成");
                 //缓存完成,继续播放
                 ViewUtil.setVisibility(video_loading, false);
+                ViewUtil.setVisibility(videoCoverIv, false);
                 break;
         }
         return false;
@@ -544,6 +549,7 @@ public class ActVideoDetail extends BaseUMActivity implements MediaPlayer.OnInfo
     public void onPrepared(MediaPlayer mediaPlayer) {
         LogUtil.println("ActPlayVideo", "onPrepared");
         mediaPlayer.start();
+        ViewUtil.setVisibility(videoCoverIv, false);
         ViewUtil.setVisibility(video_loading, false);
     }
 

+ 8 - 0
app/src/main/res/layout/act_video_detail.xml

@@ -11,6 +11,14 @@
         android:layout_height="wrap_content"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
+    <ImageView
+        android:id="@+id/videoCoverIv"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:adjustViewBounds="true"
+        android:scaleType="fitXY"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
     <com.github.ybq.android.spinkit.SpinKitView
         android:id="@+id/video_loading"
         style="@style/SpinKitView.Large.ThreeBounce"