Commit 5f4d527a authored by Karthikeyan Ganesan's avatar Karthikeyan Ganesan Committed by zooble

Defect fix (#306)

* add SYSTEM_ALERT_WINDOW permission to draw overlay

* TYPE_APPLICATION_OVERLAY - add type check

* add version check

* add import lib

* permission move to main app manifest

* set layoutparams
parent a4410df6
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.beefe.picker">
</manifest>
......@@ -12,6 +12,7 @@ import android.view.Window;
import android.view.WindowManager;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.os.Build;
import com.beefe.picker.util.MIUIUtils;
import com.beefe.picker.view.OnSelectedListener;
......@@ -358,11 +359,16 @@ public class PickerViewModule extends ReactContextBaseJavaModule implements Life
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
Window window = dialog.getWindow();
if (window != null) {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
window.setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
}else{
if (MIUIUtils.isMIUI()) {
layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION;
}else {
//layoutParams.type = WindowManager.LayoutParams.TYPE_TOAST;
}
}
layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
layoutParams.format = PixelFormat.TRANSPARENT;
layoutParams.windowAnimations = R.style.PickerAnim;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment