6d67c67d5f
* chapter drawer themed textcolor * animated splashscreen * added lotti animation * splashscreen centered * upgrade to android sdk 31 * reverted sdk changes * fixed unstyled bars * fixed animation Co-authored-by: Patrick <patrick.los@proton.me>
101 lines
3.2 KiB
Java
101 lines
3.2 KiB
Java
package com.rajarsheechatterjee.LNReader;
|
|
|
|
import android.app.Application;
|
|
import android.content.Context;
|
|
|
|
import com.facebook.react.PackageList;
|
|
import com.facebook.react.ReactApplication;
|
|
import com.facebook.react.ReactInstanceManager;
|
|
import com.facebook.react.ReactNativeHost;
|
|
import com.facebook.react.ReactPackage;
|
|
import com.facebook.soloader.SoLoader;
|
|
import com.rajarsheechatterjee.LNReader.generated.BasePackageList;
|
|
import com.rajarsheechatterjee.VolumeButtonListener.VolumeButtonListenerPackage;
|
|
|
|
import org.unimodules.adapters.react.ModuleRegistryAdapter;
|
|
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
|
|
|
|
import com.facebook.react.bridge.JSIModulePackage;
|
|
import com.swmansion.reanimated.ReanimatedJSIModulePackage;
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.util.List;
|
|
|
|
import org.devio.rn.splashscreen.SplashScreenReactPackage;
|
|
|
|
public class MainApplication extends Application implements ReactApplication {
|
|
private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(
|
|
new BasePackageList().getPackageList());
|
|
|
|
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
|
|
@Override
|
|
public boolean getUseDeveloperSupport() {
|
|
return BuildConfig.DEBUG;
|
|
}
|
|
|
|
@Override
|
|
protected List<ReactPackage> getPackages() {
|
|
List<ReactPackage> packages = new PackageList(this).getPackages();
|
|
packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));
|
|
packages.add(new com.rajarsheechatterjee.LNReader.NavigationBarColorPackage());
|
|
packages.add(new VolumeButtonListenerPackage());
|
|
return packages;
|
|
}
|
|
|
|
@Override
|
|
protected String getJSMainModuleName() {
|
|
return "index";
|
|
}
|
|
|
|
@Override
|
|
protected JSIModulePackage getJSIModulePackage() {
|
|
return new ReanimatedJSIModulePackage();
|
|
}
|
|
};
|
|
|
|
@Override
|
|
public ReactNativeHost getReactNativeHost() {
|
|
return mReactNativeHost;
|
|
}
|
|
|
|
@Override
|
|
public void onCreate() {
|
|
super.onCreate();
|
|
SoLoader.init(this, /* native exopackage */ false);
|
|
|
|
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
|
|
}
|
|
|
|
/**
|
|
* Loads Flipper in React Native templates. Call this in the onCreate method
|
|
* with something like
|
|
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
|
|
*
|
|
* @param context
|
|
* @param reactInstanceManager
|
|
*/
|
|
private static void initializeFlipper(
|
|
Context context, ReactInstanceManager reactInstanceManager) {
|
|
if (BuildConfig.DEBUG) {
|
|
try {
|
|
/*
|
|
* We use reflection here to pick up the class that initializes Flipper,
|
|
* since Flipper library is not available in release mode
|
|
*/
|
|
Class<?> aClass = Class.forName("com.rajarsheechatterjee.LNReader.ReactNativeFlipper");
|
|
aClass
|
|
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
|
|
.invoke(null, context, reactInstanceManager);
|
|
} catch (ClassNotFoundException e) {
|
|
e.printStackTrace();
|
|
} catch (NoSuchMethodException e) {
|
|
e.printStackTrace();
|
|
} catch (IllegalAccessException e) {
|
|
e.printStackTrace();
|
|
} catch (InvocationTargetException e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|