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 xmlns:android="http://schemas.android.com/apk/res/android" package="com.beefe.picker">
</manifest> </manifest>
...@@ -12,6 +12,7 @@ import android.view.Window; ...@@ -12,6 +12,7 @@ import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import android.os.Build;
import com.beefe.picker.util.MIUIUtils; import com.beefe.picker.util.MIUIUtils;
import com.beefe.picker.view.OnSelectedListener; import com.beefe.picker.view.OnSelectedListener;
...@@ -358,10 +359,15 @@ public class PickerViewModule extends ReactContextBaseJavaModule implements Life ...@@ -358,10 +359,15 @@ public class PickerViewModule extends ReactContextBaseJavaModule implements Life
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(); WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
Window window = dialog.getWindow(); Window window = dialog.getWindow();
if (window != null) { if (window != null) {
if (MIUIUtils.isMIUI()) { if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION; layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
}else { window.setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
//layoutParams.type = WindowManager.LayoutParams.TYPE_TOAST; }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.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
layoutParams.format = PixelFormat.TRANSPARENT; layoutParams.format = PixelFormat.TRANSPARENT;
...@@ -369,7 +375,7 @@ public class PickerViewModule extends ReactContextBaseJavaModule implements Life ...@@ -369,7 +375,7 @@ public class PickerViewModule extends ReactContextBaseJavaModule implements Life
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
layoutParams.height = height; layoutParams.height = height;
layoutParams.gravity = Gravity.BOTTOM; layoutParams.gravity = Gravity.BOTTOM;
window.setAttributes(layoutParams); window.setAttributes(layoutParams);
} }
} else { } else {
dialog.dismiss(); dialog.dismiss();
......
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