diff options
Diffstat (limited to 'Source/Android/app/src')
| -rw-r--r-- | Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/CheatsDisabledWarningFragment.java | 16 | ||||
| -rw-r--r-- | Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/GraphicsModsDisabledWarningFragment.java | 16 | ||||
| -rw-r--r-- | Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/SettingDisabledWarningFragment.java (renamed from Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/CheatWarningFragment.java) | 25 | ||||
| -rw-r--r-- | Source/Android/app/src/main/res/layout/fragment_cheat_list.xml | 16 | ||||
| -rw-r--r-- | Source/Android/app/src/main/res/layout/fragment_cheat_warning.xml | 3 | ||||
| -rw-r--r-- | Source/Android/app/src/main/res/values/strings.xml | 1 |
6 files changed, 69 insertions, 8 deletions
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 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"> <androidx.fragment.app.FragmentContainerView - android:id="@+id/cheat_warning" - android:name="org.dolphinemu.dolphinemu.features.cheats.ui.CheatWarningFragment" + android:id="@+id/cheats_warning" + android:name="org.dolphinemu.dolphinemu.features.cheats.ui.CheatsDisabledWarningFragment" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toTopOf="@id/gfx_mods_warning" /> + + <androidx.fragment.app.FragmentContainerView + android:id="@+id/gfx_mods_warning" + android:name="org.dolphinemu.dolphinemu.features.cheats.ui.GraphicsModsDisabledWarningFragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/cheats_warning" app:layout_constraintBottom_toTopOf="@id/cheat_list" /> <androidx.recyclerview.widget.RecyclerView @@ -21,7 +31,7 @@ android:layout_height="0dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toBottomOf="@id/cheat_warning" + app:layout_constraintTop_toBottomOf="@id/gfx_mods_warning" app:layout_constraintBottom_toBottomOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> 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 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" @@ -10,7 +11,7 @@ android:layout_width="0dp" android:layout_height="match_parent" android:layout_margin="@dimen/spacing_large" - android:text="@string/cheats_disabled_warning" + tools:text="@string/cheats_disabled_warning" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/button_settings" app:layout_constraintStart_toStartOf="parent" diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index 7b1d1b7bf4..1b8b3583cf 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -511,6 +511,7 @@ <string name="cheats_download_empty">File contained no codes.</string> <string name="cheats_download_succeeded">Downloaded %1$d codes. (added %2$d)</string> <string name="cheats_disabled_warning">Dolphin\'s cheat system is currently disabled.</string> + <string name="gfx_mods_disabled_warning">Graphics mods are currently disabled.</string> <string name="cheats_open_settings">Settings</string> <!-- Convert Screen --> |
