From fe8be906f3f172028cf261eaf88423d75e2731d8 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 14 Mar 2023 23:00:02 +0100 Subject: [PATCH] Android: Use LifecycleOwner instead of subtype --- .../utils/AfterDirectoryInitializationRunner.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/AfterDirectoryInitializationRunner.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/AfterDirectoryInitializationRunner.java index 8d0d555caa..0312955156 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/AfterDirectoryInitializationRunner.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/AfterDirectoryInitializationRunner.java @@ -2,7 +2,7 @@ package org.dolphinemu.dolphinemu.utils; -import androidx.core.app.ComponentActivity; +import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.Observer; import org.dolphinemu.dolphinemu.utils.DirectoryInitialization.DirectoryInitializationState; @@ -18,10 +18,10 @@ public class AfterDirectoryInitializationRunner * be executed immediately. If this is called before directory initialization has finished, * the Runnable will be executed after directory initialization finishes. * - * If the passed-in activity gets destroyed before this operation finishes, - * it will be automatically canceled. + * If the passed-in LifecycleOwner gets destroyed before this operation finishes, + * the operation will be automatically canceled. */ - public void runWithLifecycle(ComponentActivity activity, Runnable runnable) + public void runWithLifecycle(LifecycleOwner lifecycleOwner, Runnable runnable) { if (DirectoryInitialization.areDolphinDirectoriesReady()) { @@ -30,7 +30,7 @@ public class AfterDirectoryInitializationRunner else { mObserver = createObserver(runnable); - DirectoryInitialization.getDolphinDirectoriesState().observe(activity, mObserver); + DirectoryInitialization.getDolphinDirectoriesState().observe(lifecycleOwner, mObserver); } }