Skip to content

Commit

Permalink
Convert to kt
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Oct 27, 2023
1 parent 2cca94a commit 3c472f8
Showing 1 changed file with 21 additions and 44 deletions.
65 changes: 21 additions & 44 deletions app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,57 +17,34 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

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) {}

Check warning on line 39 in app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt#L39

This empty block of code can be removed.

@Override
public final void onActivityResumed(Activity activity) {
// not needed
}
override fun onActivityResumed(activity: Activity) {}

Check warning on line 41 in app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt#L41

This empty block of code can be removed.

@Override
public final void onActivityPaused(Activity activity) {
// not needed
}
override fun onActivityPaused(activity: Activity) {}

Check warning on line 43 in app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt#L43

This empty block of code can be removed.

@Override
public final void onActivityStopped(Activity activity) {
// not needed
}
override fun onActivityStopped(activity: Activity) {}

Check warning on line 45 in app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt#L45

This empty block of code can be removed.

@Override
public final void onActivitySaveInstanceState(Activity activity, Bundle outState) {
// not needed
}
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}

Check warning on line 47 in app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt#L47

This empty block of code can be removed.

@Override
public final void onActivityDestroyed(Activity activity) {
// not needed
}
override fun onActivityDestroyed(activity: Activity) {}

Check warning on line 49 in app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

app/src/main/java/com/nextcloud/client/di/ActivityInjector.kt#L49

This empty block of code can be removed.
}

0 comments on commit 3c472f8

Please sign in to comment.