提交 25c14ff8 编写于 作者: S shuyu

增加了不同类似布局的实现方法

上级 4ed74bdf
......@@ -10,6 +10,7 @@ import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.example.gsyvideoplayer.listener.SampleListener;
import com.example.gsyvideoplayer.video.LandLayoutVideo;
import com.shuyu.gsyvideoplayer.GSYPreViewManager;
import com.shuyu.gsyvideoplayer.GSYVideoPlayer;
......@@ -31,7 +32,7 @@ public class DetailPlayer extends AppCompatActivity {
//推荐使用StandardGSYVideoPlayer,功能一致
//CustomGSYVideoPlayer部分功能处于试验阶段
@BindView(R.id.detail_player)
CustomGSYVideoPlayer detailPlayer;
LandLayoutVideo detailPlayer;
@BindView(R.id.activity_detail_player)
RelativeLayout activityDetailPlayer;
......
package com.example.gsyvideoplayer.video;
import android.content.Context;
import android.util.AttributeSet;
import com.example.gsyvideoplayer.R;
/**
* Created by shuyu on 2016/12/23.
*/
public class LandLayoutVideo extends SampleVideo {
/**
* 1.5开始加入,必须重载
*/
public LandLayoutVideo(Context context, Boolean fullFlag) {
super(context, fullFlag);
}
public LandLayoutVideo(Context context) {
super(context);
}
public LandLayoutVideo(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public int getLayoutId() {
if (mIfCurrentIsFullscreen) {
return R.layout.sample_video_land;
}
return R.layout.sample_video;
}
}
......@@ -46,6 +46,13 @@ public class SampleVideo extends StandardGSYVideoPlayer {
//数据源
private int mSourcePosition = 0;
/**
* 1.5开始加入,必须重载
*/
public SampleVideo(Context context, Boolean fullFlag) {
super(context, fullFlag);
}
public SampleVideo(Context context) {
super(context);
}
......
......@@ -29,7 +29,7 @@
</android.support.v4.widget.NestedScrollView>
<com.shuyu.gsyvideoplayer.video.CustomGSYVideoPlayer
<com.example.gsyvideoplayer.video.LandLayoutVideo
android:id="@+id/detail_player"
android:layout_width="match_parent"
android:layout_height="@dimen/post_media_height" />
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black">
<RelativeLayout
android:id="@+id/surface_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
</RelativeLayout>
<com.shuyu.gsyvideoplayer.GSYImageCover
android:id="@+id/cover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:scaleType="fitXY" />
<RelativeLayout
android:id="@+id/thumb"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="#000000"
android:scaleType="fitCenter" />
<LinearLayout
android:id="@+id/layout_bottom"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:background="#99000000"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="invisible">
<moe.codeest.enviews.ENPlayView
android:id="@+id/start"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp" />
<TextView
android:id="@+id/current"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:text="00:00"
android:textColor="#ffffff" />
<SeekBar
android:id="@+id/progress"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1.0"
android:background="@null"
android:max="100"
android:maxHeight="4dp"
android:minHeight="4dp"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:progressDrawable="@drawable/video_seek_progress"
android:thumb="@drawable/video_seek_thumb" />
<TextView
android:id="@+id/total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:text="00:00"
android:textColor="#ffffff" />
<TextView
android:id="@+id/switchSize"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="16dp"
android:gravity="center"
android:minEms="2"
android:text="标准"
android:textColor="#ffffff" />
<ImageView
android:id="@+id/fullscreen"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:paddingRight="16dp"
android:scaleType="center"
android:src="@drawable/video_enlarge" />
</LinearLayout>
<ProgressBar
android:id="@+id/bottom_progressbar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="1.5dp"
android:layout_alignParentBottom="true"
android:max="100"
android:progressDrawable="@drawable/video_progress" />
<ImageView
android:id="@+id/back_tiny"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="6dp"
android:layout_marginTop="6dp"
android:visibility="gone" />
<moe.codeest.enviews.ENDownloadView
android:id="@+id/loading"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="invisible" />
<ImageView
android:id="@+id/small_close"
android:layout_width="30dp"
android:layout_height="30dp"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:scaleType="centerInside"
android:src="@drawable/video_small_close"
android:visibility="gone" />
<ImageView
android:id="@+id/lock_screen"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="50dp"
android:scaleType="centerInside"
android:src="@drawable/unlock"
android:visibility="gone" />
<LinearLayout
android:id="@+id/layout_top"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/back_tiny"
android:layout_toRightOf="@+id/back_tiny"
android:background="@drawable/video_title_bg"
android:gravity="center_vertical">
<ImageView
android:id="@+id/back"
android:layout_width="48dp"
android:layout_height="48dp"
android:paddingLeft="10dp"
android:scaleType="centerInside"
android:src="@drawable/video_back" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="10dp"
android:textColor="@android:color/white"
android:textSize="18sp" />
<TextView
android:id="@+id/moreScale"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:minEms="5"
android:paddingLeft="10dp"
android:text="默认比例"
android:textColor="@android:color/white"
android:textSize="13sp" />
</LinearLayout>
</RelativeLayout>
......@@ -132,6 +132,14 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
*/
public abstract void startPlayLogic();
/**
* 1.5开始加入,必须重载
*/
public GSYVideoPlayer(Context context, Boolean fullFlag) {
super(context, fullFlag);
init(context);
}
public GSYVideoPlayer(Context context) {
super(context);
init(context);
......
......@@ -32,6 +32,13 @@ public class CustomGSYVideoPlayer extends StandardGSYVideoPlayer {
private int mPreProgress = -2;
/**
* 1.5开始加入,必须重载
*/
public CustomGSYVideoPlayer(Context context, Boolean fullFlag) {
super(context, fullFlag);
}
public CustomGSYVideoPlayer(Context context) {
super(context);
}
......
......@@ -128,6 +128,13 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
private Handler mHandler = new Handler();
/**
* 1.5开始加入,必须重载
*/
public GSYBaseVideoPlayer(Context context, Boolean fullFlag) {
super(context);
mIfCurrentIsFullscreen = fullFlag;
}
public GSYBaseVideoPlayer(Context context) {
super(context);
......@@ -287,8 +294,8 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
saveLocationStatus(context, statusBar, actionBar);
try {
Constructor<GSYBaseVideoPlayer> constructor = (Constructor<GSYBaseVideoPlayer>) GSYBaseVideoPlayer.this.getClass().getConstructor(Context.class);
final GSYBaseVideoPlayer gsyVideoPlayer = constructor.newInstance(getContext());
Constructor<GSYBaseVideoPlayer> constructor = (Constructor<GSYBaseVideoPlayer>) GSYBaseVideoPlayer.this.getClass().getConstructor(Context.class, Boolean.class);
final GSYBaseVideoPlayer gsyVideoPlayer = constructor.newInstance(getContext(), true);
gsyVideoPlayer.setId(FULLSCREEN_ID);
gsyVideoPlayer.setIfCurrentIsFullscreen(true);
gsyVideoPlayer.setVideoAllCallBack(mVideoAllCallBack);
......
......@@ -19,6 +19,13 @@ public class ListGSYVideoPlayer extends StandardGSYVideoPlayer {
protected List<GSYVideoModel> mUriList = new ArrayList<>();
protected int mPlayPosition;
/**
* 1.5开始加入,必须重载
*/
public ListGSYVideoPlayer(Context context, Boolean fullFlag) {
super(context, fullFlag);
}
public ListGSYVideoPlayer(Context context) {
super(context);
}
......
......@@ -102,6 +102,13 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
setVideoAllCallBack(standardVideoAllCallBack);
}
/**
* 1.5开始加入,必须重载
*/
public StandardGSYVideoPlayer(Context context, Boolean fullFlag) {
super(context, fullFlag);
}
public StandardGSYVideoPlayer(Context context) {
super(context);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册