Merge pull request #2514 from NativeScript/android-launch-screen

Add a mechanism the launch screen theme to be reset after launch
This commit is contained in:
Panayot Cankov
2016-07-27 15:26:16 +03:00
committed by GitHub

View File

@ -14,6 +14,16 @@ function initLifecycleCallbacks() {
let lifecycleCallbacks = new android.app.Application.ActivityLifecycleCallbacks({
onActivityCreated: function (activity: any, bundle: any) {
if (!androidApp.startActivity) {
// Set app theme after launch screen was used during startup
let activityInfo = activity.getPackageManager().getActivityInfo(activity.getComponentName(), android.content.pm.PackageManager.GET_META_DATA);
if (activityInfo.metaData) {
let setThemeOnLaunch = activityInfo.metaData.getInt("SET_THEME_ON_LAUNCH", -1);
if (setThemeOnLaunch !== -1) {
activity.setTheme(setThemeOnLaunch);
}
}
androidApp.startActivity = activity;
androidApp.notify(<definition.AndroidActivityBundleEventData>{ eventName: "activityCreated", object: androidApp, activity: activity, bundle: bundle });