adding icons, improving AndroidManifest.xml handling

This commit is contained in:
benfry
2010-07-19 02:15:47 +00:00
parent b855ec8da2
commit 9930c6beed
4 changed files with 55 additions and 19 deletions
+28 -8
View File
@@ -23,7 +23,9 @@ X reverting to using the PGraphics version rather than P2D
X because Paint.ascent() is returning negative values
X properly handle setting whatever permissions are necessary
X added dialog box to set permissions
X re: rewriting manifest on each build
o http://dev.processing.org/bugs/show_bug.cgi?id=1429
X http://code.google.com/p/processing/issues/detail?id=221
X change skewX/Y to shearX/Y
_ need updated reference for this
@@ -41,13 +43,7 @@ P3 _ example sketch added to bug report
P3 _ http://dev.processing.org/bugs/show_bug.cgi?id=1472
P3 _ http://code.google.com/p/processing/issues/detail?id=232
_ add method to set the icon (and package name?)
o http://dev.processing.org/bugs/show_bug.cgi?id=1429
_ http://code.google.com/p/processing/issues/detail?id=221
_ http://developer.android.com/guide/publishing/preparing.html
_ add information to wiki about preparing apps for release
_ http://developer.android.com/guide/publishing/preparing.html
_ remove 'import processing.opengl.*' in the preprocessor?
_ additional manifest gui necessary:
_ icons are apparently important
@@ -56,9 +52,30 @@ _ http://developer.android.com/guide/practices/ui_guidelines/icon_design.html
_ setting the default package
_ some sort of warning re: messing with AndroidManifest.xml
_ Remove the android:debuggable="true" attribute from <application>
_ http://developer.android.com/guide/publishing/preparing.html
"Medium-density assets go in a res/drawable-mdpi/ directory
(or in the default res/drawable/ directory),"
icon.png, icon-hdpi, icon-ldpi, icon-mdpi
android:icon="@drawable/app_notes"
./res/drawable-hdpi/app_notes.png -> 72x72
./res/drawable-hdpi-v6/app_notes.png
./res/drawable-ldpi-v6/app_notes.png -> 36x36
./res/drawable-mdpi/app_notes.png -> 48x48
./res/drawable-mdpi-v6/app_notes.png
android:icon="@drawable/app_lunar_lander"
./res/drawable/app_lunar_lander.png -> 64x64
JetBoy... <application android:icon="@drawable/icon"
res/drawable/icon.png -> 48x48
_ also for the wiki:
_ add information about permissions, since loadStrings() will break
_ add information to wiki about preparing apps for release
_ http://developer.android.com/guide/publishing/preparing.html
_ don't let the keystore message show up in red
_ Using keystore: /Users/fry/.android/debug.keystore
@@ -249,6 +266,9 @@ P2 _ http://dev.processing.org/bugs/show_bug.cgi?id=1379
P2 _ save state re: whether sketches are android or java mode (or others?)
P2 _ http://dev.processing.org/bugs/show_bug.cgi?id=1380
_ compiler errors on Windows not highlighting line number
_ http://code.google.com/p/processing/issues/detail?id=253
P3 _ compiler errors not appearing properly on windows
P3 _ http://dev.processing.org/bugs/show_bug.cgi?id=1546
P3 _ remove various debug messages on the console
@@ -113,12 +113,12 @@ class Build {
// Create the 'src' folder with the preprocessed code.
final File srcFolder = new File(tempBuildFolder, "src");
// Base.openFolder(tempBuildFolder);
Base.openFolder(tempBuildFolder);
try {
manifest = new Manifest(editor);
System.out.println(manifest + " " + manifest.getPackageName());
// System.out.println(manifest + " " + manifest.getPackageName());
final File javaFolder =
mkdirs(srcFolder, manifest.getPackageName().replace('.', '/'));
// File srcFile = new File(actualSrc, className + ".java");
@@ -140,7 +140,7 @@ class Build {
if (className != null) {
// final File androidXML = new File(tempBuildFolder, "AndroidManifest.xml");
// writeAndroidManifest(androidXML, sketch.getName(), className);
manifest.setClassName(className);
// manifest.setClassName(className);
File tempManifest = new File(tempBuildFolder, "AndroidManifest.xml");
manifest.writeBuild(tempManifest, className, target.equals("debug"));
@@ -24,6 +24,7 @@ package processing.app.tools.android;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import processing.app.*;
@@ -161,15 +162,22 @@ public class Manifest {
* Save a new version of the manifest info to the build location.
* Also fill in any missing attributes that aren't yet set properly.
*/
protected void writeBuild(File file, String className, boolean debug) {
protected void writeBuild(File file, String className,
boolean debug) throws IOException {
// write a copy to the build location
save(file);
// load the copy from the build location and start messing with it
XMLElement mf = new XMLElement(new FileReader(file));
// package name, or default
String p = xml.getString("package").trim();
String p = mf.getString("package").trim();
if (p.length() == 0) {
xml.setString("package", defaultPackageName());
mf.setString("package", defaultPackageName());
}
// app name and label, or the class name
XMLElement app = xml.getChild("application");
XMLElement app = mf.getChild("application");
String label = app.getString("android:label");
if (label.length() == 0) {
app.setString("android:label", className);
@@ -184,7 +192,7 @@ public class Manifest {
}
PrintWriter writer = PApplet.createWriter(file);
xml.write(writer);
mf.write(writer);
writer.close();
}
@@ -229,11 +237,16 @@ public class Manifest {
}
protected void save() {
save(getManifestFile());
}
/**
* Save to the sketch folder, so that it can be copied in later.
*/
protected void save() {
PrintWriter writer = PApplet.createWriter(getManifestFile());
protected void save(File file) {
PrintWriter writer = PApplet.createWriter(file);
xml.write(writer);
writer.close();
}