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

@ -96,6 +96,17 @@
android:entries="@array/EPr_swipe_lists_performance_mode"
android:entryValues="@array/EPr_swipe_lists_performance_mode_values"
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>
@ -106,27 +117,10 @@
<PreferenceScreen android:title="@string/p_files_dir" android:key="@string/p_files_dir" />
<PreferenceScreen
android:key="@string/p_voicePrefSection"
android:title="@string/EPr_voice_header">
<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>
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_voiceRemindersEnabled"
android:title="@string/EPr_voiceRemindersEnabled_title"
android:defaultValue="false" />
<CheckBoxPreference
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.TodorooPreferenceActivity;
import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.dao.Database;
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 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_LABS = 1;
private static final int REQUEST_CODE_FILES_DIR = 2;
public static final int RESULT_CODE_THEME_CHANGED = 1;
@ -135,8 +134,6 @@ public class EditPreferences extends TodorooPreferenceActivity {
addPluginPreferences(screen);
screen.getPreference(POWER_PACK_PREFERENCE).setEnabled(addOnService.hasPowerPack());
final Resources r = getResources();
// first-order preferences
@ -194,6 +191,8 @@ public class EditPreferences extends TodorooPreferenceActivity {
addPreferenceListeners();
disablePremiumPrefs();
if (!AndroidUtilities.isTabletSized(this)) {
screen.removePreference(screen.findPreference(getString(R.string.p_force_phone_layout)));
}
@ -230,6 +229,13 @@ public class EditPreferences extends TodorooPreferenceActivity {
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 */
private void showAbout () {
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())) {
preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(SyncProviderPreferences.RESULT_CODE_SYNCHRONIZE));
}
// voice input and output
if(!addOnService.hasPowerPack())
return;
if (r.getString(R.string.p_voiceInputEnabled).equals(preference.getKey())) {
else if (r.getString(R.string.p_voiceInputEnabled).equals(preference.getKey())) {
if (value != null && !(Boolean)value)
preference.setSummary(R.string.EPr_voiceInputEnabled_desc_disabled);
else

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

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

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

Loading…
Cancel
Save