diff --git a/android/src/main/java/com/brentvatne/react/ReactVideoPackage.kt b/android/src/main/java/com/brentvatne/react/ReactVideoPackage.kt index 6f93485889..99aed98510 100644 --- a/android/src/main/java/com/brentvatne/react/ReactVideoPackage.kt +++ b/android/src/main/java/com/brentvatne/react/ReactVideoPackage.kt @@ -1,50 +1,29 @@ -package com.brentvatne.react; +package com.brentvatne.react -import com.brentvatne.exoplayer.DefaultReactExoplayerConfig; -import com.brentvatne.exoplayer.ReactExoplayerConfig; -import com.brentvatne.exoplayer.ReactExoplayerViewManager; -import com.facebook.react.ReactPackage; -import com.facebook.react.bridge.JavaScriptModule; -import com.facebook.react.bridge.NativeModule; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.uimanager.ViewManager; +import com.brentvatne.exoplayer.DefaultReactExoplayerConfig +import com.brentvatne.exoplayer.ReactExoplayerConfig +import com.brentvatne.exoplayer.ReactExoplayerViewManager +import com.facebook.react.ReactPackage +import com.facebook.react.bridge.JavaScriptModule +import com.facebook.react.bridge.NativeModule +import com.facebook.react.bridge.ReactApplicationContext +import com.facebook.react.uimanager.ViewManager -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +class ReactVideoPackage @JvmOverloads constructor(private var config: ReactExoplayerConfig? = null) : ReactPackage { -public class ReactVideoPackage implements ReactPackage { - - private ReactExoplayerConfig config; - - public ReactVideoPackage() { - } - - public ReactVideoPackage(ReactExoplayerConfig config) { - this.config = config; - } - - @Override - public List createNativeModules(ReactApplicationContext reactContext) { - List modules = new ArrayList(); - - modules.add(new VideoDecoderPropertiesModule(reactContext)); - modules.add(new VideoManagerModule(reactContext)); - - return modules; - } + override fun createNativeModules(reactContext: ReactApplicationContext): List = + listOf( + VideoDecoderPropertiesModule(reactContext), + VideoManagerModule(reactContext) + ) // Deprecated RN 0.47 - public List> createJSModules() { - return Collections.emptyList(); - } - + fun createJSModules(): List> = emptyList() - @Override - public List createViewManagers(ReactApplicationContext reactContext) { + override fun createViewManagers(reactContext: ReactApplicationContext): List> { if (config == null) { - config = new DefaultReactExoplayerConfig(reactContext); + config = DefaultReactExoplayerConfig(reactContext) } - return Collections.singletonList(new ReactExoplayerViewManager(config)); + return listOf(ReactExoplayerViewManager(config!!)) } }