diff options
author | Charles Lombardo <clombardo169@gmail.com> | 2023-03-07 23:20:31 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2023-06-03 09:05:36 +0200 |
commit | 412ec72d26ae40aa78f91b3c7a9e52da8e05b6ee (patch) | |
tree | 70670086944687c6ed53c5c7a803647cfa76759b /src/android | |
parent | android: Convert Setting to Kotlin (diff) | |
download | yuzu-412ec72d26ae40aa78f91b3c7a9e52da8e05b6ee.tar yuzu-412ec72d26ae40aa78f91b3c7a9e52da8e05b6ee.tar.gz yuzu-412ec72d26ae40aa78f91b3c7a9e52da8e05b6ee.tar.bz2 yuzu-412ec72d26ae40aa78f91b3c7a9e52da8e05b6ee.tar.lz yuzu-412ec72d26ae40aa78f91b3c7a9e52da8e05b6ee.tar.xz yuzu-412ec72d26ae40aa78f91b3c7a9e52da8e05b6ee.tar.zst yuzu-412ec72d26ae40aa78f91b3c7a9e52da8e05b6ee.zip |
Diffstat (limited to 'src/android')
2 files changed, 34 insertions, 55 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/SettingSection.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/SettingSection.java deleted file mode 100644 index da9d40c78..000000000 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/SettingSection.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.yuzu.yuzu_emu.features.settings.model; - -import java.util.HashMap; - -/** - * A semantically-related group of Settings objects. These Settings are - * internally stored as a HashMap. - */ -public final class SettingSection { - private String mName; - - private HashMap<String, Setting> mSettings = new HashMap<>(); - - /** - * Create a new SettingSection with no Settings in it. - * - * @param name The header of this section; e.g. [Core] or [Enhancements] without the brackets. - */ - public SettingSection(String name) { - mName = name; - } - - public String getName() { - return mName; - } - - /** - * Convenience method; inserts a value directly into the backing HashMap. - * - * @param setting The Setting to be inserted. - */ - public void putSetting(Setting setting) { - mSettings.put(setting.getKey(), setting); - } - - /** - * Convenience method; gets a value directly from the backing HashMap. - * - * @param key Used to retrieve the Setting. - * @return A Setting object (you should probably cast this before using) - */ - public Setting getSetting(String key) { - return mSettings.get(key); - } - - public HashMap<String, Setting> getSettings() { - return mSettings; - } - - public void mergeSection(SettingSection settingSection) { - for (Setting setting : settingSection.mSettings.values()) { - putSetting(setting); - } - } -} diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/SettingSection.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/SettingSection.kt new file mode 100644 index 000000000..929884e30 --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/SettingSection.kt @@ -0,0 +1,34 @@ +package org.yuzu.yuzu_emu.features.settings.model + +/** + * A semantically-related group of Settings objects. These Settings are + * internally stored as a HashMap. + */ +class SettingSection(val name: String) { + val settings = HashMap<String, Setting>() + + /** + * Convenience method; inserts a value directly into the backing HashMap. + * + * @param setting The Setting to be inserted. + */ + fun putSetting(setting: Setting) { + settings[setting.key] = setting + } + + /** + * Convenience method; gets a value directly from the backing HashMap. + * + * @param key Used to retrieve the Setting. + * @return A Setting object (you should probably cast this before using) + */ + fun getSetting(key: String): Setting? { + return settings[key] + } + + fun mergeSection(settingSection: SettingSection) { + for (setting in settingSection.settings.values) { + putSetting(setting) + } + } +} |