This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository say-my-texts. See http://git.chorem.org/say-my-texts.git commit f8c491dd1e6fe10b35440c84c875b2b2ab7c530e Author: Kevin Morin <morin@codelutin.com> Date: Sat Aug 1 00:14:54 2015 +0200 Move the app info into an about dialog. --- res/menu/settings.xml | 10 +++++ res/values-fr/strings.xml | 1 + res/values/arrays.xml | 10 ++--- res/values/preference_keys.xml | 3 -- res/values/strings.xml | 30 ++++++++++--- res/xml/preferences.xml | 16 ------- .../android/saymytexts/AboutDialogFragment.java | 51 ++++++++++++++++++++++ .../android/saymytexts/SettingsActivity.java | 49 +++++++++------------ 8 files changed, 110 insertions(+), 60 deletions(-) diff --git a/res/menu/settings.xml b/res/menu/settings.xml new file mode 100644 index 0000000..540e87e --- /dev/null +++ b/res/menu/settings.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android" > + + <item android:id="@+id/action_about" + android:icon="@android:drawable/ic_menu_info_details" + android:title="@string/menu_about" + android:onClick="openAbout" + android:showAsAction="always"/> + +</menu> \ No newline at end of file diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 90f8f69..2df65a0 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -67,4 +67,5 @@ <string name="notification_reading_unactive_no_headset_connected">Pas de casque branché.</string> <string name="notification_reading_unactive_no_headset_nor_bt_device_connected">Pas de casque branché ni d\'appareil bluetooth est connecté.</string> + </resources> diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 9685a26..ff10f40 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -11,20 +11,20 @@ <string-array name="preferences_reading_profile_entries"> <item>Always</item> <item>When a headset, headphone or bluetooth device is connected</item> - <item>When a headset, headphone is connected</item> + <item>When a headset or headphone is connected</item> <item>Never</item> </string-array> <string-array name="preferences_notifications_values"> <item>disabled</item> - <item>cancelable</item> - <item>not_cancelable</item> + <item>cancellable</item> + <item>not_cancellable</item> </string-array> <string-array name="preferences_notifications_entries"> <item>Disabled</item> - <item>Cancelable</item> - <item>Not cancelable</item> + <item>Cancellable</item> + <item>Not cancellable</item> </string-array> </resources> \ No newline at end of file diff --git a/res/values/preference_keys.xml b/res/values/preference_keys.xml index 8028cf4..8b46fde 100644 --- a/res/values/preference_keys.xml +++ b/res/values/preference_keys.xml @@ -8,7 +8,4 @@ <string name="preference_block_equals_sms_key">preference_block_equals_sms_key</string> <string name="preference_notifications_key">preference_notifications_key</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 diff --git a/res/values/strings.xml b/res/values/strings.xml index 38b8904..ffd1485 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -21,13 +21,6 @@ <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> - <string name="preference_ask_phone_number_title">Your phone number</string> <string name="preference_ask_phone_number_message">Enter your phone number to send the text</string> @@ -67,4 +60,27 @@ <string name="notification_reading_unactive_no_headset_connected">No headset plugged.</string> <string name="notification_reading_unactive_no_headset_nor_bt_device_connected">No headset plugged nor bluetooth device connected.</string> + <string name="menu_about">About</string> + <string name="dialog_about_title">Say My Texts %s</string> + <string name="dialog_about_message"><![CDATA[ + <p> + Say My Texts is a free application (<a href=\'http://www.gnu.org/licenses/gpl-3.0.html\'>GPLv3</a> license). + </p> + <p> + If you need help, please visit the <a href=\'https://doc.chorem.org/say-my-texts/index.html\'>documentation page</a>. + </p> + <p> + If you find a bug or think of new features, you can create an issue on our + <a href=\'http://forge.chorem.org/projects/say-my-texts/issues\'>Chorem forge</a>. + </p> + <p> + Thanks to Crowdin users, this app is available in several languages. + If yours is not available, you can help us to translate the app on our + <a href=\'https://crowdin.com/project/say-my-texts\'>Crowdin page</a>. + </p> + <p> + Copyright (C) 2014 - 2015 Code Lutin + </p> + ]]></string> + </resources> diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 0d8f41b..9e332ab 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -46,20 +46,4 @@ </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 diff --git a/src/main/java/org/chorem/android/saymytexts/AboutDialogFragment.java b/src/main/java/org/chorem/android/saymytexts/AboutDialogFragment.java new file mode 100644 index 0000000..cb5d2aa --- /dev/null +++ b/src/main/java/org/chorem/android/saymytexts/AboutDialogFragment.java @@ -0,0 +1,51 @@ +package org.chorem.android.saymytexts; + +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.DialogFragment; +import android.content.Context; +import android.content.DialogInterface; +import android.content.pm.PackageManager; +import android.os.Bundle; +import android.text.Html; +import android.util.Log; + +/** + * @author Kevin Morin (Code Lutin) + * @since 3.0 + */ +public class AboutDialogFragment extends DialogFragment { + + private static final String TAG = "SettingsActivity"; + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + Context context = getActivity(); + String currentVersion; + try { + currentVersion = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; + + } catch (PackageManager.NameNotFoundException e) { + if (SayMyTextsApplication.LOG_ENABLED) { + Log.e(TAG, "error while getting the version"); + } + currentVersion = ""; + } + + // Use the Builder class for convenient dialog construction + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + builder.setTitle(getString(R.string.dialog_about_title, currentVersion)) + .setIcon(R.drawable.ic_launcher_heisendroid) + .setMessage(Html.fromHtml(getString(R.string.dialog_about_message))) + .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dismiss(); + } + }); + + // Create the AlertDialog object and return it + return builder.create(); + } + + +} diff --git a/src/main/java/org/chorem/android/saymytexts/SettingsActivity.java b/src/main/java/org/chorem/android/saymytexts/SettingsActivity.java index 5482153..275864a 100644 --- a/src/main/java/org/chorem/android/saymytexts/SettingsActivity.java +++ b/src/main/java/org/chorem/android/saymytexts/SettingsActivity.java @@ -26,14 +26,13 @@ package org.chorem.android.saymytexts; import android.app.Activity; import android.app.AlertDialog; +import android.app.DialogFragment; import android.app.PendingIntent; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; -import android.content.pm.PackageManager; -import android.net.Uri; import android.os.Bundle; import android.preference.ListPreference; import android.preference.Preference; @@ -45,6 +44,9 @@ import android.telephony.SmsManager; import android.telephony.TelephonyManager; import android.text.InputType; import android.util.Log; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.widget.EditText; import android.widget.Toast; import org.chorem.android.saymytexts.utils.SayMyTextsUtils; @@ -59,6 +61,8 @@ public class SettingsActivity extends Activity { private static final String TAG = "SettingsActivity"; + protected static final String ABOUT_DIALOG_TAG = "about"; + protected static final int CHECK_TTS_REQUEST_CODE = 42; @Override @@ -106,6 +110,19 @@ public class SettingsActivity extends Activity { } } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu items for use in the action bar + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.settings, menu); + return super.onCreateOptionsMenu(menu); + } + + public void openAbout(MenuItem item) { + DialogFragment newFragment = new AboutDialogFragment(); + newFragment.show(getFragmentManager(), ABOUT_DIALOG_TAG); + } + public static class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener { @@ -126,21 +143,8 @@ public class SettingsActivity extends Activity { }); Context context = getActivity(); - try { - 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) { - if (SayMyTextsApplication.LOG_ENABLED) { - Log.e(TAG, "error while getting the version"); - } - } - - addWebsitePreferenceClickListener(R.string.preference_documentation_key); - addWebsitePreferenceClickListener(R.string.preference_issue_tracker_key); - SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity()); + SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context); String key = getString(R.string.preference_reading_profile_key); ListPreference listPreference = (ListPreference) findPreference(key); @@ -232,19 +236,6 @@ public class SettingsActivity extends Activity { } } - 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(); TelephonyManager tMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.