mirror of
https://github.com/processing/processing4.git
synced 2026-02-11 17:40:48 +01:00
permissions dialog box now working, read/write from AndroidManifest.xml works
This commit is contained in:
@@ -21,6 +21,8 @@ o http://code.google.com/p/processing/issues/detail?id=249
|
||||
X text ascent/descent problem, text("blah\nblah") doesn't work properly
|
||||
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
|
||||
|
||||
P1 _ exceptions with StreamPump and adb devices on osx and linux
|
||||
P1 _ http://dev.processing.org/bugs/show_bug.cgi?id=1545
|
||||
@@ -29,7 +31,6 @@ P1 _ implement certificates (self-signed) for distribution
|
||||
P1 _ http://developer.android.com/guide/publishing/app-signing.html
|
||||
P1 _ http://dev.processing.org/bugs/show_bug.cgi?id=1430
|
||||
P1 _ http://code.google.com/p/processing/issues/detail?id=222
|
||||
P1 _ properly handle setting whatever permissions are necessary
|
||||
|
||||
P3 _ Errors show up that .java files are duplicates with the Android tools.
|
||||
P3 _ problem is with the packages and where the preproc is putting the file
|
||||
|
||||
@@ -117,6 +117,7 @@ class Build {
|
||||
|
||||
try {
|
||||
manifest = new Manifest(editor);
|
||||
System.out.println(manifest + " " + manifest.getPackageName());
|
||||
|
||||
final File javaFolder =
|
||||
mkdirs(srcFolder, manifest.getPackageName().replace('.', '/'));
|
||||
@@ -140,6 +141,9 @@ class Build {
|
||||
// final File androidXML = new File(tempBuildFolder, "AndroidManifest.xml");
|
||||
// writeAndroidManifest(androidXML, sketch.getName(), className);
|
||||
manifest.setClassName(className);
|
||||
File tempManifest = new File(tempBuildFolder, "AndroidManifest.xml");
|
||||
manifest.save(tempManifest);
|
||||
|
||||
writeBuildProps(new File(tempBuildFolder, "build.properties"));
|
||||
buildFile = new File(tempBuildFolder, "build.xml");
|
||||
writeBuildXML(buildFile, sketch.getName());
|
||||
|
||||
@@ -48,7 +48,7 @@ public class Manifest {
|
||||
private Sketch sketch;
|
||||
|
||||
// entries we care about from the manifest file
|
||||
private String packageName;
|
||||
// private String packageName;
|
||||
|
||||
/** the manifest data read from the file */
|
||||
private XMLElement xml;
|
||||
@@ -57,22 +57,24 @@ public class Manifest {
|
||||
public Manifest(Editor editor) {
|
||||
this.editor = editor;
|
||||
this.sketch = editor.getSketch();
|
||||
load();
|
||||
}
|
||||
|
||||
|
||||
private String getDefaultPackageName() {
|
||||
private String defaultPackageName() {
|
||||
Sketch sketch = editor.getSketch();
|
||||
return Build.basePackage + "." + sketch.getName().toLowerCase();
|
||||
}
|
||||
|
||||
|
||||
public String getPackageName() {
|
||||
return packageName;
|
||||
// return packageName;
|
||||
return xml.getString("package");
|
||||
}
|
||||
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
// this.packageName = packageName;
|
||||
// this is the package attribute in the root <manifest> object
|
||||
xml.setString("package", packageName);
|
||||
save();
|
||||
@@ -126,7 +128,7 @@ public class Manifest {
|
||||
final PrintWriter writer = PApplet.createWriter(file);
|
||||
writer.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
|
||||
writer.println("<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" ");
|
||||
writer.println(" package=\"" + getDefaultPackageName() + "\" ");
|
||||
writer.println(" package=\"" + defaultPackageName() + "\" ");
|
||||
writer.println(" android:versionCode=\"1\" ");
|
||||
writer.println(" android:versionName=\"1.0\">");
|
||||
writer.println(" <uses-sdk android:minSdkVersion=\"" + Build.sdkVersion + "\" />");
|
||||
@@ -186,11 +188,24 @@ public class Manifest {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save to the sketch folder, so that it can be copied in later.
|
||||
*/
|
||||
protected void save() {
|
||||
save(getManifestFile());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save to another location (such as the temp build folder).
|
||||
*/
|
||||
protected void save(File file) {
|
||||
// Sketch sketch = editor.getSketch();
|
||||
// File manifestFile = new File(sketch.getFolder(), MANIFEST_XML);
|
||||
// File manifestFile
|
||||
xml.write(PApplet.createWriter(getManifestFile()));
|
||||
// File manifestFile
|
||||
PrintWriter writer = PApplet.createWriter(file);
|
||||
xml.write(writer);
|
||||
writer.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import processing.app.Editor;
|
||||
import processing.app.Preferences;
|
||||
import processing.app.tools.Tool;
|
||||
//import processing.core.*;
|
||||
import processing.core.PApplet;
|
||||
//import processing.core.PApplet;
|
||||
|
||||
|
||||
public class Permissions extends JFrame implements Tool {
|
||||
@@ -273,6 +273,8 @@ public class Permissions extends JFrame implements Tool {
|
||||
|
||||
|
||||
protected void setSelections(String[] sel) {
|
||||
// processing.core.PApplet.println("permissions are:");
|
||||
// processing.core.PApplet.println(sel);
|
||||
HashMap<String,Object> map = new HashMap<String, Object>();
|
||||
for (String s : sel) {
|
||||
map.put(s, new Object());
|
||||
@@ -280,7 +282,8 @@ public class Permissions extends JFrame implements Tool {
|
||||
DefaultListModel model = (DefaultListModel) permissionList.getModel();
|
||||
for (int i = 0; i < count; i++) {
|
||||
JCheckBox box = (JCheckBox) model.get(i);
|
||||
box.setSelected(map.containsKey(box.getName()));
|
||||
// System.out.println(map.containsKey(box.getText()) + " " + box.getText());
|
||||
box.setSelected(map.containsKey(box.getText()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user