diff --git a/.gitignore b/.gitignore index e847189..7591c3d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,29 @@ -/.svn/ -/bin/ +**/.idea/dictionaries +**/.idea/gradle.xml +**/.idea/libraries +**/.idea/tasks.xml +**/.idea/workspace.xml +*.iws +.DS_Store +.classpath +.gradle +.nb-gradle +.project +.settings /.classpath /.fbprefs /.pmd /.project +/.svn/ +/bin +/build +/deploy +/dist +/gen +/local.properties +/out +/proguard-project.txt +/project.properties +/test-output +Thumbs.db +ehthumbs.db \ No newline at end of file diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 2b841d5..6734ae1 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,16 +1,29 @@ - - - - - - - - - - - - \ No newline at end of file + android:installLocation="auto" + package="net.thauvin.erik.android.googsms" + android:versionCode="3" + android:versionName="0.3" > + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/gen/net/thauvin/erik/android/googsms/R.java b/gen/net/thauvin/erik/android/googsms/R.java index 7d16384..36dae30 100644 --- a/gen/net/thauvin/erik/android/googsms/R.java +++ b/gen/net/thauvin/erik/android/googsms/R.java @@ -31,30 +31,29 @@ public final class R { public static final int main=0x7f030001; } public static final class string { - public static final int about_menu_txt=0x7f06000a; - public static final int about_txt=0x7f060009; - public static final int alert_dialog_ok=0x7f06000c; - public static final int app_name=0x7f060001; - public static final int default_google_sms=0x7f060008; - public static final int hello=0x7f060000; - public static final int main_location_err_txt=0x7f060007; - public static final int main_query_err_txt=0x7f060006; - public static final int main_query_lbl_txt=0x7f060002; - public static final int main_send_btn_txt=0x7f060004; - public static final int main_sms_sent_txt=0x7f060005; - public static final int main_type_lbl_txt=0x7f060003; - public static final int prefs_dialog_title=0x7f06000d; - public static final int prefs_key_loc=0x7f060017; - public static final int prefs_key_sms=0x7f060016; - public static final int prefs_location_dialog_title=0x7f06000e; - public static final int prefs_location_hint=0x7f060011; - public static final int prefs_location_summary=0x7f060010; - public static final int prefs_location_title=0x7f06000f; - public static final int prefs_menu_txt=0x7f06000b; - public static final int prefs_sms_dialog_title=0x7f060012; - public static final int prefs_sms_hint=0x7f060015; - public static final int prefs_sms_summary=0x7f060014; - public static final int prefs_sms_title=0x7f060013; + public static final int about_menu_txt=0x7f060009; + public static final int about_txt=0x7f060008; + public static final int alert_dialog_ok=0x7f06000b; + public static final int app_name=0x7f060000; + public static final int default_google_sms=0x7f060007; + public static final int main_location_err_txt=0x7f060006; + public static final int main_query_err_txt=0x7f060005; + public static final int main_query_lbl_txt=0x7f060001; + public static final int main_send_btn_txt=0x7f060003; + public static final int main_sms_sent_txt=0x7f060004; + public static final int main_type_lbl_txt=0x7f060002; + public static final int prefs_dialog_title=0x7f06000c; + public static final int prefs_key_loc=0x7f060016; + public static final int prefs_key_sms=0x7f060015; + public static final int prefs_location_dialog_title=0x7f06000d; + public static final int prefs_location_hint=0x7f060010; + public static final int prefs_location_summary=0x7f06000f; + public static final int prefs_location_title=0x7f06000e; + public static final int prefs_menu_txt=0x7f06000a; + public static final int prefs_sms_dialog_title=0x7f060011; + public static final int prefs_sms_hint=0x7f060014; + public static final int prefs_sms_summary=0x7f060013; + public static final int prefs_sms_title=0x7f060012; } public static final class xml { public static final int prefs=0x7f040000; diff --git a/res/layout/main.xml b/res/layout/main.xml index a31ec84..e6cd564 100644 --- a/res/layout/main.xml +++ b/res/layout/main.xml @@ -1,26 +1,53 @@ + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:orientation="vertical" + android:padding="10dip" > - + + - - - + + - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 12e1b84..b14b43b 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -1,86 +1,68 @@ - - Search - Web Snippets - Local Search - Local Movies - Local Weather - Airlines - Airports - Area Codes - Calculator - Currency Conversion - Directions - Flights - Glossary - METAR - Maps - Movies - Products - Q&A - Sports - Stocks - Time - Translation - Weather - Zip Codes - Help - - - %s - web %s - %s %l - movies %%s %l - weather %l - %s - %s airport - area code %s - %s - %s - directions %s - flight %s - define %s - metar %s - map %s - movies %s - price %s - %s - score %s - stock %s - time %s - translate %s - weather %s - zip code %s - help %s - + + Search + Web Snippets + Local Search + Local Movies + Local Weather + Calculator + Currency Conversion + Directions + Glossary + Maps + Movies + Products + Sports + Stocks + Time + Translation + Weather + Zip Codes + Help + + + %s + WEB %s + %s %l + MOVIES %%s %l + WEATHER %l + %s + %s + DIRECTIONS %s + DEFINE %s + MAP %s + %s + PRICE %s + SCORE %s + STOCK %s + TIME %s + TRANSLATE %s + WEATHER %s + ZIP CODE %s + HELP %s + + + blockbuster seattle wa + search terms, e.g.: galaxy nexus + business listing, sushi, pizza, etc. + No query or current movie name + No query required + 1 us pint in liters, 5+2/2, etc. + 8 usd in yen + pasadena ca to 94043 + word to define, e.g.: zenith + 5th avenue new york + current movie name boston, ma + ipod 40gb, UPC/ISBN, etc. + NBA/NHL/MLB/NFL/NCAA team + ticker symbol, e.g.: goog + new york, ny + hello in french + new york, ny + 90210 + search feature, e.g.: local, etc. + - - blockbuster seattle wa - search terms, e.g.: nexus one - business listing, sushi, pizza, etc. - No query or current movie name - No query required - united airlines - airport code, e.g.: sfo - area code, e.g.: 650 - 1 us pint in liters, 5+2/2, etc. - 8 usd in yen - pasadena ca to 94043 - aa 2111, ua 14, etc. - word to define, e.g.: zenith - ICAO airport code, e.g.: khio - 5th avenue new york - current movie name boston, ma - ipod 40gb, UPC/ISBN, etc. - india population - NBA/NHL/MLB/NFL/NCAA team - ticker symbol, e.g.: goog - new york, ny - hello in french - new york, ny - 90210 - search feature, e.g.: local, etc. - - + \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index b7fd93c..2e7f85d 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,27 +1,28 @@ - Hello World, GoogSMS - GoogSMS - Query: - Type: - Send via SMS - Your message was sent. - Please enter a query... - Please set your location... - 466453 - © 2008-10 Erik C. Thauvin\nAll Rights Reserved\n\nerik@thauvin.net\n\nhttp://mobile.thauvin.net/ - About - Preferences - OK - Preferences - Set Your Location... - Location - Your current city and state or zip. - e.g.: san francisco ca or 94123 - Set SMS Number... - Google SMS - The short code or number of the Google SMS service. - e.g.: 466453 - prefs_sms - prefs_loc - + + GoogSMS + Query: + Type: + Send via SMS + Your message was sent. + Please enter a query! + Please set your location… + 466453 + © 2008–12 Erik C. Thauvin\nAll Rights Reserved\n\nerik@thauvin.net\nhttp://m.thauvin.net/android/ + About + Preferences + OK + Preferences + Set Your Location… + Location + Your current city and state or zip. + e.g.: san francisco ca or 94123 + Set SMS Number… + Google SMS + The short code or number of the Google SMS service. + e.g.: 466453 + prefs_sms + prefs_loc + + \ No newline at end of file diff --git a/screenshots/feature.png b/screenshots/feature.png new file mode 100644 index 0000000..f8014ee Binary files /dev/null and b/screenshots/feature.png differ diff --git a/screenshots/icon-hi.png b/screenshots/icon-hi.png new file mode 100644 index 0000000..7a7b7fb Binary files /dev/null and b/screenshots/icon-hi.png differ diff --git a/screenshots/promo.png b/screenshots/promo.png new file mode 100644 index 0000000..90f3011 Binary files /dev/null and b/screenshots/promo.png differ diff --git a/src/net/thauvin/erik/android/googsms/GoogSMS.java b/src/net/thauvin/erik/android/googsms/GoogSMS.java index 2e8367d..44d97f9 100644 --- a/src/net/thauvin/erik/android/googsms/GoogSMS.java +++ b/src/net/thauvin/erik/android/googsms/GoogSMS.java @@ -31,7 +31,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id$ + * $Id: GoogSMS.java 81 2010-06-29 12:59:19Z erik $ * */ package net.thauvin.erik.android.googsms; @@ -46,26 +46,32 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager.NameNotFoundException; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.telephony.gsm.SmsManager; import android.text.ClipboardManager; +import android.text.Editable; import android.text.TextUtils; +import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; +import android.view.MotionEvent; import android.view.View; +import android.view.View.OnTouchListener; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.Spinner; +import android.widget.TextView; import android.widget.Toast; /** * The GoogSMS class implements a simple front-end for Google SMS. * * @author Erik C. Thauvin - * @version $Revision$, $Date$ + * @version $Revision: 81 $, $Date: 2010-06-29 05:59:19 -0700 (Tue, 29 Jun 2010) $ * @created Nov 2, 2008 * @since 1.0 */ @@ -73,7 +79,7 @@ import android.widget.Toast; public class GoogSMS extends Activity { private static final boolean DEBUG = false; - + private static final int MAX_HISTORY_SIZE = 15; private static final int MENU_ABOUT = 0; private static final int MENU_PREFS = 1; @@ -198,6 +204,58 @@ public class GoogSMS extends Activity } }); + final Drawable imgX = getResources().getDrawable(android.R.drawable.presence_offline); + + manageClearButton(queryFld, imgX); + + queryFld.setOnTouchListener(new OnTouchListener() + { + @Override + public boolean onTouch(View v, MotionEvent event) + { + // Is there an X showing? + if (queryFld.getCompoundDrawables()[2] == null) + { + return false; + } + + // Only do this for up touches + if (event.getAction() != MotionEvent.ACTION_UP) + { + return false; + } + + // Is touch on our clear button? + if (event.getX() > queryFld.getWidth() - queryFld.getPaddingRight() - imgX.getIntrinsicWidth()) + { + queryFld.requestFocusFromTouch(); + queryFld.setText(""); + } + return false; + } + }); + + queryFld.addTextChangedListener(new TextWatcher() + { + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) + { + manageClearButton(queryFld, imgX); + } + + @Override + public void afterTextChanged(Editable s) + { + + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) + { + + } + }); + sendBtn.setOnClickListener(new Button.OnClickListener() { public void onClick(View view) @@ -322,9 +380,9 @@ public class GoogSMS extends Activity final LayoutInflater factory = LayoutInflater.from(this); final View aboutView = factory.inflate(R.layout.about, null); - new AlertDialog.Builder(this).setView(aboutView).setIcon(android.R.drawable.ic_dialog_info).setTitle( - getString(R.string.app_name) + ' ' + getVersionNumber()).setPositiveButton(R.string.alert_dialog_ok, - new DialogInterface.OnClickListener() + new AlertDialog.Builder(this).setView(aboutView).setIcon(android.R.drawable.ic_dialog_info) + .setTitle(getString(R.string.app_name) + ' ' + getVersionNumber()) + .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { @@ -394,4 +452,24 @@ public class GoogSMS extends Activity { mSmsNumber = smsNumber; } + + /** + * Manages the clear button. + * + * @param view The text view. + * @param img The image. + */ + private void manageClearButton(TextView view, Drawable img) + { + if (view.getText().toString().equals("")) + { + view.setCompoundDrawablesWithIntrinsicBounds(view.getCompoundDrawables()[0], view.getCompoundDrawables()[1], null, + view.getCompoundDrawables()[3]); + } + else + { + view.setCompoundDrawablesWithIntrinsicBounds(view.getCompoundDrawables()[0], view.getCompoundDrawables()[1], img, + view.getCompoundDrawables()[3]); + } + } } \ No newline at end of file