diff options
| author | Akshay Nair <phenax5@gmail.com> | 2024-05-12 16:40:21 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2024-09-29 16:16:35 +0530 |
| commit | 8ca8f830a09d8ff08ccb654199cb33779117cc37 (patch) | |
| tree | 328fcca1e9c04338e373aa9626d0ae4eaa11cbad /android/app/src/main/java/com/owynlauncherrewrite | |
| download | daft-launcher-8ca8f830a09d8ff08ccb654199cb33779117cc37.tar.gz daft-launcher-8ca8f830a09d8ff08ccb654199cb33779117cc37.zip | |
Initial commit
Generated by react-native@0.74.1
Diffstat (limited to 'android/app/src/main/java/com/owynlauncherrewrite')
| -rw-r--r-- | android/app/src/main/java/com/owynlauncherrewrite/MainActivity.kt | 22 | ||||
| -rw-r--r-- | android/app/src/main/java/com/owynlauncherrewrite/MainApplication.kt | 43 |
2 files changed, 65 insertions, 0 deletions
diff --git a/android/app/src/main/java/com/owynlauncherrewrite/MainActivity.kt b/android/app/src/main/java/com/owynlauncherrewrite/MainActivity.kt new file mode 100644 index 0000000..c784bb9 --- /dev/null +++ b/android/app/src/main/java/com/owynlauncherrewrite/MainActivity.kt @@ -0,0 +1,22 @@ +package com.owynlauncherrewrite + +import com.facebook.react.ReactActivity +import com.facebook.react.ReactActivityDelegate +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled +import com.facebook.react.defaults.DefaultReactActivityDelegate + +class MainActivity : ReactActivity() { + + /** + * Returns the name of the main component registered from JavaScript. This is used to schedule + * rendering of the component. + */ + override fun getMainComponentName(): String = "OwynLauncherRewrite" + + /** + * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] + * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] + */ + override fun createReactActivityDelegate(): ReactActivityDelegate = + DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) +} diff --git a/android/app/src/main/java/com/owynlauncherrewrite/MainApplication.kt b/android/app/src/main/java/com/owynlauncherrewrite/MainApplication.kt new file mode 100644 index 0000000..4583c39 --- /dev/null +++ b/android/app/src/main/java/com/owynlauncherrewrite/MainApplication.kt @@ -0,0 +1,43 @@ +package com.owynlauncherrewrite + +import android.app.Application +import com.facebook.react.PackageList +import com.facebook.react.ReactApplication +import com.facebook.react.ReactHost +import com.facebook.react.ReactNativeHost +import com.facebook.react.ReactPackage +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load +import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost +import com.facebook.react.defaults.DefaultReactNativeHost +import com.facebook.soloader.SoLoader + +class MainApplication : Application(), ReactApplication { + + override val reactNativeHost: ReactNativeHost = + object : DefaultReactNativeHost(this) { + override fun getPackages(): List<ReactPackage> = + PackageList(this).packages.apply { + // Packages that cannot be autolinked yet can be added manually here, for example: + // add(MyReactNativePackage()) + } + + override fun getJSMainModuleName(): String = "index" + + override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG + + override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED + override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED + } + + override val reactHost: ReactHost + get() = getDefaultReactHost(applicationContext, reactNativeHost) + + override fun onCreate() { + super.onCreate() + SoLoader.init(this, false) + if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { + // If you opted-in for the New Architecture, we load the native entry point for this app. + load() + } + } +} |
