diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..08de716 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/CVS/ +CVS +/deployed/ +/build/ +/cmd.bat \ No newline at end of file diff --git a/GooglME-1.iws b/GooglME-1.iws index 0f8934c..7dc7bfa 100755 --- a/GooglME-1.iws +++ b/GooglME-1.iws @@ -115,7 +115,7 @@ - + @@ -124,7 +124,7 @@ - + @@ -133,28 +133,28 @@ - + - + - + - + @@ -163,7 +163,7 @@ - + @@ -179,25 +179,25 @@ + - + + + + - - - - @@ -231,30 +231,6 @@ - - - - - - - + + + + + + + @@ -330,21 +330,21 @@ - + - - - + + + - - - + + + - + @@ -444,9 +444,16 @@ + + + + + + + - + @@ -455,7 +462,7 @@ - + @@ -464,28 +471,28 @@ - + - + - + - + @@ -494,7 +501,7 @@ - + diff --git a/GooglME-2.iws b/GooglME-2.iws index b137339..eac11b6 100755 --- a/GooglME-2.iws +++ b/GooglME-2.iws @@ -112,45 +112,45 @@ - + - + - + - + - + - + - + - + @@ -159,7 +159,7 @@ - + @@ -173,14 +173,14 @@ - + - + @@ -202,29 +202,29 @@ - + - - - - - - - - + + + + + + + + + + + - - - - - + + @@ -258,6 +258,20 @@ + + - - @@ -357,13 +357,13 @@ - + - + @@ -460,6 +460,13 @@ + + + + + + + @@ -467,44 +474,30 @@ - - - - - - - - - - - - - - - + - + - + - + @@ -513,7 +506,7 @@ - + @@ -527,14 +520,21 @@ - + - + + + + + + + + diff --git a/GooglME-2.jad b/GooglME-2.jad index b2bd49f..968d158 100755 --- a/GooglME-2.jad +++ b/GooglME-2.jad @@ -1,7 +1,7 @@ MIDlet-1: GooglME,/googlme.png,net.thauvin.j2me.googlme.GooglME MIDlet-Jar-URL: GooglME-2.jar MIDlet-Icon: /googlme.png -MIDlet-Version: 0.3.0 +MIDlet-Version: 0.4.2 MIDlet-Description: GooglME MIDlet-Name: GooglME MIDlet-Vendor: Erik C. Thauvin diff --git a/GooglME.jad b/GooglME.jad index 1fd2405..cf7964e 100755 --- a/GooglME.jad +++ b/GooglME.jad @@ -1,7 +1,7 @@ MIDlet-1: GooglME,/googlme.png,net.thauvin.j2me.googlme.GooglME MIDlet-Jar-URL: GooglME.jar MIDlet-Icon: /googlme.png -MIDlet-Version: 0.3.0 +MIDlet-Version: 0.4.2 MIDlet-Description: GooglME MIDlet-Name: GooglME MIDlet-Vendor: Erik C. Thauvin diff --git a/build.xml b/build.xml index 6c5044f..d161a10 100755 --- a/build.xml +++ b/build.xml @@ -86,7 +86,7 @@ - + diff --git a/googlme.gif b/googlme.gif index 3f42cfd..3f1852a 100755 Binary files a/googlme.gif and b/googlme.gif differ diff --git a/googlme.wml b/googlme.wml index e4b3447..837758b 100755 --- a/googlme.wml +++ b/googlme.wml @@ -8,7 +8,7 @@

- GoogleME 0.3 (13Kb)
+ GoogleME 0.4.2 (~13Kb)

