From 469f0ec019752b041262acb6c704f0a822bbac65 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Tue, 7 Mar 2023 21:14:19 -0500 Subject: android: Convert SettingsActivityView to Kotlin --- .../features/settings/ui/SettingsActivityView.java | 98 ---------------------- .../features/settings/ui/SettingsActivityView.kt | 91 ++++++++++++++++++++ 2 files changed, 91 insertions(+), 98 deletions(-) delete mode 100644 src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivityView.java create mode 100644 src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivityView.kt (limited to 'src') diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivityView.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivityView.java deleted file mode 100644 index 58ccf31b7..000000000 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivityView.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.yuzu.yuzu_emu.features.settings.ui; - -import android.content.IntentFilter; - -import org.yuzu.yuzu_emu.features.settings.model.Settings; -import org.yuzu.yuzu_emu.utils.DirectoryStateReceiver; - -/** - * Abstraction for the Activity that manages SettingsFragments. - */ -public interface SettingsActivityView { - /** - * Show a new SettingsFragment. - * - * @param menuTag Identifier for the settings group that should be displayed. - * @param addToStack Whether or not this fragment should replace a previous one. - */ - void showSettingsFragment(String menuTag, boolean addToStack, String gameId); - - /** - * Called by a contained Fragment to get access to the Setting HashMap - * loaded from disk, so that each Fragment doesn't need to perform its own - * read operation. - * - * @return A possibly null HashMap of Settings. - */ - Settings getSettings(); - - /** - * Used to provide the Activity with Settings HashMaps if a Fragment already - * has one; for example, if a rotation occurs, the Fragment will not be killed, - * but the Activity will, so the Activity needs to have its HashMaps resupplied. - * - * @param settings The ArrayList of all the Settings HashMaps. - */ - void setSettings(Settings settings); - - /** - * Called when an asynchronous load operation completes. - * - * @param settings The (possibly null) result of the ini load operation. - */ - void onSettingsFileLoaded(Settings settings); - - /** - * Called when an asynchronous load operation fails. - */ - void onSettingsFileNotFound(); - - /** - * Display a popup text message on screen. - * - * @param message The contents of the onscreen message. - * @param is_long Whether this should be a long Toast or short one. - */ - void showToastMessage(String message, boolean is_long); - - /** - * End the activity. - */ - void finish(); - - /** - * Called by a containing Fragment to tell the Activity that a setting was changed; - * unless this has been called, the Activity will not save to disk. - */ - void onSettingChanged(); - - /** - * Show loading dialog while loading the settings - */ - void showLoading(); - - /** - * Hide the loading the dialog - */ - void hideLoading(); - - /** - * Show a hint to the user that the app needs the external storage to be mounted - */ - void showExternalStorageNotMountedHint(); - - /** - * Start the DirectoryInitialization and listen for the result. - * - * @param receiver the broadcast receiver for the DirectoryInitialization - * @param filter the Intent broadcasts to be received. - */ - void startDirectoryInitializationService(DirectoryStateReceiver receiver, IntentFilter filter); - - /** - * Stop listening to the DirectoryInitialization. - * - * @param receiver The broadcast receiver to unregister. - */ - void stopListeningToDirectoryInitializationService(DirectoryStateReceiver receiver); -} diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivityView.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivityView.kt new file mode 100644 index 000000000..5a5c5d9cf --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivityView.kt @@ -0,0 +1,91 @@ +package org.yuzu.yuzu_emu.features.settings.ui + +import android.content.IntentFilter +import org.yuzu.yuzu_emu.features.settings.model.Settings +import org.yuzu.yuzu_emu.utils.DirectoryStateReceiver + +/** + * Abstraction for the Activity that manages SettingsFragments. + */ +interface SettingsActivityView { + /** + * Show a new SettingsFragment. + * + * @param menuTag Identifier for the settings group that should be displayed. + * @param addToStack Whether or not this fragment should replace a previous one. + */ + fun showSettingsFragment(menuTag: String, addToStack: Boolean, gameId: String) + + /** + * Called by a contained Fragment to get access to the Setting HashMap + * loaded from disk, so that each Fragment doesn't need to perform its own + * read operation. + * + * @return A possibly null HashMap of Settings. + */ + var settings: Settings? + + /** + * Called when an asynchronous load operation completes. + * + * @param settings The (possibly null) result of the ini load operation. + */ + fun onSettingsFileLoaded(settings: Settings?) + + /** + * Called when an asynchronous load operation fails. + */ + fun onSettingsFileNotFound() + + /** + * Display a popup text message on screen. + * + * @param message The contents of the onscreen message. + * @param is_long Whether this should be a long Toast or short one. + */ + fun showToastMessage(message: String, is_long: Boolean) + + /** + * End the activity. + */ + fun finish() + + /** + * Called by a containing Fragment to tell the Activity that a setting was changed; + * unless this has been called, the Activity will not save to disk. + */ + fun onSettingChanged() + + /** + * Show loading dialog while loading the settings + */ + fun showLoading() + + /** + * Hide the loading the dialog + */ + fun hideLoading() + + /** + * Show a hint to the user that the app needs the external storage to be mounted + */ + fun showExternalStorageNotMountedHint() + + /** + * Start the DirectoryInitialization and listen for the result. + * + * @param receiver the broadcast receiver for the DirectoryInitialization + * @param filter the Intent broadcasts to be received. + */ + fun startDirectoryInitializationService( + receiver: DirectoryStateReceiver?, + filter: IntentFilter + ) + + /** + * Stop listening to the DirectoryInitialization. + * + * @param receiver The broadcast receiver to unregister. + */ + fun stopListeningToDirectoryInitializationService(receiver: DirectoryStateReceiver) +} -- cgit v1.2.3