add quick menu option for secondary layout
This commit is contained in:
parent
c4d2d44de3
commit
e24ac13c7e
5 changed files with 114 additions and 0 deletions
|
|
@ -62,6 +62,13 @@ class ScreenAdjustmentUtil(
|
|||
NativeLibrary.updateFramebuffer(NativeLibrary.isPortraitMode)
|
||||
}
|
||||
|
||||
fun changeSecondaryOrientation(layoutOption: Int) {
|
||||
IntSetting.SECONDARY_DISPLAY_LAYOUT.int = layoutOption
|
||||
settings.saveSetting(IntSetting.SECONDARY_DISPLAY_LAYOUT,SettingsFile.FILE_NAME_CONFIG)
|
||||
NativeLibrary.reloadSettings()
|
||||
NativeLibrary.updateFramebuffer(NativeLibrary.isPortraitMode)
|
||||
}
|
||||
|
||||
fun changeActivityOrientation(orientationOption: Int) {
|
||||
val activity = context as? Activity ?: return
|
||||
IntSetting.ORIENTATION_OPTION.int = orientationOption
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ import org.citra.citra_emu.databinding.FragmentEmulationBinding
|
|||
import org.citra.citra_emu.display.PortraitScreenLayout
|
||||
import org.citra.citra_emu.display.ScreenAdjustmentUtil
|
||||
import org.citra.citra_emu.display.ScreenLayout
|
||||
import org.citra.citra_emu.display.SecondaryDisplayLayout
|
||||
import org.citra.citra_emu.features.settings.model.BooleanSetting
|
||||
import org.citra.citra_emu.features.settings.model.IntSetting
|
||||
import org.citra.citra_emu.features.settings.model.Settings
|
||||
|
|
@ -306,6 +307,11 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
|||
true
|
||||
}
|
||||
|
||||
R.id.menu_secondary_screen_layout -> {
|
||||
showSecondaryScreenLayoutMenu()
|
||||
true
|
||||
}
|
||||
|
||||
R.id.menu_swap_screens -> {
|
||||
screenAdjustmentUtil.swapScreen()
|
||||
true
|
||||
|
|
@ -1002,6 +1008,61 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
|||
popupMenu.show()
|
||||
}
|
||||
|
||||
private fun showSecondaryScreenLayoutMenu() {
|
||||
val popupMenu = PopupMenu(
|
||||
requireContext(),
|
||||
binding.inGameMenu.findViewById(R.id.menu_secondary_screen_layout)
|
||||
)
|
||||
|
||||
popupMenu.menuInflater.inflate(R.menu.menu_secondary_screen_layout, popupMenu.menu)
|
||||
|
||||
val layoutOptionMenuItem = when (IntSetting.SECONDARY_DISPLAY_LAYOUT.int) {
|
||||
SecondaryDisplayLayout.NONE.int ->
|
||||
R.id.menu_secondary_layout_none
|
||||
SecondaryDisplayLayout.REVERSE_PRIMARY.int ->
|
||||
R.id.menu_secondary_layout_reverse_primary
|
||||
SecondaryDisplayLayout.TOP_SCREEN.int ->
|
||||
R.id.menu_secondary_layout_top
|
||||
SecondaryDisplayLayout.BOTTOM_SCREEN.int ->
|
||||
R.id.menu_secondary_layout_bottom
|
||||
else ->
|
||||
R.id.menu_secondary_layout_side_by_side
|
||||
|
||||
}
|
||||
|
||||
popupMenu.menu.findItem(layoutOptionMenuItem).setChecked(true)
|
||||
|
||||
popupMenu.setOnMenuItemClickListener {
|
||||
when (it.itemId) {
|
||||
R.id.menu_secondary_layout_none -> {
|
||||
screenAdjustmentUtil.changeSecondaryOrientation(SecondaryDisplayLayout.NONE.int)
|
||||
true
|
||||
}
|
||||
|
||||
R.id.menu_secondary_layout_reverse_primary -> {
|
||||
screenAdjustmentUtil.changeSecondaryOrientation(SecondaryDisplayLayout.REVERSE_PRIMARY.int)
|
||||
true
|
||||
}
|
||||
R.id.menu_secondary_layout_top -> {
|
||||
screenAdjustmentUtil.changeSecondaryOrientation(SecondaryDisplayLayout.TOP_SCREEN.int)
|
||||
true
|
||||
}
|
||||
R.id.menu_secondary_layout_bottom -> {
|
||||
screenAdjustmentUtil.changeSecondaryOrientation(SecondaryDisplayLayout.BOTTOM_SCREEN.int)
|
||||
true
|
||||
}
|
||||
R.id.menu_secondary_layout_side_by_side -> {
|
||||
screenAdjustmentUtil.changeSecondaryOrientation(SecondaryDisplayLayout.SIDE_BY_SIDE.int)
|
||||
true
|
||||
}
|
||||
|
||||
|
||||
else -> true
|
||||
}
|
||||
}
|
||||
|
||||
popupMenu.show()
|
||||
}
|
||||
private fun editControlsPlacement() {
|
||||
if (binding.surfaceInputOverlay.isInEditMode) {
|
||||
binding.doneControlConfig.visibility = View.GONE
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M17 4h3c1.1 0 2 0.9 2 2v2h-2V6h-3ZM4 8V6h3V4H4C2.9 4 2 4.9 2 6v2z m16 8v2h-3v2h3c1.1 0 2-0.9 2-2v-2ZM7 18H4v-2H2v2c0 1.1 0.9 2 2 2h3ZM18 8H6v8h12z"/>
|
||||
<path
|
||||
android:fillColor="#FFffffff"
|
||||
android:pathData="M12.6 10.23q-0.07-0.17-0.21-0.28-0.13-0.12-0.26-0.14-0.42 0-0.77 0.23-0.35 0.22-0.64 0.53-0.13 0.1-0.29 0.1-0.16 0-0.27-0.1-0.1-0.12-0.1-0.3 0-0.15 0.1-0.3 0.18-0.19 0.39-0.37 0.21-0.2 0.45-0.34 0.24-0.14 0.5-0.23 0.25-0.09 0.52-0.09 0.31 0 0.58 0.14 0.27 0.12 0.47 0.36 0.2 0.24 0.31 0.56 0.12 0.33 0.12 0.72 0 0.12-0.03 0.26-0.1 0.44-0.33 0.72-0.21 0.28-0.48 0.48-0.26 0.2-0.55 0.36-0.28 0.15-0.53 0.35-0.24 0.2-0.42 0.47-0.19 0.27-0.25 0.7h1.84q0.11 0 0.17-0.03l0.09-0.06 0.1-0.12q0.08-0.1 0.12-0.11l0.1-0.04 0.12-0.01q0.18 0 0.28 0.12 0.1 0.12 0.1 0.28 0 0.11-0.02 0.17l-0.04 0.08q-0.18 0.26-0.43 0.42-0.25 0.15-0.56 0.15h-2.3q-0.38-0.03-0.42-0.45 0.03-0.32 0.1-0.62 0.05-0.3 0.16-0.59 0.1-0.28 0.27-0.53 0.16-0.25 0.41-0.45 0.22-0.17 0.51-0.33 0.3-0.15 0.55-0.34 0.26-0.19 0.45-0.44 0.18-0.25 0.18-0.6 0-0.1-0.04-0.21l-0.05-0.12z"/>
|
||||
</vector>
|
||||
|
|
@ -32,6 +32,11 @@
|
|||
android:icon="@drawable/ic_portrait_fit_screen"
|
||||
android:title="@string/emulation_switch_portrait_layout" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_secondary_screen_layout"
|
||||
android:icon="@drawable/ic_secondary_fit_screen"
|
||||
android:title="@string/emulation_switch_secondary_layout" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_swap_screens"
|
||||
android:icon="@drawable/ic_splitscreen"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<group android:checkableBehavior="single">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_secondary_layout_none"
|
||||
android:title="@string/emulation_secondary_display_default" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_secondary_layout_reverse_primary"
|
||||
android:title="@string/emulation_secondary_display_reverse_primary" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_secondary_layout_top"
|
||||
android:title="@string/emulation_top_screen" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_secondary_layout_bottom"
|
||||
android:title="@string/emulation_bottom_screen" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_secondary_layout_side_by_side"
|
||||
android:title="@string/emulation_screen_layout_sidebyside" />
|
||||
|
||||
</group>
|
||||
|
||||
</menu>
|
||||
Loading…
Add table
Add a link
Reference in a new issue