Android: Add warning if graphics mods are not enabled
This commit is contained in:
parent
8f410bff15
commit
3bd2bca385
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,21 +7,35 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.R;
|
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.model.Settings;
|
||||||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity;
|
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 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
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||||
|
@ -35,6 +49,9 @@ public class CheatWarningFragment extends Fragment implements View.OnClickListen
|
||||||
{
|
{
|
||||||
mView = view;
|
mView = view;
|
||||||
|
|
||||||
|
TextView textView = view.findViewById(R.id.text_warning);
|
||||||
|
textView.setText(mText);
|
||||||
|
|
||||||
Button settingsButton = view.findViewById(R.id.button_settings);
|
Button settingsButton = view.findViewById(R.id.button_settings);
|
||||||
settingsButton.setOnClickListener(this);
|
settingsButton.setOnClickListener(this);
|
||||||
|
|
||||||
|
@ -51,13 +68,13 @@ public class CheatWarningFragment extends Fragment implements View.OnClickListen
|
||||||
CheatsActivity activity = (CheatsActivity) requireActivity();
|
CheatsActivity activity = (CheatsActivity) requireActivity();
|
||||||
try (Settings settings = activity.loadGameSpecificSettings())
|
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);
|
mView.setVisibility(cheatsEnabled ? View.GONE : View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick(View view)
|
public void onClick(View view)
|
||||||
{
|
{
|
||||||
SettingsActivity.launch(requireContext(), MenuTag.CONFIG_GENERAL);
|
SettingsActivity.launch(requireContext(), mSettingShortcut);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,13 +6,23 @@
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.fragment.app.FragmentContainerView
|
<androidx.fragment.app.FragmentContainerView
|
||||||
android:id="@+id/cheat_warning"
|
android:id="@+id/cheats_warning"
|
||||||
android:name="org.dolphinemu.dolphinemu.features.cheats.ui.CheatWarningFragment"
|
android:name="org.dolphinemu.dolphinemu.features.cheats.ui.CheatsDisabledWarningFragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="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" />
|
app:layout_constraintBottom_toTopOf="@id/cheat_list" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
@ -21,7 +31,7 @@
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="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" />
|
app:layout_constraintBottom_toBottomOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<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"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -10,7 +11,7 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/spacing_large"
|
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_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@id/button_settings"
|
app:layout_constraintEnd_toStartOf="@id/button_settings"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|
|
@ -511,6 +511,7 @@
|
||||||
<string name="cheats_download_empty">File contained no codes.</string>
|
<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_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="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>
|
<string name="cheats_open_settings">Settings</string>
|
||||||
|
|
||||||
<!-- Convert Screen -->
|
<!-- Convert Screen -->
|
||||||
|
|
Loading…
Reference in New Issue