FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge remote-tracking branch 'upstream/master' · processing/processing@0c61455 · GitHub

Repository navigation

Commit 0c61455

Browse files
Ostap Andrusiv
committed
Merge remote-tracking branch 'upstream/master'
2 parents bddbea5 + 5fcf88b commit 0c61455

44 files changed

Lines changed: 3320 additions & 2273 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎android/.classpath‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5+
<classpathentry combineaccessrules="false" kind="src" path="/processing-app"/>
6+
<classpathentry kind="lib" path="/processing-app/lib/antlr.jar" sourcepath="/processing-app/lib/antlr-src.zip"/>
7+
<classpathentry kind="lib" path="/processing-core/bin"/>
8+
<classpathentry kind="output" path="core/bin"/>
9+
</classpath>

‎android/.gitignore‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
android-core.zip
1+
bin
2+
android-core.zip
3+
release
4+
**/.DS_Store

‎android/.project‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>android-mode</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>

‎android/build.xml‎

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<?xml version="1.0"?>
2+
3+
<project name="Android Mode for Processing" default="build">
4+
5+
<!-- path to the main processing repo -->
6+
<property name="processing.dir" value=".." />
7+
8+
<property name="core.jar.path" value="android-core.zip" />
9+
<property name="mode.jar.path" value="mode/AndroidMode.jar" />
10+
<property name="mode.dist.path" value="release/AndroidMode.zip" />
11+
12+
13+
<target name="clean" description="Clean the build directories">
14+
<delete dir="bin" />
15+
<delete file="${mode.jar.path}" />
16+
17+
<!-- clean the core.jar project for Android -->
18+
<subant buildpath="core" target="clean"/>
19+
</target>
20+
21+
<target name="compile" description="Compile sources">
22+
<!-- build the core.jar file for Android -->
23+
<subant buildpath="core" target="build"/>
24+
25+
<condition property="core-built">
26+
<available file="${processing.dir}/core/library/core.jar" />
27+
</condition>
28+
<fail unless="core-built"
29+
message="Please build the core library first and make sure it sits in ${processing.dir}/core/library/core.jar" />
30+
31+
<mkdir dir="bin" />
32+
33+
<!-- env used to set classpath below -->
34+
<property environment="env" />
35+
36+
<!--
37+
classpath="../core/library/core.jar; lib/ant.jar; lib/ant-launcher.jar; lib/antlr.jar; lib/apple.jar; lib/jdt-core.jar; lib/jna.jar; lib/org-netbeans-swing-outline.jar;lib/com.ibm.icu_4.4.2.v20110823.jar;lib/jdi.jar;lib/jdimodel.jar;lib/org.eclipse.osgi_3.8.1.v20120830-144521.jar"
38+
-->
39+
<javac source="1.6"
40+
target="1.6"
41+
destdir="bin"
42+
encoding="UTF-8"
43+
includeAntRuntime="false"
44+
classpath="${processing.dir}/core/library/core.jar;
45+
${processing.dir}/app/pde.jar;
46+
${processing.dir}/app/lib/ant.jar;
47+
${processing.dir}/app/lib/ant-launcher.jar;
48+
${processing.dir}/app/lib/antlr.jar"
49+
debug="on">
50+
<src path="src" />
51+
</javac>
52+
</target>
53+
54+
55+
<target name="build" depends="compile" description="Build Android mode">
56+
<jar basedir="bin" destfile="${mode.jar.path}" />
57+
</target>
58+
59+
60+
<!-- now that this is standalone, probably not really needed -->
61+
<!--
62+
<target name="android-dist-check">
63+
-->
64+
<!-- ensure that the android-core.zip file has been built -->
65+
<!--
66+
<available file="${core.jar.path}"
67+
property="android-core-present" />
68+
-->
69+
<!--<echo message="${target.path}/modes/android/android-core.zip" />-->
70+
<!--
71+
<fail unless="android-core-present"
72+
message="android-core.zip was not built, but is required for dist. Install the Android tools, set ANDROID_SDK, and try again." />
73+
</target>
74+
-->
75+
76+
77+
<target name="dist"
78+
depends="build"
79+
description="Create AndroidMode.zip and AndroidMode.txt">
80+
<mkdir dir="release" />
81+
82+
<zip destfile="${mode.dist.path}">
83+
<zipfileset dir="." prefix="AndroidMode">
84+
<include name="android-core.zip" />
85+
<include name="mode.properties" />
86+
<include name="examples/**" />
87+
<include name="icons/**" />
88+
<include name="theme/**" />
89+
<!-- no extra keywords file
90+
<include name="keywords.txt" />
91+
-->
92+
<exclude name="**/._*" />
93+
</zipfileset>
94+
</zip>
95+
96+
<copy file="mode.properties"
97+
tofile="release/AndroidMode.txt" />
98+
</target>
99+
100+
101+
<target name="upload" depends="dist" description="Upload to processing.org">
102+
<!--
103+
<scp todir="${user}@processing.org:/var/www/web/download/">
104+
<fileset dir="release">
105+
<include name="AndroidMode.txt" />
106+
<include name="AndroidMode.zip" />
107+
</fileset>
108+
</scp>
109+
-->
110+
<exec executable="scp">
111+
<arg value="release/AndroidMode.txt" />
112+
<arg value="${user.name}@processing.org:/var/www/android/" />
113+
</exec>
114+
<exec executable="scp">
115+
<arg value="release/AndroidMode.zip" />
116+
<arg value="${user.name}@processing.org:/var/www/android/" />
117+
</exec>
118+
</target>
119+
120+
121+
</project>

