Merge pull request #9357 from JosJuice/android-one-settings-entrypoint

Android: Only have one settings entrypoint per activity/dialog
This commit is contained in:
LC 2020-12-24 12:46:43 -05:00 committed by GitHub
commit d61c64684b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 49 additions and 82 deletions

View File

@ -99,7 +99,7 @@ public final class EmulationActivity extends AppCompatActivity
MENU_ACTION_LOAD_SLOT6, MENU_ACTION_EXIT, MENU_ACTION_CHANGE_DISC,
MENU_ACTION_RESET_OVERLAY, MENU_SET_IR_SENSITIVITY, MENU_ACTION_CHOOSE_DOUBLETAP,
MENU_ACTION_MOTION_CONTROLS, MENU_ACTION_PAUSE_EMULATION, MENU_ACTION_UNPAUSE_EMULATION,
MENU_ACTION_OVERLAY_CONTROLS, MENU_ACTION_SETTINGS_CORE, MENU_ACTION_SETTINGS_GRAPHICS})
MENU_ACTION_OVERLAY_CONTROLS, MENU_ACTION_SETTINGS})
public @interface MenuAction
{
}
@ -137,8 +137,7 @@ public final class EmulationActivity extends AppCompatActivity
public static final int MENU_ACTION_PAUSE_EMULATION = 30;
public static final int MENU_ACTION_UNPAUSE_EMULATION = 31;
public static final int MENU_ACTION_OVERLAY_CONTROLS = 32;
public static final int MENU_ACTION_SETTINGS_CORE = 33;
public static final int MENU_ACTION_SETTINGS_GRAPHICS = 34;
public static final int MENU_ACTION_SETTINGS = 33;
private static final SparseIntArray buttonsActionsMap = new SparseIntArray();
@ -656,12 +655,8 @@ public final class EmulationActivity extends AppCompatActivity
showMotionControlsOptions();
break;
case MENU_ACTION_SETTINGS_CORE:
SettingsActivity.launch(this, MenuTag.CONFIG);
break;
case MENU_ACTION_SETTINGS_GRAPHICS:
SettingsActivity.launch(this, MenuTag.GRAPHICS);
case MENU_ACTION_SETTINGS:
SettingsActivity.launch(this, MenuTag.SETTINGS);
break;
case MENU_ACTION_EXIT:

View File

