Enable voice add for everyone, rearrange some preferences

pull/14/head
Sam Bosley 12 years ago
parent 3e25e0fb8a
commit a336aa9eb8

@ -360,6 +360,8 @@
android:label="@string/actfm_APr_header"> android:label="@string/actfm_APr_header">
<meta-data android:name="category" <meta-data android:name="category"
android:resource="@string/SyP_label" /> android:resource="@string/SyP_label" />
<meta-data android:name="syncAction"
android:value="true" />
<intent-filter> <intent-filter>
<action android:name="com.todoroo.astrid.SETTINGS" /> <action android:name="com.todoroo.astrid.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
@ -440,6 +442,8 @@
android:label="@string/gtasks_GPr_header"> android:label="@string/gtasks_GPr_header">
<meta-data android:name="category" <meta-data android:name="category"
android:resource="@string/SyP_label" /> android:resource="@string/SyP_label" />
<meta-data android:name="syncAction"
android:value="true" />
<intent-filter> <intent-filter>
<action android:name="com.todoroo.astrid.SETTINGS" /> <action android:name="com.todoroo.astrid.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
@ -605,6 +609,8 @@
android:label="@string/producteev_PPr_header"> android:label="@string/producteev_PPr_header">
<meta-data android:name="category" <meta-data android:name="category"
android:resource="@string/SyP_label" /> android:resource="@string/SyP_label" />
<meta-data android:name="syncAction"
android:value="true" />
<intent-filter> <intent-filter>
<action android:name="com.todoroo.astrid.SETTINGS" /> <action android:name="com.todoroo.astrid.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />

@ -97,6 +97,17 @@
android:entryValues="@array/EPr_swipe_lists_performance_mode_values" android:entryValues="@array/EPr_swipe_lists_performance_mode_values"
android:summary="@string/EPr_swipe_lists_performance_subtitle" /> android:summary="@string/EPr_swipe_lists_performance_subtitle" />
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_voiceInputEnabled"
android:title="@string/EPr_voiceInputEnabled_title"
android:defaultValue="true" />
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_voiceInputCreatesTask"
android:title="@string/EPr_voiceInputCreatesTask_title"
android:dependency="@string/p_voiceInputEnabled"
android:defaultValue="false" />
</PreferenceScreen> </PreferenceScreen>
@ -106,27 +117,10 @@
<PreferenceScreen android:title="@string/p_files_dir" android:key="@string/p_files_dir" /> <PreferenceScreen android:title="@string/p_files_dir" android:key="@string/p_files_dir" />
<PreferenceScreen <com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_voicePrefSection" android:key="@string/p_voiceRemindersEnabled"
android:title="@string/EPr_voice_header"> android:title="@string/EPr_voiceRemindersEnabled_title"
android:defaultValue="false" />
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_voiceInputEnabled"
android:title="@string/EPr_voiceInputEnabled_title"
android:defaultValue="true" />
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_voiceInputCreatesTask"
android:title="@string/EPr_voiceInputCreatesTask_title"
android:dependency="@string/p_voiceInputEnabled"
android:defaultValue="false" />
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_voiceRemindersEnabled"
android:title="@string/EPr_voiceRemindersEnabled_title"
android:defaultValue="false" />
</PreferenceScreen>
<CheckBoxPreference <CheckBoxPreference
android:key="@string/p_field_missed_calls" android:key="@string/p_field_missed_calls"

