9
0
mirror of https://gitee.com/shuto/customCamera.git synced 2026-05-02 00:07:24 +08:00

Modification pour gérer les fichiers de ressources drawable + ajout d'une classe java.

This commit is contained in:
Christophe Boucaut
2014-11-14 17:12:31 +01:00
parent 2ec58daee2
commit a674443551
3 changed files with 25 additions and 8 deletions
+22 -5
View File
@@ -11,6 +11,7 @@ var pathConfigXml = "config.xml";
var pathAndroidCordova = "platforms/android/";
var pathResAndroidCordova = "platforms/android/res/";
var pathAndroidPlugin = __dirname+"/../../src/android/";
var pathResAndroidPlugin = pathAndroidPlugin+"customCamera/res/";
var pathResPlugin = __dirname+"/../../res/";
/**
@@ -120,9 +121,9 @@ var updateConfig = function() {
var pathTranslations = pathResPlugin+"translations.json";
if (fs.existsSync(pathTranslations)) {
// get translations.
var translationsForApplications = fs.readFileSync(pathTranslations, {encoding: "utf8"});
translationsForApplications = JSON.parse(translationsForApplications);
for (lang in translationsForApplications) {
var translationsForApplication = fs.readFileSync(pathTranslations, {encoding: "utf8"});
translationsForApplication = JSON.parse(translationsForApplication);
for (lang in translationsForApplication) {
var pathFileTranslate = pathResAndroidCordova+"values-"+lang+"/";
var objToXml;
@@ -142,9 +143,9 @@ var updateConfig = function() {
}
// add message.
for (tag in translationsForApplications[lang]) {
for (tag in translationsForApplication[lang]) {
objToXml["resources"]["string"].push({
_: translationsForApplications[lang][tag],
_: translationsForApplication[lang][tag],
$: {
name: tag
}
@@ -161,6 +162,22 @@ var updateConfig = function() {
console.error("File translations.json in plugin not found.");
process.exit(1);
}
var contentResAndroidPlugin = fs.readdirSync(pathResAndroidPlugin);
for (var i = contentResAndroidPlugin.length - 1; i >= 0; i--) {
var nameDirDrawable = contentResAndroidPlugin[i];
if (nameDirDrawable.match(/^drawable-.*$/)) {
var contentDrawableDir = fs.readdirSync(pathResAndroidPlugin+nameDirDrawable);
for (var j = contentDrawableDir.length - 1; j >= 0; j--) {
var nameFileInDrawable = contentDrawableDir[j];
var contentFileDrawable = fs.readFileSync(pathResAndroidPlugin+nameDirDrawable+"/"+nameFileInDrawable);
if (!fs.existsSync(pathResAndroidCordova+nameDirDrawable)) {
fs.mkdirSync(pathResAndroidCordova+nameDirDrawable);
}
fs.writeFileSync(pathResAndroidCordova+nameDirDrawable+"/"+nameFileInDrawable, contentFileDrawable);
};
}
};
}
// Check if files required exist.
+1
View File
@@ -28,6 +28,7 @@
<source-file src="src/android/CameraLauncher.java" target-dir="src/org/geneanet/customcamera" />
<source-file src="src/android/customCamera/src/org/geneanet/customcamera/CustomCamera.java" target-dir="src/org/geneanet/customcamera" />
<source-file src="src/android/customCamera/src/org/geneanet/customcamera/CameraPreview.java" target-dir="src/org/geneanet/customcamera" />
<source-file src="src/android/customCamera/src/org/geneanet/customcamera/VerticalSeekBar.java" target-dir="src/org/geneanet/customcamera" />
<hook type="before_build" src="hooks/before_build/generateActivity.js" />
</platform>
+2 -3
View File
@@ -1,11 +1,10 @@
{
"fr": {
"Miniature": "Miniature",
"PHOTO": "Photo",
"PHOTO": "Photo"
},
"en": {
"Miniature": "Miniature",
"PHOTO": "Photo",
"PHOTO": "Photo"
}
}