diff --git a/astrid/plugin-src/com/todoroo/astrid/calls/MissedCallActivity.java b/astrid/plugin-src/com/todoroo/astrid/calls/MissedCallActivity.java
index 23643025f..a6337408e 100644
--- a/astrid/plugin-src/com/todoroo/astrid/calls/MissedCallActivity.java
+++ b/astrid/plugin-src/com/todoroo/astrid/calls/MissedCallActivity.java
@@ -30,7 +30,7 @@ import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
-import com.todoroo.astrid.core.LabsPreferences;
+import com.todoroo.astrid.activity.EditPreferences;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.reminders.NotificationFragment.SnoozeDialog;
import com.todoroo.astrid.reminders.Notifications;
@@ -168,7 +168,7 @@ public class MissedCallActivity extends Activity {
ignoreSettingsButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- Intent labsPreferences = new Intent(MissedCallActivity.this, LabsPreferences.class);
+ Intent labsPreferences = new Intent(MissedCallActivity.this, EditPreferences.class);
startActivity(labsPreferences);
finish();
}
diff --git a/astrid/plugin-src/com/todoroo/astrid/core/LabsPreferences.java b/astrid/plugin-src/com/todoroo/astrid/core/LabsPreferences.java
deleted file mode 100644
index acb37155f..000000000
--- a/astrid/plugin-src/com/todoroo/astrid/core/LabsPreferences.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * Copyright (c) 2012 Todoroo Inc
- *
- * See the file "LICENSE" for the full license governing this code.
- */
-package com.todoroo.astrid.core;
-
-import android.content.res.Resources;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceScreen;
-import android.text.TextUtils;
-
-import com.timsu.astrid.R;
-import com.todoroo.andlib.utility.AndroidUtilities;
-import com.todoroo.andlib.utility.TodorooPreferenceActivity;
-import com.todoroo.astrid.activity.EditPreferences;
-import com.todoroo.astrid.utility.Constants;
-
-public class LabsPreferences extends TodorooPreferenceActivity {
-
- @Override
- public int getPreferenceResource() {
- return R.xml.preferences_labs;
- }
-
- public static final int RESULT_TLA_NEEDS_REFRESH = 3;
- public static final int RESULT_NEEDS_SYNC = 4;
-
- private class SetResultOnPreferenceChangeListener implements OnPreferenceChangeListener {
- private final int resultCode;
- public SetResultOnPreferenceChangeListener(int resultCode) {
- this.resultCode = resultCode;
- }
-
- @Override
- public boolean onPreferenceChange(Preference p, Object newValue) {
- setResult(resultCode);
- updatePreferences(p, newValue);
- return true;
- }
- }
-
- @Override
- public void onCreate(android.os.Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- EditPreferences.removeForbiddenPreferences(getPreferenceScreen(), getResources());
-
- if (!AndroidUtilities.isTabletSized(this)) {
- PreferenceScreen screen = getPreferenceScreen();
- screen.removePreference(screen.findPreference(getString(R.string.p_force_phone_layout)));
- }
- }
-
- @Override
- public void updatePreferences(Preference preference, Object value) {
- final Resources r = getResources();
-
- String key = preference.getKey();
- if (r.getString(R.string.p_swipe_lists_performance_key).equals(key)) {
- preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_TLA_NEEDS_REFRESH));
-
- int index = 0;
- if(value instanceof String && !TextUtils.isEmpty((String)value))
- index = AndroidUtilities.indexOf(r.getStringArray(R.array.EPr_swipe_lists_performance_mode_values), (String)value);
- if (index < 0)
- index = 0;
-
- String name = r.getStringArray(R.array.EPr_swipe_lists_performance_mode)[index];
- String desc = r.getStringArray(R.array.EPr_swipe_lists_performance_desc)[index];
- preference.setSummary(r.getString(R.string.EPr_swipe_lists_display, name, desc));
- } else if (r.getString(R.string.p_field_missed_calls).equals(key)) {
- setEnabledSummary(preference, value,
- R.string.MCA_missed_calls_pref_desc_enabled, R.string.MCA_missed_calls_pref_desc_disabled);
- } else if (r.getString(R.string.p_use_contact_picker).equals(key)) {
- setEnabledSummary(preference, value,
- R.string.EPr_use_contact_picker_desc_enabled, R.string.EPr_use_contact_picker_desc_disabled);
- } else if (r.getString(R.string.p_third_party_addons).equals(key)) {
- setEnabledSummary(preference, value,
- R.string.EPr_third_party_addons_desc_enabled, R.string.EPr_third_party_addons_desc_disabled);
- } else if (r.getString(R.string.p_end_at_deadline).equals(key)){
- setEnabledSummary(preference, value, R.string.EPr_cal_start_at_due_time, R.string.EPr_cal_end_at_due_time);
- } else if (r.getString(R.string.p_ideas_tab_enabled).equals(key)) {
- if (!Constants.MARKET_STRATEGY.allowIdeasTab()) {
- PreferenceScreen screen = getPreferenceScreen();
- screen.removePreference(preference);
- }
- } else if (r.getString(R.string.p_force_phone_layout).equals(key)) {
- preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_TLA_NEEDS_REFRESH));
- } else if (r.getString(R.string.p_show_featured_lists_labs).equals(key)) {
- preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_NEEDS_SYNC));
- }
- }
-
- private void setEnabledSummary(Preference preference, Object value, int enabledStr, int disabledStr) {
- if (value != null && (Boolean) value) {
- preference.setSummary(enabledStr);
- } else {
- preference.setSummary(disabledStr);
- }
- }
-
-}
diff --git a/astrid/res/values/strings-ppack.xml b/astrid/res/values/strings-ppack.xml
index 88f9cdd77..e0700e2a0 100644
--- a/astrid/res/values/strings-ppack.xml
+++ b/astrid/res/values/strings-ppack.xml
@@ -9,7 +9,7 @@
- Astrid Power Pack
+ Premium and Misc. Settings
Anonymous Usage Stats
diff --git a/astrid/res/xml/preferences.xml b/astrid/res/xml/preferences.xml
index a944bb555..48c7b4d9c 100644
--- a/astrid/res/xml/preferences.xml
+++ b/astrid/res/xml/preferences.xml
@@ -75,11 +75,32 @@
android:key="@string/p_autoIdea"
android:title="@string/EPr_ideaAuto_title"
android:defaultValue="true" />
+
+
+
+
+
+
+
+
-
@@ -106,12 +127,29 @@
+
+
+
+
+
+
+
+
-
+
diff --git a/astrid/res/xml/preferences_labs.xml b/astrid/res/xml/preferences_labs.xml
deleted file mode 100644
index dd7171e4e..000000000
--- a/astrid/res/xml/preferences_labs.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/astrid/src/com/todoroo/astrid/activity/EditPreferences.java b/astrid/src/com/todoroo/astrid/activity/EditPreferences.java
index 033bf23e0..cf5d0889d 100644
--- a/astrid/src/com/todoroo/astrid/activity/EditPreferences.java
+++ b/astrid/src/com/todoroo/astrid/activity/EditPreferences.java
@@ -5,21 +5,12 @@
*/
package com.todoroo.astrid.activity;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map.Entry;
-
-import org.weloveastrid.rmilk.MilkPreferences;
-import org.weloveastrid.rmilk.MilkUtilities;
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;
import android.os.Bundle;
@@ -46,17 +37,11 @@ import com.todoroo.andlib.utility.Preferences;
import com.todoroo.andlib.utility.TodorooPreferenceActivity;
import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.api.AstridApiConstants;
-import com.todoroo.astrid.core.LabsPreferences;
import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.files.FileExplore;
import com.todoroo.astrid.files.FileMetadata;
-import com.todoroo.astrid.gtasks.GtasksPreferences;
-import com.todoroo.astrid.helper.MetadataHelper;
-import com.todoroo.astrid.producteev.ProducteevPreferences;
-import com.todoroo.astrid.producteev.ProducteevUtilities;
import com.todoroo.astrid.service.AddOnService;
-import com.todoroo.astrid.service.MarketStrategy.AmazonMarketStrategy;
import com.todoroo.astrid.service.StartupService;
import com.todoroo.astrid.service.StatisticsConstants;
import com.todoroo.astrid.service.StatisticsService;
@@ -85,7 +70,7 @@ public class EditPreferences extends TodorooPreferenceActivity {
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_LABS = 1;
private static final int REQUEST_CODE_FILES_DIR = 2;
public static final int RESULT_CODE_THEME_CHANGED = 1;
@@ -105,6 +90,20 @@ public class EditPreferences extends TodorooPreferenceActivity {
DependencyInjectionService.getInstance().inject(this);
}
+ private class SetResultOnPreferenceChangeListener implements OnPreferenceChangeListener {
+ private final int resultCode;
+ public SetResultOnPreferenceChangeListener(int resultCode) {
+ this.resultCode = resultCode;
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference p, Object newValue) {
+ setResult(resultCode);
+ updatePreferences(p, newValue);
+ return true;
+ }
+ }
+
@Override
public int getPreferenceResource() {
return R.xml.preferences;
@@ -119,7 +118,7 @@ public class EditPreferences extends TodorooPreferenceActivity {
PreferenceScreen screen = getPreferenceScreen();
voiceInputAssistant = new VoiceInputAssistant(this);
- addPluginPreferences(screen);
+// addPluginPreferences(screen);
screen.getPreference(POWER_PACK_PREFERENCE).setEnabled(addOnService.hasPowerPack());
@@ -180,6 +179,10 @@ public class EditPreferences extends TodorooPreferenceActivity {
addPreferenceListeners();
+ if (!AndroidUtilities.isTabletSized(this)) {
+ screen.removePreference(screen.findPreference(getString(R.string.p_force_phone_layout)));
+ }
+
removeForbiddenPreferences(screen, r);
}
@@ -243,81 +246,81 @@ public class EditPreferences extends TodorooPreferenceActivity {
private static final HashMap, Integer> PREFERENCE_REQUEST_CODES = new HashMap, Integer>();
static {
PREFERENCE_REQUEST_CODES.put(SyncProviderPreferences.class, REQUEST_CODE_SYNC);
- PREFERENCE_REQUEST_CODES.put(LabsPreferences.class, REQUEST_CODE_LABS);
+// PREFERENCE_REQUEST_CODES.put(LabsPreferences.class, REQUEST_CODE_LABS);
}
- private void addPluginPreferences(PreferenceScreen screen) {
- Intent queryIntent = new Intent(AstridApiConstants.ACTION_SETTINGS);
- PackageManager pm = getPackageManager();
- List resolveInfoList = pm.queryIntentActivities(queryIntent,
- PackageManager.GET_META_DATA);
- int length = resolveInfoList.size();
- LinkedHashMap> categoryPreferences =
- new LinkedHashMap>();
-
- // Loop through a list of all packages (including plugins, addons)
- // that have a settings action
- String labsTitle = getString(R.string.EPr_labs_header);
- for(int i = 0; i < length; i++) {
- ResolveInfo resolveInfo = resolveInfoList.get(i);
- final Intent intent = new Intent(AstridApiConstants.ACTION_SETTINGS);
- intent.setClassName(resolveInfo.activityInfo.packageName,
- resolveInfo.activityInfo.name);
-
- if(MilkPreferences.class.getName().equals(resolveInfo.activityInfo.name) &&
- !MilkUtilities.INSTANCE.isLoggedIn())
- continue;
-
- if (GtasksPreferences.class.getName().equals(resolveInfo.activityInfo.name)
- && AmazonMarketStrategy.isKindleFire())
- continue;
-
- if (ProducteevPreferences.class.getName().equals(resolveInfo.activityInfo.name)
- && !Preferences.getBoolean(R.string.p_third_party_addons, false) && !ProducteevUtilities.INSTANCE.isLoggedIn())
- continue;
-
- Preference preference = new Preference(this);
- preference.setTitle(resolveInfo.activityInfo.loadLabel(pm));
- if (labsTitle.equals(preference.getTitle()))
- preference.setSummary(R.string.EPr_labs_desc);
- try {
- Class> intentComponent = Class.forName(intent.getComponent().getClassName());
- if (intentComponent.getSuperclass().equals(SyncProviderPreferences.class))
- intentComponent = SyncProviderPreferences.class;
- if (PREFERENCE_REQUEST_CODES.containsKey(intentComponent)) {
- final int code = PREFERENCE_REQUEST_CODES.get(intentComponent);
- preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference pref) {
- startActivityForResult(intent, code);
- return true;
- }
- });
- } else {
- preference.setIntent(intent);
- }
- } catch (ClassNotFoundException e) {
- preference.setIntent(intent);
- }
-
- String category = MetadataHelper.resolveActivityCategoryName(resolveInfo, pm);
-
- if(!categoryPreferences.containsKey(category))
- categoryPreferences.put(category, new ArrayList());
- ArrayList arrayList = categoryPreferences.get(category);
- arrayList.add(preference);
- }
-
- for(Entry> entry : categoryPreferences.entrySet()) {
- Preference header = new Preference(this);
- header.setLayoutResource(android.R.layout.preference_category);
- header.setTitle(entry.getKey());
- screen.addPreference(header);
-
- for(Preference preference : entry.getValue())
- screen.addPreference(preference);
- }
- }
+// private void addPluginPreferences(PreferenceScreen screen) {
+// Intent queryIntent = new Intent(AstridApiConstants.ACTION_SETTINGS);
+// PackageManager pm = getPackageManager();
+// List resolveInfoList = pm.queryIntentActivities(queryIntent,
+// PackageManager.GET_META_DATA);
+// int length = resolveInfoList.size();
+// LinkedHashMap> categoryPreferences =
+// new LinkedHashMap>();
+//
+// // Loop through a list of all packages (including plugins, addons)
+// // that have a settings action
+// String labsTitle = getString(R.string.EPr_labs_header);
+// for(int i = 0; i < length; i++) {
+// ResolveInfo resolveInfo = resolveInfoList.get(i);
+// final Intent intent = new Intent(AstridApiConstants.ACTION_SETTINGS);
+// intent.setClassName(resolveInfo.activityInfo.packageName,
+// resolveInfo.activityInfo.name);
+//
+// if(MilkPreferences.class.getName().equals(resolveInfo.activityInfo.name) &&
+// !MilkUtilities.INSTANCE.isLoggedIn())
+// continue;
+//
+// if (GtasksPreferences.class.getName().equals(resolveInfo.activityInfo.name)
+// && AmazonMarketStrategy.isKindleFire())
+// continue;
+//
+// if (ProducteevPreferences.class.getName().equals(resolveInfo.activityInfo.name)
+// && !Preferences.getBoolean(R.string.p_third_party_addons, false) && !ProducteevUtilities.INSTANCE.isLoggedIn())
+// continue;
+//
+// Preference preference = new Preference(this);
+// preference.setTitle(resolveInfo.activityInfo.loadLabel(pm));
+// if (labsTitle.equals(preference.getTitle()))
+// preference.setSummary(R.string.EPr_labs_desc);
+// try {
+// Class> intentComponent = Class.forName(intent.getComponent().getClassName());
+// if (intentComponent.getSuperclass().equals(SyncProviderPreferences.class))
+// intentComponent = SyncProviderPreferences.class;
+// if (PREFERENCE_REQUEST_CODES.containsKey(intentComponent)) {
+// final int code = PREFERENCE_REQUEST_CODES.get(intentComponent);
+// preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+// @Override
+// public boolean onPreferenceClick(Preference pref) {
+// startActivityForResult(intent, code);
+// return true;
+// }
+// });
+// } else {
+// preference.setIntent(intent);
+// }
+// } catch (ClassNotFoundException e) {
+// preference.setIntent(intent);
+// }
+//
+// String category = MetadataHelper.resolveActivityCategoryName(resolveInfo, pm);
+//
+// if(!categoryPreferences.containsKey(category))
+// categoryPreferences.put(category, new ArrayList());
+// ArrayList arrayList = categoryPreferences.get(category);
+// arrayList.add(preference);
+// }
+//
+// for(Entry> entry : categoryPreferences.entrySet()) {
+// Preference header = new Preference(this);
+// header.setLayoutResource(android.R.layout.preference_category);
+// header.setTitle(entry.getKey());
+// screen.addPreference(header);
+//
+// for(Preference preference : entry.getValue())
+// screen.addPreference(preference);
+// }
+// }
@SuppressWarnings("nls")
private void addDebugPreferences() {
@@ -440,7 +443,32 @@ public class EditPreferences extends TodorooPreferenceActivity {
R.string.EPr_statistics_desc_disabled, R.string.EPr_statistics_desc_enabled));
else if (booleanPreference(preference, value, R.string.p_autoIdea,
R.string.EPr_ideaAuto_desc_disabled, R.string.EPr_ideaAuto_desc_enabled));
-
+ else if (r.getString(R.string.p_swipe_lists_performance_key).equals(preference.getKey())) {
+ preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_CODE_PERFORMANCE_PREF_CHANGED));
+
+ int index = 0;
+ if(value instanceof String && !TextUtils.isEmpty((String)value))
+ index = AndroidUtilities.indexOf(r.getStringArray(R.array.EPr_swipe_lists_performance_mode_values), (String)value);
+ if (index < 0)
+ index = 0;
+
+ String name = r.getStringArray(R.array.EPr_swipe_lists_performance_mode)[index];
+ String desc = r.getStringArray(R.array.EPr_swipe_lists_performance_desc)[index];
+ preference.setSummary(r.getString(R.string.EPr_swipe_lists_display, name, desc));
+ }
+ else if (booleanPreference(preference, value, R.string.p_field_missed_calls,
+ R.string.MCA_missed_calls_pref_desc_enabled, R.string.MCA_missed_calls_pref_desc_disabled));
+ else if (booleanPreference(preference, value, R.string.p_use_contact_picker,
+ R.string.EPr_use_contact_picker_desc_enabled, R.string.EPr_use_contact_picker_desc_disabled));
+ else if (booleanPreference(preference, value, R.string.p_third_party_addons,
+ R.string.EPr_third_party_addons_desc_enabled, R.string.EPr_third_party_addons_desc_disabled));
+ else if (booleanPreference(preference, value, R.string.p_end_at_deadline,
+ R.string.EPr_cal_start_at_due_time, R.string.EPr_cal_end_at_due_time));
+ else if (r.getString(R.string.p_force_phone_layout).equals(preference.getKey())) {
+ preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_CODE_PERFORMANCE_PREF_CHANGED));
+ } 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())
@@ -484,13 +512,6 @@ public class EditPreferences extends TodorooPreferenceActivity {
setResult(SyncProviderPreferences.RESULT_CODE_SYNCHRONIZE);
finish();
return;
- } else if (requestCode == REQUEST_CODE_LABS && resultCode == LabsPreferences.RESULT_TLA_NEEDS_REFRESH) {
- setResult(RESULT_CODE_PERFORMANCE_PREF_CHANGED);
- return;
- } else if (requestCode == REQUEST_CODE_LABS && resultCode == LabsPreferences.RESULT_NEEDS_SYNC) {
- if (Preferences.getBoolean(R.string.p_show_featured_lists_labs, false))
- setResult(SyncProviderPreferences.RESULT_CODE_SYNCHRONIZE);
- return;
} else if (requestCode == REQUEST_CODE_FILES_DIR && resultCode == RESULT_OK) {
if (data != null) {
String dir = data.getStringExtra(FileExplore.RESULT_DIR_SELECTED);
diff --git a/astrid/src/com/todoroo/astrid/service/MarketStrategy.java b/astrid/src/com/todoroo/astrid/service/MarketStrategy.java
index bcdab647e..2a339d3a7 100644
--- a/astrid/src/com/todoroo/astrid/service/MarketStrategy.java
+++ b/astrid/src/com/todoroo/astrid/service/MarketStrategy.java
@@ -171,7 +171,8 @@ public abstract class MarketStrategy {
R.string.p_voicePrefSection,
R.string.p_end_at_deadline,
R.string.p_swipe_lists_performance_key,
- R.string.p_field_missed_calls
+ R.string.p_field_missed_calls,
+ R.string.p_ideas_tab_enabled
};
}