Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ac13
GSYVideoPlayer
提交
626300f1
G
GSYVideoPlayer
项目概览
ac13
/
GSYVideoPlayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
GSYVideoPlayer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
626300f1
编写于
1月 16, 2018
作者:
G
guoshuyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化SmallVideoHelper支持
上级
05548deb
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
73 addition
and
24 deletion
+73
-24
README.md
README.md
+1
-1
app/src/main/java/com/example/gsyvideoplayer/ListVideo2Activity.java
...n/java/com/example/gsyvideoplayer/ListVideo2Activity.java
+3
-1
app/src/main/java/com/example/gsyvideoplayer/adapter/ListVideoAdapter.java
.../com/example/gsyvideoplayer/adapter/ListVideoAdapter.java
+2
-1
app/src/main/java/com/example/gsyvideoplayer/utils/SmallVideoHelper.java
...va/com/example/gsyvideoplayer/utils/SmallVideoHelper.java
+65
-19
app/src/main/res/layout/activity_main.xml
app/src/main/res/layout/activity_main.xml
+2
-2
未找到文件。
README.md
浏览文件 @
626300f1
...
...
@@ -144,7 +144,7 @@ compile 'com.shuyu:gsyVideoPlayer-ex_so:3.0.0'
5、DEMO增加S
amllVideoHelper实现小窗口
逻辑,更新demo
5、DEMO增加S
mallVideoHelper实现小窗口,全屏
逻辑,更新demo
...
...
app/src/main/java/com/example/gsyvideoplayer/ListVideo2Activity.java
浏览文件 @
626300f1
...
...
@@ -59,7 +59,9 @@ public class ListVideo2Activity extends AppCompatActivity {
//创建小窗口帮助类
smallVideoHelper
=
new
SmallVideoHelper
(
this
);
smallVideoHelper
.
setFullViewContainer
(
videoFullContainer
);
//如果不设置即使用默认的 windowViewContainer
//smallVideoHelper.setFullViewContainer(videoFullContainer);
//配置
gsySmallVideoHelperBuilder
=
new
SmallVideoHelper
.
GSYSmallVideoHelperBuilder
();
...
...
app/src/main/java/com/example/gsyvideoplayer/adapter/ListVideoAdapter.java
浏览文件 @
626300f1
...
...
@@ -94,7 +94,8 @@ public class ListVideoAdapter extends BaseAdapter {
notifyDataSetChanged
();
//listVideoUtil.setLoop(true);
smallVideoHelper
.
setPlayPositionAndTag
(
position
,
TAG
);
final
String
url
=
"https://res.exexm.com/cw_145225549855002"
;
//final String url = "https://res.exexm.com/cw_145225549855002";
final
String
url
=
"http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4"
;
gsySmallVideoHelperBuilder
.
setVideoTitle
(
"title "
+
position
)
.
setUrl
(
url
);
smallVideoHelper
.
startPlay
();
...
...
app/src/main/java/com/example/gsyvideoplayer/utils/SmallVideoHelper.java
浏览文件 @
626300f1
...
...
@@ -9,6 +9,7 @@ import android.os.Handler;
import
android.view.Gravity
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.Window
;
import
android.widget.FrameLayout
;
import
com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
;
...
...
@@ -51,6 +52,10 @@ public class SmallVideoHelper {
* 全屏承载布局
*/
private
ViewGroup
fullViewContainer
;
/**
* 全屏承载布局
*/
private
ViewGroup
windowViewContainer
;
/**
* 记录列表中item的父布局
*/
...
...
@@ -102,13 +107,14 @@ public class SmallVideoHelper {
public
SmallVideoHelper
(
Context
context
)
{
gsyVideoPlayer
=
new
StandardGSYVideoPlayer
(
context
);
this
.
context
=
context
;
this
(
context
,
new
StandardGSYVideoPlayer
(
context
));
}
public
SmallVideoHelper
(
Context
context
,
StandardGSYVideoPlayer
player
)
{
gsyVideoPlayer
=
player
;
this
.
context
=
context
;
this
.
windowViewContainer
=
(
ViewGroup
)
(
CommonUtil
.
scanForActivity
(
context
)).
findViewById
(
Window
.
ID_ANDROID_CONTENT
);
}
/**
...
...
@@ -156,11 +162,17 @@ public class SmallVideoHelper {
* 添加到全屏父布局里
*/
private
void
resolveFullAdd
()
{
if
(
gsyVideoOptionBuilder
.
isShowFullAnimation
())
{
if
(
gsyVideoOptionBuilder
.
isShowFullAnimation
())
{
if
(
fullViewContainer
!=
null
)
{
fullViewContainer
.
setBackgroundColor
(
Color
.
BLACK
);
}
}
resolveChangeFirstLogic
(
0
);
if
(
fullViewContainer
!=
null
)
{
fullViewContainer
.
addView
(
gsyVideoPlayer
);
}
else
{
windowViewContainer
.
addView
(
gsyVideoPlayer
);
}
}
/**
...
...
@@ -176,12 +188,20 @@ public class SmallVideoHelper {
FrameLayout
.
LayoutParams
lp
=
new
FrameLayout
.
LayoutParams
(
listItemSize
[
0
],
listItemSize
[
1
]);
lp
.
setMargins
(
listItemRect
[
0
],
listItemRect
[
1
],
0
,
0
);
frameLayout
.
addView
(
gsyVideoPlayer
,
lp
);
if
(
fullViewContainer
!=
null
)
{
fullViewContainer
.
addView
(
frameLayout
,
lpParent
);
}
else
{
windowViewContainer
.
addView
(
frameLayout
,
lpParent
);
}
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
//开始动画
if
(
fullViewContainer
!=
null
)
{
TransitionManager
.
beginDelayedTransition
(
fullViewContainer
);
}
else
{
TransitionManager
.
beginDelayedTransition
(
windowViewContainer
);
}
resolveMaterialFullVideoShow
(
gsyVideoPlayer
);
resolveChangeFirstLogic
(
600
);
}
...
...
@@ -207,20 +227,25 @@ public class SmallVideoHelper {
*/
private
void
resolveToNormal
()
{
int
delay
=
orientationUtils
.
backToProtVideo
();
if
(!
gsyVideoOptionBuilder
.
isShowFullAnimation
())
{
if
(!
gsyVideoOptionBuilder
.
isShowFullAnimation
())
{
delay
=
0
;
}
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
isFull
=
false
;
removeWindowContainer
();
if
(
fullViewContainer
!=
null
)
{
fullViewContainer
.
removeAllViews
();
}
if
(
gsyVideoPlayer
.
getParent
()
!=
null
)
{
((
ViewGroup
)
gsyVideoPlayer
.
getParent
()).
removeView
(
gsyVideoPlayer
);
}
orientationUtils
.
setEnable
(
false
);
gsyVideoPlayer
.
setIfCurrentIsFullscreen
(
false
);
if
(
fullViewContainer
!=
null
)
{
fullViewContainer
.
setBackgroundColor
(
Color
.
TRANSPARENT
);
}
listParent
.
addView
(
gsyVideoPlayer
,
listParams
);
gsyVideoPlayer
.
getFullscreenButton
().
setImageResource
(
gsyVideoPlayer
.
getEnlargeImageRes
());
gsyVideoPlayer
.
getBackButton
().
setVisibility
(
View
.
GONE
);
...
...
@@ -274,15 +299,26 @@ public class SmallVideoHelper {
*/
private
void
resolveChangeFirstLogic
(
int
time
)
{
if
(
gsyVideoOptionBuilder
.
isLockLand
())
{
if
(
time
>
0
)
{
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
orientationUtils
.
getIsLand
()
!=
1
)
{
if
(
fullViewContainer
!=
null
)
{
fullViewContainer
.
setBackgroundColor
(
Color
.
BLACK
);
}
orientationUtils
.
resolveByClick
();
}
}
},
time
);
}
else
{
if
(
orientationUtils
.
getIsLand
()
!=
1
)
{
if
(
fullViewContainer
!=
null
)
{
fullViewContainer
.
setBackgroundColor
(
Color
.
BLACK
);
}
orientationUtils
.
resolveByClick
();
}
}
}
gsyVideoPlayer
.
setIfCurrentIsFullscreen
(
true
);
if
(
gsyVideoOptionBuilder
.
getVideoAllCallBack
()
!=
null
)
{
...
...
@@ -320,6 +356,14 @@ public class SmallVideoHelper {
return
isPlayView
(
position
,
tag
);
}
private
boolean
removeWindowContainer
()
{
if
(
windowViewContainer
!=
null
&&
windowViewContainer
.
indexOfChild
(
gsyVideoPlayer
)
!=
-
1
)
{
windowViewContainer
.
removeView
(
gsyVideoPlayer
);
return
true
;
}
return
false
;
}
/**
* 动态添加视频播放
*
...
...
@@ -402,9 +446,6 @@ public class SmallVideoHelper {
* 全屏按键逻辑
*/
public
void
doFullBtnLogic
()
{
if
(
fullViewContainer
==
null
)
{
return
;
}
if
(!
isFull
)
{
resolveToFull
();
}
else
{
...
...
@@ -421,6 +462,9 @@ public class SmallVideoHelper {
if
(
fullViewContainer
!=
null
&&
fullViewContainer
.
getChildCount
()
>
0
)
{
isFull
=
true
;
resolveMaterialToNormal
(
gsyVideoPlayer
);
}
else
if
(
windowViewContainer
!=
null
&&
windowViewContainer
.
indexOfChild
(
gsyVideoPlayer
)
!=
-
1
)
{
isFull
=
true
;
resolveMaterialToNormal
(
gsyVideoPlayer
);
}
return
isFull
;
}
...
...
@@ -429,6 +473,7 @@ public class SmallVideoHelper {
* 释放持有的视频
*/
public
void
releaseVideoPlayer
()
{
removeWindowContainer
();
ViewGroup
viewGroup
=
(
ViewGroup
)
gsyVideoPlayer
.
getParent
();
if
(
viewGroup
!=
null
)
viewGroup
.
removeAllViews
();
...
...
@@ -465,6 +510,7 @@ public class SmallVideoHelper {
/**
* 设置全屏显示的viewGroup
* 如果不设置即使用默认的 windowViewContainer
*
* @param fullViewContainer viewGroup
*/
...
...
app/src/main/res/layout/activity_main.xml
浏览文件 @
626300f1
...
...
@@ -61,7 +61,7 @@
android:layout_width=
"240dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:text=
"List小窗口列表"
/>
android:text=
"List
全屏和
小窗口列表"
/>
<Button
android:id=
"@+id/recycler"
...
...
@@ -83,7 +83,7 @@
android:layout_width=
"240dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:text=
"recycler小窗口列表"
/>
android:text=
"recycler
全屏和
小窗口列表"
/>
<Button
android:id=
"@+id/list_detail"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录