Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOMobile
Commits
4f5b65c2
Commit
4f5b65c2
authored
Dec 09, 2018
by
feihuaduo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
高版本悬浮窗适配
parent
cfaab8cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
...ava/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
+15
-0
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
View file @
4f5b65c2
...
...
@@ -253,6 +253,13 @@ public class ServiceDuelAssistant extends Service {
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
//关闭悬浮窗时的声明
stopForeground
(
true
);
}
private
void
joinRoom
(
String
ss
,
int
start
)
{
final
String
password
=
ss
.
substring
(
start
,
ss
.
length
());
ds_text
.
setText
(
getString
(
R
.
string
.
quick_join
)
+
password
+
"\""
);
...
...
@@ -368,6 +375,14 @@ public class ServiceDuelAssistant extends Service {
//实现悬浮窗到状态栏
wmParams
.
flags
=
WindowManager
.
LayoutParams
.
FLAG_NOT_FOCUSABLE
|
WindowManager
.
LayoutParams
.
FLAG_BLUR_BEHIND
;
//安卓7.0要求
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
){
wmParams
.
type
=
WindowManager
.
LayoutParams
.
TYPE_SYSTEM_ALERT
;
}
//安卓8.0要求
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
){
wmParams
.
type
=
WindowManager
.
LayoutParams
.
TYPE_APPLICATION_OVERLAY
;
}
//调整悬浮窗显示的停靠位置为左侧置顶
wmParams
.
gravity
=
Gravity
.
LEFT
|
Gravity
.
TOP
;
// 以屏幕左上角为原点,设置x、y初始值,相对于gravity
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment