mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 00:29:50 -04:00
Compromise: remove Android < 28 notch support because it breaks virtual navbars
This commit is contained in:
parent
4c435228cc
commit
13f55e21bc
@ -2,6 +2,7 @@ package net.kdt.pojavlaunch;
|
|||||||
|
|
||||||
import android.app.*;
|
import android.app.*;
|
||||||
import android.content.*;
|
import android.content.*;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.net.*;
|
import android.net.*;
|
||||||
import android.os.*;
|
import android.os.*;
|
||||||
@ -484,18 +485,18 @@ public final class Tools {
|
|||||||
}else{
|
}else{
|
||||||
if (SDK_INT >= Build.VERSION_CODES.R) {
|
if (SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
activity.getDisplay().getRealMetrics(displayMetrics);
|
activity.getDisplay().getRealMetrics(displayMetrics);
|
||||||
} else if(SDK_INT >= P) {
|
} else { // Removed the clause for devices with unofficial notch support, since it also ruins all devices with virtual nav bars before P
|
||||||
activity.getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics);
|
activity.getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics);
|
||||||
}else{ // Some old devices can have a notch despite it not being officially supported
|
|
||||||
activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
|
||||||
}
|
}
|
||||||
if(!PREF_IGNORE_NOTCH){
|
if(!PREF_IGNORE_NOTCH){
|
||||||
//Remove notch width when it isn't ignored.
|
//Remove notch width when it isn't ignored.
|
||||||
|
if(activity.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)
|
||||||
|
displayMetrics.heightPixels -= PREF_NOTCH_SIZE;
|
||||||
|
else
|
||||||
displayMetrics.widthPixels -= PREF_NOTCH_SIZE;
|
displayMetrics.widthPixels -= PREF_NOTCH_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currentDisplayMetrics = displayMetrics;
|
currentDisplayMetrics = displayMetrics;
|
||||||
|
|
||||||
return displayMetrics;
|
return displayMetrics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user