From 56a3ee5fe66c4eb0ac67b2f258d4f1f9a0536ff8 Mon Sep 17 00:00:00 2001 From: Daniel Toplak Date: Wed, 26 Nov 2014 08:31:45 +0100 Subject: [PATCH] CB-8079 Use activity class package name, but fallback to application package name when looking for splash screen drawable Close #136 --- framework/src/org/apache/cordova/CordovaPreferences.java | 3 +++ framework/src/org/apache/cordova/SplashScreenInternal.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/framework/src/org/apache/cordova/CordovaPreferences.java b/framework/src/org/apache/cordova/CordovaPreferences.java index 536f25a2..ed0b9b89 100644 --- a/framework/src/org/apache/cordova/CordovaPreferences.java +++ b/framework/src/org/apache/cordova/CordovaPreferences.java @@ -133,6 +133,9 @@ public class CordovaPreferences { } else if (name.equals("splashscreen")) { // Note: We should probably pass in the classname for the variable splash on splashscreen! int resource = action.getResources().getIdentifier(value, "drawable", action.getClass().getPackage().getName()); + if(resource == 0) { + resource = action.getResources().getIdentifier(value, "drawable", action.getPackageName()); + } action.getIntent().putExtra(name, resource); } else if(name.equals("backgroundcolor")) { diff --git a/framework/src/org/apache/cordova/SplashScreenInternal.java b/framework/src/org/apache/cordova/SplashScreenInternal.java index 605fce7d..715e4182 100644 --- a/framework/src/org/apache/cordova/SplashScreenInternal.java +++ b/framework/src/org/apache/cordova/SplashScreenInternal.java @@ -54,6 +54,9 @@ public class SplashScreenInternal extends CordovaPlugin { String splashResource = preferences.getString("SplashScreen", null); if (splashResource != null) { drawableId = cordova.getActivity().getResources().getIdentifier(splashResource, "drawable", cordova.getActivity().getClass().getPackage().getName()); + if (drawableId == 0) { + drawableId = cordova.getActivity().getResources().getIdentifier(splashResource, "drawable", cordova.getActivity().getPackageName()); + } preferences.set("SplashDrawableId", drawableId); } }