mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
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:
@ -14,6 +14,16 @@ function initLifecycleCallbacks() {
|
|||||||
let lifecycleCallbacks = new android.app.Application.ActivityLifecycleCallbacks({
|
let lifecycleCallbacks = new android.app.Application.ActivityLifecycleCallbacks({
|
||||||
onActivityCreated: function (activity: any, bundle: any) {
|
onActivityCreated: function (activity: any, bundle: any) {
|
||||||
if (!androidApp.startActivity) {
|
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.startActivity = activity;
|
||||||
androidApp.notify(<definition.AndroidActivityBundleEventData>{ eventName: "activityCreated", object: androidApp, activity: activity, bundle: bundle });
|
androidApp.notify(<definition.AndroidActivityBundleEventData>{ eventName: "activityCreated", object: androidApp, activity: activity, bundle: bundle });
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user