@ -4,6 +4,7 @@ import androidx.annotation.NonNull;
public enum MenuTag
{
SETTINGS("settings"),
CONFIG("config"),
CONFIG_GENERAL("config_general"),
CONFIG_INTERFACE("config_interface"),

View File

@ -35,7 +35,8 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
static
{
titles.put(MenuTag.CONFIG, R.string.preferences_settings);
titles.put(MenuTag.SETTINGS, R.string.preferences_settings);
titles.put(MenuTag.CONFIG, R.string.config);
titles.put(MenuTag.CONFIG_GENERAL, R.string.general_submenu);
titles.put(MenuTag.CONFIG_INTERFACE, R.string.interface_submenu);
titles.put(MenuTag.CONFIG_AUDIO, R.string.audio_submenu);
@ -43,10 +44,10 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
titles.put(MenuTag.CONFIG_GAME_CUBE, R.string.gamecube_submenu);
titles.put(MenuTag.CONFIG_WII, R.string.wii_submenu);
titles.put(MenuTag.CONFIG_ADVANCED, R.string.advanced_submenu);
titles.put(MenuTag.WIIMOTE, R.string.grid_menu_wiimote_settings);
titles.put(MenuTag.WIIMOTE, R.string.wiimote_settings);
titles.put(MenuTag.WIIMOTE_EXTENSION, R.string.wiimote_extensions);
titles.put(MenuTag.GCPAD_TYPE, R.string.grid_menu_gcpad_settings);
titles.put(MenuTag.GRAPHICS, R.string.grid_menu_graphics_settings);
titles.put(MenuTag.GCPAD_TYPE, R.string.gcpad_settings);
titles.put(MenuTag.GRAPHICS, R.string.graphics_settings);
titles.put(MenuTag.HACKS, R.string.hacks_submenu);
titles.put(MenuTag.CONFIG_LOG, R.string.log_submenu);
titles.put(MenuTag.DEBUG, R.string.debug_submenu);

View File

@ -122,6 +122,10 @@ public final class SettingsFragmentPresenter
switch (mMenuTag)
{
case SETTINGS:
addTopLevelSettings(sl);
break;
case CONFIG:
addConfigSettings(sl);
break;
@ -216,6 +220,20 @@ public final class SettingsFragmentPresenter
mView.showSettingsList(mSettingsList);
}
private void addTopLevelSettings(ArrayList<SettingsItem> sl)
{
sl.add(new SubmenuSetting(R.string.config, MenuTag.CONFIG));
sl.add(new SubmenuSetting(R.string.graphics_settings, MenuTag.GRAPHICS));
if (!NativeLibrary.IsRunning())
{
sl.add(new SubmenuSetting(R.string.gcpad_settings, MenuTag.GCPAD_TYPE));
sl.add(new SubmenuSetting(R.string.wiimote_settings, MenuTag.WIIMOTE));
}
sl.add(new HeaderSetting(R.string.setting_clear_info, 0));
}
private void addConfigSettings(ArrayList<SettingsItem> sl)
{
sl.add(new SubmenuSetting(R.string.general_submenu, MenuTag.CONFIG_GENERAL));
@ -227,7 +245,6 @@ public final class SettingsFragmentPresenter
sl.add(new SubmenuSetting(R.string.advanced_submenu, MenuTag.CONFIG_ADVANCED));
sl.add(new SubmenuSetting(R.string.log_submenu, MenuTag.CONFIG_LOG));
sl.add(new SubmenuSetting(R.string.debug_submenu, MenuTag.DEBUG));
sl.add(new HeaderSetting(R.string.setting_clear_info, 0));
}
private void addGeneralSettings(ArrayList<SettingsItem> sl)
@ -513,7 +530,6 @@ public final class SettingsFragmentPresenter
sl.add(new HeaderSetting(R.string.graphics_enhancements_and_hacks, 0));
sl.add(new SubmenuSetting(R.string.enhancements_submenu, MenuTag.ENHANCEMENTS));
sl.add(new SubmenuSetting(R.string.hacks_submenu, MenuTag.HACKS));
sl.add(new HeaderSetting(R.string.setting_clear_info, 0));
}
private void addEnhanceSettings(ArrayList<SettingsItem> sl)

View File

@ -48,9 +48,7 @@ public final class MenuFragment extends Fragment implements View.OnClickListener
.append(R.id.menu_refresh_wiimotes, EmulationActivity.MENU_ACTION_REFRESH_WIIMOTES);
buttonsActionsMap.append(R.id.menu_change_disc, EmulationActivity.MENU_ACTION_CHANGE_DISC);
buttonsActionsMap.append(R.id.menu_exit, EmulationActivity.MENU_ACTION_EXIT);
buttonsActionsMap.append(R.id.menu_settings_core, EmulationActivity.MENU_ACTION_SETTINGS_CORE);
buttonsActionsMap.append(R.id.menu_settings_graphics,
EmulationActivity.MENU_ACTION_SETTINGS_GRAPHICS);
buttonsActionsMap.append(R.id.menu_settings, EmulationActivity.MENU_ACTION_SETTINGS);
}
public static MenuFragment newInstance()

View File