‎android/core/src/processing/data/XML.java‎

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
*
4444
* @webref data:composite
4545
* @see PApplet#loadXML(String)
46+
* @see PApplet#parseXML(String)
47+
* @see PApplet#saveXML(XML, String)
4648
*/
4749
public class XML implements Serializable {
4850

@@ -75,16 +77,26 @@ protected XML() { }
7577
// this(parent.createReader(filename));
7678
// }
7779

80+
81+
/**
82+
* @param file description TBD
83+
*/
7884
public XML(File file) throws IOException, ParserConfigurationException, SAXException {
7985
this(file, null);
8086
}
8187

8288

89+
/**
90+
* @param options description TBD
91+
*/
8392
public XML(File file, String options) throws IOException, ParserConfigurationException, SAXException {
8493
this(PApplet.createReader(file), options);
8594
}
8695

8796

97+
/**
98+
* @param input description TBD
99+
*/
88100
public XML(InputStream input) throws IOException, ParserConfigurationException, SAXException {
89101
this(input, null);
90102
}
@@ -138,6 +150,9 @@ protected XML(Reader reader, String options) throws IOException, ParserConfigura
138150
}
139151

140152

153+
/**
154+
* @param name description TBD
155+
*/
141156
// TODO is there a more efficient way of doing this? wow.
142157
public XML(String name) throws ParserConfigurationException {
143158
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
@@ -749,6 +764,58 @@ public String getContent() {
749764
}
750765

751766

767+
public int getIntContent() {
768+
return getIntContent(0);
769+
}
770+
771+
772+
public int getIntContent(int defaultValue) {
773+
return PApplet.parseInt(node.getTextContent(), defaultValue);
774+
}
775+
776+
777+
public float getFloatContent() {
778+
return getFloatContent(0);
779+
}
780+
781+
782+
public float getFloatContent(float defaultValue) {
783+
return PApplet.parseFloat(node.getTextContent(), defaultValue);
784+
}
785+
786+
787+
public long getLongContent() {
788+
return getLongContent(0);
789+
}
790+
791+
792+
public long getLongContent(long defaultValue) {
793+
String c = node.getTextContent();
794+
if (c != null) {
795+
try {
796+
return Long.parseLong(c);
797+
} catch (NumberFormatException nfe) { }
798+
}
799+
return defaultValue;
800+
}
801+
802+
803+
public double getDoubleContent() {
804+
return getDoubleContent(0);
805+
}
806+
807+
808+
public double getDoubleContent(double defaultValue) {
809+
String c = node.getTextContent();
810+
if (c != null) {
811+
try {
812+
return Double.parseDouble(c);
813+
} catch (NumberFormatException nfe) { }
814+
}
815+
return defaultValue;
816+
}
817+
818+
752819
/**
753820
* @webref xml:method
754821
* @brief Sets the content of an element
@@ -758,6 +825,26 @@ public void setContent(String text) {
758825
}
759826

760827

828+
public void setIntContent(int value) {
829+
setContent(String.valueOf(value));
830+
}
831+
832+
833+
public void setFloatContent(float value) {
834+
setContent(String.valueOf(value));
835+
}
836+
837+
838+
public void setLongContent(long value) {
839+
setContent(String.valueOf(value));
840+
}
841+
842+
843+
public void setDoubleContent(double value) {
844+
setContent(String.valueOf(value));
845+
}
846+
847+
761848
/**
762849
* Format this XML data as a String.
763850
*

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL