From 98c688ee6883bd015e15dee063f4d083401795b5 Mon Sep 17 00:00:00 2001 From: codedwrench Date: Sat, 30 Apr 2022 19:15:57 +0200 Subject: [PATCH] Android: XLink Kai Android UI option --- .../settings/model/BooleanSetting.java | 2 + .../features/settings/model/IntSetting.java | 2 + .../settings/model/StringSetting.java | 4 + .../settings/model/view/HeaderSetting.java | 2 +- .../model/view/HyperLinkHeaderSetting.java | 19 +++++ .../model/view/InputStringSetting.java | 72 +++++++++++++++++ .../settings/model/view/SettingsItem.java | 2 + .../features/settings/ui/MenuTag.java | 6 ++ .../settings/ui/SettingsActivity.java | 6 ++ .../ui/SettingsActivityPresenter.java | 10 +++ .../settings/ui/SettingsActivityView.java | 9 +++ .../features/settings/ui/SettingsAdapter.java | 45 +++++++++++ .../settings/ui/SettingsFragment.java | 7 ++ .../ui/SettingsFragmentPresenter.java | 26 +++++++ .../settings/ui/SettingsFragmentView.java | 9 +++ .../viewholder/HeaderHyperLinkViewHolder.java | 33 ++++++++ .../ui/viewholder/HeaderViewHolder.java | 4 +- .../InputStringSettingViewHolder.java | 77 +++++++++++++++++++ .../main/res/layout/dialog_input_string.xml | 19 +++++ .../app/src/main/res/values/arrays.xml | 12 +++ .../app/src/main/res/values/strings.xml | 7 ++ 21 files changed, 370 insertions(+), 3 deletions(-) create mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/HyperLinkHeaderSetting.java create mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InputStringSetting.java create mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderHyperLinkViewHolder.java create mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/InputStringSettingViewHolder.java create mode 100644 Source/Android/app/src/main/res/layout/dialog_input_string.xml diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java index b6e63895a3..b419099808 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java @@ -18,6 +18,8 @@ public enum BooleanSetting implements AbstractBooleanSetting MAIN_OVERRIDE_REGION_SETTINGS(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "OverrideRegionSettings", false), MAIN_AUDIO_STRETCH(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AudioStretch", false), + MAIN_BBA_XLINK_CHAT_OSD(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "BBA_XLINK_CHAT_OSD", + false), MAIN_ADAPTER_RUMBLE_0(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AdapterRumble0", true), MAIN_ADAPTER_RUMBLE_1(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AdapterRumble1", true), MAIN_ADAPTER_RUMBLE_2(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AdapterRumble2", true), diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java index 98601a1741..a06c4f8d61 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java @@ -20,6 +20,7 @@ public enum IntSetting implements AbstractIntSetting MAIN_GC_LANGUAGE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SelectedLanguage", 0), MAIN_SLOT_A(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SlotA", 8), MAIN_SLOT_B(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SlotB", 255), + MAIN_SERIAL_PORT_1(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SerialPort1", 255), MAIN_FALLBACK_REGION(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "FallbackRegion", 2), MAIN_SI_DEVICE_0(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SIDevice0", 6), MAIN_SI_DEVICE_1(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SIDevice1", 0), @@ -77,6 +78,7 @@ public enum IntSetting implements AbstractIntSetting MAIN_GC_LANGUAGE, MAIN_SLOT_A, // Can actually be changed, but specific code is required MAIN_SLOT_B, // Can actually be changed, but specific code is required + MAIN_SERIAL_PORT_1, MAIN_FALLBACK_REGION, MAIN_SI_DEVICE_0, // Can actually be changed, but specific code is required MAIN_SI_DEVICE_1, // Can actually be changed, but specific code is required diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/StringSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/StringSetting.java index 5cb9127a58..751d18f90f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/StringSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/StringSetting.java @@ -13,6 +13,10 @@ public enum StringSetting implements AbstractStringSetting // These entries have the same names and order as in C++, just for consistency. MAIN_DEFAULT_ISO(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "DefaultISO", ""), + + MAIN_BBA_MAC(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "BBA_MAC", ""), + MAIN_BBA_XLINK_IP(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "BBA_XLINK_IP", ""), + MAIN_GFX_BACKEND(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "GFXBackend", NativeLibrary.GetDefaultGraphicsBackendName()), diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/HeaderSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/HeaderSetting.java index 5f0605553c..14c5f49021 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/HeaderSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/HeaderSetting.java @@ -6,7 +6,7 @@ import android.content.Context; import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting; -public final class HeaderSetting extends SettingsItem +public class HeaderSetting extends SettingsItem { public HeaderSetting(Context context, int titleId, int descriptionId) { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/HyperLinkHeaderSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/HyperLinkHeaderSetting.java new file mode 100644 index 0000000000..785e6cd6f6 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/HyperLinkHeaderSetting.java @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +package org.dolphinemu.dolphinemu.features.settings.model.view; + +import android.content.Context; + +public final class HyperLinkHeaderSetting extends HeaderSetting +{ + public HyperLinkHeaderSetting(Context context, int titleId, int descriptionId) + { + super(context, titleId, descriptionId); + } + + @Override + public int getType() + { + return SettingsItem.TYPE_HYPERLINK_HEADER; + } +} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InputStringSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InputStringSetting.java new file mode 100644 index 0000000000..90773e1762 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InputStringSetting.java @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +package org.dolphinemu.dolphinemu.features.settings.model.view; + +import android.content.Context; + +import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting; +import org.dolphinemu.dolphinemu.features.settings.model.AbstractStringSetting; +import org.dolphinemu.dolphinemu.features.settings.model.Settings; +import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag; + +public class InputStringSetting extends SettingsItem +{ + private AbstractStringSetting mSetting; + + private MenuTag mMenuTag; + + public InputStringSetting(Context context, AbstractStringSetting setting, int titleId, + int descriptionId, MenuTag menuTag) + { + super(context, titleId, descriptionId); + mSetting = setting; + mMenuTag = menuTag; + } + + public InputStringSetting(Context context, AbstractStringSetting setting, int titleId, + int descriptionId) + { + this(context, setting, titleId, descriptionId, null); + } + + public InputStringSetting(Context context, AbstractStringSetting setting, int titleId, + int descriptionId, int choicesId, int valuesId, MenuTag menuTag) + { + super(context, titleId, descriptionId); + mSetting = setting; + mMenuTag = menuTag; + } + + public InputStringSetting(Context context, AbstractStringSetting setting, int titleId, + int descriptionId, int choicesId, int valuesId) + { + this(context, setting, titleId, descriptionId, choicesId, valuesId, null); + } + + public String getSelectedValue(Settings settings) + { + return mSetting.getString(settings); + } + + public MenuTag getMenuTag() + { + return mMenuTag; + } + + public void setSelectedValue(Settings settings, String selection) + { + mSetting.setString(settings, selection); + } + + @Override + public int getType() + { + return TYPE_STRING; + } + + @Override + public AbstractSetting getSetting() + { + return mSetting; + } +} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.java index fade63e26d..ffb653d26f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.java @@ -27,6 +27,8 @@ public abstract class SettingsItem public static final int TYPE_SINGLE_CHOICE_DYNAMIC_DESCRIPTIONS = 8; public static final int TYPE_FILE_PICKER = 9; public static final int TYPE_RUN_RUNNABLE = 10; + public static final int TYPE_STRING = 11; + public static final int TYPE_HYPERLINK_HEADER = 12; private final CharSequence mName; private final CharSequence mDescription; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/MenuTag.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/MenuTag.java index aa5d4216a0..38cb3382ef 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/MenuTag.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/MenuTag.java @@ -13,6 +13,7 @@ public enum MenuTag CONFIG_AUDIO("config_audio"), CONFIG_PATHS("config_paths"), CONFIG_GAME_CUBE("config_gamecube"), + CONFIG_SERIALPORT1("config_serialport1"), CONFIG_WII("config_wii"), CONFIG_ADVANCED("config_advanced"), CONFIG_LOG("config_log"), @@ -74,6 +75,11 @@ public enum MenuTag return subType; } + public boolean isSerialPort1Menu() + { + return this == CONFIG_SERIALPORT1; + } + public boolean isGCPadMenu() { return this == GCPAD_1 || this == GCPAD_2 || this == GCPAD_3 || this == GCPAD_4; 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 baaf955e96..8f3d587b3f 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 @@ -277,6 +277,12 @@ public final class SettingsActivity extends AppCompatActivity implements Setting mPresenter.onSettingChanged(); } + @Override + public void onSerialPort1SettingChanged(MenuTag menuTag, int value) + { + mPresenter.onSerialPort1SettingChanged(menuTag, value); + } + @Override public void onGcPadSettingChanged(MenuTag key, int value) { 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 78f3a78fd6..4135f06e01 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 @@ -135,6 +135,16 @@ public final class SettingsActivityPresenter return mShouldSave; } + public void onSerialPort1SettingChanged(MenuTag key, int value) + { + if (value != 0 && value != 255) // Not disabled or dummy + { + Bundle bundle = new Bundle(); + bundle.putInt(SettingsFragmentPresenter.ARG_SERIALPORT1_TYPE, value); + mView.showSettingsFragment(key, bundle, true, mGameId); + } + } + public void onGcPadSettingChanged(MenuTag key, int value) { if (value != 0) // Not disabled 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 0b04ee7875..d126920c24 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 @@ -58,6 +58,15 @@ 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. 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 3f8499a4ef..75f184f5b0 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 @@ -10,6 +10,7 @@ import android.provider.DocumentsContract; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.EditText; import android.widget.SeekBar; import android.widget.TextView; @@ -29,12 +30,15 @@ import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem; import org.dolphinemu.dolphinemu.features.settings.model.view.SingleChoiceSetting; import org.dolphinemu.dolphinemu.features.settings.model.view.SingleChoiceSettingDynamicDescriptions; import org.dolphinemu.dolphinemu.features.settings.model.view.SliderSetting; +import org.dolphinemu.dolphinemu.features.settings.model.view.InputStringSetting; import org.dolphinemu.dolphinemu.features.settings.model.view.StringSingleChoiceSetting; import org.dolphinemu.dolphinemu.features.settings.model.view.SubmenuSetting; import org.dolphinemu.dolphinemu.features.settings.ui.viewholder.CheckBoxSettingViewHolder; import org.dolphinemu.dolphinemu.features.settings.ui.viewholder.FilePickerViewHolder; +import org.dolphinemu.dolphinemu.features.settings.ui.viewholder.HeaderHyperLinkViewHolder; import org.dolphinemu.dolphinemu.features.settings.ui.viewholder.HeaderViewHolder; import org.dolphinemu.dolphinemu.features.settings.ui.viewholder.InputBindingSettingViewHolder; +import org.dolphinemu.dolphinemu.features.settings.ui.viewholder.InputStringSettingViewHolder; import org.dolphinemu.dolphinemu.features.settings.ui.viewholder.RumbleBindingViewHolder; import org.dolphinemu.dolphinemu.features.settings.ui.viewholder.RunRunnableViewHolder; import org.dolphinemu.dolphinemu.features.settings.ui.viewholder.SettingViewHolder; @@ -119,6 +123,14 @@ public final class SettingsAdapter extends RecyclerView.Adapter + { + String editTextInput = input.getText().toString(); + + if (!item.getSelectedValue(mView.getSettings()).equals(editTextInput)) + { + notifyItemChanged(position); + mView.onSettingChanged(); + } + + item.setSelectedValue(mView.getSettings(), editTextInput); + }); + builder.setNegativeButton(R.string.cancel, null); + + mDialog = builder.show(); + } + public void onSingleChoiceClick(SingleChoiceSetting item, int position) { mClickedItem = item; @@ -364,6 +404,11 @@ public final class SettingsAdapter extends RecyclerView.Adapter mSettingsList; + private int mSerialPort1Type; private int mControllerNumber; private int mControllerType; @@ -83,6 +87,10 @@ public final class SettingsFragmentPresenter { mControllerNumber = menuTag.getSubType(); } + else if (menuTag.isSerialPort1Menu()) + { + mSerialPort1Type = extras.getInt(ARG_SERIALPORT1_TYPE); + } } public void onViewCreated(MenuTag menuTag, Settings settings) @@ -167,6 +175,10 @@ public final class SettingsFragmentPresenter addGraphicsSettings(sl); break; + case CONFIG_SERIALPORT1: + addSerialPortSubSettings(sl, mSerialPort1Type); + break; + case GCPAD_TYPE: addGcPadSettings(sl); break; @@ -425,6 +437,10 @@ public final class SettingsFragmentPresenter R.array.slotDeviceEntries, R.array.slotDeviceValues)); sl.add(new SingleChoiceSetting(mContext, IntSetting.MAIN_SLOT_B, R.string.slot_b_device, 0, R.array.slotDeviceEntries, R.array.slotDeviceValues)); + sl.add(new SingleChoiceSetting(mContext, IntSetting.MAIN_SERIAL_PORT_1, + R.string.serial_port_1_device, 0, + R.array.serialPort1DeviceEntries, R.array.serialPort1DeviceValues, + MenuTag.CONFIG_SERIALPORT1)); } private void addWiiSettings(ArrayList sl) @@ -559,6 +575,16 @@ public final class SettingsFragmentPresenter R.array.synchronizeGpuThreadValues)); } + private void addSerialPortSubSettings(ArrayList sl, int serialPort1Type) + { + if (serialPort1Type == 10) // XLink Kai + { + sl.add(new HyperLinkHeaderSetting(mContext, R.string.xlink_kai_guide_header, 0)); + sl.add(new InputStringSetting(mContext, StringSetting.MAIN_BBA_XLINK_IP, + R.string.xlink_kai_bba_ip, R.string.xlink_kai_bba_ip_description)); + } + } + private void addGcPadSettings(ArrayList sl) { sl.add(new SingleChoiceSetting(mContext, IntSetting.MAIN_SI_DEVICE_0, R.string.controller_0, 0, 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 04736091df..e79ef6a859 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 @@ -71,6 +71,15 @@ public interface SettingsFragmentView */ 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); + /** * Have the fragment tell the containing Activity that a GCPad's setting was modified. * diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderHyperLinkViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderHyperLinkViewHolder.java new file mode 100644 index 0000000000..8a30e34fff --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderHyperLinkViewHolder.java @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +package org.dolphinemu.dolphinemu.features.settings.ui.viewholder; + +import android.content.Context; +import android.text.method.LinkMovementMethod; +import android.view.View; + +import androidx.core.content.ContextCompat; + +import org.dolphinemu.dolphinemu.R; +import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem; +import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter; + +public final class HeaderHyperLinkViewHolder extends HeaderViewHolder +{ + private Context mContext; + + public HeaderHyperLinkViewHolder(View itemView, SettingsAdapter adapter, Context context) + { + super(itemView, adapter); + mContext = context; + itemView.setOnClickListener(null); + } + + @Override + public void bind(SettingsItem item) + { + super.bind(item); + mHeaderName.setMovementMethod(LinkMovementMethod.getInstance()); + mHeaderName.setLinkTextColor(ContextCompat.getColor(mContext, R.color.dolphin_blue_secondary)); + } +} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderViewHolder.java index eaa2014364..4422d9081d 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderViewHolder.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/HeaderViewHolder.java @@ -11,9 +11,9 @@ import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem; import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter; -public final class HeaderViewHolder extends SettingViewHolder +public class HeaderViewHolder extends SettingViewHolder { - private TextView mHeaderName; + protected TextView mHeaderName; public HeaderViewHolder(View itemView, SettingsAdapter adapter) { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/InputStringSettingViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/InputStringSettingViewHolder.java new file mode 100644 index 0000000000..da36fb1953 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/InputStringSettingViewHolder.java @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +package org.dolphinemu.dolphinemu.features.settings.ui.viewholder; + +import android.text.TextUtils; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.Nullable; + +import org.dolphinemu.dolphinemu.R; +import org.dolphinemu.dolphinemu.features.settings.model.view.InputStringSetting; +import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem; +import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter; + +public final class InputStringSettingViewHolder extends SettingViewHolder +{ + private InputStringSetting mInputString; + + private TextView mTextSettingName; + private TextView mTextSettingDescription; + + public InputStringSettingViewHolder(View itemView, SettingsAdapter adapter) + { + super(itemView, adapter); + } + + @Override + protected void findViews(View root) + { + mTextSettingName = root.findViewById(R.id.text_setting_name); + mTextSettingDescription = root.findViewById(R.id.text_setting_description); + } + + @Override + public void bind(SettingsItem item) + { + mInputString = (InputStringSetting) item; + + String inputString = mInputString.getSelectedValue(getAdapter().getSettings()); + + mTextSettingName.setText(item.getName()); + + if (!TextUtils.isEmpty(inputString)) + { + mTextSettingDescription.setText(inputString); + } + else + { + mTextSettingDescription.setText(item.getDescription()); + } + + setStyle(mTextSettingName, mInputString); + } + + @Override + public void onClick(View clicked) + { + if (!mInputString.isEditable()) + { + showNotRuntimeEditableError(); + return; + } + + int position = getAdapterPosition(); + + getAdapter().onInputStringClick(mInputString, position); + + setStyle(mTextSettingName, mInputString); + } + + @Nullable @Override + protected SettingsItem getItem() + { + return mInputString; + } +} diff --git a/Source/Android/app/src/main/res/layout/dialog_input_string.xml b/Source/Android/app/src/main/res/layout/dialog_input_string.xml new file mode 100644 index 0000000000..0af48d47fe --- /dev/null +++ b/Source/Android/app/src/main/res/layout/dialog_input_string.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/Source/Android/app/src/main/res/values/arrays.xml b/Source/Android/app/src/main/res/values/arrays.xml index 2833d23b86..ff8050b9cb 100644 --- a/Source/Android/app/src/main/res/values/arrays.xml +++ b/Source/Android/app/src/main/res/values/arrays.xml @@ -97,6 +97,18 @@ 8 + + + Nothing + Dummy + Broadband Adapter (XLink Kai) + + + 255 + 0 + 10 + + Japanese diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index 765310156f..e7b1318b82 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -131,6 +131,7 @@ System Language GameCube Slot A Device GameCube Slot B Device + GameCube Serial Port 1 Device Wii Widescreen Changes aspect ratio from 4:3 to 16:9 in games that support it. @@ -160,6 +161,12 @@ Generate a New Statistics Identity Are you sure you want to generate a new statistics identity? + + Serial Port 1 + For setup instructions, refer to this page. + XLink Kai IP Address/hostname + IP address or hostname of device running the XLink Kai client + Interface Screen Orientation During Emulation