Add preference for idea auto

pull/14/head
Tim Su 14 years ago
parent e661f4d574
commit c29c2cd103

@ -328,6 +328,9 @@
<!-- Anonymous usage statistics --> <!-- Anonymous usage statistics -->
<string name="p_statistics">statistics</string> <string name="p_statistics">statistics</string>
<!-- Ideas tab autoloading -->
<string name="p_autoIdea">ideaauto</string>
<!-- ================================================= NEW USER EXPERIENCE --> <!-- ================================================= NEW USER EXPERIENCE -->
<!-- Preference Keys (do not translate) --> <!-- Preference Keys (do not translate) -->

@ -490,6 +490,11 @@
<string name="EPr_fullTask_desc_enabled">Full task title will be shown</string> <string name="EPr_fullTask_desc_enabled">Full task title will be shown</string>
<string name="EPr_fullTask_desc_disabled">First two lines of task title will be shown</string> <string name="EPr_fullTask_desc_disabled">First two lines of task title will be shown</string>
<!-- Preferences: Auto-load Ideas Tab -->
<string name="EPr_ideaAuto_title">Show full task title</string>
<string name="EPr_ideaAuto_desc_enabled">Full task title will be shown</string>
<string name="EPr_ideaAuto_desc_disabled">First two lines of task title will be shown</string>
<!-- Preference: Theme --> <!-- Preference: Theme -->
<string name="EPr_theme_title">Color Theme</string> <string name="EPr_theme_title">Color Theme</string>
<!-- Preference: Theme Description (%s => value) --> <!-- Preference: Theme Description (%s => value) -->

@ -59,6 +59,7 @@
<PreferenceCategory <PreferenceCategory
android:title="@string/EPr_powerpack_header"> android:title="@string/EPr_powerpack_header">
<PreferenceScreen <PreferenceScreen
android:title="@string/EPr_voice_header"> android:title="@string/EPr_voice_header">
@ -66,11 +67,13 @@
android:key="@string/p_voiceInputEnabled" android:key="@string/p_voiceInputEnabled"
android:title="@string/EPr_voiceInputEnabled_title" android:title="@string/EPr_voiceInputEnabled_title"
android:defaultValue="true" /> android:defaultValue="true" />
<com.todoroo.astrid.ui.MultilineCheckboxPreference <com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_voiceInputCreatesTask" android:key="@string/p_voiceInputCreatesTask"
android:title="@string/EPr_voiceInputCreatesTask_title" android:title="@string/EPr_voiceInputCreatesTask_title"
android:dependency="@string/p_voiceInputEnabled" android:dependency="@string/p_voiceInputEnabled"
android:defaultValue="false" /> android:defaultValue="false" />
<com.todoroo.astrid.ui.MultilineCheckboxPreference <com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_voiceRemindersEnabled" android:key="@string/p_voiceRemindersEnabled"
android:title="@string/EPr_voiceRemindersEnabled_title" android:title="@string/EPr_voiceRemindersEnabled_title"
@ -82,6 +85,12 @@
android:key="@string/p_statistics" android:key="@string/p_statistics"
android:title="@string/EPr_statistics_title" android:title="@string/EPr_statistics_title"
android:defaultValue="true" /> android:defaultValue="true" />
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_ideaAuto"
android:title="@string/EPr_ideaAuto_title"
android:defaultValue="true" />
</PreferenceCategory> </PreferenceCategory>

@ -308,13 +308,15 @@ public class EditPreferences extends TodorooPreferenceActivity {
r.getStringArray(R.array.EPr_themes)[index])); r.getStringArray(R.array.EPr_themes)[index]));
} }
} }
// statistics service
else if (r.getString(R.string.p_statistics).equals(preference.getKey())) { // pp preferences
if (value != null && !(Boolean)value) else if (booleanPreference(preference, value, R.string.p_statistics,
preference.setSummary(R.string.EPr_statistics_desc_disabled); R.string.EPr_statistics_desc_disabled, R.string.EPr_statistics_desc_enabled))
else ;
preference.setSummary(R.string.EPr_statistics_desc_enabled); else if (booleanPreference(preference, value, R.string.p_idea_autoload,
} R.string.EPr_ideaAuto_desc_disabled, R.string.EPr_ideaAuto_desc_enabled))
;
// voice input and output // voice input and output
if(!addOnService.hasPowerPack()) if(!addOnService.hasPowerPack())
@ -340,6 +342,18 @@ public class EditPreferences extends TodorooPreferenceActivity {
} }
} }
protected boolean booleanPreference(Preference preference, Object value,
int key, int disabledString, int enabledString) {
if(getString(key).equals(preference.getKey())) {
if (value != null && !(Boolean)value)
preference.setSummary(disabledString);
else
preference.setSummary(enabledString);
return true;
}
return false;
}
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {
try { try {

Loading…
Cancel
Save