Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6338 from mahdihijazi/settings_enhancements
Update Android UI Settings to have the most common used settings
- Loading branch information
Showing
27 changed files
with
610 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
...rc/main/java/org/dolphinemu/dolphinemu/model/settings/view/StringSingleChoiceSetting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,97 @@ | |||
package org.dolphinemu.dolphinemu.model.settings.view; | |||
|
|||
import org.dolphinemu.dolphinemu.model.settings.Setting; | |||
import org.dolphinemu.dolphinemu.model.settings.StringSetting; | |||
|
|||
public class StringSingleChoiceSetting extends SettingsItem | |||
{ | |||
private String mDefaultValue; | |||
|
|||
private String[] mChoicesId; | |||
private String[] mValuesId; | |||
|
|||
public StringSingleChoiceSetting(String key, String section, int file, int titleId, int descriptionId, String[] choicesId, String[] valuesId, String defaultValue, Setting setting) | |||
{ | |||
super(key, section, file, setting, titleId, descriptionId); | |||
mValuesId = valuesId; | |||
mChoicesId = choicesId; | |||
mDefaultValue = defaultValue; | |||
} | |||
|
|||
public String[] getChoicesId() | |||
{ | |||
return mChoicesId; | |||
} | |||
|
|||
public String[] getValuesId() | |||
{ | |||
return mValuesId; | |||
} | |||
|
|||
public String getValueAt(int index) | |||
{ | |||
if (mValuesId == null) | |||
return null; | |||
|
|||
if (index >= 0 && index < mValuesId.length) | |||
{ | |||
return mValuesId[index]; | |||
} | |||
|
|||
return ""; | |||
} | |||
|
|||
public String getSelectedValue() | |||
{ | |||
if (getSetting() != null) | |||
{ | |||
StringSetting setting = (StringSetting) getSetting(); | |||
return setting.getValue(); | |||
} | |||
else | |||
{ | |||
return mDefaultValue; | |||
} | |||
} | |||
|
|||
public int getSelectValueIndex() { | |||
String selectedValue = getSelectedValue(); | |||
for(int i=0;i<mValuesId.length;i++) { | |||
if(mValuesId[i].equals(selectedValue)) { | |||
return i; | |||
} | |||
} | |||
|
|||
return -1; | |||
} | |||
/** | |||
* Write a value to the backing int. If that int was previously null, | |||
* initializes a new one and returns it, so it can be added to the Hashmap. | |||
* | |||
* @param selection New value of the int. | |||
* @return null if overwritten successfully otherwise; a newly created IntSetting. | |||
*/ | |||
public StringSetting setSelectedValue(String selection) | |||
{ | |||
if (getSetting() == null) | |||
{ | |||
StringSetting setting = new StringSetting(getKey(), getSection(), getFile(), selection); | |||
setSetting(setting); | |||
return setting; | |||
} | |||
else | |||
{ | |||
StringSetting setting = (StringSetting) getSetting(); | |||
setting.setValue(selection); | |||
return null; | |||
} | |||
} | |||
|
|||
@Override | |||
public int getType() | |||
{ | |||
return TYPE_STRING_SINGLE_CHOICE; | |||
} | |||
} | |||
|
|||
|
7 changes: 4 additions & 3 deletions
7
...droid/app/src/main/java/org/dolphinemu/dolphinemu/model/settings/view/SubmenuSetting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.