From c39bf17f835122bdd1292271aac01498bb43286e Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Tue, 7 Mar 2023 21:15:02 -0500 Subject: android: Convert SettingsFragmentView to Kotlin --- .../features/settings/ui/SettingsFragmentView.java | 78 ---------------------- .../features/settings/ui/SettingsFragmentView.kt | 75 +++++++++++++++++++++ 2 files changed, 75 insertions(+), 78 deletions(-) delete mode 100644 src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentView.java create mode 100644 src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentView.kt (limited to 'src/android/app') diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentView.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentView.java deleted file mode 100644 index 3c1743fab..000000000 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentView.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.yuzu.yuzu_emu.features.settings.ui; - -import androidx.fragment.app.FragmentActivity; - -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.view.SettingsItem; - -import java.util.ArrayList; - -/** - * Abstraction for a screen showing a list of settings. Instances of - * this type of view will each display a layer of the setting hierarchy. - */ -public interface SettingsFragmentView { - /** - * Called by the containing Activity to notify the Fragment that an - * asynchronous load operation completed. - * - * @param settings The (possibly null) result of the ini load operation. - */ - void onSettingsFileLoaded(Settings settings); - - /** - * Pass a settings HashMap to the containing activity, so that it can - * share the HashMap with other SettingsFragments; useful so that rotations - * do not require an additional load operation. - * - * @param settings An ArrayList containing all the settings HashMaps. - */ - void passSettingsToActivity(Settings settings); - - /** - * Pass an ArrayList to the View so that it can be displayed on screen. - * - * @param settingsList The result of converting the HashMap to an ArrayList - */ - void showSettingsList(ArrayList settingsList); - - /** - * Called by the containing Activity when an asynchronous load operation fails. - * Instructs the Fragment to load the settings screen with defaults selected. - */ - void loadDefaultSettings(); - - /** - * @return The Fragment's containing activity. - */ - FragmentActivity getActivity(); - - /** - * Tell the Fragment to tell the containing Activity to show a new - * Fragment containing a submenu of settings. - * - * @param menuKey Identifier for the settings group that should be shown. - */ - void loadSubMenu(String menuKey); - - /** - * Tell the Fragment to tell the containing activity to display a toast message. - * - * @param message Text to be shown in the Toast - * @param is_long Whether this should be a long Toast or short one. - */ - void showToastMessage(String message, boolean is_long); - - /** - * Have the fragment add a setting to the HashMap. - * - * @param setting The (possibly previously missing) new setting. - */ - void putSetting(Setting setting); - - /** - * Have the fragment tell the containing Activity that a setting was modified. - */ - void onSettingChanged(); -} diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentView.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentView.kt new file mode 100644 index 000000000..c4a586329 --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentView.kt @@ -0,0 +1,75 @@ +package org.yuzu.yuzu_emu.features.settings.ui + +import androidx.fragment.app.FragmentActivity +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.view.SettingsItem + +/** + * Abstraction for a screen showing a list of settings. Instances of + * this type of view will each display a layer of the setting hierarchy. + */ +interface SettingsFragmentView { + /** + * Called by the containing Activity to notify the Fragment that an + * asynchronous load operation completed. + * + * @param settings The (possibly null) result of the ini load operation. + */ + fun onSettingsFileLoaded(settings: Settings?) + + /** + * Pass a settings HashMap to the containing activity, so that it can + * share the HashMap with other SettingsFragments; useful so that rotations + * do not require an additional load operation. + * + * @param settings An ArrayList containing all the settings HashMaps. + */ + fun passSettingsToActivity(settings: Settings) + + /** + * Pass an ArrayList to the View so that it can be displayed on screen. + * + * @param settingsList The result of converting the HashMap to an ArrayList + */ + fun showSettingsList(settingsList: ArrayList) + + /** + * Called by the containing Activity when an asynchronous load operation fails. + * Instructs the Fragment to load the settings screen with defaults selected. + */ + fun loadDefaultSettings() + + /** + * @return The Fragment's containing activity. + */ + val fragmentActivity: FragmentActivity + + /** + * Tell the Fragment to tell the containing Activity to show a new + * Fragment containing a submenu of settings. + * + * @param menuKey Identifier for the settings group that should be shown. + */ + fun loadSubMenu(menuKey: String) + + /** + * Tell the Fragment to tell the containing activity to display a toast message. + * + * @param message Text to be shown in the Toast + * @param is_long Whether this should be a long Toast or short one. + */ + fun showToastMessage(message: String?, is_long: Boolean) + + /** + * Have the fragment add a setting to the HashMap. + * + * @param setting The (possibly previously missing) new setting. + */ + fun putSetting(setting: Setting) + + /** + * Have the fragment tell the containing Activity that a setting was modified. + */ + fun onSettingChanged() +} -- cgit v1.2.3