From b449fc3ef1bea1f28e8b0afcc80f6c006906e157 Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Tue, 15 Feb 2011 18:13:20 -0600 Subject: [PATCH] Moved 'about' strings to strings-core --- .../andlib/widget/TodorooPreferences.java | 2 +- astrid/res/values/strings-core.xml | 17 ++++++++++++ astrid/res/xml/preferences.xml | 2 ++ .../astrid/activity/EditPreferences.java | 26 ++++++++++++++++++- 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/astrid/common-src/com/todoroo/andlib/widget/TodorooPreferences.java b/astrid/common-src/com/todoroo/andlib/widget/TodorooPreferences.java index 137f6836d..66b5d748c 100644 --- a/astrid/common-src/com/todoroo/andlib/widget/TodorooPreferences.java +++ b/astrid/common-src/com/todoroo/andlib/widget/TodorooPreferences.java @@ -8,10 +8,10 @@ import android.preference.CheckBoxPreference; import android.preference.EditTextPreference; import android.preference.ListPreference; import android.preference.Preference; +import android.preference.Preference.OnPreferenceChangeListener; import android.preference.PreferenceActivity; import android.preference.PreferenceGroup; import android.preference.RingtonePreference; -import android.preference.Preference.OnPreferenceChangeListener; import com.todoroo.andlib.service.DependencyInjectionService; diff --git a/astrid/res/values/strings-core.xml b/astrid/res/values/strings-core.xml index cdd2f831e..6215cc0f2 100644 --- a/astrid/res/values/strings-core.xml +++ b/astrid/res/values/strings-core.xml @@ -424,6 +424,23 @@ Select tasks to view... + + + + + About Astrid + + +Astrid Tasks\n\n + +Current version: %s\n\n + +Astrid is open-source and proudly maintained by Todoroo, Inc.\n\n + +Source: http://github.com/todoroo/astrid\n +Privacy Policy: http://www.todoroo.com/privacy\n +Terms of Use: http://www.todoroo.com/terms\n +Visit http://weloveastrid.com for more information, to add translations or help make Astrid better! diff --git a/astrid/res/xml/preferences.xml b/astrid/res/xml/preferences.xml index 3955ebdb3..cbc31da70 100644 --- a/astrid/res/xml/preferences.xml +++ b/astrid/res/xml/preferences.xml @@ -3,6 +3,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:title="@string/EPr_title"> + + diff --git a/astrid/src/com/todoroo/astrid/activity/EditPreferences.java b/astrid/src/com/todoroo/astrid/activity/EditPreferences.java index c571f27b7..d403bf929 100644 --- a/astrid/src/com/todoroo/astrid/activity/EditPreferences.java +++ b/astrid/src/com/todoroo/astrid/activity/EditPreferences.java @@ -16,6 +16,7 @@ import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.net.Uri; @@ -56,7 +57,8 @@ import com.todoroo.astrid.voice.VoiceOutputService; */ public class EditPreferences extends TodorooPreferences { - private static final int POWER_PACK_PREFERENCE = 1; + private static final int ABOUT_PREFERENCE = 0; // see preferences.xml for order of prefs + private static final int POWER_PACK_PREFERENCE = 2; // --- instance variables @@ -90,11 +92,30 @@ public class EditPreferences extends TodorooPreferences { screen.getPreference(POWER_PACK_PREFERENCE).setEnabled(addOnService.hasPowerPack()); + final Resources r = getResources(); + // About pref + Preference preference = screen.getPreference(ABOUT_PREFERENCE); + preference.setTitle(r.getString(R.string.p_about)); + preference.setOnPreferenceClickListener(new OnPreferenceClickListener() { + public boolean onPreferenceClick(Preference p) { + showAbout(); + return true; + } + }); + addDebugPreferences(); addPreferenceListeners(); } + private void showAbout () + { + try { + About.showAbout(this, getResources(), getPackageManager().getPackageInfo("com.timsu.astrid", 0).versionName); + } catch (NameNotFoundException e) { + } + } + private void addPluginPreferences(PreferenceScreen screen) { Intent queryIntent = new Intent(AstridApiConstants.ACTION_SETTINGS); PackageManager pm = getPackageManager(); @@ -193,6 +214,8 @@ public class EditPreferences extends TodorooPreferences { @Override public void updatePreferences(final Preference preference, Object value) { final Resources r = getResources(); + + if (r.getString(R.string.p_showNotes).equals(preference.getKey())) { if (value != null && !(Boolean)value) preference.setSummary(R.string.EPr_showNotes_desc_disabled); @@ -204,6 +227,7 @@ public class EditPreferences extends TodorooPreferences { } } + // statistics service else if (r.getString(R.string.p_statistics).equals(preference.getKey())) { if (value != null && !(Boolean)value)