commit a2aa9fe4e1c868f76717217d42c5fe0b4127220d Author: Erik C. Thauvin Date: Mon Oct 11 16:12:44 2004 +0000 Initial import. diff --git a/.cvsignore b/.cvsignore new file mode 100755 index 0000000..29aa1e0 --- /dev/null +++ b/.cvsignore @@ -0,0 +1,4 @@ +DevSuite +deployed +build +cmd.bat \ No newline at end of file diff --git a/GooglME-1.iml b/GooglME-1.iml new file mode 100755 index 0000000..32f3335 --- /dev/null +++ b/GooglME-1.iml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GooglME-1.ipr b/GooglME-1.ipr new file mode 100755 index 0000000..97d8b08 --- /dev/null +++ b/GooglME-1.ipr @@ -0,0 +1,267 @@ + + + + + + + false + false + false + false + false + + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GooglME-1.iws b/GooglME-1.iws new file mode 100755 index 0000000..86cd76a --- /dev/null +++ b/GooglME-1.iws @@ -0,0 +1,387 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GooglME-2.iml b/GooglME-2.iml new file mode 100755 index 0000000..9268a8a --- /dev/null +++ b/GooglME-2.iml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GooglME-2.ipr b/GooglME-2.ipr new file mode 100755 index 0000000..de114e2 --- /dev/null +++ b/GooglME-2.ipr @@ -0,0 +1,267 @@ + + + + + + + false + false + false + false + false + + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GooglME-2.iws b/GooglME-2.iws new file mode 100755 index 0000000..1d2e2a5 --- /dev/null +++ b/GooglME-2.iws @@ -0,0 +1,439 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GooglME-2.jad b/GooglME-2.jad new file mode 100755 index 0000000..6e43448 --- /dev/null +++ b/GooglME-2.jad @@ -0,0 +1,10 @@ +MIDlet-1: GooglME,/googlme.png,net.thauvin.j2me.googlme.GooglME +MIDlet-Jar-URL: GooglME-2.jar +MIDlet-Icon: /googlme.png +MIDlet-Version: 0.1.0 +MIDlet-Description: GoogleME +MIDlet-Name: GooglME +MIDlet-Vendor: Erik C. Thauvin +MIDlet-Info-URL: http://www.thauvin.net/erik/j2me/ +MicroEdition-Profile: MIDP-2.0 +MIDlet-Permissions: javax.microedition.io.Connector.sms,javax.wireless.messaging.sms.send \ No newline at end of file diff --git a/GooglME.jad b/GooglME.jad new file mode 100755 index 0000000..4cb8261 --- /dev/null +++ b/GooglME.jad @@ -0,0 +1,8 @@ +MIDlet-1: GooglME,/googlme.png,net.thauvin.j2me.googlme.GooglME +MIDlet-Jar-URL: GooglME.jar +MIDlet-Icon: /googlme.png +MIDlet-Version: 0.1.0 +MIDlet-Description: GoogleME +MIDlet-Name: GooglME +MIDlet-Vendor: Erik C. Thauvin +MIDlet-Info-URL: http://www.thauvin.net/erik/j2me/ diff --git a/build.xml b/build.xml new file mode 100755 index 0000000..95d1342 --- /dev/null +++ b/build.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/googlme.gif b/googlme.gif new file mode 100755 index 0000000..3f42cfd Binary files /dev/null and b/googlme.gif differ diff --git a/googlme.wml b/googlme.wml new file mode 100755 index 0000000..c7d238a --- /dev/null +++ b/googlme.wml @@ -0,0 +1,24 @@ + + + + + +

+ GoogleME 0.1 (7Kb)
+

+

+ MIDP 2.0
+ Download Jad
+ Download Jar
+

+

+ MIDP 1.0
+ Download Jad
+ Download Jar
+