MIDP 2.0
diff --git a/lib/cldcapi10.jar b/lib/cldcapi10.jar index 9b4bf49..d53b92b 100755 Binary files a/lib/cldcapi10.jar and b/lib/cldcapi10.jar differ diff --git a/lib/midpapi10.jar b/lib/midpapi10.jar index f7a0634..58514a9 100755 Binary files a/lib/midpapi10.jar and b/lib/midpapi10.jar differ diff --git a/lib/midpapi20.jar b/lib/midpapi20.jar index 9969041..46d9dc0 100755 Binary files a/lib/midpapi20.jar and b/lib/midpapi20.jar differ diff --git a/res/.gitignore b/res/.gitignore new file mode 100644 index 0000000..0acd18c --- /dev/null +++ b/res/.gitignore @@ -0,0 +1 @@ +/Thumbs.db diff --git a/src/net/thauvin/j2me/googlme/.gitignore b/src/net/thauvin/j2me/googlme/.gitignore new file mode 100644 index 0000000..a0fa60b --- /dev/null +++ b/src/net/thauvin/j2me/googlme/.gitignore @@ -0,0 +1 @@ +/desktop.ini diff --git a/src/net/thauvin/j2me/googlme/GooglME.java b/src/net/thauvin/j2me/googlme/GooglME.java index 7d7358b..7d90976 100755 --- a/src/net/thauvin/j2me/googlme/GooglME.java +++ b/src/net/thauvin/j2me/googlme/GooglME.java @@ -83,6 +83,11 @@ public class GooglME extends MIDlet implements CommandListener, Runnable */ protected static final String CHOICE_GOOGLE_SMS = "Google SMS"; + /** + * Google Weather choice. + */ + protected static final String CHOICE_WEATHER = "Weather"; + /** * Local Showtimes choice. */ @@ -107,7 +112,7 @@ public class GooglME extends MIDlet implements CommandListener, Runnable /** * The application version. */ - protected static final String APP_VERSION = "0.3"; + protected static final String APP_VERSION = "0.4.2"; /** * The Back command. @@ -121,7 +126,7 @@ public class GooglME extends MIDlet implements CommandListener, Runnable { CHOICE_GOOGLE_SMS, CHOICE_GOOGLE_LOCAL, CHOICE_FROOGLE_PRICES, CHOICE_GOOGLE_SEARCH, CHOICE_MOVIE_SHOWTIMES, CHOICE_LOCAL_SHOWTIMES, - CHOICE_DEFINITION + CHOICE_DEFINITION, CHOICE_WEATHER }; /** @@ -184,6 +189,11 @@ public class GooglME extends MIDlet implements CommandListener, Runnable */ private static final String PREFIX_MOVIE = "movie: "; + /** + * The Weather query prefix. + */ + private static final String PREFIX_WEATHER = "weather "; + /** * The history preferences key. */ @@ -278,10 +288,10 @@ public class GooglME extends MIDlet implements CommandListener, Runnable { if (isValidString(_address)) { - _query = _mainScreen.queryFld.getString(); + /* final */ String q = _mainScreen.queryFld.getString(); _action = CHOICES[_mainScreen.actionPopup.getSelectedIndex()]; - if (isValidString(_query)) + if (isValidString(q)) { if (((_action.equals(CHOICE_GOOGLE_LOCAL)) || (_action.equals(CHOICE_LOCAL_SHOWTIMES))) && !isValidString(_location)) @@ -295,6 +305,11 @@ public class GooglME extends MIDlet implements CommandListener, Runnable _sendingAlert = new Alert(""); } + _query = buildQuery(q); + + addHistory(_query); + saveHistory(); + alert(_sendingAlert, "Sending SMS", "Sending message to " + _address + "...", d, 2500, false); new Thread(this).start(); @@ -406,6 +421,13 @@ public class GooglME extends MIDlet implements CommandListener, Runnable } } + // Weather + else if (query.startsWith(PREFIX_WEATHER)) + { + _mainScreen.queryFld.setString(query.substring(PREFIX_WEATHER.length())); + _mainScreen.actionPopup.setSelectedIndex(choiceIndex(CHOICE_WEATHER), true); + } + // Local else if (isValidString(_location) && query.endsWith('.' + _location)) { @@ -556,10 +578,8 @@ public class GooglME extends MIDlet implements CommandListener, Runnable { _history.removeElementAt(MAX_HISTORY - 1); } - + _history.insertElementAt(query, 0); - - saveHistory(); } // Displays a modal message/error alert dialog. @@ -589,6 +609,75 @@ public class GooglME extends MIDlet implements CommandListener, Runnable _display.setCurrent(alert, d); } + // Builds the full query . + private String buildQuery(String query) + { + /* final */ String text; + + if (_action.equals(CHOICE_GOOGLE_LOCAL)) + { + if (isValidString(_location)) + { + text = query + '.' + _location; + } + else + { + text = query; + } + } + + // Froogle + else if (_action.equals(CHOICE_FROOGLE_PRICES)) + { + text = PREFIX_FROOGLE + query; + } + + // Google + else if (_action.equals(CHOICE_GOOGLE_SEARCH)) + { + text = PREFIX_GOOGLE + query; + } + + // Definition + else if (_action.equals(CHOICE_DEFINITION)) + { + text = PREFIX_DEFINITION + query; + } + + // Showtimes + else if (_action.equals(CHOICE_MOVIE_SHOWTIMES)) + { + text = PREFIX_MOVIE + query; + } + + // Local Showtimes + else if (_action.equals(CHOICE_LOCAL_SHOWTIMES)) + { + if (isValidString(_location)) + { + text = PREFIX_MOVIE + query + ' ' + _location; + } + else + { + text = PREFIX_MOVIE + query; + } + } + + // Weather + else if (_action.equals(CHOICE_WEATHER)) + { + text = PREFIX_WEATHER + query; + } + + // Default + else + { + text = query; + } + + return text; + } + // Exits the application. private void exit() { @@ -657,66 +746,9 @@ public class GooglME extends MIDlet implements CommandListener, Runnable /* final */ TextMessage msg = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE); msg.setAddress(address); - /* final */ String text; + msg.setPayloadText(_query); - if (_action.equals(CHOICE_GOOGLE_LOCAL)) - { - if (isValidString(_location)) - { - text = _query + '.' + _location; - } - else - { - text = _query; - } - } - - // Froogle - else if (_action.equals(CHOICE_FROOGLE_PRICES)) - { - text = PREFIX_FROOGLE + _query; - } - - // Google - else if (_action.equals(CHOICE_GOOGLE_SEARCH)) - { - text = PREFIX_GOOGLE + _query; - } - - // Definition - else if (_action.equals(CHOICE_DEFINITION)) - { - text = PREFIX_DEFINITION + _query; - } - - // Showtimes - else if (_action.equals(CHOICE_MOVIE_SHOWTIMES)) - { - text = PREFIX_MOVIE + _query; - } - - // Local Showtimes - else if (_action.equals(CHOICE_LOCAL_SHOWTIMES)) - { - if (isValidString(_location)) - { - text = PREFIX_MOVIE + _query + ' ' + _location; - } - else - { - text = PREFIX_MOVIE + _query; - } - } - - // Default - else - { - text = _query; - } - - msg.setPayloadText(text); conn.send(msg); - addHistory(text); //alert("SMS Sent", "The text message was sent.", _mainScreen, false); } diff --git a/src/net/thauvin/j2me/googlme/HelpScreen.java b/src/net/thauvin/j2me/googlme/HelpScreen.java index 1616154..7175d15 100755 --- a/src/net/thauvin/j2me/googlme/HelpScreen.java +++ b/src/net/thauvin/j2me/googlme/HelpScreen.java @@ -71,6 +71,8 @@ public class HelpScreen extends Form append(new StringItem(GooglME.CHOICE_LOCAL_SHOWTIMES + ": ", "To get local movie showtimes, enter the movie's title. For a listing of theaters near you, enter 'theaters'. For a listing of movies playing near you, enter 'movies'. The permanent location setting is automatically added to your query.\n\n")); append(new StringItem(GooglME.CHOICE_DEFINITION + ": ", "For definitions, enter the word or term.\n\n")); + append(new StringItem(GooglME.CHOICE_WEATHER + ": ", + "To get the latest weather conditions and four-day forecast for a particular U.S. location, just enter your location, zip or city and state.\n\n")); addCommand(GooglME.COMMAND_BACK);