diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index b66ff28..8d4682e 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -21,8 +21,8 @@ Visit http://ub0r.de/translate/websms-api/de/strings.xml to edit the file. --> - Diese App ist ein WebSMS Connector.\nDu kannst ihn nur mit WebSMS 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 64c2a68..8bf3773 100644 --- a/res/values-hu/strings.xml +++ b/res/values-hu/strings.xml @@ -21,8 +21,8 @@ Visit http://ub0r.de/translate/websms-api/hu/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 eea6c63..61f9e2e 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -21,9 +21,9 @@ Visit http://ub0r.de/translate/websms-api/it/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 5486366..3669a53 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -21,8 +21,8 @@ Visit http://ub0r.de/translate/websms-api/ru/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 5b2e8ab..126f620 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. - 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. diff --git a/src/de/ub0r/android/websms/connector/common/InfoActivity.java b/src/de/ub0r/android/websms/connector/common/InfoActivity.java index 8509246..372166e 100644 --- a/src/de/ub0r/android/websms/connector/common/InfoActivity.java +++ b/src/de/ub0r/android/websms/connector/common/InfoActivity.java @@ -39,25 +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")); + /** 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."; + + "\nThe only way to use it, is lauching it with WebSMS or mysms."; + + /** Button label: websms. */ + private static final String BTN_WEBSMS = "WebSMS"; + + /** Button label: mysms. */ + private static final String BTN_MYSMS = "mysms"; - /** Button label: search websms. */ - private static final String BTN_MARKET_WEBSMS = "market: WebSMS"; - /** Button label: search connectors. */ - private static final String BTN_MARKET_CONNECTORS = // . - "market: Connectors"; + /** Link to WebSMS in android market. */ + private Intent intentWebsms = new Intent(Intent.ACTION_VIEW, Uri.parse(// . + "market://search?q=pname:" + PACKAGENAME_WEBSMS)); + + /** Link to mysms in android market. */ + private Intent intentMysms = new Intent(Intent.ACTION_VIEW, Uri.parse(// . + "market://search?q=pname:" + PACKAGENAME_MYSMS)); /** * {@inheritDoc} @@ -76,8 +80,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) { @@ -96,38 +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(); - } - }); + + 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.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.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) {