+
+
diff --git a/lib/cldcapi10.jar b/lib/cldcapi10.jar new file mode 100755 index 0000000..9b4bf49 Binary files /dev/null and b/lib/cldcapi10.jar differ diff --git a/lib/midpapi10.jar b/lib/midpapi10.jar new file mode 100755 index 0000000..f7a0634 Binary files /dev/null and b/lib/midpapi10.jar differ diff --git a/lib/midpapi20.jar b/lib/midpapi20.jar new file mode 100755 index 0000000..9969041 Binary files /dev/null and b/lib/midpapi20.jar differ diff --git a/lib/wma.jar b/lib/wma.jar new file mode 100755 index 0000000..dd28b7e Binary files /dev/null and b/lib/wma.jar differ diff --git a/licenses/J2ME WTK BinaryLicense.html b/licenses/J2ME WTK BinaryLicense.html new file mode 100755 index 0000000..f4e111b --- /dev/null +++ b/licenses/J2ME WTK BinaryLicense.html @@ -0,0 +1,178 @@ + + + + + + + + +
Sun Microsystems, Inc.
+
+ +
Binary Code License Agreement
+
+
+ READ THE TERMS OF THIS AGREEMENT AND ANY PROVIDED SUPPLEMENTAL LICENSE +TERMS (COLLECTIVELY "AGREEMENT") CAREFULLY BEFORE OPENING THE SOFTWARE MEDIA +PACKAGE.  BY OPENING THE SOFTWARE MEDIA PACKAGE, YOU AGREE TO THE TERMS +OF THIS AGREEMENT.  IF YOU ARE ACCESSING THE SOFTWARE ELECTRONICALLY, +INDICATE YOUR ACCEPTANCE OF THESE TERMS BY SELECTING THE "ACCEPT" BUTTON +AT THE END OF THIS AGREEMENT.  IF YOU DO NOT AGREE TO ALL THESE TERMS, +PROMPTLY RETURN THE UNUSED SOFTWARE TO YOUR PLACE OF PURCHASE FOR A REFUND +OR, IF THE SOFTWARE IS ACCESSED ELECTRONICALLY, SELECT THE "DECLINE" BUTTON +AT THE END OF THIS AGREEMENT.
+
+ 1. LICENSE TO USE.  Sun grants you a non-exclusive and non-transferable + license for the internal use only of the accompanying software and documentation + and any error corrections provided by Sun (collectively "Software"), by +the number of users and the class of computer hardware for which the corresponding + fee has been paid.
+
+ 2. RESTRICTIONS.  Software is confidential and copyrighted. +Title to Software and all associated intellectual property rights is retained +by Sun and/or its licensors.  Except as specifically authorized in any + Supplemental License Terms, you may not make copies of Software, other than + a single copy of Software for archival purposes.  Unless enforcement + is prohibited by applicable law, you may not modify, decompile, or reverse + engineer Software.  You acknowledge that Software is not designed, +licensed or intended for use in the design, construction, operation or maintenance + of any nuclear facility.  Sun disclaims any express or implied warranty + of fitness for such uses.  No right, title or interest in or to any +trademark, service mark, logo or trade name of Sun or its licensors is granted +under this Agreement.
+
+ 3. LIMITED WARRANTY.  Sun warrants to you that for a period +of ninety (90) days from the date of purchase, as evidenced by a copy of the +receipt, the media on which Software is furnished (if any) will be free of +defects in materials and workmanship under normal use.  Except for the +foregoing, Software is provided "AS IS".  Your exclusive remedy and +Sun's entire liability under this limited warranty will be at Sun's option + to replace Software media or refund the fee paid for Software.
+
+  4. DISCLAIMER OF WARRANTY.  UNLESS SPECIFIED IN THIS +AGREEMENT, ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, +INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE OR NON-INFRINGEMENT ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT THESE +DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.
+
+ 5. LIMITATION OF LIABILITY.  TO THE EXTENT NOT PROHIBITED BY + LAW, IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, + PROFIT OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + DAMAGES, HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT + OF OR RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS + BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.  In no event will +Sun's liability to you, whether in contract, tort (including negligence), +or otherwise, exceed the amount paid by you for Software under this Agreement.  +The foregoing limitations will apply even if the above stated warranty fails +of its essential purpose.
+
+ 6. Termination.  This Agreement is effective until terminated.  + You may terminate this Agreement at any time by destroying all copies of +Software.  This Agreement will terminate immediately without notice +from Sun if you fail to comply with any provision of this Agreement.  +Upon Termination, you must destroy all copies of Software.
+
+ 7. Export Regulations. All Software and technical data delivered +under this Agreement are subject to US export control laws and may be subject +to export or import regulations in other countries.  You agree to comply + strictly with all such laws and regulations and acknowledge that you have + the responsibility to obtain such licenses to export, re-export, or import + as may be required after delivery to you.
+
+ 8. U.S. Government Restricted Rights.  If Software is being +acquired by or on behalf of the U.S. Government or by a U.S. Government prime +contractor or subcontractor (at any tier), then the Government's rights in +Software and accompanying documentation will be only as set forth in this +Agreement; this is in accordance with 48 CFR 227.7201 through 227.7202-4 (for +Department of Defense (DOD) acquisitions) and with 48 CFR 2.101 and 12.212 +(for non-DOD acquisitions).
+
+ 9. Governing Law.  Any action related to this Agreement will + be governed by California law and controlling U.S. federal law.  No +choice of law rules of any jurisdiction will apply.
+
+ 10. Severability. If any provision of this Agreement is held to +be unenforceable, this Agreement will remain in effect with the provision +omitted, unless omission would frustrate the intent of the parties, in which +case this Agreement will immediately terminate.
+
+ 11. Integration.  This Agreement is the entire agreement between + you and Sun relating to its subject matter.  It supersedes all prior + or contemporaneous oral or written communications, proposals, representations + and warranties and prevails over any conflicting or additional terms of +any quote, order, acknowledgment, or other communication between the parties +relating to its subject matter during the term of this Agreement.  No +modification of this Agreement will be binding, unless in writing and signed +by an authorized representative of each party.
+
+ +
JAVA(TM) DEVELOPMENT TOOLS
+
+ J2ME(TM) WIRELESS TOOLKIT (J2ME WTK), VERSION 2.1.x
+ SUPPLEMENTAL LICENSE TERMS

