CB-8079 Use activity class package name, but fallback to application

package name when looking for splash screen drawable

Close #136
This commit is contained in:
Daniel Toplak 2014-11-26 08:31:45 +01:00 committed by Andrew Grieve
parent d80d532a2a
commit 56a3ee5fe6
2 changed files with 6 additions and 0 deletions

View File

@ -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")) {

View File

@ -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);
}
}