Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_26386469
GSYVideoPlayer
提交
f7a41536
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
f7a41536
编写于
6月 13, 2018
作者:
S
Shuyu Guo
提交者:
GitHub
6月 13, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1192 from haohaozaici/master
修复8.0+悬浮窗权限
上级
dad91e8b
c071ef47
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
12 deletion
+14
-12
app/src/main/java/com/example/gsyvideoplayer/WindowActivity.java
.../main/java/com/example/gsyvideoplayer/WindowActivity.java
+2
-2
app/src/main/java/com/example/gsyvideoplayer/utils/floatUtil/FloatPhone.java
...om/example/gsyvideoplayer/utils/floatUtil/FloatPhone.java
+8
-1
app/src/main/java/com/example/gsyvideoplayer/utils/floatUtil/Util.java
...java/com/example/gsyvideoplayer/utils/floatUtil/Util.java
+4
-9
未找到文件。
app/src/main/java/com/example/gsyvideoplayer/WindowActivity.java
浏览文件 @
f7a41536
...
...
@@ -4,6 +4,7 @@ import android.content.Intent;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.provider.Settings
;
import
android.support.annotation.RequiresApi
;
import
android.support.v7.app.AppCompatActivity
;
import
android.view.View
;
...
...
@@ -56,8 +57,7 @@ public class WindowActivity extends AppCompatActivity {
@RequiresApi
(
api
=
23
)
private
void
requestAlertWindowPermission
()
{
Intent
intent
=
new
Intent
(
"android.settings.action.MANAGE_OVERLAY_PERMISSION"
);
intent
.
setData
(
Uri
.
parse
(
"package:"
+
getPackageName
()));
Intent
intent
=
new
Intent
(
Settings
.
ACTION_MANAGE_OVERLAY_PERMISSION
,
Uri
.
parse
(
"package:"
+
getPackageName
()));
startActivityForResult
(
intent
,
1
);
}
...
...
app/src/main/java/com/example/gsyvideoplayer/utils/floatUtil/FloatPhone.java
浏览文件 @
f7a41536
...
...
@@ -2,6 +2,7 @@ package com.example.gsyvideoplayer.utils.floatUtil;
import
android.content.Context
;
import
android.graphics.PixelFormat
;
import
android.os.Build
;
import
android.view.View
;
import
android.view.WindowManager
;
...
...
@@ -33,9 +34,15 @@ class FloatPhone extends FloatView {
@Override
public
void
setView
(
View
view
)
{
int
layout_type
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
layout_type
=
WindowManager
.
LayoutParams
.
TYPE_APPLICATION_OVERLAY
;
}
else
{
layout_type
=
WindowManager
.
LayoutParams
.
TYPE_PHONE
;
}
mLayoutParams
.
flags
=
WindowManager
.
LayoutParams
.
FLAG_NOT_TOUCH_MODAL
|
WindowManager
.
LayoutParams
.
FLAG_NOT_FOCUSABLE
;
mLayoutParams
.
type
=
WindowManager
.
LayoutParams
.
TYPE_PHONE
;
mLayoutParams
.
type
=
layout_type
;
mLayoutParams
.
windowAnimations
=
0
;
mView
=
view
;
}
...
...
app/src/main/java/com/example/gsyvideoplayer/utils/floatUtil/Util.java
浏览文件 @
f7a41536
...
...
@@ -2,7 +2,9 @@ package com.example.gsyvideoplayer.utils.floatUtil;
import
android.content.Context
;
import
android.graphics.Point
;
import
android.os.Build
;
import
android.provider.Settings
;
import
android.support.annotation.RequiresApi
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.WindowManager
;
...
...
@@ -22,16 +24,9 @@ public class Util {
return
inflate
.
inflate
(
layoutId
,
null
);
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
M
)
public
static
boolean
hasPermission
(
Context
context
)
{
Boolean
result
;
try
{
Class
clazz
=
Settings
.
class
;
Method
canDrawOverlays
=
clazz
.
getDeclaredMethod
(
"canDrawOverlays"
,
Context
.
class
);
result
=
(
Boolean
)
canDrawOverlays
.
invoke
(
null
,
context
);
}
catch
(
Exception
e
)
{
result
=
false
;
}
return
result
;
return
Settings
.
canDrawOverlays
(
context
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录