summaryrefslogtreecommitdiff
path: root/Source/Android/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Android/app/src/main/java')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivity.java22
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivityPresenter.java62
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivityView.java39
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java25
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragment.java22
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentView.java35
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SingleChoiceViewHolder.java2
7 files changed, 53 insertions, 154 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivity.java
index 17e53da132..99ec999f39 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivity.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivity.java
@@ -305,27 +305,9 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
}
@Override
- public void onSerialPort1SettingChanged(MenuTag menuTag, int value)
+ public void onMenuTagAction(@NonNull MenuTag menuTag, int value)
{
- mPresenter.onSerialPort1SettingChanged(menuTag, value);
- }
-
- @Override
- public void onGcPadSettingChanged(MenuTag key, int value)
- {
- mPresenter.onGcPadSettingChanged(key, value);
- }
-
- @Override
- public void onWiimoteSettingChanged(MenuTag section, int value)
- {
- mPresenter.onWiimoteSettingChanged(section, value);
- }
-
- @Override
- public void onExtensionSettingChanged(MenuTag menuTag, int value)
- {
- mPresenter.onExtensionSettingChanged(menuTag, value);
+ mPresenter.onMenuTagAction(menuTag, value);
}
@Override
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivityPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivityPresenter.java
index 710342a64e..8bc2e2141f 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivityPresenter.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivityPresenter.java
@@ -5,6 +5,7 @@ package org.dolphinemu.dolphinemu.features.settings.ui;
import android.os.Bundle;
import android.text.TextUtils;
+import androidx.annotation.NonNull;
import androidx.core.app.ComponentActivity;
import org.dolphinemu.dolphinemu.R;
@@ -128,47 +129,50 @@ public final class SettingsActivityPresenter
return mShouldSave;
}
- public void onSerialPort1SettingChanged(MenuTag key, int value)
+ public void onMenuTagAction(@NonNull MenuTag menuTag, int value)
{
- if (value != 0 && value != 255) // Not disabled or dummy
+ if (menuTag.isSerialPort1Menu())
{
- Bundle bundle = new Bundle();
- bundle.putInt(SettingsFragmentPresenter.ARG_SERIALPORT1_TYPE, value);
- mView.showSettingsFragment(key, bundle, true, mGameId);
+ if (value != 0 && value != 255) // Not disabled or dummy
+ {
+ Bundle bundle = new Bundle();
+ bundle.putInt(SettingsFragmentPresenter.ARG_SERIALPORT1_TYPE, value);
+ mView.showSettingsFragment(menuTag, bundle, true, mGameId);
+ }
}
- }
- public void onGcPadSettingChanged(MenuTag key, int value)
- {
- if (value != 0) // Not disabled
+ if (menuTag.isGCPadMenu())
{
- Bundle bundle = new Bundle();
- bundle.putInt(SettingsFragmentPresenter.ARG_CONTROLLER_TYPE, value);
- mView.showSettingsFragment(key, bundle, true, mGameId);
+ if (value != 0) // Not disabled
+ {
+ Bundle bundle = new Bundle();
+ bundle.putInt(SettingsFragmentPresenter.ARG_CONTROLLER_TYPE, value);
+ mView.showSettingsFragment(menuTag, bundle, true, mGameId);
+ }
}
- }
- public void onWiimoteSettingChanged(MenuTag menuTag, int value)
- {
- switch (value)
+ if (menuTag.isWiimoteMenu())
{
- case 1:
- mView.showSettingsFragment(menuTag, null, true, mGameId);
- break;
+ switch (value)
+ {
+ case 1:
+ mView.showSettingsFragment(menuTag, null, true, mGameId);
+ break;
- case 2:
- mView.showToastMessage(mActivity.getString(R.string.make_sure_continuous_scan_enabled));
- break;
+ case 2:
+ mView.showToastMessage(mActivity.getString(R.string.make_sure_continuous_scan_enabled));
+ break;
+ }
}
- }
- public void onExtensionSettingChanged(MenuTag menuTag, int value)
- {
- if (value != 0) // None
+ if (menuTag.isWiimoteExtensionMenu())
{
- Bundle bundle = new Bundle();
- bundle.putInt(SettingsFragmentPresenter.ARG_CONTROLLER_TYPE, value);
- mView.showSettingsFragment(menuTag, bundle, true, mGameId);
+ if (value != 0) // None
+ {
+ Bundle bundle = new Bundle();
+ bundle.putInt(SettingsFragmentPresenter.ARG_CONTROLLER_TYPE, value);
+ mView.showSettingsFragment(menuTag, bundle, true, mGameId);
+ }
}
}
}
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivityView.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivityView.java
index da14f5c5cb..cb0c23f7be 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivityView.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivityView.java
@@ -4,6 +4,8 @@ package org.dolphinemu.dolphinemu.features.settings.ui;
import android.os.Bundle;
+import androidx.annotation.NonNull;
+
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
/**
@@ -59,40 +61,13 @@ public interface SettingsActivityView
void onSettingChanged();
/**
- * Called by a containing Fragment to tell the containing Activity that the Serial Port 1 setting
- * was modified.
- *
- * @param menuTag Identifier for the SerialPort that was modified.
- * @param value New setting for the SerialPort.
- */
- void onSerialPort1SettingChanged(MenuTag menuTag, int value);
-
- /**
- * Called by a containing Fragment to tell the containing Activity that a GCPad's setting
- * was modified.
- *
- * @param menuTag Identifier for the GCPad that was modified.
- * @param value New setting for the GCPad.
- */
- void onGcPadSettingChanged(MenuTag menuTag, int value);
-
- /**
- * Called by a containing Fragment to tell the containing Activity that a Wiimote's setting
- * was modified.
- *
- * @param menuTag Identifier for Wiimote that was modified.
- * @param value New setting for the Wiimote.
- */
- void onWiimoteSettingChanged(MenuTag menuTag, int value);
-
- /**
- * Called by a containing Fragment to tell the containing Activity that an extension setting
- * was modified.
+ * Called by a containing Fragment to tell the containing Activity that the user wants to open the
+ * MenuTag associated with a setting.
*
- * @param menuTag Identifier for the extension that was modified.
- * @param value New setting for the extension.
+ * @param menuTag The MenuTag to open.
+ * @param value The current value of the associated setting.
*/
- void onExtensionSettingChanged(MenuTag menuTag, int value);
+ void onMenuTagAction(@NonNull MenuTag menuTag, int value);
/**
* Show loading dialog while loading the settings
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java
index be46ded8a1..cc9bf8f85e 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java
@@ -467,30 +467,9 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
}
}
- public void handleMenuTag(MenuTag menuTag, int value)
+ public void onMenuTagAction(@NonNull MenuTag menuTag, int value)
{
- if (menuTag != null)
- {
- if (menuTag.isSerialPort1Menu())
- {
- mView.onSerialPort1SettingChanged(menuTag, value);
- }
-
- if (menuTag.isGCPadMenu())
- {
- mView.onGcPadSettingChanged(menuTag, value);
- }
-
- if (menuTag.isWiimoteMenu())
- {
- mView.onWiimoteSettingChanged(menuTag, value);
- }
-
- if (menuTag.isWiimoteExtensionMenu())
- {
- mView.onExtensionSettingChanged(menuTag, value);
- }
- }
+ mView.onMenuTagAction(menuTag, value);
}
@Override
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragment.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragment.java
index b1eef00d7d..c9a9040b2e 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragment.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragment.java
@@ -226,27 +226,9 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
}
@Override
- public void onSerialPort1SettingChanged(MenuTag menuTag, int value)
+ public void onMenuTagAction(@NonNull MenuTag menuTag, int value)
{
- mActivity.onSerialPort1SettingChanged(menuTag, value);
- }
-
- @Override
- public void onGcPadSettingChanged(MenuTag menuTag, int value)
- {
- mActivity.onGcPadSettingChanged(menuTag, value);
- }
-
- @Override
- public void onWiimoteSettingChanged(MenuTag menuTag, int value)
- {
- mActivity.onWiimoteSettingChanged(menuTag, value);
- }
-
- @Override
- public void onExtensionSettingChanged(MenuTag menuTag, int value)
- {
- mActivity.onExtensionSettingChanged(menuTag, value);
+ mActivity.onMenuTagAction(menuTag, value);
}
private void setInsets()
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentView.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentView.java
index e79ef6a859..7deeead9d2 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentView.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentView.java
@@ -2,6 +2,7 @@
package org.dolphinemu.dolphinemu.features.settings.ui;
+import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentActivity;
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
@@ -72,35 +73,11 @@ public interface SettingsFragmentView
void onSettingChanged();
/**
- * Called by a containing Fragment to tell the containing Activity that the Serial Port 1 setting
- * was modified.
+ * Have the fragment tell the containing Activity that the user wants to open the MenuTag
+ * associated with a setting.
*
- * @param menuTag Identifier for the SerialPort that was modified.
- * @param value New setting for the SerialPort.
+ * @param menuTag The MenuTag to open.
+ * @param value The current value of the associated setting.
*/
- void onSerialPort1SettingChanged(MenuTag menuTag, int value);
-
- /**
- * Have the fragment tell the containing Activity that a GCPad's setting was modified.
- *
- * @param menuTag Identifier for the GCPad that was modified.
- * @param value New setting for the GCPad.
- */
- void onGcPadSettingChanged(MenuTag menuTag, int value);
-
- /**
- * Have the fragment tell the containing Activity that a Wiimote's setting was modified.
- *
- * @param menuTag Identifier for Wiimote that was modified.
- * @param value New setting for the Wiimote.
- */
- void onWiimoteSettingChanged(MenuTag menuTag, int value);
-
- /**
- * Have the fragment tell the containing Activity that an extension setting was modified.
- *
- * @param menuTag Identifier for the extension that was modified.
- * @param value New setting for the extension.
- */
- void onExtensionSettingChanged(MenuTag menuTag, int value);
+ void onMenuTagAction(@NonNull MenuTag menuTag, int value);
}
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SingleChoiceViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SingleChoiceViewHolder.java
index ba7bae3901..462ed4bb53 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SingleChoiceViewHolder.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SingleChoiceViewHolder.java
@@ -108,7 +108,7 @@ public final class SingleChoiceViewHolder extends SettingViewHolder
final MenuTag finalMenuTag = menuTag;
final Function<Settings, Integer> finalGetSelectedValue = getSelectedValue;
mBinding.buttonMoreSettings.setOnClickListener((view) ->
- adapter.handleMenuTag(finalMenuTag, finalGetSelectedValue.apply(settings)));
+ adapter.onMenuTagAction(finalMenuTag, finalGetSelectedValue.apply(settings)));
}
else
{