@ -46,6 +46,7 @@ import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
import com.todoroo.andlib.utility.TodorooPreferenceActivity; import com.todoroo.andlib.utility.TodorooPreferenceActivity;
import com.todoroo.astrid.actfm.ActFmLoginActivity; import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.dao.Database; import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
@ -82,10 +83,8 @@ public class EditPreferences extends TodorooPreferenceActivity {
private static final String SUPPORT_URL = "http://blog.astrid.com/topics/support/android"; //$NON-NLS-1$ private static final String SUPPORT_URL = "http://blog.astrid.com/topics/support/android"; //$NON-NLS-1$
private static final int APPEARANCE_PREFERENCE = 1; private static final int APPEARANCE_PREFERENCE = 1;
private static final int POWER_PACK_PREFERENCE = 2;
private static final int REQUEST_CODE_SYNC = 0; private static final int REQUEST_CODE_SYNC = 0;
// private static final int REQUEST_CODE_LABS = 1;
private static final int REQUEST_CODE_FILES_DIR = 2; private static final int REQUEST_CODE_FILES_DIR = 2;
public static final int RESULT_CODE_THEME_CHANGED = 1; public static final int RESULT_CODE_THEME_CHANGED = 1;
@ -135,8 +134,6 @@ public class EditPreferences extends TodorooPreferenceActivity {
addPluginPreferences(screen); addPluginPreferences(screen);
screen.getPreference(POWER_PACK_PREFERENCE).setEnabled(addOnService.hasPowerPack());
final Resources r = getResources(); final Resources r = getResources();
// first-order preferences // first-order preferences
@ -194,6 +191,8 @@ public class EditPreferences extends TodorooPreferenceActivity {
addPreferenceListeners(); addPreferenceListeners();
disablePremiumPrefs();
if (!AndroidUtilities.isTabletSized(this)) { if (!AndroidUtilities.isTabletSized(this)) {
screen.removePreference(screen.findPreference(getString(R.string.p_force_phone_layout))); screen.removePreference(screen.findPreference(getString(R.string.p_force_phone_layout)));
} }
@ -230,6 +229,13 @@ public class EditPreferences extends TodorooPreferenceActivity {
return false; return false;
} }
private void disablePremiumPrefs() {
boolean hasPowerPack = addOnService.hasPowerPack();
findPreference(getString(R.string.p_files_dir)).setEnabled(ActFmPreferenceService.isPremiumUser());
findPreference(getString(R.string.p_voiceRemindersEnabled)).setEnabled(hasPowerPack);
findPreference(getString(R.string.p_statistics)).setEnabled(hasPowerPack);
}
/** Show about dialog */ /** Show about dialog */
private void showAbout () { private void showAbout () {
String version = "unknown"; //$NON-NLS-1$ String version = "unknown"; //$NON-NLS-1$
@ -496,12 +502,7 @@ public class EditPreferences extends TodorooPreferenceActivity {
} else if (r.getString(R.string.p_show_featured_lists_labs).equals(preference.getKey())) { } else if (r.getString(R.string.p_show_featured_lists_labs).equals(preference.getKey())) {
preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(SyncProviderPreferences.RESULT_CODE_SYNCHRONIZE)); preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(SyncProviderPreferences.RESULT_CODE_SYNCHRONIZE));
} }
else if (r.getString(R.string.p_voiceInputEnabled).equals(preference.getKey())) {
// voice input and output
if(!addOnService.hasPowerPack())
return;
if (r.getString(R.string.p_voiceInputEnabled).equals(preference.getKey())) {
if (value != null && !(Boolean)value) if (value != null && !(Boolean)value)
preference.setSummary(R.string.EPr_voiceInputEnabled_desc_disabled); preference.setSummary(R.string.EPr_voiceInputEnabled_desc_disabled);
else else

@ -103,6 +103,7 @@ import com.todoroo.astrid.ui.WebServicesView;
import com.todoroo.astrid.utility.Constants; import com.todoroo.astrid.utility.Constants;
import com.todoroo.astrid.utility.Flags; import com.todoroo.astrid.utility.Flags;
import com.todoroo.astrid.voice.VoiceInputAssistant; import com.todoroo.astrid.voice.VoiceInputAssistant;
import com.todoroo.astrid.voice.VoiceRecognizer;
import com.viewpagerindicator.TabPageIndicator; import com.viewpagerindicator.TabPageIndicator;
/** /**
@ -670,18 +671,16 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
public void onUiThread() { public void onUiThread() {
// prepare and set listener for voice-button // prepare and set listener for voice-button
if (getActivity() != null) { if (getActivity() != null && VoiceRecognizer.voiceInputAvailable(getActivity())) {
if (addOnService.hasPowerPack()) { voiceAddNoteButton = (ImageButton) notesControlSet.getView().findViewById(
voiceAddNoteButton = (ImageButton) notesControlSet.getView().findViewById( R.id.voiceAddNoteButton);
R.id.voiceAddNoteButton); voiceAddNoteButton.setVisibility(View.VISIBLE);
voiceAddNoteButton.setVisibility(View.VISIBLE); int prompt = R.string.voice_edit_note_prompt;
int prompt = R.string.voice_edit_note_prompt; voiceNoteAssistant = new VoiceInputAssistant(TaskEditFragment.this,
voiceNoteAssistant = new VoiceInputAssistant(TaskEditFragment.this, voiceAddNoteButton, notesEditText, REQUEST_VOICE_RECOG);
voiceAddNoteButton, notesEditText, REQUEST_VOICE_RECOG); voiceNoteAssistant.setAppend(true);
voiceNoteAssistant.setAppend(true); voiceNoteAssistant.setLanguageModel(RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
voiceNoteAssistant.setLanguageModel(RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); voiceNoteAssistant.configureMicrophoneButton(prompt);
voiceNoteAssistant.configureMicrophoneButton(prompt);
}
loadMoreContainer(); loadMoreContainer();
} }

@ -216,6 +216,12 @@ public class SyncActionHelper {
&& !ProducteevUtilities.INSTANCE.isLoggedIn() && !Preferences.getBoolean(R.string.p_third_party_addons, false)) && !ProducteevUtilities.INSTANCE.isLoggedIn() && !Preferences.getBoolean(R.string.p_third_party_addons, false))
continue; continue;
if (resolveInfo.activityInfo.metaData != null) {
Bundle metadata = resolveInfo.activityInfo.metaData;
if (!metadata.getBoolean("syncAction")) //$NON-NLS-1$
continue;
}
if (category.equals(desiredCategory)) { if (category.equals(desiredCategory)) {
syncIntents.add(new IntentWithLabel(intent, syncIntents.add(new IntentWithLabel(intent,
resolveInfo.activityInfo.loadLabel(pm).toString())); resolveInfo.activityInfo.loadLabel(pm).toString()));

@ -186,8 +186,7 @@ public class QuickAddBar extends LinearLayout implements RecognizerApiListener {
} }
}); });
if (addOnService.hasPowerPack() if (Preferences.getBoolean(R.string.p_voiceInputEnabled, true)
&& Preferences.getBoolean(R.string.p_voiceInputEnabled, true)
&& VoiceRecognizer.voiceInputAvailable(activity)) { && VoiceRecognizer.voiceInputAvailable(activity)) {
voiceAddButton.setVisibility(View.VISIBLE); voiceAddButton.setVisibility(View.VISIBLE);
} else { } else {

Loading…
Cancel
Save