android 6.0 悬浮窗,FloatWindowPermission

this repository is aimed to adapt android float window permission in most of phone models and how to request it at runtime

its result is as follows :

c5818541a184e7763ee11112b7b63c89.gif

if you want to see more,click here

from now on,the models below android M that have been adapted are :

xiaomi:v5,v6,v7,v8

huawei:partial

meizu:partial

360:partial

others:phones like samsung,sony or other model can directly show the float window, so there is no need to adapt,but if you find one that can not,contact me via my email(zhao_zepeng@hotmail.com) or leave a message on my blog i mentioned above,thanks

more details about the models that have been adapted(thanks ruanqin0706 for help):

attention

support api version below 23.

if api version >= 23, please use RxPermission and so on .

useage

ask for permission :(contains the checkPermission logic)

FloatWindowManager.getInstance().askPermission(this);checkPermission

public boolean checkPermission(Context context)

show a view as TYPE_TOAST:

if has permission ,show the view ,if not, call askPermission

public Dialog showAsTypeToast(View view)

the return type Dialog is just a wrapper of WindowManager ,with a convenient api . to dismiss it ,just call

if(dialog !=null && dialog.isShowing()){

dialog.dismiss();

}

if you want to response to the backpressed event of activity ,you can overide in activity like this:

@Override

public void onBackPressed() {

if(dialog !=null && dialog.isShowing()){

dialog.dismiss();

}else {

super.onBackPressed();

}

}

gradle

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

allprojects {

repositories {

...

maven { url "https://jitpack.io" }

}

}

Step 2. Add the dependency

dependencies {

compile 'com.github.hss01248:FloatWindowPermission:lastest release'

}

the read me of origin project:

6.0/6.0+**

most models are OK with this way of adaption except meizu:

d0651d154e5592f824aec255d6b2edc9.png

bf7c6ff7833d7b4858c3212e756fae59.png

conclusion:

1c02e17590274b88952e92893628f734.png

until now(2016-11-21), this problem has been solved, we have made a special treatment to the ROM above 6.0 inclue 6.0 in meizu mobiles.

huawei

here is the test result for huawei mobiles:

aaf357abecc3ebcb8f3e2db6b6c94303.png

conclusion:

5a6388dda9b95bd82d74c0856b8ac217.png

waiting for adapted...

xiaomi

most of xiaomi mobiles are adapted very well except some paticular models:

344c1fc8fcb57302fb7711ee9ba0ec2d.png

here is the conclusion:

b3c4b03bc61c55b9c4ea05d0ad7ca5cb.png

samsung

almost 100% of the samsung mobiles are adapted very well:

c5ea22852aa3d7be9422417bf35c7852.png

here is the conclusion of samsung:

55f4d079097e7de5ba14af1f7717281b.png

oppo&&vivo

only test a small part of the mobiles and here is the result:

d4ca329c2fa73bd84f7aaf5fad043bcf.png

conclusion:

7a4550896298b66183866da864d83af3.png

others

we random pick some other models like HTC and Sony and here is the result:

361dba73c69fe949657666647373b3c3.png

conclusion:

2de388e324d9d0019d95286f0c902711.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值