diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/CheatsDisabledWarningFragment.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/CheatsDisabledWarningFragment.java new file mode 100644 index 0000000000..f2dfd7b341 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/CheatsDisabledWarningFragment.java @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +package org.dolphinemu.dolphinemu.features.cheats.ui; + +import org.dolphinemu.dolphinemu.R; +import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting; +import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag; + +public class CheatsDisabledWarningFragment extends SettingDisabledWarningFragment +{ + public CheatsDisabledWarningFragment() + { + super(BooleanSetting.MAIN_ENABLE_CHEATS, MenuTag.CONFIG_GENERAL, + R.string.cheats_disabled_warning); + } +} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/GraphicsModsDisabledWarningFragment.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/GraphicsModsDisabledWarningFragment.java new file mode 100644 index 0000000000..eaf26f094b --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/GraphicsModsDisabledWarningFragment.java @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +package org.dolphinemu.dolphinemu.features.cheats.ui; + +import org.dolphinemu.dolphinemu.R; +import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting; +import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag; + +public class GraphicsModsDisabledWarningFragment extends SettingDisabledWarningFragment +{ + public GraphicsModsDisabledWarningFragment() + { + super(BooleanSetting.GFX_MODS_ENABLE, MenuTag.ADVANCED_GRAPHICS, + R.string.gfx_mods_disabled_warning); + } +} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/CheatWarningFragment.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/SettingDisabledWarningFragment.java similarity index 68% rename from Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/CheatWarningFragment.java rename to Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/SettingDisabledWarningFragment.java index df6d9d94b0..c239c5c9af 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/CheatWarningFragment.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/SettingDisabledWarningFragment.java @@ -7,21 +7,35 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import org.dolphinemu.dolphinemu.R; -import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting; +import org.dolphinemu.dolphinemu.features.settings.model.AbstractBooleanSetting; import org.dolphinemu.dolphinemu.features.settings.model.Settings; import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag; import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity; -public class CheatWarningFragment extends Fragment implements View.OnClickListener +public abstract class SettingDisabledWarningFragment extends Fragment + implements View.OnClickListener { private View mView; + private final AbstractBooleanSetting mSetting; + private final MenuTag mSettingShortcut; + private final int mText; + + public SettingDisabledWarningFragment(AbstractBooleanSetting setting, MenuTag settingShortcut, + int text) + { + mSetting = setting; + mSettingShortcut = settingShortcut; + mText = text; + } + @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @@ -35,6 +49,9 @@ public class CheatWarningFragment extends Fragment implements View.OnClickListen { mView = view; + TextView textView = view.findViewById(R.id.text_warning); + textView.setText(mText); + Button settingsButton = view.findViewById(R.id.button_settings); settingsButton.setOnClickListener(this); @@ -51,13 +68,13 @@ public class CheatWarningFragment extends Fragment implements View.OnClickListen CheatsActivity activity = (CheatsActivity) requireActivity(); try (Settings settings = activity.loadGameSpecificSettings()) { - boolean cheatsEnabled = BooleanSetting.MAIN_ENABLE_CHEATS.getBoolean(settings); + boolean cheatsEnabled = mSetting.getBoolean(settings); mView.setVisibility(cheatsEnabled ? View.GONE : View.VISIBLE); } } public void onClick(View view) { - SettingsActivity.launch(requireContext(), MenuTag.CONFIG_GENERAL); + SettingsActivity.launch(requireContext(), mSettingShortcut); } } diff --git a/Source/Android/app/src/main/res/layout/fragment_cheat_list.xml b/Source/Android/app/src/main/res/layout/fragment_cheat_list.xml index 9c976ac408..ad8ec880af 100644 --- a/Source/Android/app/src/main/res/layout/fragment_cheat_list.xml +++ b/Source/Android/app/src/main/res/layout/fragment_cheat_list.xml @@ -6,13 +6,23 @@ android:layout_height="match_parent"> + + diff --git a/Source/Android/app/src/main/res/layout/fragment_cheat_warning.xml b/Source/Android/app/src/main/res/layout/fragment_cheat_warning.xml index d56a1160b6..6ed47961e2 100644 --- a/Source/Android/app/src/main/res/layout/fragment_cheat_warning.xml +++ b/Source/Android/app/src/main/res/layout/fragment_cheat_warning.xml @@ -1,5 +1,6 @@ File contained no codes. Downloaded %1$d codes. (added %2$d) Dolphin\'s cheat system is currently disabled. + Graphics mods are currently disabled. Settings