Android: Use CharSequence for SettingsItem name/description
This commit is contained in:
parent
049b92b7ef
commit
a8f48feddb
|
@ -1,5 +1,7 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractBooleanSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
|
@ -8,9 +10,10 @@ public class CheckBoxSetting extends SettingsItem
|
|||
{
|
||||
protected AbstractBooleanSetting mSetting;
|
||||
|
||||
public CheckBoxSetting(AbstractBooleanSetting setting, int titleId, int descriptionId)
|
||||
public CheckBoxSetting(Context context, AbstractBooleanSetting setting, int titleId,
|
||||
int descriptionId)
|
||||
{
|
||||
super(titleId, descriptionId);
|
||||
super(context, titleId, descriptionId);
|
||||
mSetting = setting;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
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;
|
||||
|
@ -12,10 +14,10 @@ public final class FilePicker extends SettingsItem
|
|||
private int mRequestType;
|
||||
private String mDefaultPathRelativeToUserDirectory;
|
||||
|
||||
public FilePicker(AbstractStringSetting setting, int titleId, int descriptionId, int requestType,
|
||||
@Nullable String defaultPathRelativeToUserDirectory)
|
||||
public FilePicker(Context context, AbstractStringSetting setting, int titleId, int descriptionId,
|
||||
int requestType, @Nullable String defaultPathRelativeToUserDirectory)
|
||||
{
|
||||
super(titleId, descriptionId);
|
||||
super(context, titleId, descriptionId);
|
||||
mSetting = setting;
|
||||
mRequestType = requestType;
|
||||
mDefaultPathRelativeToUserDirectory = defaultPathRelativeToUserDirectory;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractFloatSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
|
@ -8,10 +10,10 @@ public class FloatSliderSetting extends SliderSetting
|
|||
{
|
||||
protected AbstractFloatSetting mSetting;
|
||||
|
||||
public FloatSliderSetting(AbstractFloatSetting setting, int titleId, int descriptionId, int min,
|
||||
int max, String units)
|
||||
public FloatSliderSetting(Context context, AbstractFloatSetting setting, int titleId,
|
||||
int descriptionId, int min, int max, String units)
|
||||
{
|
||||
super(titleId, descriptionId, min, max, units);
|
||||
super(context, titleId, descriptionId, min, max, units);
|
||||
mSetting = setting;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting;
|
||||
|
||||
public final class HeaderSetting extends SettingsItem
|
||||
{
|
||||
public HeaderSetting(int titleId, int descriptionId)
|
||||
public HeaderSetting(Context context, int titleId, int descriptionId)
|
||||
{
|
||||
super(titleId, descriptionId);
|
||||
super(context, titleId, descriptionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.InputDevice;
|
||||
|
@ -17,9 +18,10 @@ public class InputBindingSetting extends SettingsItem
|
|||
|
||||
private String mGameId;
|
||||
|
||||
public InputBindingSetting(String file, String section, String key, int titleId, String gameId)
|
||||
public InputBindingSetting(Context context, String file, String section, String key, int titleId,
|
||||
String gameId)
|
||||
{
|
||||
super(titleId, 0);
|
||||
super(context, titleId, 0);
|
||||
mFile = file;
|
||||
mSection = section;
|
||||
mKey = key;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractIntSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
|
@ -8,10 +10,10 @@ public final class IntSliderSetting extends SliderSetting
|
|||
{
|
||||
private AbstractIntSetting mSetting;
|
||||
|
||||
public IntSliderSetting(AbstractIntSetting setting, int titleId, int descriptionId, int min,
|
||||
int max, String units)
|
||||
public IntSliderSetting(Context context, AbstractIntSetting setting, int titleId,
|
||||
int descriptionId, int min, int max, String units)
|
||||
{
|
||||
super(titleId, descriptionId, min, max, units);
|
||||
super(context, titleId, descriptionId, min, max, units);
|
||||
mSetting = setting;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractBooleanSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
|
||||
public final class InvertedCheckBoxSetting extends CheckBoxSetting
|
||||
{
|
||||
public InvertedCheckBoxSetting(AbstractBooleanSetting setting, int titleId,
|
||||
public InvertedCheckBoxSetting(Context context, AbstractBooleanSetting setting, int titleId,
|
||||
int descriptionId)
|
||||
{
|
||||
super(setting, titleId, descriptionId);
|
||||
super(context, setting, titleId, descriptionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AdHocBooleanSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
|
||||
|
@ -7,9 +9,10 @@ public class LogCheckBoxSetting extends CheckBoxSetting
|
|||
{
|
||||
String mKey;
|
||||
|
||||
public LogCheckBoxSetting(String key, int titleId, int descriptionId)
|
||||
public LogCheckBoxSetting(Context context, String key, int titleId, int descriptionId)
|
||||
{
|
||||
super(new AdHocBooleanSetting(Settings.FILE_LOGGER, Settings.SECTION_LOGGER_LOGS, key, false),
|
||||
super(context,
|
||||
new AdHocBooleanSetting(Settings.FILE_LOGGER, Settings.SECTION_LOGGER_LOGS, key, false),
|
||||
titleId, descriptionId);
|
||||
mKey = key;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractFloatSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
|
||||
public final class PercentSliderSetting extends FloatSliderSetting
|
||||
{
|
||||
public PercentSliderSetting(AbstractFloatSetting setting, int titleId, int descriptionId, int min,
|
||||
int max, String units)
|
||||
public PercentSliderSetting(Context context, AbstractFloatSetting setting, int titleId,
|
||||
int descriptionId, int min, int max, String units)
|
||||
{
|
||||
super(setting, titleId, descriptionId, min, max, units);
|
||||
super(context, setting, titleId, descriptionId, min, max, units);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Vibrator;
|
||||
import android.view.InputDevice;
|
||||
import android.view.KeyEvent;
|
||||
|
@ -12,9 +13,10 @@ import org.dolphinemu.dolphinemu.utils.Rumble;
|
|||
|
||||
public class RumbleBindingSetting extends InputBindingSetting
|
||||
{
|
||||
public RumbleBindingSetting(String file, String section, String key, int titleId, String gameId)
|
||||
public RumbleBindingSetting(Context context, String file, String section, String key, int titleId,
|
||||
String gameId)
|
||||
{
|
||||
super(file, section, key, titleId, gameId);
|
||||
super(context, file, section, key, titleId, gameId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting;
|
||||
|
||||
public final class RunRunnable extends SettingsItem
|
||||
|
@ -8,10 +10,10 @@ public final class RunRunnable extends SettingsItem
|
|||
private final int mToastTextAfterRun;
|
||||
private final Runnable mRunnable;
|
||||
|
||||
public RunRunnable(int titleId, int descriptionId, int alertText, int toastTextAfterRun,
|
||||
Runnable runnable)
|
||||
public RunRunnable(Context context, int titleId, int descriptionId, int alertText,
|
||||
int toastTextAfterRun, Runnable runnable)
|
||||
{
|
||||
super(titleId, descriptionId);
|
||||
super(context, titleId, descriptionId);
|
||||
mAlertText = alertText;
|
||||
mToastTextAfterRun = toastTextAfterRun;
|
||||
mRunnable = runnable;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.dolphinemu.dolphinemu.DolphinApplication;
|
||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
|
@ -24,33 +27,39 @@ public abstract class SettingsItem
|
|||
public static final int TYPE_FILE_PICKER = 9;
|
||||
public static final int TYPE_RUN_RUNNABLE = 10;
|
||||
|
||||
private final int mNameId;
|
||||
private final int mDescriptionId;
|
||||
private final CharSequence mName;
|
||||
private final CharSequence mDescription;
|
||||
|
||||
/**
|
||||
* Base constructor.
|
||||
*
|
||||
* @param nameId Resource ID for a text string to be displayed as this setting's name.
|
||||
* @param descriptionId Resource ID for a text string to be displayed as this setting's description.
|
||||
* @param name A text string to be displayed as this setting's name.
|
||||
* @param description A text string to be displayed as this setting's description.
|
||||
*/
|
||||
|
||||
public SettingsItem(int nameId, int descriptionId)
|
||||
public SettingsItem(CharSequence name, CharSequence description)
|
||||
{
|
||||
mNameId = nameId;
|
||||
mDescriptionId = descriptionId;
|
||||
mName = name;
|
||||
mDescription = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A resource ID for a text string representing this setting's name.
|
||||
* @param nameId Resource ID for a text string to be displayed as this setting's name.
|
||||
* @param descriptionId Resource ID for a text string to be displayed as this setting's description.
|
||||
*/
|
||||
public int getNameId()
|
||||
public SettingsItem(Context context, int nameId, int descriptionId)
|
||||
{
|
||||
return mNameId;
|
||||
mName = nameId == 0 ? "" : context.getText(nameId);
|
||||
mDescription = descriptionId == 0 ? "" : context.getText(descriptionId);
|
||||
}
|
||||
|
||||
public int getDescriptionId()
|
||||
public CharSequence getName()
|
||||
{
|
||||
return mDescriptionId;
|
||||
return mName;
|
||||
}
|
||||
|
||||
public CharSequence getDescription()
|
||||
{
|
||||
return mDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractIntSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
|
@ -13,20 +15,20 @@ public final class SingleChoiceSetting extends SettingsItem
|
|||
private int mValuesId;
|
||||
private MenuTag menuTag;
|
||||
|
||||
public SingleChoiceSetting(AbstractIntSetting setting, int titleId, int descriptionId,
|
||||
int choicesId, int valuesId, MenuTag menuTag)
|
||||
public SingleChoiceSetting(Context context, AbstractIntSetting setting, int titleId,
|
||||
int descriptionId, int choicesId, int valuesId, MenuTag menuTag)
|
||||
{
|
||||
super(titleId, descriptionId);
|
||||
super(context, titleId, descriptionId);
|
||||
mSetting = setting;
|
||||
mValuesId = valuesId;
|
||||
mChoicesId = choicesId;
|
||||
this.menuTag = menuTag;
|
||||
}
|
||||
|
||||
public SingleChoiceSetting(AbstractIntSetting setting, int titleId, int descriptionId,
|
||||
int choicesId, int valuesId)
|
||||
public SingleChoiceSetting(Context context, AbstractIntSetting setting, int titleId,
|
||||
int descriptionId, int choicesId, int valuesId)
|
||||
{
|
||||
this(setting, titleId, descriptionId, choicesId, valuesId, null);
|
||||
this(context, setting, titleId, descriptionId, choicesId, valuesId, null);
|
||||
}
|
||||
|
||||
public int getChoicesId()
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractIntSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
|
@ -15,11 +17,11 @@ public final class SingleChoiceSettingDynamicDescriptions extends SettingsItem
|
|||
private int mDescriptionValuesId;
|
||||
private MenuTag menuTag;
|
||||
|
||||
public SingleChoiceSettingDynamicDescriptions(AbstractIntSetting setting, int titleId,
|
||||
int descriptionId, int choicesId, int valuesId, int descriptionChoicesId,
|
||||
public SingleChoiceSettingDynamicDescriptions(Context context, AbstractIntSetting setting,
|
||||
int titleId, int descriptionId, int choicesId, int valuesId, int descriptionChoicesId,
|
||||
int descriptionValuesId, MenuTag menuTag)
|
||||
{
|
||||
super(titleId, descriptionId);
|
||||
super(context, titleId, descriptionId);
|
||||
mSetting = setting;
|
||||
mValuesId = valuesId;
|
||||
mChoicesId = choicesId;
|
||||
|
@ -28,11 +30,11 @@ public final class SingleChoiceSettingDynamicDescriptions extends SettingsItem
|
|||
this.menuTag = menuTag;
|
||||
}
|
||||
|
||||
public SingleChoiceSettingDynamicDescriptions(AbstractIntSetting setting, int titleId,
|
||||
int descriptionId, int choicesId, int valuesId, int descriptionChoicesId,
|
||||
public SingleChoiceSettingDynamicDescriptions(Context context, AbstractIntSetting setting,
|
||||
int titleId, int descriptionId, int choicesId, int valuesId, int descriptionChoicesId,
|
||||
int descriptionValuesId)
|
||||
{
|
||||
this(setting, titleId, descriptionId, choicesId, valuesId, descriptionChoicesId,
|
||||
this(context, setting, titleId, descriptionId, choicesId, valuesId, descriptionChoicesId,
|
||||
descriptionValuesId, null);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
|
||||
public abstract class SliderSetting extends SettingsItem
|
||||
|
@ -8,9 +10,10 @@ public abstract class SliderSetting extends SettingsItem
|
|||
private int mMax;
|
||||
private String mUnits;
|
||||
|
||||
public SliderSetting(int nameId, int descriptionId, int min, int max, String units)
|
||||
public SliderSetting(Context context, int nameId, int descriptionId, int min, int max,
|
||||
String units)
|
||||
{
|
||||
super(nameId, descriptionId);
|
||||
super(context, nameId, descriptionId);
|
||||
mMin = min;
|
||||
mMax = max;
|
||||
mUnits = units;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.model.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.dolphinemu.dolphinemu.DolphinApplication;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractStringSetting;
|
||||
|
@ -14,36 +16,36 @@ public class StringSingleChoiceSetting extends SettingsItem
|
|||
private String[] mValuesId;
|
||||
private MenuTag mMenuTag;
|
||||
|
||||
public StringSingleChoiceSetting(AbstractStringSetting setting, int titleId,
|
||||
public StringSingleChoiceSetting(Context context, AbstractStringSetting setting, int titleId,
|
||||
int descriptionId, String[] choicesId, String[] valuesId, MenuTag menuTag)
|
||||
{
|
||||
super(titleId, descriptionId);
|
||||
super(context, titleId, descriptionId);
|
||||
mSetting = setting;
|
||||
mChoicesId = choicesId;
|
||||
mValuesId = valuesId;
|
||||
mMenuTag = menuTag;
|
||||
}
|
||||
|
||||
public StringSingleChoiceSetting(AbstractStringSetting setting, int titleId,
|
||||
public StringSingleChoiceSetting(Context context, AbstractStringSetting setting, int titleId,
|
||||
int descriptionId, String[] choicesId, String[] valuesId)
|
||||
{
|
||||
this(setting, titleId, descriptionId, choicesId, valuesId, null);
|
||||
this(context, setting, titleId, descriptionId, choicesId, valuesId, null);
|
||||
}
|
||||
|
||||
public StringSingleChoiceSetting(AbstractStringSetting setting, int titleId,
|
||||
public StringSingleChoiceSetting(Context context, AbstractStringSetting setting, int titleId,
|
||||
int descriptionId, int choicesId, int valuesId, MenuTag menuTag)
|
||||
{
|
||||
super(titleId, descriptionId);
|
||||
super(context, titleId, descriptionId);
|
||||
mSetting = setting;
|
||||
mChoicesId = DolphinApplication.getAppContext().getResources().getStringArray(choicesId);
|
||||
mValuesId = DolphinApplication.getAppContext().getResources().getStringArray(valuesId);
|
||||
mMenuTag = menuTag;
|
||||
}
|
||||
|
||||
public StringSingleChoiceSetting(AbstractStringSetting setting, int titleId,
|
||||
public StringSingleChoiceSetting(Context context, AbstractStringSetting setting, int titleId,
|
||||
int descriptionId, int choicesId, int valuesId)
|
||||
{
|
||||
this(setting, titleId, descriptionId, choicesId, valuesId, null);
|
||||
this(context, setting, titleId, descriptionId, choicesId, valuesId, null);
|
||||
}
|
||||
|
||||
public String[] getChoicesId()
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
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.ui.MenuTag;
|
||||
|
||||
|
@ -7,9 +9,9 @@ public final class SubmenuSetting extends SettingsItem
|
|||
{
|
||||
private MenuTag mMenuKey;
|
||||
|
||||
public SubmenuSetting(int titleId, MenuTag menuKey)
|
||||
public SubmenuSetting(Context context, int titleId, MenuTag menuKey)
|
||||
{
|
||||
super(titleId, 0);
|
||||
super(context, titleId, 0);
|
||||
mMenuKey = menuKey;
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
|||
AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity(),
|
||||
R.style.DolphinDialogBase);
|
||||
|
||||
builder.setTitle(item.getNameId());
|
||||
builder.setTitle(item.getName());
|
||||
builder.setSingleChoiceItems(item.getChoicesId(), value, this);
|
||||
|
||||
mDialog = builder.show();
|
||||
|
@ -208,7 +208,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
|||
AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity(),
|
||||
R.style.DolphinDialogBase);
|
||||
|
||||
builder.setTitle(item.getNameId());
|
||||
builder.setTitle(item.getName());
|
||||
builder.setSingleChoiceItems(item.getChoicesId(), item.getSelectValueIndex(getSettings()),
|
||||
this);
|
||||
|
||||
|
@ -226,7 +226,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
|||
AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity(),
|
||||
R.style.DolphinDialogBase);
|
||||
|
||||
builder.setTitle(item.getNameId());
|
||||
builder.setTitle(item.getName());
|
||||
builder.setSingleChoiceItems(item.getChoicesId(), value, this);
|
||||
|
||||
mDialog = builder.show();
|
||||
|
@ -244,7 +244,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
|||
LayoutInflater inflater = LayoutInflater.from(mView.getActivity());
|
||||
View view = inflater.inflate(R.layout.dialog_seekbar, null);
|
||||
|
||||
builder.setTitle(item.getNameId());
|
||||
builder.setTitle(item.getName());
|
||||
builder.setView(view);
|
||||
builder.setPositiveButton(R.string.ok, this);
|
||||
mDialog = builder.show();
|
||||
|
@ -279,7 +279,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
|||
dialog.setMessage(String.format(mContext.getString(
|
||||
item instanceof RumbleBindingSetting ?
|
||||
R.string.input_rumble_description : R.string.input_binding_description),
|
||||
mContext.getString(item.getNameId())));
|
||||
item.getName()));
|
||||
dialog.setButton(AlertDialog.BUTTON_NEGATIVE, mContext.getString(R.string.cancel), this);
|
||||
dialog.setButton(AlertDialog.BUTTON_NEUTRAL, mContext.getString(R.string.clear),
|
||||
(dialogInterface, i) -> item.clearValue(getSettings()));
|
||||
|
|
|
@ -26,7 +26,7 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
|
|||
private static final String ARGUMENT_MENU_TAG = "menu_tag";
|
||||
private static final String ARGUMENT_GAME_ID = "game_id";
|
||||
|
||||
private SettingsFragmentPresenter mPresenter = new SettingsFragmentPresenter(this);
|
||||
private SettingsFragmentPresenter mPresenter;
|
||||
private SettingsActivityView mActivity;
|
||||
|
||||
private SettingsAdapter mAdapter;
|
||||
|
@ -102,7 +102,8 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
|
|||
MenuTag menuTag = (MenuTag) args.getSerializable(ARGUMENT_MENU_TAG);
|
||||
String gameId = getArguments().getString(ARGUMENT_GAME_ID);
|
||||
|
||||
mAdapter = new SettingsAdapter(this, getActivity());
|
||||
mPresenter = new SettingsFragmentPresenter(this, getContext());
|
||||
mAdapter = new SettingsAdapter(this, getContext());
|
||||
|
||||
mPresenter.onCreate(menuTag, gameId, args);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,6 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.ui.viewholder;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.TextView;
|
||||
|
@ -41,24 +42,17 @@ public final class CheckBoxSettingViewHolder extends SettingViewHolder
|
|||
mItem = (CheckBoxSetting) item;
|
||||
|
||||
// Special case for LogTypes retrieved via JNI since those aren't string references.
|
||||
if (item.getNameId() == 0 && item instanceof LogCheckBoxSetting)
|
||||
if (TextUtils.isEmpty(item.getName()) && item instanceof LogCheckBoxSetting)
|
||||
{
|
||||
String key = ((LogCheckBoxSetting) item).getKey();
|
||||
mTextSettingName.setText(SettingsFragmentPresenter.LOG_TYPE_NAMES.get(key));
|
||||
}
|
||||
else
|
||||
{
|
||||
mTextSettingName.setText(item.getNameId());
|
||||
mTextSettingName.setText(item.getName());
|
||||
}
|
||||
|
||||
if (item.getDescriptionId() > 0)
|
||||
{
|
||||
mTextSettingDescription.setText(item.getDescriptionId());
|
||||
}
|
||||
else
|
||||
{
|
||||
mTextSettingDescription.setText("");
|
||||
}
|
||||
mTextSettingDescription.setText(item.getDescription());
|
||||
|
||||
mCheckbox.setChecked(mItem.isChecked(getAdapter().getSettings()));
|
||||
|
||||
|
|
|
@ -56,11 +56,11 @@ public final class FilePickerViewHolder extends SettingViewHolder
|
|||
itemView.setBackgroundResource(R.drawable.invalid_setting_background);
|
||||
}
|
||||
|
||||
mTextSettingName.setText(item.getNameId());
|
||||
mTextSettingName.setText(item.getName());
|
||||
|
||||
if (item.getDescriptionId() > 0)
|
||||
if (!TextUtils.isEmpty(item.getDescription()))
|
||||
{
|
||||
mTextSettingDescription.setText(item.getDescriptionId());
|
||||
mTextSettingDescription.setText(item.getDescription());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ public final class HeaderViewHolder extends SettingViewHolder
|
|||
@Override
|
||||
public void bind(SettingsItem item)
|
||||
{
|
||||
mHeaderName.setText(item.getNameId());
|
||||
mHeaderName.setText(item.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class InputBindingSettingViewHolder extends SettingViewHolder
|
|||
|
||||
mItem = (InputBindingSetting) item;
|
||||
|
||||
mTextSettingName.setText(mItem.getNameId());
|
||||
mTextSettingName.setText(mItem.getName());
|
||||
mTextSettingDescription
|
||||
.setText(sharedPreferences.getString(mItem.getKey() + mItem.getGameId(), ""));
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public class RumbleBindingViewHolder extends SettingViewHolder
|
|||
|
||||
mItem = (RumbleBindingSetting) item;
|
||||
|
||||
mTextSettingName.setText(item.getNameId());
|
||||
mTextSettingName.setText(item.getName());
|
||||
mTextSettingDescription
|
||||
.setText(sharedPreferences.getString(mItem.getKey() + mItem.getGameId(), ""));
|
||||
|
||||
|
|
|
@ -41,12 +41,8 @@ public final class RunRunnableViewHolder extends SettingViewHolder
|
|||
{
|
||||
mItem = (RunRunnable) item;
|
||||
|
||||
mTextSettingName.setText(item.getNameId());
|
||||
|
||||
if (item.getDescriptionId() > 0)
|
||||
{
|
||||
mTextSettingDescription.setText(item.getDescriptionId());
|
||||
}
|
||||
mTextSettingName.setText(item.getName());
|
||||
mTextSettingDescription.setText(item.getDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,7 +53,7 @@ public final class RunRunnableViewHolder extends SettingViewHolder
|
|||
if (alertTextID > 0)
|
||||
{
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mContext, R.style.DolphinDialogBase)
|
||||
.setTitle(mItem.getNameId())
|
||||
.setTitle(mItem.getName())
|
||||
.setMessage(alertTextID);
|
||||
|
||||
builder
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.ui.viewholder;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -37,11 +38,11 @@ public final class SingleChoiceViewHolder extends SettingViewHolder
|
|||
{
|
||||
mItem = item;
|
||||
|
||||
mTextSettingName.setText(item.getNameId());
|
||||
mTextSettingName.setText(item.getName());
|
||||
|
||||
if (item.getDescriptionId() > 0)
|
||||
if (!TextUtils.isEmpty(item.getDescription()))
|
||||
{
|
||||
mTextSettingDescription.setText(item.getDescriptionId());
|
||||
mTextSettingDescription.setText(item.getDescription());
|
||||
}
|
||||
else if (item instanceof SingleChoiceSetting)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.ui.viewholder;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -39,11 +40,11 @@ public final class SliderViewHolder extends SettingViewHolder
|
|||
{
|
||||
mItem = (SliderSetting) item;
|
||||
|
||||
mTextSettingName.setText(item.getNameId());
|
||||
mTextSettingName.setText(item.getName());
|
||||
|
||||
if (item.getDescriptionId() > 0)
|
||||
if (!TextUtils.isEmpty(item.getDescription()))
|
||||
{
|
||||
mTextSettingDescription.setText(item.getDescriptionId());
|
||||
mTextSettingDescription.setText(item.getDescription());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ public final class SubmenuViewHolder extends SettingViewHolder
|
|||
{
|
||||
mItem = (SubmenuSetting) item;
|
||||
|
||||
mTextSettingName.setText(item.getNameId());
|
||||
mTextSettingName.setText(item.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue