Check premium status for enabled state of premium features

pull/14/head
Sam Bosley 13 years ago
parent 46a4fb57cf
commit 8822ffedf7

@ -137,7 +137,7 @@ public class ActFmPreferenceService extends SyncProviderUtilities {
return user; return user;
} }
public boolean isPremiumUser() { public static boolean isPremiumUser() {
return Preferences.getBoolean(PREF_PREMIUM, false); return Preferences.getBoolean(PREF_PREMIUM, false);
} }

@ -566,12 +566,14 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
controls.add(timerControl); controls.add(timerControl);
controlSetMap.put(getString(R.string.TEA_ctrl_timer_pref), timerControl); controlSetMap.put(getString(R.string.TEA_ctrl_timer_pref), timerControl);
filesControlSet = new FilesControlSet(getActivity(), if (ActFmPreferenceService.isPremiumUser()) {
R.layout.control_set_files, filesControlSet = new FilesControlSet(getActivity(),
R.layout.control_set_files_display, R.layout.control_set_files,
R.string.TEA_control_files); R.layout.control_set_files_display,
controls.add(filesControlSet); R.string.TEA_control_files);
controlSetMap.put(getString(R.string.TEA_ctrl_files_pref), filesControlSet); controls.add(filesControlSet);
controlSetMap.put(getString(R.string.TEA_ctrl_files_pref), filesControlSet);
}
try { try {
if (ProducteevUtilities.INSTANCE.isLoggedIn()) { if (ProducteevUtilities.INSTANCE.isLoggedIn()) {
@ -1051,7 +1053,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
return; return;
} }
createNewFileAttachment(dst.getAbsolutePath(), ""); createNewFileAttachment(dst.getAbsolutePath(), ""); //$NON-NLS-1$
} }
@SuppressWarnings("nls") @SuppressWarnings("nls")
@ -1123,13 +1125,15 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
AstridActivity activity = (AstridActivity) getActivity(); AstridActivity activity = (AstridActivity) getActivity();
item = menu.add(Menu.NONE, MENU_ATTACH_ID, 0, R.string.premium_attach_file); if (ActFmPreferenceService.isPremiumUser()) {
item.setIcon(R.drawable.ic_menu_attach); item = menu.add(Menu.NONE, MENU_ATTACH_ID, 0, R.string.premium_attach_file);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); item.setIcon(R.drawable.ic_menu_attach);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
item = menu.add(Menu.NONE, MENU_RECORD_ID, 0, R.string.premium_record_audio); item = menu.add(Menu.NONE, MENU_RECORD_ID, 0, R.string.premium_record_audio);
item.setIcon(R.drawable.ic_menu_mic); item.setIcon(R.drawable.ic_menu_mic);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}
if (activity instanceof TaskListActivity && activity.fragmentLayout != AstridActivity.LAYOUT_DOUBLE || activity instanceof TaskEditActivity) { if (activity instanceof TaskListActivity && activity.fragmentLayout != AstridActivity.LAYOUT_DOUBLE || activity instanceof TaskEditActivity) {
item = menu.add(Menu.NONE, MENU_DISCARD_ID, 0, R.string.TEA_menu_discard); item = menu.add(Menu.NONE, MENU_DISCARD_ID, 0, R.string.TEA_menu_discard);

@ -17,6 +17,7 @@ import com.todoroo.aacenc.RecognizerApi;
import com.todoroo.aacenc.RecognizerApi.RecognizerApiListener; import com.todoroo.aacenc.RecognizerApi.RecognizerApiListener;
import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
public class VoiceRecognizer { public class VoiceRecognizer {
@ -24,7 +25,9 @@ public class VoiceRecognizer {
protected VoiceInputAssistant voiceInputAssistant; protected VoiceInputAssistant voiceInputAssistant;
public static boolean speechRecordingAvailable(Context context) { public static boolean speechRecordingAvailable(Context context) {
return AndroidUtilities.getSdkVersion() >= 8 && SpeechRecognizer.isRecognitionAvailable(context); return ActFmPreferenceService.isPremiumUser() &&
AndroidUtilities.getSdkVersion() >= 8 &&
SpeechRecognizer.isRecognitionAvailable(context);
} }
/** /**

Loading…
Cancel
Save