From ddd05ee5ab6ee85cfd43246730f6b6e7612f1440 Mon Sep 17 00:00:00 2001 From: yhaowa Date: Mon, 25 Dec 2017 15:32:38 +0800 Subject: [PATCH] update to v1.0.7 --- README.md | 11 ++++++++--- .../main/java/com/yhao/floatwindow/FloatPhone.java | 7 ++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 79ac3cb..f23ae73 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ ``` dependencies { - compile 'com.github.yhaolpz:FloatWindow:1.0.6' + compile 'com.github.yhaolpz:FloatWindow:1.0.7' } ``` @@ -85,7 +85,7 @@ setView 方法可设置 View 子类或 xml 布局。 .with(getApplicationContext()) .setView(view) .setX(100) //100px - .setY(Screen.width,0.2f) //屏幕宽度的 20% + .setY(Screen.height,0.3f) //屏幕高度的 30% .build(); ``` @@ -152,7 +152,7 @@ MoveType.free : 不可拖动,但可改变位置 ``` -自定义贴边或回到原位置过程的动画效果,只在 MoveType.slide 或 MoveType.back 模式下设置此项才有意义。默认减速插值器,默认动画时长为 300ms。 +自定义动画效果,只在 MoveType.slide 或 MoveType.back 模式下设置此项才有意义。默认减速插值器,默认动画时长为 300ms。 **7.后续操作** @@ -227,6 +227,11 @@ MoveType.free : 不可拖动,但可改变位置 **更新日志** -- +**v1.0.7** + +1.适配 Android 8.0 + + **v1.0.6** 1.支持悬浮窗拖动及相关动效 diff --git a/floatwindow/src/main/java/com/yhao/floatwindow/FloatPhone.java b/floatwindow/src/main/java/com/yhao/floatwindow/FloatPhone.java index 53cde07..4c50269 100644 --- a/floatwindow/src/main/java/com/yhao/floatwindow/FloatPhone.java +++ b/floatwindow/src/main/java/com/yhao/floatwindow/FloatPhone.java @@ -2,6 +2,7 @@ import android.content.Context; import android.graphics.PixelFormat; +import android.os.Build; import android.view.View; import android.view.WindowManager; @@ -35,7 +36,11 @@ public void setSize(int width, int height) { public void setView(View view) { mLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; - mLayoutParams.type = WindowManager.LayoutParams.TYPE_PHONE; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + mLayoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; + }else{ + mLayoutParams.type = WindowManager.LayoutParams.TYPE_PHONE; + } mLayoutParams.windowAnimations = 0; mView = view; }