Fixes API compatibility

~~No longer save bytes 😂~~
This commit is contained in:
Duy Tran Khanh 2021-02-02 21:01:47 +07:00 committed by GitHub
parent 7eb7b342e1
commit 9f54be3156
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -325,7 +325,11 @@ public final class Tools
//For devices with free form/split screen, we need window size, not screen size.
displayMetrics = ctx.getResources().getDisplayMetrics();
}else{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
ctx.getDisplay().getRealMetrics(displayMetrics);
} else {
displayMetrics = getWindowManager().getDefaultDisplay();
}
if(!PREF_IGNORE_NOTCH){
//Remove notch width when it isn't ignored.
displayMetrics.widthPixels -= PREF_NOTCH_SIZE;