File tree 1 file changed +11
-2
lines changed
OneSignalSDK/onesignal/core/src/main/java/com/onesignal/common
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,12 @@ import android.app.Activity
4
4
import android.content.Context
5
5
import android.graphics.Rect
6
6
import android.net.ConnectivityManager
7
+ import android.os.Build
7
8
import android.telephony.TelephonyManager
8
9
import android.util.DisplayMetrics
9
10
import android.view.View
11
+ import android.view.WindowInsets
12
+ import androidx.core.view.WindowInsetsCompat
10
13
import java.lang.ref.WeakReference
11
14
12
15
object DeviceUtils {
@@ -28,8 +31,14 @@ object DeviceUtils {
28
31
window.windowManager.defaultDisplay.getMetrics(metrics)
29
32
}
30
33
if (view != null ) {
31
- val heightDiff = metrics.heightPixels - visibleBounds.bottom
32
- isOpen = heightDiff > MARGIN_ERROR_PX_SIZE
34
+ isOpen = if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .R ) {
35
+ val imeInsets = view.rootWindowInsets.getInsets(WindowInsetsCompat .Type .ime())
36
+ // ensure input method size is 0
37
+ ! (imeInsets.left == 0 && imeInsets.top == 0 && imeInsets.right == 0 && imeInsets.bottom == 0 )
38
+ } else {
39
+ val heightDiff = metrics.heightPixels - visibleBounds.bottom
40
+ heightDiff > MARGIN_ERROR_PX_SIZE
41
+ }
33
42
}
34
43
return isOpen
35
44
}
You can’t perform that action at this time.
0 commit comments