Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_26386469
GSYVideoPlayer
提交
6ce23650
G
GSYVideoPlayer
项目概览
qq_26386469
/
GSYVideoPlayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
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,发现更多精彩内容 >>
提交
6ce23650
编写于
12月 01, 2016
作者:
S
shuyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
init 隐藏虚拟按键
上级
c66d6715
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
87 addition
and
1 deletion
+87
-1
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYVideoPlayer.java
...rc/main/java/com/shuyu/gsyvideoplayer/GSYVideoPlayer.java
+8
-0
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/utils/CommonUtil.java
.../main/java/com/shuyu/gsyvideoplayer/utils/CommonUtil.java
+29
-0
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/utils/ListVideoUtil.java
...in/java/com/shuyu/gsyvideoplayer/utils/ListVideoUtil.java
+22
-0
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/GSYBaseVideoPlayer.java
...va/com/shuyu/gsyvideoplayer/video/GSYBaseVideoPlayer.java
+28
-1
未找到文件。
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYVideoPlayer.java
浏览文件 @
6ce23650
...
...
@@ -38,6 +38,7 @@ import java.util.TimerTask;
import
tv.danmaku.ijk.media.player.IMediaPlayer
;
import
static
com
.
shuyu
.
gsyvideoplayer
.
utils
.
CommonUtil
.
getTextSpeed
;
import
static
com
.
shuyu
.
gsyvideoplayer
.
utils
.
CommonUtil
.
hideNavKey
;
/**
...
...
@@ -287,6 +288,9 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
@Override
public
void
onClick
(
View
v
)
{
int
i
=
v
.
getId
();
if
(
mHideKey
&&
mIfCurrentIsFullscreen
)
{
hideNavKey
(
mContext
);
}
if
(
i
==
R
.
id
.
start
)
{
if
(
TextUtils
.
isEmpty
(
mUrl
))
{
Toast
.
makeText
(
getContext
(),
getResources
().
getString
(
R
.
string
.
no_url
),
Toast
.
LENGTH_SHORT
).
show
();
...
...
@@ -602,6 +606,10 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
}
}
startProgressTimer
();
//不要和隐藏虚拟按键后,滑出虚拟按键冲突
if
(
mHideKey
&&
mChangePosition
)
{
return
true
;
}
break
;
}
}
else
if
(
id
==
R
.
id
.
progress
)
{
...
...
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/utils/CommonUtil.java
浏览文件 @
6ce23650
...
...
@@ -5,12 +5,14 @@ import android.content.Context;
import
android.content.ContextWrapper
;
import
android.net.ConnectivityManager
;
import
android.net.NetworkInfo
;
import
android.os.Build
;
import
android.support.v4.app.FragmentActivity
;
import
android.support.v7.app.ActionBar
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.internal.view.ContextThemeWrapper
;
import
android.util.DisplayMetrics
;
import
android.util.TypedValue
;
import
android.view.View
;
import
android.view.WindowManager
;
import
java.io.File
;
...
...
@@ -143,6 +145,33 @@ public class CommonUtil {
}
}
public
static
void
hideNavKey
(
Context
context
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
// 设置屏幕始终在前面,不然点击鼠标,重新出现虚拟按键
((
Activity
)
context
).
getWindow
().
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
|
View
.
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_HIDE_NAVIGATION
// hide nav
// bar
|
View
.
SYSTEM_UI_FLAG_FULLSCREEN
// hide status bar
|
View
.
SYSTEM_UI_FLAG_IMMERSIVE
);
}
else
{
((
Activity
)
context
).
getWindow
().
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
|
View
.
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_HIDE_NAVIGATION
// hide nav
// bar
|
View
.
SYSTEM_UI_FLAG_FULLSCREEN
// hide status bar
);
}
}
public
static
void
showNavKey
(
Context
context
,
int
systemUiVisibility
)
{
((
Activity
)
context
).
getWindow
().
getDecorView
().
setSystemUiVisibility
(
systemUiVisibility
);
}
/**
* Get AppCompatActivity from context
...
...
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/utils/ListVideoUtil.java
浏览文件 @
6ce23650
...
...
@@ -22,6 +22,8 @@ import java.util.Map;
import
static
com
.
shuyu
.
gsyvideoplayer
.
utils
.
CommonUtil
.
getActionBarHeight
;
import
static
com
.
shuyu
.
gsyvideoplayer
.
utils
.
CommonUtil
.
getStatusBarHeight
;
import
static
com
.
shuyu
.
gsyvideoplayer
.
utils
.
CommonUtil
.
hideNavKey
;
import
static
com
.
shuyu
.
gsyvideoplayer
.
utils
.
CommonUtil
.
showNavKey
;
/**
* Created by shuyu on 2016/11/12.
...
...
@@ -48,11 +50,13 @@ public class ListVideoUtil {
private
int
playPosition
=
-
1
;
// 播放的位置
private
int
speed
=
1
;
// 播放速度,仅支持6.0
private
int
systemUiVisibility
;
private
boolean
isFull
;
//当前是否全屏
private
boolean
isSmall
;
//当前是否小屏
private
boolean
hideStatusBar
;
//是否隐藏有状态bar
private
boolean
hideActionBar
;
//是否隐藏有状态ActionBar
private
boolean
isLoop
;
//循环
private
boolean
hideKey
=
true
;
//隐藏按键
private
int
[]
listItemRect
;
//当前item框的屏幕位置
...
...
@@ -163,7 +167,11 @@ public class ListVideoUtil {
* 处理全屏逻辑
*/
private
void
resolveToFull
()
{
systemUiVisibility
=
((
Activity
)
context
).
getWindow
().
getDecorView
().
getSystemUiVisibility
();
CommonUtil
.
hideSupportActionBar
(
context
,
hideActionBar
,
hideStatusBar
);
if
(
hideKey
)
{
hideNavKey
(
context
);
}
isFull
=
true
;
ViewGroup
viewGroup
=
(
ViewGroup
)
gsyVideoPlayer
.
getParent
();
listParams
=
gsyVideoPlayer
.
getLayoutParams
();
...
...
@@ -269,6 +277,9 @@ public class ListVideoUtil {
Debuger
.
printfLog
(
"onQuitFullscreen"
);
videoAllCallBack
.
onQuitFullscreen
(
url
);
}
if
(
hideKey
)
{
showNavKey
(
context
,
systemUiVisibility
);
}
}
},
delay
);
}
...
...
@@ -582,4 +593,15 @@ public class ListVideoUtil {
return
gsyVideoPlayer
;
}
public
boolean
isHideKey
()
{
return
hideKey
;
}
/**
* 隐藏虚拟按键
*/
public
void
setHideKey
(
boolean
hideKey
)
{
this
.
hideKey
=
hideKey
;
}
}
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/GSYBaseVideoPlayer.java
浏览文件 @
6ce23650
...
...
@@ -32,7 +32,9 @@ import java.util.Map;
import
static
com
.
shuyu
.
gsyvideoplayer
.
utils
.
CommonUtil
.
getActionBarHeight
;
import
static
com
.
shuyu
.
gsyvideoplayer
.
utils
.
CommonUtil
.
getStatusBarHeight
;
import
static
com
.
shuyu
.
gsyvideoplayer
.
utils
.
CommonUtil
.
hideNavKey
;
import
static
com
.
shuyu
.
gsyvideoplayer
.
utils
.
CommonUtil
.
hideSupportActionBar
;
import
static
com
.
shuyu
.
gsyvideoplayer
.
utils
.
CommonUtil
.
showNavKey
;
import
static
com
.
shuyu
.
gsyvideoplayer
.
utils
.
CommonUtil
.
showSupportActionBar
;
/**
...
...
@@ -51,6 +53,8 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
protected
boolean
mStatusBar
=
false
;
//是否需要在利用window实现全屏幕的时候隐藏statusbar
protected
boolean
mHideKey
=
true
;
//是否隐藏虚拟按键
protected
boolean
mCache
=
false
;
//是否播边边缓冲
private
boolean
mShowFullAnimation
=
true
;
//是否使用全屏动画效果
...
...
@@ -95,6 +99,8 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
private
Handler
mHandler
=
new
Handler
();
private
int
mSystemUiVisibility
;
public
GSYBaseVideoPlayer
(
Context
context
)
{
super
(
context
);
...
...
@@ -198,6 +204,9 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
mVideoAllCallBack
.
onQuitFullscreen
(
mUrl
,
mObjects
);
}
mIfCurrentIsFullscreen
=
false
;
if
(
mHideKey
)
{
showNavKey
(
mContext
,
mSystemUiVisibility
);
}
}
/**
...
...
@@ -209,8 +218,14 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
*/
public
GSYBaseVideoPlayer
startWindowFullscreen
(
final
Context
context
,
final
boolean
actionBar
,
final
boolean
statusBar
)
{
mSystemUiVisibility
=
((
Activity
)
context
).
getWindow
().
getDecorView
().
getSystemUiVisibility
();
hideSupportActionBar
(
context
,
actionBar
,
statusBar
);
if
(
mHideKey
)
{
hideNavKey
(
context
);
}
this
.
mActionBar
=
actionBar
;
this
.
mStatusBar
=
statusBar
;
...
...
@@ -313,6 +328,7 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
*/
private
void
backToNormal
()
{
showSupportActionBar
(
mContext
,
mActionBar
,
mStatusBar
);
final
ViewGroup
vp
=
getViewGroup
();
final
View
oldF
=
vp
.
findViewById
(
FULLSCREEN_ID
);
...
...
@@ -439,7 +455,7 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
* @param objects
* @return
*/
public
abstract
boolean
setUp
(
String
url
,
boolean
cacheWithPlay
,
File
cachePath
,
Object
...
objects
);
public
abstract
boolean
setUp
(
String
url
,
boolean
cacheWithPlay
,
File
cachePath
,
Object
...
objects
);
/**
* 设置播放URL
...
...
@@ -562,4 +578,15 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
public
void
setSpeed
(
float
speed
)
{
this
.
mSpeed
=
speed
;
}
public
boolean
isHideKey
()
{
return
mHideKey
;
}
/**
* 隐藏虚拟按键
*/
public
void
setHideKey
(
boolean
hideKey
)
{
this
.
mHideKey
=
hideKey
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录