mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-11 13:07:08 +03:00
Merge pull request #10981 from JosJuice/android-string-single-choice-naming
Android: Clean up StringSingleChoiceSetting naming
This commit is contained in:
commit
fea552a4de
3 changed files with 22 additions and 22 deletions
|
@ -14,24 +14,24 @@ public class StringSingleChoiceSetting extends SettingsItem
|
||||||
{
|
{
|
||||||
private AbstractStringSetting mSetting;
|
private AbstractStringSetting mSetting;
|
||||||
|
|
||||||
private String[] mChoicesId;
|
private String[] mChoices;
|
||||||
private String[] mValuesId;
|
private String[] mValues;
|
||||||
private MenuTag mMenuTag;
|
private MenuTag mMenuTag;
|
||||||
|
|
||||||
public StringSingleChoiceSetting(Context context, AbstractStringSetting setting, int titleId,
|
public StringSingleChoiceSetting(Context context, AbstractStringSetting setting, int titleId,
|
||||||
int descriptionId, String[] choicesId, String[] valuesId, MenuTag menuTag)
|
int descriptionId, String[] choices, String[] values, MenuTag menuTag)
|
||||||
{
|
{
|
||||||
super(context, titleId, descriptionId);
|
super(context, titleId, descriptionId);
|
||||||
mSetting = setting;
|
mSetting = setting;
|
||||||
mChoicesId = choicesId;
|
mChoices = choices;
|
||||||
mValuesId = valuesId;
|
mValues = values;
|
||||||
mMenuTag = menuTag;
|
mMenuTag = menuTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringSingleChoiceSetting(Context context, AbstractStringSetting setting, int titleId,
|
public StringSingleChoiceSetting(Context context, AbstractStringSetting setting, int titleId,
|
||||||
int descriptionId, String[] choicesId, String[] valuesId)
|
int descriptionId, String[] choices, String[] values)
|
||||||
{
|
{
|
||||||
this(context, setting, titleId, descriptionId, choicesId, valuesId, null);
|
this(context, setting, titleId, descriptionId, choices, values, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringSingleChoiceSetting(Context context, AbstractStringSetting setting, int titleId,
|
public StringSingleChoiceSetting(Context context, AbstractStringSetting setting, int titleId,
|
||||||
|
@ -39,8 +39,8 @@ public class StringSingleChoiceSetting extends SettingsItem
|
||||||
{
|
{
|
||||||
super(context, titleId, descriptionId);
|
super(context, titleId, descriptionId);
|
||||||
mSetting = setting;
|
mSetting = setting;
|
||||||
mChoicesId = DolphinApplication.getAppContext().getResources().getStringArray(choicesId);
|
mChoices = DolphinApplication.getAppContext().getResources().getStringArray(choicesId);
|
||||||
mValuesId = DolphinApplication.getAppContext().getResources().getStringArray(valuesId);
|
mValues = DolphinApplication.getAppContext().getResources().getStringArray(valuesId);
|
||||||
mMenuTag = menuTag;
|
mMenuTag = menuTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,24 +50,24 @@ public class StringSingleChoiceSetting extends SettingsItem
|
||||||
this(context, setting, titleId, descriptionId, choicesId, valuesId, null);
|
this(context, setting, titleId, descriptionId, choicesId, valuesId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getChoicesId()
|
public String[] getChoices()
|
||||||
{
|
{
|
||||||
return mChoicesId;
|
return mChoices;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getValuesId()
|
public String[] getValues()
|
||||||
{
|
{
|
||||||
return mValuesId;
|
return mValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValueAt(int index)
|
public String getValueAt(int index)
|
||||||
{
|
{
|
||||||
if (mValuesId == null)
|
if (mValues == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (index >= 0 && index < mValuesId.length)
|
if (index >= 0 && index < mValues.length)
|
||||||
{
|
{
|
||||||
return mValuesId[index];
|
return mValues[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
@ -78,12 +78,12 @@ public class StringSingleChoiceSetting extends SettingsItem
|
||||||
return mSetting.getString(settings);
|
return mSetting.getString(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSelectValueIndex(Settings settings)
|
public int getSelectedValueIndex(Settings settings)
|
||||||
{
|
{
|
||||||
String selectedValue = getSelectedValue(settings);
|
String selectedValue = getSelectedValue(settings);
|
||||||
for (int i = 0; i < mValuesId.length; i++)
|
for (int i = 0; i < mValues.length; i++)
|
||||||
{
|
{
|
||||||
if (mValuesId[i].equals(selectedValue))
|
if (mValues[i].equals(selectedValue))
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,7 +251,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity());
|
||||||
|
|
||||||
builder.setTitle(item.getName());
|
builder.setTitle(item.getName());
|
||||||
builder.setSingleChoiceItems(item.getChoicesId(), item.getSelectValueIndex(getSettings()),
|
builder.setSingleChoiceItems(item.getChoices(), item.getSelectedValueIndex(getSettings()),
|
||||||
this);
|
this);
|
||||||
|
|
||||||
mDialog = builder.show();
|
mDialog = builder.show();
|
||||||
|
|
|
@ -64,8 +64,8 @@ public final class SingleChoiceViewHolder extends SettingViewHolder
|
||||||
else if (item instanceof StringSingleChoiceSetting)
|
else if (item instanceof StringSingleChoiceSetting)
|
||||||
{
|
{
|
||||||
StringSingleChoiceSetting setting = (StringSingleChoiceSetting) item;
|
StringSingleChoiceSetting setting = (StringSingleChoiceSetting) item;
|
||||||
String[] choices = setting.getChoicesId();
|
String[] choices = setting.getChoices();
|
||||||
int valueIndex = setting.getSelectValueIndex(getAdapter().getSettings());
|
int valueIndex = setting.getSelectedValueIndex(getAdapter().getSettings());
|
||||||
if (valueIndex != -1)
|
if (valueIndex != -1)
|
||||||
mTextSettingDescription.setText(choices[valueIndex]);
|
mTextSettingDescription.setText(choices[valueIndex]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue