mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 05:16:24 -05:00
android: Convert SettingsFragmentPresenter to Kotlin
This commit is contained in:
parent
1fc66f1b30
commit
14d156701f
2 changed files with 333 additions and 184 deletions
|
@ -1,184 +0,0 @@
|
|||
package org.yuzu.yuzu_emu.features.settings.ui;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.yuzu.yuzu_emu.R;
|
||||
import org.yuzu.yuzu_emu.features.settings.model.Setting;
|
||||
import org.yuzu.yuzu_emu.features.settings.model.SettingSection;
|
||||
import org.yuzu.yuzu_emu.features.settings.model.Settings;
|
||||
import org.yuzu.yuzu_emu.features.settings.model.StringSetting;
|
||||
import org.yuzu.yuzu_emu.features.settings.model.view.CheckBoxSetting;
|
||||
import org.yuzu.yuzu_emu.features.settings.model.view.DateTimeSetting;
|
||||
import org.yuzu.yuzu_emu.features.settings.model.view.HeaderSetting;
|
||||
import org.yuzu.yuzu_emu.features.settings.model.view.SettingsItem;
|
||||
import org.yuzu.yuzu_emu.features.settings.model.view.SingleChoiceSetting;
|
||||
import org.yuzu.yuzu_emu.features.settings.model.view.SliderSetting;
|
||||
import org.yuzu.yuzu_emu.features.settings.model.view.SubmenuSetting;
|
||||
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public final class SettingsFragmentPresenter {
|
||||
private SettingsFragmentView mView;
|
||||
|
||||
private String mMenuTag;
|
||||
private String mGameID;
|
||||
|
||||
private Settings mSettings;
|
||||
private ArrayList<SettingsItem> mSettingsList;
|
||||
|
||||
public SettingsFragmentPresenter(SettingsFragmentView view) {
|
||||
mView = view;
|
||||
}
|
||||
|
||||
public void onCreate(String menuTag, String gameId) {
|
||||
mGameID = gameId;
|
||||
mMenuTag = menuTag;
|
||||
}
|
||||
|
||||
public void onViewCreated(Settings settings) {
|
||||
setSettings(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the screen is rotated, the Activity will forget the settings map. This fragment
|
||||
* won't, though; so rather than have the Activity reload from disk, have the fragment pass
|
||||
* the settings map back to the Activity.
|
||||
*/
|
||||
public void onAttach() {
|
||||
if (mSettings != null) {
|
||||
mView.passSettingsToActivity(mSettings);
|
||||
}
|
||||
}
|
||||
|
||||
public void putSetting(Setting setting) {
|
||||
mSettings.getSection(setting.getSection()).putSetting(setting);
|
||||
}
|
||||
|
||||
private StringSetting asStringSetting(Setting setting) {
|
||||
if (setting == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StringSetting stringSetting = new StringSetting(setting.getKey(), setting.getSection(), setting.getValueAsString());
|
||||
putSetting(stringSetting);
|
||||
return stringSetting;
|
||||
}
|
||||
|
||||
public void loadDefaultSettings() {
|
||||
loadSettingsList();
|
||||
}
|
||||
|
||||
public void setSettings(Settings settings) {
|
||||
if (mSettingsList == null && settings != null) {
|
||||
mSettings = settings;
|
||||
|
||||
loadSettingsList();
|
||||
} else {
|
||||
mView.getActivity().setTitle(R.string.preferences_settings);
|
||||
mView.showSettingsList(mSettingsList);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadSettingsList() {
|
||||
if (!TextUtils.isEmpty(mGameID)) {
|
||||
mView.getActivity().setTitle("Game Settings: " + mGameID);
|
||||
}
|
||||
ArrayList<SettingsItem> sl = new ArrayList<>();
|
||||
|
||||
if (mMenuTag == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (mMenuTag) {
|
||||
case SettingsFile.FILE_NAME_CONFIG:
|
||||
addConfigSettings(sl);
|
||||
break;
|
||||
case Settings.SECTION_GENERAL:
|
||||
addGeneralSettings(sl);
|
||||
break;
|
||||
case Settings.SECTION_SYSTEM:
|
||||
addSystemSettings(sl);
|
||||
break;
|
||||
case Settings.SECTION_RENDERER:
|
||||
addGraphicsSettings(sl);
|
||||
break;
|
||||
case Settings.SECTION_AUDIO:
|
||||
addAudioSettings(sl);
|
||||
break;
|
||||
default:
|
||||
mView.showToastMessage("Unimplemented menu", false);
|
||||
return;
|
||||
}
|
||||
|
||||
mSettingsList = sl;
|
||||
mView.showSettingsList(mSettingsList);
|
||||
}
|
||||
|
||||
private void addConfigSettings(ArrayList<SettingsItem> sl) {
|
||||
mView.getActivity().setTitle(R.string.preferences_settings);
|
||||
|
||||
sl.add(new SubmenuSetting(null, null, R.string.preferences_general, 0, Settings.SECTION_GENERAL));
|
||||
sl.add(new SubmenuSetting(null, null, R.string.preferences_system, 0, Settings.SECTION_SYSTEM));
|
||||
sl.add(new SubmenuSetting(null, null, R.string.preferences_graphics, 0, Settings.SECTION_RENDERER));
|
||||
sl.add(new SubmenuSetting(null, null, R.string.preferences_audio, 0, Settings.SECTION_AUDIO));
|
||||
}
|
||||
|
||||
private void addGeneralSettings(ArrayList<SettingsItem> sl) {
|
||||
mView.getActivity().setTitle(R.string.preferences_general);
|
||||
|
||||
SettingSection rendererSection = mSettings.getSection(Settings.SECTION_RENDERER);
|
||||
Setting frameLimitEnable = rendererSection.getSetting(SettingsFile.KEY_RENDERER_USE_SPEED_LIMIT);
|
||||
Setting frameLimitValue = rendererSection.getSetting(SettingsFile.KEY_RENDERER_SPEED_LIMIT);
|
||||
|
||||
sl.add(new CheckBoxSetting(SettingsFile.KEY_RENDERER_USE_SPEED_LIMIT, Settings.SECTION_RENDERER, R.string.frame_limit_enable, R.string.frame_limit_enable_description, true, frameLimitEnable));
|
||||
sl.add(new SliderSetting(SettingsFile.KEY_RENDERER_SPEED_LIMIT, Settings.SECTION_RENDERER, R.string.frame_limit_slider, R.string.frame_limit_slider_description, 1, 200, "%", 100, frameLimitValue));
|
||||
|
||||
SettingSection cpuSection = mSettings.getSection(Settings.SECTION_CPU);
|
||||
Setting cpuAccuracy = cpuSection.getSetting(SettingsFile.KEY_CPU_ACCURACY);
|
||||
sl.add(new SingleChoiceSetting(SettingsFile.KEY_CPU_ACCURACY, Settings.SECTION_CPU, R.string.cpu_accuracy, 0, R.array.cpuAccuracyNames, R.array.cpuAccuracyValues, 0, cpuAccuracy));
|
||||
}
|
||||
|
||||
private void addSystemSettings(ArrayList<SettingsItem> sl) {
|
||||
mView.getActivity().setTitle(R.string.preferences_system);
|
||||
|
||||
SettingSection systemSection = mSettings.getSection(Settings.SECTION_SYSTEM);
|
||||
Setting dockedMode = systemSection.getSetting(SettingsFile.KEY_USE_DOCKED_MODE);
|
||||
Setting region = systemSection.getSetting(SettingsFile.KEY_REGION_INDEX);
|
||||
Setting language = systemSection.getSetting(SettingsFile.KEY_LANGUAGE_INDEX);
|
||||
|
||||
sl.add(new CheckBoxSetting(SettingsFile.KEY_USE_DOCKED_MODE, Settings.SECTION_SYSTEM, R.string.use_docked_mode, R.string.use_docked_mode_description, true, dockedMode));
|
||||
sl.add(new SingleChoiceSetting(SettingsFile.KEY_REGION_INDEX, Settings.SECTION_SYSTEM, R.string.emulated_region, 0, R.array.regionNames, R.array.regionValues, -1, region));
|
||||
sl.add(new SingleChoiceSetting(SettingsFile.KEY_LANGUAGE_INDEX, Settings.SECTION_SYSTEM, R.string.emulated_language, 0, R.array.languageNames, R.array.languageValues, 1, language));
|
||||
}
|
||||
|
||||
private void addGraphicsSettings(ArrayList<SettingsItem> sl) {
|
||||
mView.getActivity().setTitle(R.string.preferences_graphics);
|
||||
|
||||
SettingSection rendererSection = mSettings.getSection(Settings.SECTION_RENDERER);
|
||||
Setting rendererBackend = rendererSection.getSetting(SettingsFile.KEY_RENDERER_BACKEND);
|
||||
Setting rendererAccuracy = rendererSection.getSetting(SettingsFile.KEY_RENDERER_ACCURACY);
|
||||
Setting rendererReolution = rendererSection.getSetting(SettingsFile.KEY_RENDERER_RESOLUTION);
|
||||
Setting rendererAspectRation = rendererSection.getSetting(SettingsFile.KEY_RENDERER_ASPECT_RATIO);
|
||||
Setting rendererForceMaxClocks = rendererSection.getSetting(SettingsFile.KEY_RENDERER_FORCE_MAX_CLOCK);
|
||||
Setting rendererAsynchronousShaders = rendererSection.getSetting(SettingsFile.KEY_RENDERER_ASYNCHRONOUS_SHADERS);
|
||||
Setting rendererDebug = rendererSection.getSetting(SettingsFile.KEY_RENDERER_DEBUG);
|
||||
|
||||
sl.add(new SingleChoiceSetting(SettingsFile.KEY_RENDERER_BACKEND, Settings.SECTION_RENDERER, R.string.renderer_api, 0, R.array.rendererApiNames, R.array.rendererApiValues, 1, rendererBackend));
|
||||
sl.add(new SingleChoiceSetting(SettingsFile.KEY_RENDERER_ACCURACY, Settings.SECTION_RENDERER, R.string.renderer_accuracy, 0, R.array.rendererAccuracyNames, R.array.rendererAccuracyValues, 1, rendererAccuracy));
|
||||
sl.add(new SingleChoiceSetting(SettingsFile.KEY_RENDERER_RESOLUTION, Settings.SECTION_RENDERER, R.string.renderer_resolution, 0, R.array.rendererResolutionNames, R.array.rendererResolutionValues, 2, rendererReolution));
|
||||
sl.add(new SingleChoiceSetting(SettingsFile.KEY_RENDERER_ASPECT_RATIO, Settings.SECTION_RENDERER, R.string.renderer_aspect_ratio, 0, R.array.rendererAspectRatioNames, R.array.rendererAspectRatioValues, 0, rendererAspectRation));
|
||||
sl.add(new CheckBoxSetting(SettingsFile.KEY_RENDERER_FORCE_MAX_CLOCK, Settings.SECTION_RENDERER, R.string.renderer_force_max_clock, R.string.renderer_force_max_clock_description, true, rendererForceMaxClocks));
|
||||
sl.add(new CheckBoxSetting(SettingsFile.KEY_RENDERER_ASYNCHRONOUS_SHADERS, Settings.SECTION_RENDERER, R.string.renderer_asynchronous_shaders, R.string.renderer_asynchronous_shaders_description, false, rendererAsynchronousShaders));
|
||||
sl.add(new CheckBoxSetting(SettingsFile.KEY_RENDERER_DEBUG, Settings.SECTION_RENDERER, R.string.renderer_debug, R.string.renderer_debug_description, false, rendererDebug));
|
||||
}
|
||||
|
||||
private void addAudioSettings(ArrayList<SettingsItem> sl) {
|
||||
mView.getActivity().setTitle(R.string.preferences_audio);
|
||||
|
||||
SettingSection audioSection = mSettings.getSection(Settings.SECTION_AUDIO);
|
||||
Setting audioVolume = audioSection.getSetting(SettingsFile.KEY_AUDIO_VOLUME);
|
||||
|
||||
sl.add(new SliderSetting(SettingsFile.KEY_AUDIO_VOLUME, Settings.SECTION_AUDIO, R.string.audio_volume, R.string.audio_volume_description, 0, 100, "%", 100, audioVolume));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,333 @@
|
|||
package org.yuzu.yuzu_emu.features.settings.ui
|
||||
|
||||
import android.text.TextUtils
|
||||
import org.yuzu.yuzu_emu.R
|
||||
import org.yuzu.yuzu_emu.features.settings.model.Setting
|
||||
import org.yuzu.yuzu_emu.features.settings.model.Settings
|
||||
import org.yuzu.yuzu_emu.features.settings.model.StringSetting
|
||||
import org.yuzu.yuzu_emu.features.settings.model.view.*
|
||||
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile
|
||||
|
||||
class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView) {
|
||||
private var menuTag: String? = null
|
||||
private lateinit var gameId: String
|
||||
private var settings: Settings? = null
|
||||
private var settingsList: ArrayList<SettingsItem>? = null
|
||||
|
||||
fun onCreate(menuTag: String, gameId: String) {
|
||||
this.gameId = gameId
|
||||
this.menuTag = menuTag
|
||||
}
|
||||
|
||||
fun onViewCreated(settings: Settings?) {
|
||||
setSettings(settings)
|
||||
}
|
||||
|
||||
/**
|
||||
* If the screen is rotated, the Activity will forget the settings map. This fragment
|
||||
* won't, though; so rather than have the Activity reload from disk, have the fragment pass
|
||||
* the settings map back to the Activity.
|
||||
*/
|
||||
fun onAttach() {
|
||||
if (settings != null) {
|
||||
fragmentView.passSettingsToActivity(settings!!)
|
||||
}
|
||||
}
|
||||
|
||||
fun putSetting(setting: Setting) {
|
||||
settings!!.getSection(setting.section)!!.putSetting(setting)
|
||||
}
|
||||
|
||||
private fun asStringSetting(setting: Setting?): StringSetting? {
|
||||
if (setting == null) {
|
||||
return null
|
||||
}
|
||||
val stringSetting = StringSetting(setting.key, setting.section, setting.valueAsString)
|
||||
putSetting(stringSetting)
|
||||
return stringSetting
|
||||
}
|
||||
|
||||
fun loadDefaultSettings() {
|
||||
loadSettingsList()
|
||||
}
|
||||
|
||||
fun setSettings(settings: Settings?) {
|
||||
if (settingsList == null && settings != null) {
|
||||
this.settings = settings
|
||||
loadSettingsList()
|
||||
} else {
|
||||
fragmentView.fragmentActivity.setTitle(R.string.preferences_settings)
|
||||
fragmentView.showSettingsList(settingsList!!)
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadSettingsList() {
|
||||
if (!TextUtils.isEmpty(gameId)) {
|
||||
fragmentView.fragmentActivity.title = "Game Settings: $gameId"
|
||||
}
|
||||
val sl = ArrayList<SettingsItem>()
|
||||
if (menuTag == null) {
|
||||
return
|
||||
}
|
||||
when (menuTag) {
|
||||
SettingsFile.FILE_NAME_CONFIG -> addConfigSettings(sl)
|
||||
Settings.SECTION_GENERAL -> addGeneralSettings(sl)
|
||||
Settings.SECTION_SYSTEM -> addSystemSettings(sl)
|
||||
Settings.SECTION_RENDERER -> addGraphicsSettings(sl)
|
||||
Settings.SECTION_AUDIO -> addAudioSettings(sl)
|
||||
else -> {
|
||||
fragmentView.showToastMessage("Unimplemented menu", false)
|
||||
return
|
||||
}
|
||||
}
|
||||
settingsList = sl
|
||||
fragmentView.showSettingsList(settingsList!!)
|
||||
}
|
||||
|
||||
private fun addConfigSettings(sl: ArrayList<SettingsItem>) {
|
||||
fragmentView.fragmentActivity.setTitle(R.string.preferences_settings)
|
||||
sl.apply {
|
||||
add(
|
||||
SubmenuSetting(
|
||||
null,
|
||||
null,
|
||||
R.string.preferences_general,
|
||||
0,
|
||||
Settings.SECTION_GENERAL
|
||||
)
|
||||
)
|
||||
add(
|
||||
SubmenuSetting(
|
||||
null,
|
||||
null,
|
||||
R.string.preferences_system,
|
||||
0,
|
||||
Settings.SECTION_SYSTEM
|
||||
)
|
||||
)
|
||||
add(
|
||||
SubmenuSetting(
|
||||
null,
|
||||
null,
|
||||
R.string.preferences_graphics,
|
||||
0,
|
||||
Settings.SECTION_RENDERER
|
||||
)
|
||||
)
|
||||
add(
|
||||
SubmenuSetting(
|
||||
null,
|
||||
null,
|
||||
R.string.preferences_audio,
|
||||
0,
|
||||
Settings.SECTION_AUDIO
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun addGeneralSettings(sl: ArrayList<SettingsItem>) {
|
||||
fragmentView.fragmentActivity.setTitle(R.string.preferences_general)
|
||||
val rendererSection = settings!!.getSection(Settings.SECTION_RENDERER)
|
||||
val frameLimitEnable =
|
||||
rendererSection!!.getSetting(SettingsFile.KEY_RENDERER_USE_SPEED_LIMIT)
|
||||
val frameLimitValue = rendererSection.getSetting(SettingsFile.KEY_RENDERER_SPEED_LIMIT)
|
||||
val cpuSection = settings!!.getSection(Settings.SECTION_CPU)
|
||||
val cpuAccuracy = cpuSection!!.getSetting(SettingsFile.KEY_CPU_ACCURACY)
|
||||
sl.apply {
|
||||
add(
|
||||
CheckBoxSetting(
|
||||
SettingsFile.KEY_RENDERER_USE_SPEED_LIMIT,
|
||||
Settings.SECTION_RENDERER,
|
||||
frameLimitEnable,
|
||||
R.string.frame_limit_enable,
|
||||
R.string.frame_limit_enable_description,
|
||||
true
|
||||
)
|
||||
)
|
||||
add(
|
||||
SliderSetting(
|
||||
SettingsFile.KEY_RENDERER_SPEED_LIMIT,
|
||||
Settings.SECTION_RENDERER,
|
||||
frameLimitValue,
|
||||
R.string.frame_limit_slider,
|
||||
R.string.frame_limit_slider_description,
|
||||
1,
|
||||
200,
|
||||
"%",
|
||||
100
|
||||
)
|
||||
)
|
||||
add(
|
||||
SingleChoiceSetting(
|
||||
SettingsFile.KEY_CPU_ACCURACY,
|
||||
Settings.SECTION_CPU,
|
||||
cpuAccuracy,
|
||||
R.string.cpu_accuracy,
|
||||
0,
|
||||
R.array.cpuAccuracyNames,
|
||||
R.array.cpuAccuracyValues,
|
||||
0
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun addSystemSettings(sl: ArrayList<SettingsItem>) {
|
||||
fragmentView.fragmentActivity.setTitle(R.string.preferences_system)
|
||||
val systemSection = settings!!.getSection(Settings.SECTION_SYSTEM)
|
||||
val dockedMode = systemSection!!.getSetting(SettingsFile.KEY_USE_DOCKED_MODE)
|
||||
val region = systemSection.getSetting(SettingsFile.KEY_REGION_INDEX)
|
||||
val language = systemSection.getSetting(SettingsFile.KEY_LANGUAGE_INDEX)
|
||||
sl.apply {
|
||||
add(
|
||||
CheckBoxSetting(
|
||||
SettingsFile.KEY_USE_DOCKED_MODE,
|
||||
Settings.SECTION_SYSTEM,
|
||||
dockedMode,
|
||||
R.string.use_docked_mode,
|
||||
R.string.use_docked_mode_description,
|
||||
true,
|
||||
)
|
||||
)
|
||||
add(
|
||||
SingleChoiceSetting(
|
||||
SettingsFile.KEY_REGION_INDEX,
|
||||
Settings.SECTION_SYSTEM,
|
||||
region,
|
||||
R.string.emulated_region,
|
||||
0,
|
||||
R.array.regionNames,
|
||||
R.array.regionValues,
|
||||
-1
|
||||
)
|
||||
)
|
||||
add(
|
||||
SingleChoiceSetting(
|
||||
SettingsFile.KEY_LANGUAGE_INDEX,
|
||||
Settings.SECTION_SYSTEM,
|
||||
language,
|
||||
R.string.emulated_language,
|
||||
0,
|
||||
R.array.languageNames,
|
||||
R.array.languageValues,
|
||||
1
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun addGraphicsSettings(sl: ArrayList<SettingsItem>) {
|
||||
fragmentView.fragmentActivity.setTitle(R.string.preferences_graphics)
|
||||
val rendererSection = settings!!.getSection(Settings.SECTION_RENDERER)
|
||||
val rendererBackend = rendererSection!!.getSetting(SettingsFile.KEY_RENDERER_BACKEND)
|
||||
val rendererAccuracy = rendererSection.getSetting(SettingsFile.KEY_RENDERER_ACCURACY)
|
||||
val rendererResolution = rendererSection.getSetting(SettingsFile.KEY_RENDERER_RESOLUTION)
|
||||
val rendererAspectRatio =
|
||||
rendererSection.getSetting(SettingsFile.KEY_RENDERER_ASPECT_RATIO)
|
||||
val rendererForceMaxClocks =
|
||||
rendererSection.getSetting(SettingsFile.KEY_RENDERER_FORCE_MAX_CLOCK)
|
||||
val rendererAsynchronousShaders =
|
||||
rendererSection.getSetting(SettingsFile.KEY_RENDERER_ASYNCHRONOUS_SHADERS)
|
||||
val rendererDebug = rendererSection.getSetting(SettingsFile.KEY_RENDERER_DEBUG)
|
||||
sl.apply {
|
||||
add(
|
||||
SingleChoiceSetting(
|
||||
SettingsFile.KEY_RENDERER_BACKEND,
|
||||
Settings.SECTION_RENDERER,
|
||||
rendererBackend,
|
||||
R.string.renderer_api,
|
||||
0,
|
||||
R.array.rendererApiNames,
|
||||
R.array.rendererApiValues,
|
||||
1
|
||||
)
|
||||
)
|
||||
add(
|
||||
SingleChoiceSetting(
|
||||
SettingsFile.KEY_RENDERER_ACCURACY,
|
||||
Settings.SECTION_RENDERER,
|
||||
rendererAccuracy,
|
||||
R.string.renderer_accuracy,
|
||||
0,
|
||||
R.array.rendererAccuracyNames,
|
||||
R.array.rendererAccuracyValues,
|
||||
1
|
||||
)
|
||||
)
|
||||
add(
|
||||
SingleChoiceSetting(
|
||||
SettingsFile.KEY_RENDERER_RESOLUTION,
|
||||
Settings.SECTION_RENDERER,
|
||||
rendererResolution,
|
||||
R.string.renderer_resolution,
|
||||
0,
|
||||
R.array.rendererResolutionNames,
|
||||
R.array.rendererResolutionValues,
|
||||
2
|
||||
)
|
||||
)
|
||||
add(
|
||||
SingleChoiceSetting(
|
||||
SettingsFile.KEY_RENDERER_ASPECT_RATIO,
|
||||
Settings.SECTION_RENDERER,
|
||||
rendererAspectRatio,
|
||||
R.string.renderer_aspect_ratio,
|
||||
0,
|
||||
R.array.rendererAspectRatioNames,
|
||||
R.array.rendererAspectRatioValues,
|
||||
0
|
||||
)
|
||||
)
|
||||
add(
|
||||
CheckBoxSetting(
|
||||
SettingsFile.KEY_RENDERER_FORCE_MAX_CLOCK,
|
||||
Settings.SECTION_RENDERER,
|
||||
rendererForceMaxClocks,
|
||||
R.string.renderer_force_max_clock,
|
||||
R.string.renderer_force_max_clock_description,
|
||||
true
|
||||
)
|
||||
)
|
||||
add(
|
||||
CheckBoxSetting(
|
||||
SettingsFile.KEY_RENDERER_ASYNCHRONOUS_SHADERS,
|
||||
Settings.SECTION_RENDERER,
|
||||
rendererAsynchronousShaders,
|
||||
R.string.renderer_asynchronous_shaders,
|
||||
R.string.renderer_asynchronous_shaders_description,
|
||||
false
|
||||
)
|
||||
)
|
||||
add(
|
||||
CheckBoxSetting(
|
||||
SettingsFile.KEY_RENDERER_DEBUG,
|
||||
Settings.SECTION_RENDERER,
|
||||
rendererDebug,
|
||||
R.string.renderer_debug,
|
||||
R.string.renderer_debug_description,
|
||||
false
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun addAudioSettings(sl: ArrayList<SettingsItem>) {
|
||||
fragmentView.fragmentActivity.setTitle(R.string.preferences_audio)
|
||||
val audioSection = settings!!.getSection(Settings.SECTION_AUDIO)
|
||||
val audioVolume = audioSection!!.getSetting(SettingsFile.KEY_AUDIO_VOLUME)
|
||||
sl.add(
|
||||
SliderSetting(
|
||||
SettingsFile.KEY_AUDIO_VOLUME,
|
||||
Settings.SECTION_AUDIO,
|
||||
audioVolume,
|
||||
R.string.audio_volume,
|
||||
R.string.audio_volume_description,
|
||||
0,
|
||||
100,
|
||||
"%",
|
||||
100
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue