Android: Add option to expand display to cutout
This commit is contained in:
parent
ebcc11750d
commit
8cf4c4f211
|
@ -203,6 +203,7 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
|
|||
updateRequestedOrientation();
|
||||
updateControllers();
|
||||
updateSustainedPerformanceMode();
|
||||
updateDisplayInCutout();
|
||||
}
|
||||
|
||||
private void applySettings() {
|
||||
|
@ -296,6 +297,7 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
|
|||
// Sort out rotation.
|
||||
updateOrientation();
|
||||
updateSustainedPerformanceMode();
|
||||
updateDisplayInCutout();
|
||||
|
||||
// Hook up controller input.
|
||||
updateControllers();
|
||||
|
@ -425,6 +427,24 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
|
|||
mContentView.requestFocus();
|
||||
}
|
||||
|
||||
private void updateDisplayInCutout() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P)
|
||||
return;
|
||||
|
||||
final boolean shouldExpand = getBooleanSetting("Display/ExpandToCutout", false);
|
||||
final boolean isExpanded = getWindow().getAttributes().layoutInDisplayCutoutMode ==
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||
|
||||
if (shouldExpand == isExpanded)
|
||||
return;
|
||||
|
||||
WindowManager.LayoutParams attribs = getWindow().getAttributes();
|
||||
attribs.layoutInDisplayCutoutMode = shouldExpand ?
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES :
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
|
||||
getWindow().setAttributes(attribs);
|
||||
}
|
||||
|
||||
private static final int REQUEST_CODE_SETTINGS = 0;
|
||||
private static final int REQUEST_IMPORT_PATCH_CODES = 1;
|
||||
private static final int REQUEST_CHANGE_DISC_FILE = 2;
|
||||
|
|
|
@ -363,4 +363,6 @@
|
|||
<string name="settings_cdrom_load_image_patches">Apply Image Patches</string>
|
||||
<string name="settings_summary_load_image_patches">Automatically applies patches to disc images when they are present, currently only PPF is supported.</string>
|
||||
<string name="menu_edit_game_directories_force_saf">Force Scoped Storage</string>
|
||||
<string name="settings_expand_to_cutout">Expand To Cutout Area</string>
|
||||
<string name="settings_summary_expand_to_cutout">Expands the display area to include the cutout (or notch) area.</string>
|
||||
</resources>
|
||||
|
|
|
@ -81,6 +81,14 @@
|
|||
app:summary="@string/settings_summary_display_stretch"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:key="Display/ExpandToCutout"
|
||||
app:title="@string/settings_expand_to_cutout"
|
||||
app:defaultValue="false"
|
||||
app:dependency="Display/IntegerScaling"
|
||||
app:summary="@string/settings_summary_expand_to_cutout"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:key="Display/ShowOSDMessages"
|
||||
app:title="@string/settings_osd_show_messages"
|
||||
|
|
Loading…
Reference in New Issue