From 9ab29b83392e1e3f28c95b09c292068893273a8e Mon Sep 17 00:00:00 2001 From: John Shelley Date: Thu, 23 Mar 2017 14:58:32 -0500 Subject: [PATCH 1/3] Update to v4 suffix drawables --- local-cli/bundle/assetPathUtils.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/local-cli/bundle/assetPathUtils.js b/local-cli/bundle/assetPathUtils.js index cf14b2c62cf0dc..504c35b8275db6 100644 --- a/local-cli/bundle/assetPathUtils.js +++ b/local-cli/bundle/assetPathUtils.js @@ -10,12 +10,12 @@ function getAndroidAssetSuffix(scale) { switch (scale) { - case 0.75: return 'ldpi'; - case 1: return 'mdpi'; - case 1.5: return 'hdpi'; - case 2: return 'xhdpi'; - case 3: return 'xxhdpi'; - case 4: return 'xxxhdpi'; + case 0.75: return 'ldpi-v4'; + case 1: return 'mdpi-v4'; + case 1.5: return 'hdpi-v4'; + case 2: return 'xhdpi-v4'; + case 3: return 'xxhdpi-v4'; + case 4: return 'xxxhdpi-v4'; } } @@ -53,4 +53,4 @@ module.exports = { getAndroidDrawableFolderName: getAndroidDrawableFolderName, getAndroidResourceIdentifier: getAndroidResourceIdentifier, getBasePath: getBasePath -}; \ No newline at end of file +}; From 767b41d5e41c2c1f309284d9660c6352819a06c5 Mon Sep 17 00:00:00 2001 From: John Shelley Date: Fri, 24 Mar 2017 00:11:41 -0500 Subject: [PATCH 2/3] Revert "Update to v4 suffix drawables" This reverts commit 9ab29b83392e1e3f28c95b09c292068893273a8e. --- local-cli/bundle/assetPathUtils.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/local-cli/bundle/assetPathUtils.js b/local-cli/bundle/assetPathUtils.js index 504c35b8275db6..cf14b2c62cf0dc 100644 --- a/local-cli/bundle/assetPathUtils.js +++ b/local-cli/bundle/assetPathUtils.js @@ -10,12 +10,12 @@ function getAndroidAssetSuffix(scale) { switch (scale) { - case 0.75: return 'ldpi-v4'; - case 1: return 'mdpi-v4'; - case 1.5: return 'hdpi-v4'; - case 2: return 'xhdpi-v4'; - case 3: return 'xxhdpi-v4'; - case 4: return 'xxxhdpi-v4'; + case 0.75: return 'ldpi'; + case 1: return 'mdpi'; + case 1.5: return 'hdpi'; + case 2: return 'xhdpi'; + case 3: return 'xxhdpi'; + case 4: return 'xxxhdpi'; } } @@ -53,4 +53,4 @@ module.exports = { getAndroidDrawableFolderName: getAndroidDrawableFolderName, getAndroidResourceIdentifier: getAndroidResourceIdentifier, getBasePath: getBasePath -}; +}; \ No newline at end of file From 1b9806f7c7cc72f6e6e109d3ad5e5eb3c154c519 Mon Sep 17 00:00:00 2001 From: John Shelley Date: Fri, 24 Mar 2017 00:11:54 -0500 Subject: [PATCH 3/3] Add v4 suffix for Library Projects --- react.gradle | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/react.gradle b/react.gradle index 09c06ca7e54bb0..cdf4dcacf6f1c3 100644 --- a/react.gradle +++ b/react.gradle @@ -21,6 +21,7 @@ void runBefore(String dependentTaskName, Task task) { } gradle.projectsEvaluated { + def isAndroidLibrary = plugins.hasPlugin("com.android.library") // Grab all build types and product flavors def buildTypes = android.buildTypes.collect { type -> type.name } def productFlavors = android.productFlavors.collect { flavor -> flavor.name } @@ -88,6 +89,24 @@ gradle.projectsEvaluated { enabled config."bundleIn${targetName}" || config."bundleIn${buildTypeName.capitalize()}" ?: targetName.toLowerCase().contains("release") + + if (isAndroidLibrary) { + doLast { + def moveFunc = { resSuffix -> + File originalDir = file("${resourcesDir}/drawable-${resSuffix}") + if (originalDir.exists()) { + File destDir = file("${resourcesDir}/drawable-${resSuffix}-v4") + ant.move(file: originalDir, tofile: destDir) + } + } + moveFunc.curry("ldpi").call() + moveFunc.curry("mdpi").call() + moveFunc.curry("hdpi").call() + moveFunc.curry("xhdpi").call() + moveFunc.curry("xxhdpi").call() + moveFunc.curry("xxxhdpi").call() + } + } } // Hook bundle${productFlavor}${buildType}JsAndAssets into the android build process