@ -71,20 +71,8 @@ public final class MainPresenter
{
switch (itemId)
{
case R.id.menu_settings_core:
mView.launchSettingsActivity(MenuTag.CONFIG);
return true;
case R.id.menu_settings_graphics:
mView.launchSettingsActivity(MenuTag.GRAPHICS);
return true;
case R.id.menu_settings_gcpad:
mView.launchSettingsActivity(MenuTag.GCPAD_TYPE);
return true;
case R.id.menu_settings_wiimote:
mView.launchSettingsActivity(MenuTag.WIIMOTE);
case R.id.menu_settings:
mView.launchSettingsActivity(MenuTag.SETTINGS);
return true;
case R.id.menu_refresh:

View File

@ -313,21 +313,9 @@ public final class TvMainActivity extends FragmentActivity implements MainView
{
ArrayObjectAdapter rowItems = new ArrayObjectAdapter(new SettingsRowPresenter());
rowItems.add(new TvSettingsItem(R.id.menu_settings_core,
R.drawable.ic_settings_core_tv,
R.string.grid_menu_config));
rowItems.add(new TvSettingsItem(R.id.menu_settings_graphics,
R.drawable.ic_settings_graphics_tv,
R.string.grid_menu_graphics_settings));
rowItems.add(new TvSettingsItem(R.id.menu_settings_gcpad,
R.drawable.ic_settings_gcpad,
R.string.grid_menu_gcpad_settings));
rowItems.add(new TvSettingsItem(R.id.menu_settings_wiimote,
R.drawable.ic_settings_wiimote,
R.string.grid_menu_wiimote_settings));
rowItems.add(new TvSettingsItem(R.id.menu_settings,
R.drawable.ic_settings_tv,
R.string.grid_menu_settings));
rowItems.add(new TvSettingsItem(R.id.button_add_directory,
R.drawable.ic_add_tv,

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 788 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

View File

@ -31,16 +31,6 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/menu_settings_core"
android:text="@string/grid_menu_config"
style="@style/InGameMenuOption"/>
<Button
android:id="@+id/menu_settings_graphics"
android:text="@string/grid_menu_graphics_settings"
style="@style/InGameMenuOption"/>
<Button
android:id="@+id/menu_pause_emulation"
android:text="@string/pause_emulation"
@ -81,6 +71,11 @@
style="@style/InGameMenuOption"
android:visibility="gone"/>
<Button
android:id="@+id/menu_settings"
android:text="@string/grid_menu_settings"
style="@style/InGameMenuOption"/>
<Button
android:id="@+id/menu_overlay_controls"
android:text="@string/emulation_overlay_controls"

View File

@ -3,27 +3,9 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_settings_core"
android:title="@string/grid_menu_config"
android:icon="@drawable/ic_settings_core"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/menu_settings_graphics"
android:title="@string/grid_menu_graphics_settings"
android:icon="@drawable/ic_settings_graphics"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/menu_settings_gcpad"
android:title="@string/grid_menu_gcpad_settings"
android:icon="@drawable/ic_settings_gcpad"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/menu_settings_wiimote"
android:title="@string/grid_menu_wiimote_settings"
android:icon="@drawable/ic_settings_wiimote"
android:id="@+id/menu_settings"
android:title="@string/grid_menu_settings"
android:icon="@drawable/ic_settings"
app:showAsAction="ifRoom"/>
<item

View File

@ -121,6 +121,12 @@
<string name="turntable_effect_dial">Dial</string>
<string name="turntable_crossfade">Crossfade</string>
<!-- Main Preference Fragment -->
<string name="config">Config</string>
<string name="graphics_settings">Graphics Settings</string>
<string name="gcpad_settings">GameCube Input</string>
<string name="wiimote_settings">Wii Input</string>
<!-- General Preference Fragment -->
<string name="general_submenu">General</string>
<string name="dual_core">Dual Core</string>
@ -319,10 +325,7 @@
<!-- Game Grid Screen-->
<string name="add_directory_title">Add Folder to Library</string>
<string name="grid_menu_config">Config</string>
<string name="grid_menu_graphics_settings">Graphics Settings</string>
<string name="grid_menu_gcpad_settings">GameCube Input</string>
<string name="grid_menu_wiimote_settings">Wii Input</string>
<string name="grid_menu_settings">Settings</string>
<string name="grid_menu_refresh">Refresh Library</string>
<string name="grid_menu_open_file">Open File</string>
<string name="grid_menu_install_wad">Install WAD</string>