Android: Rework the "global" settings functions

getXGlobal() is now identical to getX(), and setXGlobal(int, X) is now
identical to setX(int, X) in the cases where setX(int, X) exists.
We can remove/rename them.
This commit is contained in:
JosJuice 2023-03-11 18:23:55 +01:00
parent 58fc347f8d
commit 99600ef781
17 changed files with 77 additions and 110 deletions

View File

@ -59,7 +59,7 @@ class GameAdapter(private val mActivity: FragmentActivity) : RecyclerView.Adapte
val gameFile = mGameFiles[position]
holder.apply {
if (BooleanSetting.MAIN_SHOW_GAME_TITLES.booleanGlobal) {
if (BooleanSetting.MAIN_SHOW_GAME_TITLES.boolean) {
binding.textGameTitle.text = gameFile.title
binding.textGameTitle.visibility = View.VISIBLE
binding.textGameTitleInner.visibility = View.GONE

View File

@ -44,7 +44,7 @@ class RiivolutionBootActivity : AppCompatActivity() {
val revision = intent.getIntExtra(ARG_REVISION, -1)
val discNumber = intent.getIntExtra(ARG_DISC_NUMBER, -1)
var loadPath = StringSetting.MAIN_LOAD_PATH.stringGlobal
var loadPath = StringSetting.MAIN_LOAD_PATH.string
if (loadPath.isEmpty()) loadPath = DirectoryInitialization.getUserDirectory() + "/Load"
binding.textSdRoot.text = getString(R.string.riivolution_sd_root, "$loadPath/Riivolution")

View File

@ -346,23 +346,7 @@ public enum BooleanSetting implements AbstractBooleanSetting
NativeConfig.setBoolean(settings.getWriteLayer(), mFile, mSection, mKey, newValue);
}
public void setBoolean(int layerType, boolean newValue)
{
if (!NativeConfig.isSettingSaveable(mFile, mSection, mKey))
{
throw new UnsupportedOperationException(
"Unsupported setting: " + mFile + ", " + mSection + ", " + mKey);
}
NativeConfig.setBoolean(layerType, mFile, mSection, mKey, newValue);
}
public boolean getBooleanGlobal()
{
return NativeConfig.getBoolean(NativeConfig.LAYER_ACTIVE, mFile, mSection, mKey, mDefaultValue);
}
public void setBooleanGlobal(int layer, boolean newValue)
public void setBoolean(int layer, boolean newValue)
{
if (!NativeConfig.isSettingSaveable(mFile, mSection, mKey))
{

View File

@ -66,12 +66,7 @@ public enum FloatSetting implements AbstractFloatSetting
NativeConfig.setFloat(settings.getWriteLayer(), mFile, mSection, mKey, newValue);
}
public float getFloatGlobal()
{
return NativeConfig.getFloat(NativeConfig.LAYER_ACTIVE, mFile, mSection, mKey, mDefaultValue);
}
public void setFloatGlobal(int layer, float newValue)
public void setFloat(int layer, float newValue)
{
NativeConfig.setFloat(layer, mFile, mSection, mKey, newValue);
}

View File

@ -171,12 +171,7 @@ public enum IntSetting implements AbstractIntSetting
NativeConfig.setInt(settings.getWriteLayer(), mFile, mSection, mKey, newValue);
}
public int getIntGlobal()
{
return NativeConfig.getInt(NativeConfig.LAYER_ACTIVE, mFile, mSection, mKey, mDefaultValue);
}
public void setIntGlobal(int layer, int newValue)
public void setInt(int layer, int newValue)
{
if (!NativeConfig.isSettingSaveable(mFile, mSection, mKey))
{

View File

@ -106,12 +106,7 @@ public enum StringSetting implements AbstractStringSetting
NativeConfig.setString(settings.getWriteLayer(), mFile, mSection, mKey, newValue);
}
public String getStringGlobal()
{
return NativeConfig.getString(NativeConfig.LAYER_ACTIVE, mFile, mSection, mKey, mDefaultValue);
}
public void setStringGlobal(int layer, String newValue)
public void setString(int layer, String newValue)
{
NativeConfig.setString(layer, mFile, mSection, mKey, newValue);
}

View File

@ -65,13 +65,12 @@ class GridOptionDialogFragment : BottomSheetDialogFragment() {
}
private fun setUpCoverButtons() {
mBindingMobile.switchDownloadCovers.isChecked =
BooleanSetting.MAIN_USE_GAME_COVERS.booleanGlobal
mBindingMobile.switchDownloadCovers.isChecked = BooleanSetting.MAIN_USE_GAME_COVERS.boolean
mBindingMobile.rootDownloadCovers.setOnClickListener {
mBindingMobile.switchDownloadCovers.isChecked = !mBindingMobile.switchDownloadCovers.isChecked
}
mBindingMobile.switchDownloadCovers.setOnCheckedChangeListener { _: CompoundButton, _: Boolean ->
BooleanSetting.MAIN_USE_GAME_COVERS.setBooleanGlobal(
BooleanSetting.MAIN_USE_GAME_COVERS.setBoolean(
NativeConfig.LAYER_BASE,
mBindingMobile.switchDownloadCovers.isChecked
)
@ -80,12 +79,12 @@ class GridOptionDialogFragment : BottomSheetDialogFragment() {
}
private fun setUpTitleButtons() {
mBindingMobile.switchShowTitles.isChecked = BooleanSetting.MAIN_SHOW_GAME_TITLES.booleanGlobal
mBindingMobile.switchShowTitles.isChecked = BooleanSetting.MAIN_SHOW_GAME_TITLES.boolean
mBindingMobile.rootShowTitles.setOnClickListener {
mBindingMobile.switchShowTitles.isChecked = !mBindingMobile.switchShowTitles.isChecked
}
mBindingMobile.switchShowTitles.setOnCheckedChangeListener { _: CompoundButton, _: Boolean ->
BooleanSetting.MAIN_SHOW_GAME_TITLES.setBooleanGlobal(
BooleanSetting.MAIN_SHOW_GAME_TITLES.setBoolean(
NativeConfig.LAYER_BASE,
mBindingMobile.switchShowTitles.isChecked
)
@ -96,12 +95,12 @@ class GridOptionDialogFragment : BottomSheetDialogFragment() {
// TODO: Remove this when leanback is removed
private fun setUpCoverButtonsTv() {
mBindingTv.switchDownloadCovers.isChecked =
BooleanSetting.MAIN_USE_GAME_COVERS.booleanGlobal
BooleanSetting.MAIN_USE_GAME_COVERS.boolean
mBindingTv.rootDownloadCovers.setOnClickListener {
mBindingTv.switchDownloadCovers.isChecked = !mBindingTv.switchDownloadCovers.isChecked
}
mBindingTv.switchDownloadCovers.setOnCheckedChangeListener { _: CompoundButton, _: Boolean ->
BooleanSetting.MAIN_USE_GAME_COVERS.setBooleanGlobal(
BooleanSetting.MAIN_USE_GAME_COVERS.setBoolean(
NativeConfig.LAYER_BASE,
mBindingTv.switchDownloadCovers.isChecked
)

View File

@ -92,7 +92,7 @@ public final class MenuFragment extends Fragment implements View.OnClickListener
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState)
{
if (IntSetting.MAIN_INTERFACE_THEME.getIntGlobal() != ThemeHelper.DEFAULT)
if (IntSetting.MAIN_INTERFACE_THEME.getInt() != ThemeHelper.DEFAULT)
{
@ColorInt int color = new ElevationOverlayProvider(view.getContext()).compositeOverlay(
MaterialColors.getColor(view, R.attr.colorSurface),
@ -114,7 +114,7 @@ public final class MenuFragment extends Fragment implements View.OnClickListener
mBinding.menuSkylanders.setVisibility(View.GONE);
}
if (!BooleanSetting.MAIN_EMULATE_SKYLANDER_PORTAL.getBooleanGlobal())
if (!BooleanSetting.MAIN_EMULATE_SKYLANDER_PORTAL.getBoolean())
{
mBinding.menuSkylanders.setVisibility(View.GONE);
}
@ -176,7 +176,7 @@ public final class MenuFragment extends Fragment implements View.OnClickListener
{
super.onResume();
boolean savestatesEnabled = BooleanSetting.MAIN_ENABLE_SAVESTATES.getBooleanGlobal();
boolean savestatesEnabled = BooleanSetting.MAIN_ENABLE_SAVESTATES.getBoolean();
int savestateVisibility = savestatesEnabled ? View.VISIBLE : View.GONE;
mBinding.menuQuicksave.setVisibility(savestateVisibility);
mBinding.menuQuickload.setVisibility(savestateVisibility);

View File

@ -98,7 +98,7 @@ public class GameFileCache
public static String[] getAllGamePaths()
{
boolean recursiveScan = BooleanSetting.MAIN_RECURSIVE_ISO_PATHS.getBooleanGlobal();
boolean recursiveScan = BooleanSetting.MAIN_RECURSIVE_ISO_PATHS.getBoolean();
LinkedHashSet<String> folderPathsSet = getPathSet(true);

View File

@ -161,7 +161,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
if (!NativeLibrary.IsEmulatingWii())
return;
int doubleTapButton = IntSetting.MAIN_DOUBLE_TAP_BUTTON.getIntGlobal();
int doubleTapButton = IntSetting.MAIN_DOUBLE_TAP_BUTTON.getInt();
if (getConfiguredControllerType() != InputOverlay.OVERLAY_WIIMOTE_CLASSIC &&
doubleTapButton == ButtonType.CLASSIC_BUTTON_A)
@ -184,8 +184,8 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
}
overlayPointer = new InputOverlayPointer(mSurfacePosition, doubleTapControl,
IntSetting.MAIN_IR_MODE.getIntGlobal(),
BooleanSetting.MAIN_IR_ALWAYS_RECENTER.getBooleanGlobal(), mControllerIndex);
IntSetting.MAIN_IR_MODE.getInt(), BooleanSetting.MAIN_IR_ALWAYS_RECENTER.getBoolean(),
mControllerIndex);
}
@Override
@ -552,55 +552,55 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
private void addGameCubeOverlayControls(String orientation)
{
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_0.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_0.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_a,
R.drawable.gcpad_a_pressed, ButtonType.BUTTON_A, ControlId.GCPAD_A_BUTTON,
orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_1.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_1.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_b,
R.drawable.gcpad_b_pressed, ButtonType.BUTTON_B, ControlId.GCPAD_B_BUTTON,
orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_2.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_2.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_x,
R.drawable.gcpad_x_pressed, ButtonType.BUTTON_X, ControlId.GCPAD_X_BUTTON,
orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_3.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_3.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_y,
R.drawable.gcpad_y_pressed, ButtonType.BUTTON_Y, ControlId.GCPAD_Y_BUTTON,
orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_4.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_4.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_z,
R.drawable.gcpad_z_pressed, ButtonType.BUTTON_Z, ControlId.GCPAD_Z_BUTTON,
orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_5.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_5.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_start,
R.drawable.gcpad_start_pressed, ButtonType.BUTTON_START, ControlId.GCPAD_START_BUTTON,
orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_6.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_6.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_l,
R.drawable.gcpad_l_pressed, ButtonType.TRIGGER_L, ControlId.GCPAD_L_DIGITAL,
orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_7.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_7.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_r,
R.drawable.gcpad_r_pressed, ButtonType.TRIGGER_R, ControlId.GCPAD_R_DIGITAL,
orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_8.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_8.getBoolean())
{
overlayDpads.add(initializeOverlayDpad(getContext(), R.drawable.gcwii_dpad,
R.drawable.gcwii_dpad_pressed_one_direction,
@ -608,13 +608,13 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
ButtonType.BUTTON_UP, ControlId.GCPAD_DPAD_UP, ControlId.GCPAD_DPAD_DOWN,
ControlId.GCPAD_DPAD_LEFT, ControlId.GCPAD_DPAD_RIGHT, orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_9.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_9.getBoolean())
{
overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.gcwii_joystick_range,
R.drawable.gcwii_joystick, R.drawable.gcwii_joystick_pressed, ButtonType.STICK_MAIN,
ControlId.GCPAD_MAIN_STICK_X, ControlId.GCPAD_MAIN_STICK_Y, orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_10.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_10.getBoolean())
{
overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.gcwii_joystick_range,
R.drawable.gcpad_c, R.drawable.gcpad_c_pressed, ButtonType.STICK_C,
@ -624,49 +624,49 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
private void addWiimoteOverlayControls(String orientation)
{
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_0.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_0.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_a,
R.drawable.wiimote_a_pressed, ButtonType.WIIMOTE_BUTTON_A, ControlId.WIIMOTE_A_BUTTON,
orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_1.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_1.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_b,
R.drawable.wiimote_b_pressed, ButtonType.WIIMOTE_BUTTON_B, ControlId.WIIMOTE_B_BUTTON,
orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_2.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_2.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_one,
R.drawable.wiimote_one_pressed, ButtonType.WIIMOTE_BUTTON_1,
ControlId.WIIMOTE_ONE_BUTTON, orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_3.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_3.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_two,
R.drawable.wiimote_two_pressed, ButtonType.WIIMOTE_BUTTON_2,
ControlId.WIIMOTE_TWO_BUTTON, orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_4.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_4.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_plus,
R.drawable.wiimote_plus_pressed, ButtonType.WIIMOTE_BUTTON_PLUS,
ControlId.WIIMOTE_PLUS_BUTTON, orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_5.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_5.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_minus,
R.drawable.wiimote_minus_pressed, ButtonType.WIIMOTE_BUTTON_MINUS,
ControlId.WIIMOTE_MINUS_BUTTON, orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_6.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_6.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_home,
R.drawable.wiimote_home_pressed, ButtonType.WIIMOTE_BUTTON_HOME,
ControlId.WIIMOTE_HOME_BUTTON, orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_7.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_7.getBoolean())
{
overlayDpads.add(initializeOverlayDpad(getContext(), R.drawable.gcwii_dpad,
R.drawable.gcwii_dpad_pressed_one_direction,
@ -678,19 +678,19 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
private void addNunchukOverlayControls(String orientation)
{
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_8.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_8.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.nunchuk_c,
R.drawable.nunchuk_c_pressed, ButtonType.NUNCHUK_BUTTON_C, ControlId.NUNCHUK_C_BUTTON,
orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_9.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_9.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.nunchuk_z,
R.drawable.nunchuk_z_pressed, ButtonType.NUNCHUK_BUTTON_Z, ControlId.NUNCHUK_Z_BUTTON,
orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_10.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_10.getBoolean())
{
overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.gcwii_joystick_range,
R.drawable.gcwii_joystick, R.drawable.gcwii_joystick_pressed,
@ -701,73 +701,73 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
private void addClassicOverlayControls(String orientation)
{
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_0.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_0.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_a,
R.drawable.classic_a_pressed, ButtonType.CLASSIC_BUTTON_A, ControlId.CLASSIC_A_BUTTON,
orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_1.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_1.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_b,
R.drawable.classic_b_pressed, ButtonType.CLASSIC_BUTTON_B, ControlId.CLASSIC_B_BUTTON,
orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_2.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_2.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_x,
R.drawable.classic_x_pressed, ButtonType.CLASSIC_BUTTON_X, ControlId.CLASSIC_X_BUTTON,
orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_3.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_3.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_y,
R.drawable.classic_y_pressed, ButtonType.CLASSIC_BUTTON_Y, ControlId.CLASSIC_Y_BUTTON,
orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_4.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_4.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_plus,
R.drawable.wiimote_plus_pressed, ButtonType.CLASSIC_BUTTON_PLUS,
ControlId.CLASSIC_PLUS_BUTTON, orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_5.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_5.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_minus,
R.drawable.wiimote_minus_pressed, ButtonType.CLASSIC_BUTTON_MINUS,
ControlId.CLASSIC_MINUS_BUTTON, orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_6.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_6.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_home,
R.drawable.wiimote_home_pressed, ButtonType.CLASSIC_BUTTON_HOME,
ControlId.CLASSIC_HOME_BUTTON, orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_7.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_7.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_l,
R.drawable.classic_l_pressed, ButtonType.CLASSIC_TRIGGER_L,
ControlId.CLASSIC_L_DIGITAL, orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_8.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_8.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_r,
R.drawable.classic_r_pressed, ButtonType.CLASSIC_TRIGGER_R,
ControlId.CLASSIC_R_DIGITAL, orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_9.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_9.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_zl,
R.drawable.classic_zl_pressed, ButtonType.CLASSIC_BUTTON_ZL,
ControlId.CLASSIC_ZL_BUTTON, orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_10.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_10.getBoolean())
{
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_zr,
R.drawable.classic_zr_pressed, ButtonType.CLASSIC_BUTTON_ZR,
ControlId.CLASSIC_ZR_BUTTON, orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_11.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_11.getBoolean())
{
overlayDpads.add(initializeOverlayDpad(getContext(), R.drawable.gcwii_dpad,
R.drawable.gcwii_dpad_pressed_one_direction,
@ -775,14 +775,14 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
ButtonType.CLASSIC_DPAD_UP, ControlId.CLASSIC_DPAD_UP, ControlId.CLASSIC_DPAD_DOWN,
ControlId.CLASSIC_DPAD_LEFT, ControlId.CLASSIC_DPAD_RIGHT, orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_12.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_12.getBoolean())
{
overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.gcwii_joystick_range,
R.drawable.gcwii_joystick, R.drawable.gcwii_joystick_pressed,
ButtonType.CLASSIC_STICK_LEFT, ControlId.CLASSIC_LEFT_STICK_X,
ControlId.CLASSIC_LEFT_STICK_Y, orientation));
}
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_13.getBooleanGlobal())
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_13.getBoolean())
{
overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.gcwii_joystick_range,
R.drawable.gcwii_joystick, R.drawable.gcwii_joystick_pressed,
@ -810,7 +810,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
IntSetting.MAIN_OVERLAY_WII_CONTROLLER : IntSetting.MAIN_OVERLAY_GC_CONTROLLER;
int controllerIndex = controllerSetting.getInt();
if (BooleanSetting.MAIN_SHOW_INPUT_OVERLAY.getBooleanGlobal())
if (BooleanSetting.MAIN_SHOW_INPUT_OVERLAY.getBoolean())
{
// Add all the enabled overlay items back to the HashSet.
switch (mControllerType)
@ -1070,7 +1070,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
break;
}
scale *= (IntSetting.MAIN_CONTROL_SCALE.getIntGlobal() + 50);
scale *= (IntSetting.MAIN_CONTROL_SCALE.getInt() + 50);
scale /= 100;
// Initialize the InputOverlayDrawableButton.
@ -1096,7 +1096,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
// Need to set the image's position
overlayDrawable.setPosition(drawableX, drawableY);
overlayDrawable.setOpacity(IntSetting.MAIN_CONTROL_OPACITY.getIntGlobal() * 255 / 100);
overlayDrawable.setOpacity(IntSetting.MAIN_CONTROL_OPACITY.getInt() * 255 / 100);
return overlayDrawable;
}
@ -1151,7 +1151,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
break;
}
scale *= (IntSetting.MAIN_CONTROL_SCALE.getIntGlobal() + 50);
scale *= (IntSetting.MAIN_CONTROL_SCALE.getInt() + 50);
scale /= 100;
// Initialize the InputOverlayDrawableDpad.
@ -1182,7 +1182,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
// Need to set the image's position
overlayDrawable.setPosition(drawableX, drawableY);
overlayDrawable.setOpacity(IntSetting.MAIN_CONTROL_OPACITY.getIntGlobal() * 255 / 100);
overlayDrawable.setOpacity(IntSetting.MAIN_CONTROL_OPACITY.getInt() * 255 / 100);
return overlayDrawable;
}
@ -1211,7 +1211,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
// Decide scale based on user preference
float scale = 0.275f;
scale *= (IntSetting.MAIN_CONTROL_SCALE.getIntGlobal() + 50);
scale *= (IntSetting.MAIN_CONTROL_SCALE.getInt() + 50);
scale /= 100;
// Initialize the InputOverlayDrawableJoystick.
@ -1251,7 +1251,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
// Need to set the image's position
overlayDrawable.setPosition(drawableX, drawableY);
overlayDrawable.setOpacity(IntSetting.MAIN_CONTROL_OPACITY.getIntGlobal() * 255 / 100);
overlayDrawable.setOpacity(IntSetting.MAIN_CONTROL_OPACITY.getInt() * 255 / 100);
return overlayDrawable;
}

View File

@ -102,7 +102,7 @@ public final class InputOverlayDrawableJoystick
public boolean TrackEvent(MotionEvent event)
{
boolean reCenter = BooleanSetting.MAIN_JOYSTICK_REL_CENTER.getBooleanGlobal();
boolean reCenter = BooleanSetting.MAIN_JOYSTICK_REL_CENTER.getBoolean();
int action = event.getActionMasked();
boolean firstPointer = action != MotionEvent.ACTION_POINTER_DOWN &&
action != MotionEvent.ACTION_POINTER_UP;

View File

@ -378,7 +378,7 @@ public final class MainActivity extends AppCompatActivity
public void onTabSelected(@NonNull TabLayout.Tab tab)
{
super.onTabSelected(tab);
IntSetting.MAIN_LAST_PLATFORM_TAB.setIntGlobal(NativeConfig.LAYER_BASE,
IntSetting.MAIN_LAST_PLATFORM_TAB.setInt(NativeConfig.LAYER_BASE,
tab.getPosition());
}
});
@ -388,7 +388,7 @@ public final class MainActivity extends AppCompatActivity
mBinding.tabsPlatforms.getTabAt(i).setIcon(PlatformPagerAdapter.TAB_ICONS[i]);
}
mBinding.pagerPlatforms.setCurrentItem(IntSetting.MAIN_LAST_PLATFORM_TAB.getIntGlobal());
mBinding.pagerPlatforms.setCurrentItem(IntSetting.MAIN_LAST_PLATFORM_TAB.getInt());
showGames();
GameFileCacheManager.startLoad();

View File

@ -175,7 +175,7 @@ public final class MainPresenter
{
Uri uri = result.getData();
boolean recursive = BooleanSetting.MAIN_RECURSIVE_ISO_PATHS.getBooleanGlobal();
boolean recursive = BooleanSetting.MAIN_RECURSIVE_ISO_PATHS.getBoolean();
String[] childNames = ContentHandler.getChildNames(uri, recursive);
if (Arrays.stream(childNames).noneMatch((name) -> FileBrowserHelper.GAME_EXTENSIONS.contains(
FileBrowserHelper.getExtension(name, false))))

View File

@ -21,7 +21,7 @@ object Analytics {
@JvmStatic
fun checkAnalyticsInit(activity: FragmentActivity) {
AfterDirectoryInitializationRunner().runWithoutLifecycle {
if (!BooleanSetting.MAIN_ANALYTICS_PERMISSION_ASKED.booleanGlobal) {
if (!BooleanSetting.MAIN_ANALYTICS_PERMISSION_ASKED.boolean) {
AnalyticsDialog().show(activity.supportFragmentManager, AnalyticsDialog.TAG)
}
}

View File

@ -37,7 +37,7 @@ object CoilUtils {
}
)
}
} else if (BooleanSetting.MAIN_USE_GAME_COVERS.booleanGlobal) {
} else if (BooleanSetting.MAIN_USE_GAME_COVERS.boolean) {
imageView.load(CoverHelper.buildGameTDBUrl(gameFile, CoverHelper.getRegion(gameFile))) {
error(R.drawable.no_banner)
target(
@ -58,13 +58,13 @@ object CoilUtils {
}
private fun enableInnerTitle(gameViewHolder: GameViewHolder?) {
if (gameViewHolder != null && !BooleanSetting.MAIN_SHOW_GAME_TITLES.booleanGlobal) {
if (gameViewHolder != null && !BooleanSetting.MAIN_SHOW_GAME_TITLES.boolean) {
gameViewHolder.binding.textGameTitleInner.visibility = View.VISIBLE
}
}
private fun disableInnerTitle(gameViewHolder: GameViewHolder?) {
if (gameViewHolder != null && !BooleanSetting.MAIN_SHOW_GAME_TITLES.booleanGlobal) {
if (gameViewHolder != null && !BooleanSetting.MAIN_SHOW_GAME_TITLES.boolean) {
gameViewHolder.binding.textGameTitleInner.visibility = View.GONE
}
}

View File

@ -356,30 +356,29 @@ public final class DirectoryInitialization
private static void checkThemeSettings(Context context)
{
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
if (IntSetting.MAIN_INTERFACE_THEME.getIntGlobal() !=
if (IntSetting.MAIN_INTERFACE_THEME.getInt() !=
preferences.getInt(ThemeHelper.CURRENT_THEME, ThemeHelper.DEFAULT))
{
preferences.edit()
.putInt(ThemeHelper.CURRENT_THEME, IntSetting.MAIN_INTERFACE_THEME.getIntGlobal())
.putInt(ThemeHelper.CURRENT_THEME, IntSetting.MAIN_INTERFACE_THEME.getInt())
.apply();
}
if (IntSetting.MAIN_INTERFACE_THEME_MODE.getIntGlobal() !=
if (IntSetting.MAIN_INTERFACE_THEME_MODE.getInt() !=
preferences.getInt(ThemeHelper.CURRENT_THEME_MODE,
AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM))
{
preferences.edit()
.putInt(ThemeHelper.CURRENT_THEME_MODE,
IntSetting.MAIN_INTERFACE_THEME_MODE.getIntGlobal())
.putInt(ThemeHelper.CURRENT_THEME_MODE, IntSetting.MAIN_INTERFACE_THEME_MODE.getInt())
.apply();
}
if (BooleanSetting.MAIN_USE_BLACK_BACKGROUNDS.getBooleanGlobal() !=
if (BooleanSetting.MAIN_USE_BLACK_BACKGROUNDS.getBoolean() !=
preferences.getBoolean(ThemeHelper.USE_BLACK_BACKGROUNDS, false))
{
preferences.edit()
.putBoolean(ThemeHelper.USE_BLACK_BACKGROUNDS,
BooleanSetting.MAIN_USE_BLACK_BACKGROUNDS.getBooleanGlobal())
BooleanSetting.MAIN_USE_BLACK_BACKGROUNDS.getBoolean())
.apply();
}
}

View File

@ -79,7 +79,7 @@ public final class FileBrowserHelper
public static boolean isPathEmptyOrValid(StringSetting path)
{
return isPathEmptyOrValid(path.getStringGlobal());
return isPathEmptyOrValid(path.getString());
}
/**