r28 - in trunk: . res/values res/values-fr res/xml src/org/chorem/android/saymytexts src/site/fr/rst src/site/rst
Author: kmorin Date: 2014-03-31 09:27:25 +0200 (Mon, 31 Mar 2014) New Revision: 28 Url: http://forge.chorem.org/projects/say-my-texts/repository/revisions/28 Log: fixes #1006 Add an "About" part in the app Modified: trunk/AndroidManifest.xml trunk/res/values-fr/strings.xml trunk/res/values/preference_keys.xml trunk/res/values/strings.xml trunk/res/xml/preferences.xml trunk/src/org/chorem/android/saymytexts/SayMyTextService.java trunk/src/org/chorem/android/saymytexts/SettingsActivity.java trunk/src/site/fr/rst/user.rst trunk/src/site/rst/dev.rst trunk/src/site/rst/index.rst trunk/src/site/rst/user.rst Modified: trunk/AndroidManifest.xml =================================================================== --- trunk/AndroidManifest.xml 2014-03-30 11:16:17 UTC (rev 27) +++ trunk/AndroidManifest.xml 2014-03-31 07:27:25 UTC (rev 28) @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.chorem.android.saymytexts" - android:versionCode="1" - android:versionName="1.0" + android:versionCode="2" + android:versionName="1.1" android:description="@string/app_description" android:installLocation="auto"> @@ -15,6 +15,7 @@ <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.BLUETOOTH" /> + <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-feature android:name="android.hardware.telephony" android:required="true"/> Modified: trunk/res/values/preference_keys.xml =================================================================== --- trunk/res/values/preference_keys.xml 2014-03-30 11:16:17 UTC (rev 27) +++ trunk/res/values/preference_keys.xml 2014-03-31 07:27:25 UTC (rev 28) @@ -3,4 +3,7 @@ <string name="preference_enable_reading_key">enable_reading</string> <string name="preference_enable_heisendroid_mode_key">enable_heisendroid_mode</string> <string name="preference_test_sms_key">test_sms</string> + <string name="preference_version_key">version</string> + <string name="preference_documentation_key">documentation</string> + <string name="preference_issue_tracker_key">issue_tracker</string> </resources> \ No newline at end of file Modified: trunk/res/values/strings.xml =================================================================== --- trunk/res/values/strings.xml 2014-03-30 11:16:17 UTC (rev 27) +++ trunk/res/values/strings.xml 2014-03-31 07:27:25 UTC (rev 28) @@ -6,11 +6,19 @@ <string name="sms_received">New message from %1$s: %2$s</string> <!-- Preferences --> + <string name="preferences_settings_label">Settings</string> <string name="preference_enable_reading_label">SMS reading</string> <string name="preference_enable_heisendroid_mode_label">Heisendroid mode</string> <string name="preference_test_sms_label">Test by sending an SMS to myself</string> <string name="test_sms_content">Heisendroïd</string> + <string name="preferences_about_label">About</string> + <string name="preference_version_label">Version</string> + <string name="preference_documentation_label">Documentation</string> + <string name="preference_documentation_url">https://doc.chorem.org/say-my-texts/index.html</string> + <string name="preference_issue_tracker_label">Bug report</string> + <string name="preference_issue_tracker_url">http://forge.chorem.org/projects/say-my-texts/issues</string> + <!--ACRA--> <string name="crash_toast_text">Ooooops ! the application crashed, but a report has been sent to my developer to help fix the issue !</string> <string name="crash_dialog_title">say My Texts has crashed</string> Modified: trunk/res/values-fr/strings.xml =================================================================== --- trunk/res/values-fr/strings.xml 2014-03-30 11:16:17 UTC (rev 27) +++ trunk/res/values-fr/strings.xml 2014-03-31 07:27:25 UTC (rev 28) @@ -6,11 +6,19 @@ <string name="sms_received">Nouveau message de %1$s : %2$s</string> <!-- Preferences --> + <string name="preferences_settings_label">Paramètres</string> <string name="preference_enable_reading_label">Lecture des SMS</string> <string name="preference_enable_heisendroid_mode_label">Mode Heisendroid</string> <string name="preference_test_sms_label">Tester en m\'envoyant un SMS</string> <string name="test_sms_content">Heisendroïd</string> + <string name="preferences_about_label">À propos</string> + <string name="preference_version_label">Version</string> + <string name="preference_documentation_label">Documentation</string> + <string name="preference_documentation_url">https://doc.chorem.org/say-my-texts/fr/index.html</string> + <string name="preference_issue_tracker_label">Rapporter un bug</string> + <string name="preference_issue_tracker_url">http://forge.chorem.org/projects/say-my-texts/issues</string> + <!--ACRA--> <string name="crash_toast_text">Erreur innatendue, préparation du rapport de bug</string> <string name="crash_dialog_title">Say My Texts a planté</string> Modified: trunk/res/xml/preferences.xml =================================================================== --- trunk/res/xml/preferences.xml 2014-03-30 11:16:17 UTC (rev 27) +++ trunk/res/xml/preferences.xml 2014-03-31 07:27:25 UTC (rev 28) @@ -2,16 +2,36 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> - <SwitchPreference android:key="@string/preference_enable_reading_key" - android:title="@string/preference_enable_reading_label" - android:defaultValue="true" /> + <PreferenceCategory android:title="@string/preferences_settings_label"> - <SwitchPreference android:key="@string/preference_enable_heisendroid_mode_key" - android:title="@string/preference_enable_heisendroid_mode_label" - android:defaultValue="false" /> + <SwitchPreference android:key="@string/preference_enable_reading_key" + android:title="@string/preference_enable_reading_label" + android:defaultValue="true" /> - <Preference android:key="@string/preference_test_sms_key" - android:title="@string/preference_test_sms_label" - android:persistent="false"/> + <SwitchPreference android:key="@string/preference_enable_heisendroid_mode_key" + android:title="@string/preference_enable_heisendroid_mode_label" + android:defaultValue="false" /> + <Preference android:key="@string/preference_test_sms_key" + android:title="@string/preference_test_sms_label" + android:persistent="false"/> + + </PreferenceCategory> + + <PreferenceCategory android:title="@string/preferences_about_label" + android:persistent="false"> + + <Preference android:key="@string/preference_version_key" + android:title="@string/preference_version_label"/> + + <Preference android:key="@string/preference_documentation_key" + android:title="@string/preference_documentation_label" + android:summary="@string/preference_documentation_url"/> + + <Preference android:key="@string/preference_issue_tracker_key" + android:title="@string/preference_issue_tracker_label" + android:summary="@string/preference_issue_tracker_url"/> + + </PreferenceCategory> + </PreferenceScreen> \ No newline at end of file Modified: trunk/src/org/chorem/android/saymytexts/SayMyTextService.java =================================================================== --- trunk/src/org/chorem/android/saymytexts/SayMyTextService.java 2014-03-30 11:16:17 UTC (rev 27) +++ trunk/src/org/chorem/android/saymytexts/SayMyTextService.java 2014-03-31 07:27:25 UTC (rev 28) @@ -32,18 +32,24 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; +import android.content.pm.PackageManager; import android.database.Cursor; import android.media.AudioManager; import android.net.Uri; +import android.os.Bundle; import android.os.IBinder; import android.preference.PreferenceManager; import android.provider.BaseColumns; import android.provider.ContactsContract; +import android.speech.RecognitionListener; +import android.speech.RecognizerIntent; +import android.speech.SpeechRecognizer; import android.speech.tts.TextToSpeech; import android.speech.tts.UtteranceProgressListener; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; import android.util.Log; +import android.widget.Toast; import java.util.ArrayList; import java.util.Collections; @@ -73,6 +79,7 @@ /** utterance id when the bluetooth device is connected */ protected static final String BT_UTTERANCE_ID = "btUtteranceId"; + protected static final String OTHER_UTTERANCE_ID = "otherUtteranceId"; protected AudioManager audioManager; @@ -184,9 +191,11 @@ @Override public void onDone(String utteranceId) { - // when the text has been read by the bluetooth device, stop the connection - audioManager.stopBluetoothSco(); - audioManager.setMode(AudioManager.MODE_NORMAL); + if (BT_UTTERANCE_ID.equals(utteranceId)) { + // when the text has been read by the bluetooth device, stop the connection + audioManager.stopBluetoothSco(); + audioManager.setMode(AudioManager.MODE_NORMAL); + } } }); @@ -261,9 +270,7 @@ protected void readText(List<String> texts, boolean btConnected) { HashMap<String, String> params = new HashMap<>(); params.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_VOICE_CALL)); - if (btConnected) { - params.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, BT_UTTERANCE_ID); - } + params.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, btConnected ? BT_UTTERANCE_ID : OTHER_UTTERANCE_ID); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); String heisendroidModeEnabledKey = getString(R.string.preference_enable_heisendroid_mode_key); Modified: trunk/src/org/chorem/android/saymytexts/SettingsActivity.java =================================================================== --- trunk/src/org/chorem/android/saymytexts/SettingsActivity.java 2014-03-30 11:16:17 UTC (rev 27) +++ trunk/src/org/chorem/android/saymytexts/SettingsActivity.java 2014-03-31 07:27:25 UTC (rev 28) @@ -29,6 +29,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.content.pm.PackageManager; import android.database.Cursor; import android.media.AudioManager; import android.net.Uri; @@ -37,11 +38,16 @@ import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.preference.SwitchPreference; +import android.speech.RecognitionListener; +import android.speech.RecognizerIntent; +import android.speech.SpeechRecognizer; import android.speech.tts.TextToSpeech; import android.telephony.SmsManager; import android.telephony.TelephonyManager; import android.util.Log; +import android.widget.Toast; +import java.util.ArrayList; import java.util.Locale; /** @@ -100,6 +106,20 @@ return true; } }); + + try { + Context context = getActivity(); + String currentVersion = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; + Preference versionPreference = findPreference(getString(R.string.preference_version_key)); + versionPreference.setSummary(currentVersion); + + } catch (PackageManager.NameNotFoundException e) { + Log.e(TAG, "error while getting the version"); + } + + addWebsitePreferenceClickListener(R.string.preference_documentation_key); + addWebsitePreferenceClickListener(R.string.preference_issue_tracker_key); + } @Override @@ -119,16 +139,96 @@ enableReadingPref.setChecked(enabled); } + protected void addWebsitePreferenceClickListener(int keyId) { + Preference preference = findPreference(getString(keyId)); + preference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(preference.getSummary().toString())); + startActivity(intent); + return true; + } + }); + } + protected void sendSMS() { - Context context = getActivity(); + final Context context = getActivity(); - TelephonyManager tMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); - String phoneNumber = tMgr.getLine1Number(); - String message = getString(R.string.test_sms_content); +// TelephonyManager tMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); +// String phoneNumber = tMgr.getLine1Number(); +// String message = getString(R.string.test_sms_content); +// +// PendingIntent pi = PendingIntent.getActivity(context, -1, new Intent(context, SettingsActivity.class), 0); +// SmsManager sms = SmsManager.getDefault(); +// sms.sendTextMessage(phoneNumber, null, message, pi, null); - PendingIntent pi = PendingIntent.getActivity(context, -1, new Intent(context, SettingsActivity.class), 0); - SmsManager sms = SmsManager.getDefault(); - sms.sendTextMessage(phoneNumber, null, message, pi, null); + SpeechRecognizer sr = SpeechRecognizer.createSpeechRecognizer(context); + sr.setRecognitionListener(new RecognitionListener() { + @Override + public void onReadyForSpeech(Bundle params) { + + Log.d(TAG, "onReadyForSpeech " ); + } + + @Override + public void onBeginningOfSpeech() { + + Log.d(TAG, "onBeginningOfSpeech " ); + } + + @Override + public void onRmsChanged(float rmsdB) { + + Log.d(TAG, "onRmsChanged " ); + } + + @Override + public void onBufferReceived(byte[] buffer) { + Log.d(TAG, "onBufferReceived " ); + + } + + @Override + public void onEndOfSpeech() { + Log.d(TAG, "onEndOfSpeech " ); + + } + + @Override + public void onError(int error) { + Log.d(TAG, "onError " + error); + + } + + @Override + public void onResults(Bundle results) { + String str = new String(); + Log.d(TAG, "onResults " + results); + ArrayList data = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION); + for (int i = 0; i < data.size(); i++) + { + Log.d(TAG, "result " + data.get(i)); + str += data.get(i) + " "; + } + Toast.makeText(context, str, Toast.LENGTH_LONG).show(); + } + + @Override + public void onPartialResults(Bundle partialResults) { + Log.d(TAG, "onPartialResults " ); + + } + + @Override + public void onEvent(int eventType, Bundle params) { + Log.d(TAG, "onEvent " ); + + } + }); + Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); + intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 5); + sr.startListening(intent); } } } Modified: trunk/src/site/fr/rst/user.rst =================================================================== --- trunk/src/site/fr/rst/user.rst 2014-03-30 11:16:17 UTC (rev 27) +++ trunk/src/site/fr/rst/user.rst 2014-03-31 07:27:25 UTC (rev 28) @@ -1,81 +1,81 @@ -.. - -.. * #%L -.. * Say My Texts -.. * $Id:$ -.. * $HeadURL:$ -.. * %% -.. * Copyright (C) 2014 Code Lutin -.. * %% -.. * This program is free software: you can redistribute it and/or modify -.. * it under the terms of the GNU General Public License as -.. * published by the Free Software Foundation, either version 3 of the -.. * License, or (at your option) any later version. -.. * -.. * This program is distributed in the hope that it will be useful, -.. * but WITHOUT ANY WARRANTY; without even the implied warranty of -.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -.. * GNU General Public License for more details. -.. * -.. * You should have received a copy of the GNU General Public -.. * License along with this program. If not, see -.. * <http://www.gnu.org/licenses/gpl-3.0.html>. -.. * #L% -.. - - -Documentation utilisateur -######################### - -Installation -~~~~~~~~~~~~ - -Pour pouvoir installer l'application, vous devez posséder un appareil sous Android Ice Cream Sandwich 4.0.3 au minimum. - -L'application a besoin d'un synthétiseur de voix. Si aucun n'est installé, il vous sera proposé d'en installer un. - -Lorsque vous avez installé l'application, il faut l'ouvrir une première fois pour l'activer. -Elle s'activera ensuite automatiquement à chaque démarrage de l'appareil. - -Permissions ------------ - -L'application a besoin des permissions suivantes : - -:RECEIVE_SMS: - pour recevoir les SMS -:SEND_SMS: - l'utilisateur peut s'envoyer des SMS pour tester -:READ_PHONE_STATE: - pour vérifier qu'un appel n'est pas en cours -:MODIFY_AUDIO_SETTINGS: - le synthétiseur d voix en a besoin -:READ_CONTACTS: - pour trouver le nom du contact à partir du numéro de l'envoyeur -:BLUETOOTH: - pour accéder aux appareils bluetooth connectés - -Configuration -~~~~~~~~~~~~~ - -Le lancement de l'application depuis le menu ouvre la configuration de l'application. -Vous pouvez : - -- activer ou désactiver la lecture -- activer ou désactiver le `mode Heisendroid`_. -- vous envoyer un SMS pour tester la lecture - -Mode Heisendroid ----------------- - -Le nom de *Say My Texts* est une référence à la série américaine *Breaking Bad*. -Le nom du personnage dans le logo s'appelle *Heisendroid*, -en référence au pseudo de Walter White dans la série (Heisenberg). - -Lorsque vous activez le mode Heisendroid, la lecture des SMS est précédée par "*Say my text*" -et suivie de "*You're goddamn right!*". Il s'agit là aussi d'une référence à une des répliques cultes de la série. - -.. _mode Heisendroid: #Mode_Heisendroid - -Widget -~~~~~~ - +.. - +.. * #%L +.. * Say My Texts +.. * $Id:$ +.. * $HeadURL:$ +.. * %% +.. * Copyright (C) 2014 Code Lutin +.. * %% +.. * This program is free software: you can redistribute it and/or modify +.. * it under the terms of the GNU General Public License as +.. * published by the Free Software Foundation, either version 3 of the +.. * License, or (at your option) any later version. +.. * +.. * This program is distributed in the hope that it will be useful, +.. * but WITHOUT ANY WARRANTY; without even the implied warranty of +.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.. * GNU General Public License for more details. +.. * +.. * You should have received a copy of the GNU General Public +.. * License along with this program. If not, see +.. * <http://www.gnu.org/licenses/gpl-3.0.html>. +.. * #L% +.. - + +Documentation utilisateur +######################### + +Installation +~~~~~~~~~~~~ + +Pour pouvoir installer l'application, vous devez posséder un appareil sous Android Ice Cream Sandwich 4.0.3 au minimum. + +L'application a besoin d'un synthétiseur de voix. Si aucun n'est installé, il vous sera proposé d'en installer un. + +Lorsque vous avez installé l'application, il faut l'ouvrir une première fois pour l'activer. +Elle s'activera ensuite automatiquement à chaque démarrage de l'appareil. + +Permissions +----------- + +L'application a besoin des permissions suivantes : + +:RECEIVE_SMS: + pour recevoir les SMS +:SEND_SMS: + l'utilisateur peut s'envoyer des SMS pour tester +:READ_PHONE_STATE: + pour vérifier qu'un appel n'est pas en cours +:MODIFY_AUDIO_SETTINGS: + le synthétiseur d voix en a besoin +:READ_CONTACTS: + pour trouver le nom du contact à partir du numéro de l'envoyeur +:BLUETOOTH: + pour accéder aux appareils bluetooth connectés + +Configuration +~~~~~~~~~~~~~ + +Le lancement de l'application depuis le menu ouvre la configuration de l'application. +Vous pouvez : + +- activer ou désactiver la lecture +- activer ou désactiver le `mode Heisendroid`_. +- vous envoyer un SMS pour tester la lecture + +Mode Heisendroid +---------------- + +Le nom de *Say My Texts* est une référence à la série américaine *Breaking Bad*. +Le nom du personnage dans le logo s'appelle *Heisendroid*, +en référence au pseudo de Walter White dans la série (Heisenberg). + +Lorsque vous activez le mode Heisendroid, la lecture des SMS est précédée par "*Say my text*" +et suivie de "*You're goddamn right!*". Il s'agit là aussi d'une référence à une des répliques cultes de la série. + +.. _mode Heisendroid: #Mode_Heisendroid + +Widget +~~~~~~ + Le widget vous permet d'activer ou désactiver la lecture depuis l'écran d'accueil. \ No newline at end of file Modified: trunk/src/site/rst/dev.rst =================================================================== --- trunk/src/site/rst/dev.rst 2014-03-30 11:16:17 UTC (rev 27) +++ trunk/src/site/rst/dev.rst 2014-03-31 07:27:25 UTC (rev 28) @@ -21,6 +21,7 @@ .. * <http://www.gnu.org/licenses/gpl-3.0.html>. .. * #L% .. - + Developer documentation ####################### Modified: trunk/src/site/rst/index.rst =================================================================== --- trunk/src/site/rst/index.rst 2014-03-30 11:16:17 UTC (rev 27) +++ trunk/src/site/rst/index.rst 2014-03-31 07:27:25 UTC (rev 28) @@ -21,6 +21,7 @@ .. * <http://www.gnu.org/licenses/gpl-3.0.html>. .. * #L% .. - + Welcome to Say My Texts website ############################### Modified: trunk/src/site/rst/user.rst =================================================================== --- trunk/src/site/rst/user.rst 2014-03-30 11:16:17 UTC (rev 27) +++ trunk/src/site/rst/user.rst 2014-03-31 07:27:25 UTC (rev 28) @@ -21,6 +21,7 @@ .. * <http://www.gnu.org/licenses/gpl-3.0.html>. .. * #L% .. - + User documentation ##################
participants (1)
-
kmorin@users.chorem.org