From 9d3560f0ecfdd177cd186eac32c95978694e4862 Mon Sep 17 00:00:00 2001 From: Gernot Pansy Date: Fri, 3 Feb 2012 11:38:03 +0100 Subject: [PATCH 1/6] added mysms as possible way to use the connector --- .../websms/connector/common/InfoActivity.java | 54 +++++++++++++------ 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/src/de/ub0r/android/websms/connector/common/InfoActivity.java b/src/de/ub0r/android/websms/connector/common/InfoActivity.java index 8509246..fcabfa0 100644 --- a/src/de/ub0r/android/websms/connector/common/InfoActivity.java +++ b/src/de/ub0r/android/websms/connector/common/InfoActivity.java @@ -44,6 +44,11 @@ public final class InfoActivity extends Activity { Intent.ACTION_VIEW, Uri.parse(// . "market://search?q=pname:de.ub0r.android.websms")); + /** Link to WebSMS in android market. */ + private static final Intent INTENT_MARKET_MYSMS = new Intent( + Intent.ACTION_VIEW, Uri.parse(// . + "market://search?q=pname:com.android.android.sms")); + /** Link to Connectors in android market. */ private static final Intent INTENT_MARKET_CONNECTORS = new Intent( Intent.ACTION_VIEW, Uri.parse(// . @@ -51,10 +56,14 @@ public final class InfoActivity extends Activity { /** Info text shown to user. */ private static final String INFO_TEXT = "This is a WebSMS Connector." - + "\nThe only way to use it, is lauching it with WebSMS."; + + "\nThe only way to use it, is lauching it with WebSMS or mysms."; /** Button label: search websms. */ private static final String BTN_MARKET_WEBSMS = "market: WebSMS"; + + /** Button label: search mysms. */ + private static final String BTN_MARKET_MYSMS = "market: mysms"; + /** Button label: search connectors. */ private static final String BTN_MARKET_CONNECTORS = // . "market: Connectors"; @@ -113,21 +122,36 @@ public void onClick(final DialogInterface dialog, InfoActivity.this.finish(); } }); - } - b.setNegativeButton(BTN_MARKET_CONNECTORS, - new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, - final int which) { - try { - InfoActivity.this - .startActivity(INTENT_MARKET_CONNECTORS); - } catch (ActivityNotFoundException e) { - Log.e(TAG, "no market", e); + b.setNegativeButton(BTN_MARKET_MYSMS, + new DialogInterface.OnClickListener() { + @Override + public void onClick(final DialogInterface dialog, + final int which) { + try { + InfoActivity.this + .startActivity(INTENT_MARKET_MYSMS); + } catch (ActivityNotFoundException e) { + Log.e(TAG, "no market", e); + } + InfoActivity.this.finish(); } - InfoActivity.this.finish(); - } - }); + }); + } else { + b.setNegativeButton(BTN_MARKET_CONNECTORS, + new DialogInterface.OnClickListener() { + @Override + public void onClick(final DialogInterface dialog, + final int which) { + try { + InfoActivity.this + .startActivity(INTENT_MARKET_CONNECTORS); + } catch (ActivityNotFoundException e) { + Log.e(TAG, "no market", e); + } + InfoActivity.this.finish(); + } + }); + } b.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(final DialogInterface dialog) { From 03c76a9d63d77a7e8f440e25c027de11b652d375 Mon Sep 17 00:00:00 2001 From: Gernot Pansy Date: Fri, 3 Feb 2012 11:39:09 +0100 Subject: [PATCH 2/6] changed info texts to reflect mysms as possible way to use connectors --- res/values-de/strings.xml | 2 +- res/values/strings.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 977c324..ed8a76d 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -21,7 +21,7 @@ Visit http://ub0r.de/translate/websms-api/edit.php?lang=de&file=strings.xml to edit the file. --> - Diese App ist ein WebSMS Connector.\nDu kannst ihn nur mit WebSMS nutzen. + Diese App ist ein WebSMS Connector.\nDu kannst ihn nur mit WebSMS oder mysms nutzen. WebSMS: senden Sende: FEHLER diff --git a/res/values/strings.xml b/res/values/strings.xml index c3bed5d..8031024 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -18,7 +18,7 @@ --> - This is a WebSMS Connector.\nThe only way to use it, is lauching it with WebSMS. + This is a WebSMS Connector.\nThe only way to use it, is lauching it with WebSMS or mysms. WebSMS: sending Sending: ERROR From e2bda7959af39d7ac46e78d4275267c4ae875f57 Mon Sep 17 00:00:00 2001 From: Gernot Pansy Date: Fri, 3 Feb 2012 11:40:56 +0100 Subject: [PATCH 3/6] added support for a different application icon --- .../ub0r/android/websms/connector/common/InfoActivity.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/de/ub0r/android/websms/connector/common/InfoActivity.java b/src/de/ub0r/android/websms/connector/common/InfoActivity.java index fcabfa0..fd28850 100644 --- a/src/de/ub0r/android/websms/connector/common/InfoActivity.java +++ b/src/de/ub0r/android/websms/connector/common/InfoActivity.java @@ -85,8 +85,11 @@ protected void onResume() { final String pkg = this.getPackageName(); final int info = this.getResources().getIdentifier("info_text", "string", pkg); - final int icon = this.getResources().getIdentifier("icon", "drawable", + int icon = this.getResources().getIdentifier("app_icon", "drawable", pkg); + if (icon == 0) { + icon = this.getResources().getIdentifier("icon", "drawable", pkg); + } Log.d(TAG, "resID.icon=" + icon); Log.d(TAG, "resID.info=" + info); if (icon > 0) { From bd3d6dee0c7f4c5da33dfcaa73162c40da7f5406 Mon Sep 17 00:00:00 2001 From: Gernot Pansy Date: Tue, 28 Feb 2012 20:41:16 +0100 Subject: [PATCH 4/6] renamed WebSMS Connector to Websms Connector --- res/values-de/strings.xml | 4 ++-- res/values-hu/strings.xml | 4 ++-- res/values-it/strings.xml | 4 ++-- res/values-ro/strings.xml | 4 ++-- res/values-ru/strings.xml | 4 ++-- res/values/strings.xml | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index ed8a76d..ea0fdac 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -21,8 +21,8 @@ Visit http://ub0r.de/translate/websms-api/edit.php?lang=de&file=strings.xml to edit the file. --> - Diese App ist ein WebSMS Connector.\nDu kannst ihn nur mit WebSMS oder mysms nutzen. - WebSMS: senden + Diese App ist ein Websms Connector.\nDu kannst ihn nur mit WebSMS oder mysms nutzen. + Websms: senden Sende: FEHLER Verbindung abgebrochen/fehlgeschlagen. Wenn deine Verbindung funktioniert, ist das sehr wahrscheinlich eine Downtime des Services. Kontrolliere die Issues auf der App-Website sowie Twitter für weitere Informationen. diff --git a/res/values-hu/strings.xml b/res/values-hu/strings.xml index d3cc9a0..00e3b8e 100644 --- a/res/values-hu/strings.xml +++ b/res/values-hu/strings.xml @@ -21,8 +21,8 @@ Visit http://ub0r.de/translate/websms-api/edit.php?lang=hu&file=strings.xml to edit the file. --> - Ez egy WebSMS kiegészítő.\nKizárólag a WebSMS-el együtt haszálható! - WebSMS: küldés + Ez egy Websms kiegészítő.\nKizárólag a WebSMS-el együtt haszálható! + Websms: küldés Küldés: HIBA Kapcsolat időtúllépési hiba. Ha az internetkapcsolatod működik, akkor valószínűleg a cél szerverrel van a hiba. A program honlapján és twitter accountján általában be van jelentve ha valami gond van. diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index 1d8eae9..e6ab2d2 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -21,9 +21,9 @@ Visit http://ub0r.de/translate/websms-api/edit.php?lang=it&file=strings.xml to edit the file. --> - Questo è un Connector per WebSMS + Questo è un Connector per Websms L\'unico modo per usarlo è lanciarlo con WebSMS. - WebSMS: invio + Websms: invio Invio: ERRORE Connessione terminata/scaduta. Se la connessione funziona, probabilmente si tratta di un guasto del servizio. Vedere il sito dell\'app per problemi e twitter per lo stato. diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml index 91ad96d..cfa1c84 100644 --- a/res/values-ro/strings.xml +++ b/res/values-ro/strings.xml @@ -21,8 +21,8 @@ Visit http://ub0r.de/translate/websms-api/ro/strings.xml to edit the file. --> - Acesta este un Conector WebSMS.\nUnica modalitate de a-l folosi este cu ajutorul aplicației WebSMS. - WebSMS: trimitere + Acesta este un Conector Websms.\nUnica modalitate de a-l folosi este cu ajutorul aplicației WebSMS. + Websms: trimitere Trimitere: EROARE Conexiune terminată/întârziată. Dacă aveți o conexiune care lucrează, cel mai probabil e o problemă a serviciului țintă. Verificați situl web al aplicației sau canalul Twitter pentru statut. diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index d552a98..e0fa5df 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -21,8 +21,8 @@ Visit http://ub0r.de/translate/websms-api/edit.php?lang=ru&file=strings.xml to edit the file. --> - This is a WebSMS Connector.\nThe only way to use it, is lauching it with WebSMS. - WebSMS: Отправка + This is a Websms Connector.\nThe only way to use it, is lauching it with WebSMS or mysms. + Websms: Отправка Отправка: ОШИБКА ОШИБКА: HTTP diff --git a/res/values/strings.xml b/res/values/strings.xml index 8031024..235691c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -18,8 +18,8 @@ --> - This is a WebSMS Connector.\nThe only way to use it, is lauching it with WebSMS or mysms. - WebSMS: sending + This is a Websms Connector.\nThe only way to use it, is lauching it with WebSMS or mysms. + Websms: sending Sending: ERROR Connection terminated/timed out. If your connection is working, it\'s most likely a downtime of the target service. Check the app\'s website issues and twitter for status. From ad44946924ff121354187223f19852aaf2e148aa Mon Sep 17 00:00:00 2001 From: Gernot Pansy Date: Tue, 28 Feb 2012 21:10:33 +0100 Subject: [PATCH 5/6] fixed mysms market link --- src/de/ub0r/android/websms/connector/common/InfoActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/ub0r/android/websms/connector/common/InfoActivity.java b/src/de/ub0r/android/websms/connector/common/InfoActivity.java index fd28850..b0ce1ce 100644 --- a/src/de/ub0r/android/websms/connector/common/InfoActivity.java +++ b/src/de/ub0r/android/websms/connector/common/InfoActivity.java @@ -47,7 +47,7 @@ public final class InfoActivity extends Activity { /** Link to WebSMS in android market. */ private static final Intent INTENT_MARKET_MYSMS = new Intent( Intent.ACTION_VIEW, Uri.parse(// . - "market://search?q=pname:com.android.android.sms")); + "market://search?q=pname:com.mysms.android.sms")); /** Link to Connectors in android market. */ private static final Intent INTENT_MARKET_CONNECTORS = new Intent( From bfe7d89ba5b224943d4d497798938976b3c8743a Mon Sep 17 00:00:00 2001 From: Gernot Pansy Date: Thu, 10 May 2012 15:06:47 +0200 Subject: [PATCH 6/6] always display WebSMS & mysms button and either open app if installed or link to google play, removed useless market link to install more connectors --- .../websms/connector/common/InfoActivity.java | 129 +++++++++--------- 1 file changed, 63 insertions(+), 66 deletions(-) diff --git a/src/de/ub0r/android/websms/connector/common/InfoActivity.java b/src/de/ub0r/android/websms/connector/common/InfoActivity.java index b0ce1ce..372166e 100644 --- a/src/de/ub0r/android/websms/connector/common/InfoActivity.java +++ b/src/de/ub0r/android/websms/connector/common/InfoActivity.java @@ -39,34 +39,29 @@ public final class InfoActivity extends Activity { /** Tag for debug output. */ private static final String TAG = "Info"; - /** Link to WebSMS in android market. */ - private static final Intent INTENT_MARKET_WEBSMS = new Intent( - Intent.ACTION_VIEW, Uri.parse(// . - "market://search?q=pname:de.ub0r.android.websms")); - - /** Link to WebSMS in android market. */ - private static final Intent INTENT_MARKET_MYSMS = new Intent( - Intent.ACTION_VIEW, Uri.parse(// . - "market://search?q=pname:com.mysms.android.sms")); + /** WebSMS package name */ + private static final String PACKAGENAME_WEBSMS = "de.ub0r.android.websms"; - /** Link to Connectors in android market. */ - private static final Intent INTENT_MARKET_CONNECTORS = new Intent( - Intent.ACTION_VIEW, Uri.parse(// . - "market://search?q=websms+connector")); + /** mysms package name */ + private static final String PACKAGENAME_MYSMS = "com.mysms.android.sms"; /** Info text shown to user. */ private static final String INFO_TEXT = "This is a WebSMS Connector." + "\nThe only way to use it, is lauching it with WebSMS or mysms."; - /** Button label: search websms. */ - private static final String BTN_MARKET_WEBSMS = "market: WebSMS"; + /** Button label: websms. */ + private static final String BTN_WEBSMS = "WebSMS"; - /** Button label: search mysms. */ - private static final String BTN_MARKET_MYSMS = "market: mysms"; + /** Button label: mysms. */ + private static final String BTN_MYSMS = "mysms"; + + /** Link to WebSMS in android market. */ + private Intent intentWebsms = new Intent(Intent.ACTION_VIEW, Uri.parse(// . + "market://search?q=pname:" + PACKAGENAME_WEBSMS)); - /** Button label: search connectors. */ - private static final String BTN_MARKET_CONNECTORS = // . - "market: Connectors"; + /** Link to mysms in android market. */ + private Intent intentMysms = new Intent(Intent.ACTION_VIEW, Uri.parse(// . + "market://search?q=pname:" + PACKAGENAME_MYSMS)); /** * {@inheritDoc} @@ -108,53 +103,55 @@ public void onClick(final DialogInterface dialog, InfoActivity.this.finish(); } }); - final List ri = this.getPackageManager() - .queryBroadcastReceivers(new Intent(Connector.ACTION_INFO), 0); - if (ri.size() == 0) { - b.setNeutralButton(BTN_MARKET_WEBSMS, - new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, - final int which) { - try { - InfoActivity.this - .startActivity(INTENT_MARKET_WEBSMS); - } catch (ActivityNotFoundException e) { - Log.e(TAG, "no market", e); - } - InfoActivity.this.finish(); - } - }); - b.setNegativeButton(BTN_MARKET_MYSMS, - new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, - final int which) { - try { - InfoActivity.this - .startActivity(INTENT_MARKET_MYSMS); - } catch (ActivityNotFoundException e) { - Log.e(TAG, "no market", e); - } - InfoActivity.this.finish(); - } - }); - } else { - b.setNegativeButton(BTN_MARKET_CONNECTORS, - new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, - final int which) { - try { - InfoActivity.this - .startActivity(INTENT_MARKET_CONNECTORS); - } catch (ActivityNotFoundException e) { - Log.e(TAG, "no market", e); - } - InfoActivity.this.finish(); - } - }); + + Intent intent = new Intent(Intent.ACTION_MAIN); + intent.addCategory(Intent.CATEGORY_LAUNCHER); + List ris = this.getPackageManager().queryIntentActivities( + intent, 0); + for (ResolveInfo ri : ris) { + if (ri.activityInfo == null) { + continue; + } + if (ri.activityInfo.packageName.equals(PACKAGENAME_WEBSMS)) { + this.intentWebsms = new Intent(Intent.ACTION_MAIN); + this.intentWebsms.addCategory(Intent.CATEGORY_LAUNCHER); + this.intentWebsms.setClassName(ri.activityInfo.packageName, + ri.activityInfo.name); + } else if (ri.activityInfo.packageName.equals(PACKAGENAME_MYSMS)) { + this.intentMysms = new Intent(Intent.ACTION_MAIN); + this.intentMysms.addCategory(Intent.CATEGORY_LAUNCHER); + this.intentMysms.setClassName(ri.activityInfo.packageName, + ri.activityInfo.name); + } } + b.setPositiveButton(BTN_WEBSMS, new DialogInterface.OnClickListener() { + @Override + public void onClick(final DialogInterface dialog, final int which) { + try { + InfoActivity.this.intentWebsms + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + InfoActivity.this + .startActivity(InfoActivity.this.intentWebsms); + } catch (ActivityNotFoundException e) { + Log.e(TAG, "no market", e); + } + InfoActivity.this.finish(); + } + }); + b.setNeutralButton(BTN_MYSMS, new DialogInterface.OnClickListener() { + @Override + public void onClick(final DialogInterface dialog, final int which) { + try { + InfoActivity.this.intentMysms + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + InfoActivity.this + .startActivity(InfoActivity.this.intentMysms); + } catch (ActivityNotFoundException e) { + Log.e(TAG, "no market", e); + } + InfoActivity.this.finish(); + } + }); b.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(final DialogInterface dialog) {