+

+
+  These supplemental license terms ("Supplemental Terms") add to or +modify the terms of the Binary Code License Agreement (collectively, the "Agreement"). +Capitalized terms not defined in these Supplemental Terms shall have the +same meanings ascribed to them in the Agreement. These Supplemental Terms +shall supersede any inconsistent or conflicting terms in the Agreement, or +in any license contained within the Software.
+
+
+ 1. Software Internal Use and Development License Grant. Subject +to the terms and conditions of this Agreement, including, but not limited +to Section 2 (Java Technology Restrictions) of these Supplemental Terms, +Sun grants you a non-exclusive, non-transferable, limited license to reproduce + internally and use internally the binary form of the Software complete and + unmodified for the sole purpose of designing, developing and testing your + Java applets and applications intended to run on the Java platform ("Programs") + provided that any executable output generated by a compiler that is contained + in the Software must (a) only be compiled from source code that conforms +to the corresponding version of the OEM Java Language Specification; (b) +be in the class file format defined by the corresponding version of the OEM +Java Virtual Machine Specification; and (c) execute properly on a reference +runtime, as specified by Sun, associated with such version of the Java platform. +
+
+ 2. Java Technology Restrictions. You may not modify the Java Platform + Interface ("JPI", identified as classes contained within the "java" package + or any subpackages of the "java" package), by creating additional classes + within the JPI or otherwise causing the addition to or modification of the + classes in the JPI.  In the event that you create an additional class + and associated API(s) which (i) extends the functionality of the Java platform, + and (ii) is exposed to third party software developers for the purpose of + developing additional software which invokes such additional API, you must + promptly publish broadly an accurate specification for such API for free +use by all developers. You may not create, or authorize your licensees to +create, additional classes, interfaces, or subpackages that are in any way +identified as "java", "javax", "sun" or similar convention as specified by +Sun in any naming convention designation.
+
+ 3. Java Runtime Availability.  Refer to the appropriate version + of the Java Runtime Environment binary code license (currently located at + http://www.java.sun.com/jdk/index.html) for the availability of runtime +code which may be distributed with Java applets and applications.
+
+ 4. Trademarks and Logos. You acknowledge and agree as between you + and Sun that Sun owns the SUN, SOLARIS, JAVA, JINI, FORTE, and iPLANET trademarks + and all SUN, SOLARIS, JAVA, JINI, FORTE, and iPLANET-related trademarks, +service marks, logos and other brand designations ("Sun Marks"), and you +agree to comply with the Sun Trademark and Logo Usage Requirements currently +located at http://www.sun.com/policies/trademarks. Any use you make of the +Sun Marks inures to Sun's benefit.
+
+ 5. Source Code. Software may contain source code that is provided + solely for reference purposes pursuant to the terms of this Agreement.  + Source code may not be redistributed unless expressly provided for in this + Agreement. 6. Termination for Infringement.  Either party may terminate + this Agreement immediately should any Software become, or in either party's + opinion be likely to become, the subject of a claim of infringement of any + intellectual property right.
+
+  For inquiries please contact: Sun Microsystems, Inc.  4150 Network + Circle, Santa Clara, California 95054, U.S.A.
+ (Form ID#011801)
+ + + diff --git a/midp-1/net/thauvin/j2me/googlme/Util.java b/midp-1/net/thauvin/j2me/googlme/Util.java new file mode 100755 index 0000000..3b9c55e --- /dev/null +++ b/midp-1/net/thauvin/j2me/googlme/Util.java @@ -0,0 +1,91 @@ +/* + * @(#)Util.java + * + * Copyright (c) 2004, Erik C. Thauvin (http://www.thauvin.net/erik/) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the authors nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $Id$ + * + */ +package net.thauvin.j2me.googlme; + +import javax.microedition.lcdui.Choice; +import javax.microedition.lcdui.ChoiceGroup; +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Item; +import javax.microedition.lcdui.TextField; + + +/** + * The Util class implements methods specific to MIDP 1.x. + * + * @author Erik C. Thauvin + * @version $Revision$, $Date$ + * + * @created October 8, 2004 + * @since 1.0 + */ +public class Util +{ + /** + * Returns a new exclusive choice group. + * + * @param title The title. + * @param choices The choices. + * + * @return The choice group. + */ + public static ChoiceGroup getChoiceGroup(String title, String[] choices) + { + return new ChoiceGroup(title, Choice.EXCLUSIVE, choices, null); + } + + /** + * Sets the current item. + * + * @param screen The screen. + * @param item The item. + */ + public static void setCurrentItem(Display screen, Item item) + { + ; // Do nothing + } + + /** + * Sets the initial input mode of the given text field. + * + * @param field The text field. + * @param inputMode The input mode. + */ + public static void setInitialInputMode(TextField field, String inputMode) + { + ; // Do nothing + } +} diff --git a/midp-2/net/thauvin/j2me/googlme/Util.java b/midp-2/net/thauvin/j2me/googlme/Util.java new file mode 100755 index 0000000..70b6f91 --- /dev/null +++ b/midp-2/net/thauvin/j2me/googlme/Util.java @@ -0,0 +1,89 @@ +/* + * @(#)Util.java + * + * Copyright (c) 2004, Erik C. Thauvin (http://www.thauvin.net/erik/) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the authors nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $Id$ + * + */ +package net.thauvin.j2me.googlme; + +import javax.microedition.lcdui.ChoiceGroup; +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Item; +import javax.microedition.lcdui.TextField; + + +/** + * The Util class implements methods specific to MIDP 2.x. + * + * @author Erik C. Thauvin + * @version $Revision$, $Date$ + * + * @created October 8, 2004 + * @since 1.0 + */ +public class Util +{ + /** + * Returns a new exclusive choice group. + * + * @param title The title. + * @param choices The choices. + * + * @return The choice group. + */ + public static ChoiceGroup getChoiceGroup(String title, String[] choices) + { + return new ChoiceGroup(title, ChoiceGroup.POPUP, choices, null); + } + + /** + * Sets the current item. + * @param screen The screen. + * @param item The item. + */ + public static void setCurrentItem(Display screen, Item item) + { + screen.setCurrentItem(item); + } + + /** + * Sets the initial input mode of the given text field. + * + * @param field The text field. + * @param inputMode The input mode. + */ + public static void setInitialInputMode(TextField field, String inputMode) + { + field.setInitialInputMode(inputMode); + } +} diff --git a/res/googlme.png b/res/googlme.png new file mode 100755 index 0000000..347a657 Binary files /dev/null and b/res/googlme.png differ diff --git a/src/net/thauvin/j2me/googlme/GooglME.java b/src/net/thauvin/j2me/googlme/GooglME.java new file mode 100755 index 0000000..3890af5 --- /dev/null +++ b/src/net/thauvin/j2me/googlme/GooglME.java @@ -0,0 +1,299 @@ +/* + * @(#)GooglME.java + * + * Copyright (c) 2004, Erik C. Thauvin (http://www.thauvin.net/erik/) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the authors nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $Id$ + * + */ +package net.thauvin.j2me.googlme; + +import javax.microedition.io.*; +import javax.microedition.lcdui.Alert; +import javax.microedition.lcdui.AlertType; +import javax.microedition.lcdui.Command; +import javax.microedition.lcdui.CommandListener; +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Displayable; +import javax.microedition.lcdui.Item; +import javax.microedition.midlet.MIDlet; +import javax.microedition.midlet.MIDletStateChangeException; + +import javax.wireless.messaging.*; + + +/** + * The GooglME class implements a simple front-end for Google SMS. + * + * @author Erik C. Thauvin + * @version $Revision$, $Date$ + * + * @created October 8, 2004 + * @since 1.0 + */ +public class GooglME extends MIDlet implements CommandListener, Runnable +{ + /** + * The About command. + */ + protected /* final */ Command aboutCommand = new Command("About", Command.SCREEN, 5); + + /** + * The Back command. + */ + protected /* final */ Command backCommand = new Command("Back", Command.BACK, 2); + + /** + * The Clear command. + */ + protected /* final */ Command clearCommand = new Command("Clear", Command.SCREEN, 3); + + /** + * The Exit command. + */ + protected /* final */ Command exitCommand = new Command("Exit", Command.EXIT, 2); + + /** + * The Help command. + */ + protected /* final */ Command helpCommand = new Command("Help", Command.HELP, 4); + + /** + * The Send command. + */ + protected /* final */ Command sendCommand = new Command("Send", Command.SCREEN, 2); + + /** + * The application name. + */ + protected /* final */ String appName = "GooglME"; + + /** + * The application version. + */ + protected /* final */ String appVersion = "0.1"; + private Display display; + + /** + * The help screen. + */ + private /* final */ HelpScreen helpScreen; + + /** + * The main screen. + */ + private /* final */ MainScreen mainScreen; + private String query; + private int action; + + /** + * Creates a new GooglME instance. + */ + public GooglME() + { + super(); + + mainScreen = new MainScreen(this); + } + + /** + * Performs a command. + * + * @param c The command action. + * @param d The diplayable screen. + */ + public void commandAction(Command c, Displayable d) + { + if (c == exitCommand) + { + exit(); + } + else if (c == aboutCommand) + { + msg("About " + appName, appName + ' ' + appVersion + "\nCopyright 2004\nErik C. Thauvin\nerik@thauvin.net", + d, false); + } + else if (c == clearCommand) + { + mainScreen.queryFld.setString(""); + Util.setCurrentItem(display, (Item) mainScreen.queryFld); + } + else if (c == sendCommand) + { + query = mainScreen.queryFld.getString(); + action = mainScreen.actionPopup.getSelectedIndex(); + + if ((query != null) && (query.length() > 0)) + { + new Thread(this).start(); + } + else + { + msg("Invalid Input", "Please specify a query.", d, true); + Util.setCurrentItem(display, (Item) mainScreen.queryFld); + } + } + else if (c == helpCommand) + { + if (helpScreen == null) + { + helpScreen = new HelpScreen(this); + } + + display.setCurrent(helpScreen); + } + else if (c == backCommand) + { + display.setCurrent(mainScreen); + } + } + + /** + * Executes the thread. + */ + public void run() + { + sendSMS(); + } + + /** + * @see javax.microedition.midlet.MIDlet#destroyApp(boolean) + */ + protected void destroyApp(boolean b) + throws MIDletStateChangeException + { + notifyDestroyed(); + } + + /** + * @see javax.microedition.midlet.MIDlet#pauseApp() + */ + protected void pauseApp() + { + ; + } + + /** + * @see javax.microedition.midlet.MIDlet#startApp() + */ + protected void startApp() + throws MIDletStateChangeException + { + display = Display.getDisplay(this); + display.setCurrent(mainScreen); + } + + // Exits the application. + private void exit() + { + try + { + destroyApp(false); + } + catch (MIDletStateChangeException e) + { + ; // Do nothing + } + } + + // Displays a message/error dialog. + private void msg(String title, String msg, Displayable d, boolean isError) + { + /* final */ Alert alert = new Alert(title, msg, null, AlertType.INFO); + + if (isError) + { + alert.setType(AlertType.ERROR); + } + + alert.setTimeout(Alert.FOREVER); + display.setCurrent(alert, d); + } + + // Sends the SMS. + private void sendSMS() + { + /* final */ String address = "sms://46645"; + MessageConnection conn = null; + + try + { + conn = (MessageConnection) Connector.open(address); + + /* final */ TextMessage msg = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE); + msg.setAddress(address); + + // Froogle + if (action == 1) + { + msg.setPayloadText("f " + query); + } + + // Google + else if (action == 2) + { + msg.setPayloadText("g " + query); + } + + // Definition + else if (action == 3) + { + msg.setPayloadText("d " + query); + } + else + { + msg.setPayloadText(query); + } + + conn.send(msg); + + msg("SMS Sent", "The text message was sent.", mainScreen, false); + } + catch (Exception e) + { + msg("SMS Error", "The text message could not be sent: " + e.getMessage(), mainScreen, true); + } + finally + { + try + { + if (conn != null) + { + conn.close(); + } + } + catch (Exception ignore) + { + ; // Do nothing; + } + } + } +} diff --git a/src/net/thauvin/j2me/googlme/HelpScreen.java b/src/net/thauvin/j2me/googlme/HelpScreen.java new file mode 100755 index 0000000..69600b3 --- /dev/null +++ b/src/net/thauvin/j2me/googlme/HelpScreen.java @@ -0,0 +1,69 @@ +/* + * @(#)HelpScreen.java + * + * Copyright (c) 2004, Erik C. Thauvin (http://www.thauvin.net/erik/) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the authors nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $Id$ + * + */ +package net.thauvin.j2me.googlme; + +import javax.microedition.lcdui.Form; + + +/** + * The HelpScreen class implements a form used to display some help. + * + * @author Erik C. Thauvin + * @version $Revision$, $Date$ + * + * @created October 8, 2004 + * @since 1.0 + */ +public class HelpScreen extends Form +{ + /** + * Creates a new HelpScreen instance. + * + * @param midlet The MIDlet instance. + */ + public HelpScreen(GooglME midlet) + { + super(midlet.appName + " Help"); + + append("Google SMS: To get business listings, enter business name and city, state or zip. If you want to make sure you get Google Local results, put a period between the business name and the location. To get phone numbers, enter name of person and city, state or zip.\n\nFroogle Prices: For product prices, enter the product name.\n\nGoogle Search: For Google search snippets, enter the search terms.\n\nDefinition: For definitions, enter the word or term."); + + addCommand(midlet.exitCommand); + addCommand(midlet.backCommand); + + setCommandListener(midlet); + } +} diff --git a/src/net/thauvin/j2me/googlme/MainScreen.java b/src/net/thauvin/j2me/googlme/MainScreen.java new file mode 100755 index 0000000..5a6e35e --- /dev/null +++ b/src/net/thauvin/j2me/googlme/MainScreen.java @@ -0,0 +1,90 @@ +/* + * @(#)MainScreen.java + * + * Copyright (c) 2004, Erik C. Thauvin (http://www.thauvin.net/erik/) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the authors nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $Id$ + * + */ +package net.thauvin.j2me.googlme; + +import javax.microedition.lcdui.ChoiceGroup; +import javax.microedition.lcdui.Form; +import javax.microedition.lcdui.TextField; + + +/** + * The MainScreen class implements a form used to gather the data needed to perform a Google SMS query. + * + * @author Erik C. Thauvin + * @version $Revision$, $Date$ + * + * @created October 8, 2004 + * @since 1.0 + */ +public class MainScreen extends Form +{ + /** + * The query action popup. + */ + protected /* final */ ChoiceGroup actionPopup; + + /** + * The query field. + */ + protected /* final */ TextField queryFld; + + /** + * Creates a new MainScreen object. + * + * @param midlet The MIDlet instance. + */ + public MainScreen(GooglME midlet) + { + super(midlet.appName); + + queryFld = new TextField("Query: ", "", 25, TextField.ANY); + Util.setInitialInputMode(queryFld, "MIDP_LOWERCASE_LATIN"); + actionPopup = + Util.getChoiceGroup("Type: ", new String[] { "Google SMS", "Froogle Prices", "Google Search", "Definition" }); + actionPopup.setSelectedIndex(0, true); + append(queryFld); + append(actionPopup); + + addCommand(midlet.helpCommand); + addCommand(midlet.aboutCommand); + addCommand(midlet.clearCommand); + addCommand(midlet.exitCommand); + addCommand(midlet.sendCommand); + + setCommandListener(midlet); + } +}