From d63aca2af9d390d10d3a3f8a736aded0115bb63e Mon Sep 17 00:00:00 2001 From: alperozturk Date: Fri, 27 Oct 2023 16:32:13 +0200 Subject: [PATCH 1/3] Rename .java to .kt Signed-off-by: alperozturk --- .../client/di/{ActivityInjector.java => ActivityInjector.kt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename app/src/main/java/com/nextcloud/client/di/{ActivityInjector.java => ActivityInjector.kt} (100%) diff --git a/app/src/main/java/com/nextcloud/client/di/ActivityInjector.java b/app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt similarity index 100% rename from app/src/main/java/com/nextcloud/client/di/ActivityInjector.java rename to app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt From c66400a91f99a37ccded68ab3fb412f17d25bf68 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Fri, 27 Oct 2023 16:32:13 +0200 Subject: [PATCH 2/3] Convert to kt Signed-off-by: alperozturk --- .../nextcloud/client/di/ActivityInjector.kt | 65 ++++++------------- 1 file changed, 21 insertions(+), 44 deletions(-) diff --git a/app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt b/app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt index b3f1bed0565e..d99b57cde20a 100644 --- a/app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt +++ b/app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt @@ -17,57 +17,34 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ - -package com.nextcloud.client.di; - -import android.app.Activity; -import android.app.Application; -import android.os.Bundle; -import androidx.fragment.app.FragmentActivity; -import androidx.fragment.app.FragmentManager; -import dagger.android.AndroidInjection; - -public class ActivityInjector implements Application.ActivityLifecycleCallbacks { - - @Override - public final void onActivityCreated(Activity activity, Bundle savedInstanceState) { - if (activity instanceof Injectable) { - AndroidInjection.inject(activity); +package com.nextcloud.client.di + +import android.app.Activity +import android.app.Application.ActivityLifecycleCallbacks +import android.os.Bundle +import androidx.fragment.app.FragmentActivity +import dagger.android.AndroidInjection + +class ActivityInjector : ActivityLifecycleCallbacks { + override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) { + if (activity is Injectable) { + AndroidInjection.inject(activity) } - - if (activity instanceof FragmentActivity) { - final FragmentManager fm = ((FragmentActivity) activity).getSupportFragmentManager(); - fm.registerFragmentLifecycleCallbacks(new FragmentInjector(), true); + if (activity is FragmentActivity) { + val fm = activity.supportFragmentManager + fm.registerFragmentLifecycleCallbacks(FragmentInjector(), true) } } - @Override - public final void onActivityStarted(Activity activity) { - // not needed - } + override fun onActivityStarted(activity: Activity) {} - @Override - public final void onActivityResumed(Activity activity) { - // not needed - } + override fun onActivityResumed(activity: Activity) {} - @Override - public final void onActivityPaused(Activity activity) { - // not needed - } + override fun onActivityPaused(activity: Activity) {} - @Override - public final void onActivityStopped(Activity activity) { - // not needed - } + override fun onActivityStopped(activity: Activity) {} - @Override - public final void onActivitySaveInstanceState(Activity activity, Bundle outState) { - // not needed - } + override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {} - @Override - public final void onActivityDestroyed(Activity activity) { - // not needed - } + override fun onActivityDestroyed(activity: Activity) {} } From 3bae1d77c5a9cf842cc5f65ffff805a7d1c4d435 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Mon, 30 Oct 2023 19:02:50 +0100 Subject: [PATCH 3/3] add comments on currently unused methods Signed-off-by: Andy Scherzinger --- .../nextcloud/client/di/ActivityInjector.kt | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt b/app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt index d99b57cde20a..7828c9b82bf7 100644 --- a/app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt +++ b/app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt @@ -36,15 +36,27 @@ class ActivityInjector : ActivityLifecycleCallbacks { } } - override fun onActivityStarted(activity: Activity) {} + override fun onActivityStarted(activity: Activity) { + // unused atm + } - override fun onActivityResumed(activity: Activity) {} + override fun onActivityResumed(activity: Activity) { + // unused atm + } - override fun onActivityPaused(activity: Activity) {} + override fun onActivityPaused(activity: Activity) { + // unused atm + } - override fun onActivityStopped(activity: Activity) {} + override fun onActivityStopped(activity: Activity) { + // unused atm + } - override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {} + override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) { + // unused atm + } - override fun onActivityDestroyed(activity: Activity) {} + override fun onActivityDestroyed(activity: Activity) { + // unused atm + } }