Merge pull request #10552 from Gamer64ytb/display-cutout
Android: Implement expand display cutout option.
This commit is contained in:
commit
17b17e3236
|
@ -7,6 +7,7 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.SparseIntArray;
|
||||
|
@ -17,6 +18,7 @@ import android.view.Menu;
|
|||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -373,6 +375,19 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
{
|
||||
super.onResume();
|
||||
|
||||
// Only android 9+ support this feature.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
|
||||
{
|
||||
WindowManager.LayoutParams attributes = getWindow().getAttributes();
|
||||
|
||||
attributes.layoutInDisplayCutoutMode =
|
||||
BooleanSetting.MAIN_EXPAND_TO_CUTOUT_AREA.getBoolean(mSettings) ?
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES :
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;
|
||||
|
||||
getWindow().setAttributes(attributes);
|
||||
}
|
||||
|
||||
updateOrientation();
|
||||
|
||||
if (NativeLibrary.IsGameMetadataValid())
|
||||
|
|
|
@ -42,6 +42,8 @@ public enum BooleanSetting implements AbstractBooleanSetting
|
|||
|
||||
MAIN_DSP_JIT(Settings.FILE_DOLPHIN, Settings.SECTION_INI_DSP, "EnableJIT", true),
|
||||
|
||||
MAIN_EXPAND_TO_CUTOUT_AREA(Settings.FILE_DOLPHIN, Settings.SECTION_INI_INTERFACE,
|
||||
"ExpandToCutoutArea", false),
|
||||
MAIN_USE_PANIC_HANDLERS(Settings.FILE_DOLPHIN, Settings.SECTION_INI_INTERFACE,
|
||||
"UsePanicHandlers", true),
|
||||
MAIN_OSD_MESSAGES(Settings.FILE_DOLPHIN, Settings.SECTION_INI_INTERFACE,
|
||||
|
|
|
@ -4,6 +4,7 @@ package org.dolphinemu.dolphinemu.features.settings.ui;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
|
@ -292,6 +293,13 @@ public final class SettingsFragmentPresenter
|
|||
R.array.orientationValues));
|
||||
}
|
||||
|
||||
// Only android 9+ supports this feature.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
|
||||
{
|
||||
sl.add(new CheckBoxSetting(mContext, BooleanSetting.MAIN_EXPAND_TO_CUTOUT_AREA,
|
||||
R.string.expand_to_cutout_area, R.string.expand_to_cutout_area_description));
|
||||
}
|
||||
|
||||
sl.add(new CheckBoxSetting(mContext, BooleanSetting.MAIN_USE_PANIC_HANDLERS,
|
||||
R.string.panic_handlers, R.string.panic_handlers_description));
|
||||
sl.add(new CheckBoxSetting(mContext, BooleanSetting.MAIN_OSD_MESSAGES, R.string.osd_messages,
|
||||
|
|
|
@ -155,8 +155,6 @@
|
|||
<string name="fallback_region">Fallback Region</string>
|
||||
<string name="enable_save_states">Enable Savestates</string>
|
||||
<string name="enable_save_states_description">WARNING: Savestates may not be compatible with future versions of Dolphin and can make it impossible to create normal saves in some cases. Never use savestates as the only way of saving your progress.</string>
|
||||
<string name="lock_emulation_landscape">Lock screen to landscape</string>
|
||||
<string name="lock_emulation_landscape_desc">Some touch controls will require additional tweaking if played in portrait</string>
|
||||
<string name="analytics">Enable usage statistics reporting</string>
|
||||
<string name="analytics_desc">If authorized, Dolphin can collect data on its performance, feature usage, and configuration, as well as data on your system\'s hardware and operating system.\n\nNo private data is ever collected. This data helps us understand how people and emulated games use Dolphin and prioritize our efforts. It also helps us identify rare configurations that are causing bugs, performance and stability issues. This authorization can be revoked at any time through Dolphin\'s settings.</string>
|
||||
<string name="analytics_new_id">Generate a New Statistics Identity</string>
|
||||
|
@ -165,6 +163,8 @@
|
|||
<!-- Interface Preference Fragment -->
|
||||
<string name="interface_submenu">Interface</string>
|
||||
<string name="emulation_screen_orientation">Screen Orientation During Emulation</string>
|
||||
<string name="expand_to_cutout_area">Expand to Cutout Area</string>
|
||||
<string name="expand_to_cutout_area_description">Expands the display area to include the cutout (or notch) area.</string>
|
||||
<string name="panic_handlers">Use Panic Handlers</string>
|
||||
<string name="panic_handlers_description">Show a message box when a potentially serious error has occurred. Disabling this may avoid annoying and non-fatal messages, but it may result in major crashes having no explanation at all.</string>
|
||||
<string name="osd_messages">Show On-Screen Display Messages</string>
|
||||
|
|
Loading…
Reference in New Issue