Android port: generate initial config when none is present with dynamically

generated values depending on your environment.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29560 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Maurus Cuelenaere 2011-03-11 15:45:22 +00:00
parent 8196f21a94
commit fe6faf2e2c
45 changed files with 198 additions and 0 deletions

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">afrikaans.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">arabic.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">bulgarian.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">portugues-brasileiro.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">catala.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">wallisertitsch.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">czech.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">dansk.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">deutsch.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">greek.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">esperanto.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">espanol.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">eesti.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">finnish.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">francais.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">galego.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">hebrew.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">hindi.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">hrvatski.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">magyar.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">islenska.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">italiano.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">japanese.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">korean.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">lietuviu.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">nederlands.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">norsk-nynorsk.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">norsk.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">polski.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">portugues.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">romaneste.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">russian.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">slovak.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">slovenscina.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">srpski.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">svenska.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">thai.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">tagalog.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">turkce.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">ukrainian.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">walon.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">chinese-simp.lng</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="rockbox_language_file">chinese-trad.lng</string>
</resources>

View file

@ -11,6 +11,9 @@
<string name="error_extraction">Error occured during extraction!</string>
<string name="rockbox_extracting">Rockbox is loading. Please wait...</string>
<!-- Rockbox initial configuration values -->
<string name="rockbox_language_file">english.lng</string>
<!-- Widget -->
<string name="appwidget_label_4x1">Rockbox (line)</string>
<string name="appwidget_label_2x2">Rockbox (square)</string>

View file

@ -24,7 +24,9 @@ package org.rockbox;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.util.Enumeration;
import java.util.Timer;
import java.util.TimerTask;
@ -41,6 +43,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Environment;
import android.os.IBinder;
import android.os.ResultReceiver;
import android.util.Log;
@ -245,6 +248,26 @@ public class RockboxService extends Service
}
}
/* Generate default config if none exists yet */
File rockboxConfig = new File(Environment.getExternalStorageDirectory(), "rockbox/config.cfg");
if (!rockboxConfig.exists()) {
File rbDir = new File(rockboxConfig.getParent());
if (!rbDir.exists())
rbDir.mkdirs();
OutputStreamWriter strm;
try {
strm = new OutputStreamWriter(new FileOutputStream(rockboxConfig));
strm.write("# config generated by RockboxService\n");
strm.write("start directory: " + Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + "\n");
strm.write("lang: /.rockbox/langs/" + getString(R.string.rockbox_language_file) + "\n");
strm.close();
} catch(Exception e) {
LOG("Exception when writing default config", e);
}
}
/* Start native code */
if (resultReceiver != null)
resultReceiver.send(RESULT_INVOKING_MAIN, null);