More preference migration

pull/189/head
Alex Baker 11 years ago
parent e84ef4ea9f
commit 6c3cb90e74

@ -7,7 +7,6 @@ package com.todoroo.andlib.utility;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Resources;
import android.preference.PreferenceManager;
@ -86,15 +85,6 @@ public class Preferences {
}
}
public static void setString(String key, String newValue) {
Context context = ContextManager.getContext();
Editor editor = getPrefs(context).edit();
editor.putString(key, newValue);
editor.commit();
}
// --- preference fetching (boolean)
public static boolean getBoolean(int keyResources, boolean defValue) {
Context context = ContextManager.getContext();
try {

@ -23,7 +23,6 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.ActFmCameraModule.CameraResultCallback;
import com.todoroo.astrid.dao.TagMetadataDao;
import com.todoroo.astrid.data.RemoteModel;
@ -39,6 +38,7 @@ import org.json.JSONArray;
import org.json.JSONObject;
import org.tasks.R;
import org.tasks.injection.InjectingActionBarActivity;
import org.tasks.preferences.Preferences;
import javax.inject.Inject;
@ -62,6 +62,7 @@ public class TagSettingsActivity extends InjectingActionBarActivity {
@Inject TagService tagService;
@Inject TagDataService tagDataService;
@Inject TagMetadataDao tagMetadataDao;
@Inject Preferences preferences;
private EditText tagName;
private Bitmap setBitmap;
@ -264,7 +265,7 @@ public class TagSettingsActivity extends InjectingActionBarActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuItem item;
if (Preferences.getBoolean(R.string.p_save_and_cancel, false)) {
if (preferences.getBoolean(R.string.p_save_and_cancel, false)) {
item = menu.add(Menu.NONE, MENU_DISCARD_ID, 0, R.string.TEA_menu_discard);
item.setIcon(ThemeService.getDrawable(R.drawable.ic_action_cancel));
setShowAsAction(item, MenuItem.SHOW_AS_ACTION_IF_ROOM);

@ -13,6 +13,8 @@ import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.tags.TagService;
import com.todoroo.astrid.ui.QuickAddBar;
import org.tasks.preferences.Preferences;
import javax.inject.Inject;
/**
@ -26,6 +28,7 @@ public final class ShareLinkActivity extends TaskListActivity {
@Inject TagService tagService;
@Inject MetadataService metadataService;
@Inject GCalHelper gcalHelper;
@Inject Preferences preferences;
private String subject;
private boolean handled;
@ -50,7 +53,7 @@ public final class ShareLinkActivity extends TaskListActivity {
if (!handled) {
Intent callerIntent = getIntent();
Task task = QuickAddBar.basicQuickAddTask(gcalHelper, taskService, metadataService, tagService, subject);
Task task = QuickAddBar.basicQuickAddTask(preferences, gcalHelper, taskService, metadataService, tagService, subject);
if (task != null) {
task.setNotes(callerIntent.getStringExtra(Intent.EXTRA_TEXT));
taskService.save(task);

@ -5,7 +5,6 @@
*/
package com.todoroo.astrid.core;
import android.content.BroadcastReceiver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
@ -17,7 +16,6 @@ import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.sql.QueryTemplate;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.activity.FilterListFragment;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.AstridFilterExposer;
@ -32,21 +30,29 @@ import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.tags.TaskToTagMetadata;
import org.tasks.R;
import org.tasks.injection.InjectingBroadcastReceiver;
import org.tasks.injection.Injector;
import org.tasks.preferences.Preferences;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
/**
* Exposes Astrid's built in filters to the {@link FilterListFragment}
*
* @author Tim Su <tim@todoroo.com>
*
*/
public final class CoreFilterExposer extends BroadcastReceiver implements AstridFilterExposer {
public final class CoreFilterExposer extends InjectingBroadcastReceiver implements AstridFilterExposer {
@Inject Preferences preferences;
@Override
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);
Resources r = context.getResources();
ContextManager.setContext(context);
@ -61,7 +67,7 @@ public final class CoreFilterExposer extends BroadcastReceiver implements Astrid
List<FilterListItem> filters = new ArrayList<>(3);
filters.add(buildInboxFilter(r));
if (Preferences.getBoolean(R.string.p_show_today_filter, true)) {
if (preferences.getBoolean(R.string.p_show_today_filter, true)) {
filters.add(getTodayFilter(r));
}
@ -120,6 +126,8 @@ public final class CoreFilterExposer extends BroadcastReceiver implements Astrid
return null;
}
injector.inject(this);
Resources r = ContextManager.getContext().getResources();
return prepareFilters(r);
}

@ -18,7 +18,6 @@ import com.todoroo.andlib.sql.Order;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.sql.QueryTemplate;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.activity.FilterListFragment;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.AstridFilterExposer;
@ -34,6 +33,7 @@ import org.tasks.R;
import org.tasks.injection.InjectingActivity;
import org.tasks.injection.InjectingBroadcastReceiver;
import org.tasks.injection.Injector;
import org.tasks.preferences.Preferences;
import java.util.ArrayList;
@ -51,6 +51,7 @@ public final class CustomFilterExposer extends InjectingBroadcastReceiver implem
private static final String TOKEN_FILTER_NAME = "name"; //$NON-NLS-1$
@Inject StoreObjectDao storeObjectDao;
@Inject Preferences preferences;
@Override
public void onReceive(Context context, Intent intent) {
@ -79,7 +80,7 @@ public final class CustomFilterExposer extends InjectingBroadcastReceiver implem
ArrayList<Filter> list = new ArrayList<>();
// stock filters
if (Preferences.getBoolean(R.string.p_show_recently_modified_filter, true)) {
if (preferences.getBoolean(R.string.p_show_recently_modified_filter, true)) {
Filter recent = new Filter(r.getString(R.string.BFE_Recent),
r.getString(R.string.BFE_Recent),
new QueryTemplate().where(

@ -20,11 +20,11 @@ import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.dao.MetadataDao.MetadataCriteria;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.TaskApiDao;
import org.tasks.notifications.NotificationManager;
import com.todoroo.astrid.reminders.ReminderService;
import org.tasks.Broadcaster;
import org.tasks.R;
import org.tasks.notifications.NotificationManager;
import javax.inject.Inject;
import javax.inject.Singleton;
@ -42,12 +42,15 @@ public class TaskDao extends RemoteModelDao<Task> {
private final Broadcaster broadcaster;
private final ReminderService reminderService;
private final NotificationManager notificationManager;
private final org.tasks.preferences.Preferences preferences;
@Inject
public TaskDao(Database database, MetadataDao metadataDao, Broadcaster broadcaster,
ReminderService reminderService, NotificationManager notificationManager) {
ReminderService reminderService, NotificationManager notificationManager,
org.tasks.preferences.Preferences preferences) {
super(Task.class);
setDatabase(database);
this.preferences = preferences;
this.metadataDao = metadataDao;
this.broadcaster = broadcaster;
this.reminderService = reminderService;
@ -194,11 +197,11 @@ public class TaskDao extends RemoteModelDao<Task> {
// set up task defaults
if(!item.containsValue(Task.IMPORTANCE)) {
item.setImportance(Preferences.getIntegerFromString(
item.setImportance(preferences.getIntegerFromString(
R.string.p_default_importance_key, Task.IMPORTANCE_SHOULD_DO));
}
if(!item.containsValue(Task.DUE_DATE)) {
int setting = Preferences.getIntegerFromString(R.string.p_default_urgency_key,
int setting = preferences.getIntegerFromString(R.string.p_default_urgency_key,
Task.URGENCY_NONE);
item.setDueDate(Task.createDueDate(setting, 0));
}

@ -2,7 +2,6 @@ package com.todoroo.astrid.gcal;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
@ -12,16 +11,19 @@ import android.text.TextUtils;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.utility.Constants;
import org.tasks.R;
import org.tasks.injection.InjectingBroadcastReceiver;
import org.tasks.preferences.Preferences;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
public class CalendarAlarmReceiver extends BroadcastReceiver {
import javax.inject.Inject;
public class CalendarAlarmReceiver extends InjectingBroadcastReceiver {
public static final int REQUEST_CODE_CAL_REMINDER = 100;
public static final String BROADCAST_CALENDAR_REMINDER = Constants.PACKAGE + ".CALENDAR_EVENT";
@ -37,9 +39,13 @@ public class CalendarAlarmReceiver extends BroadcastReceiver {
Calendars.ATTENDEES_EMAIL_COL,
};
@Inject Preferences preferences;
@Override
public void onReceive(Context context, Intent intent) {
if (!Preferences.getBoolean(R.string.p_calendar_reminders, true)) {
super.onReceive(context, intent);
if (!preferences.getBoolean(R.string.p_calendar_reminders, true)) {
return;
}
try {

@ -183,7 +183,7 @@ public class GCalControlSet extends PopupControlSet {
updateValues.put("description", task.getNotes());
}
if(setValues.containsKey(Task.DUE_DATE.name) || setValues.containsKey(Task.ESTIMATED_SECONDS.name)) {
GCalHelper.createStartAndEndDate(task, updateValues);
gcal.createStartAndEndDate(task, updateValues);
}
ContentResolver cr = activity.getContentResolver();

@ -17,11 +17,11 @@ import android.util.Log;
import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.TaskService;
import org.tasks.R;
import org.tasks.preferences.Preferences;
import java.util.TimeZone;
@ -32,11 +32,14 @@ public class GCalHelper {
private static final long DEFAULT_CAL_TIME = DateUtilities.ONE_HOUR;
public static final String CALENDAR_ID_COLUMN = "calendar_id"; //$NON-NLS-1$
private TaskService taskService;
private final TaskService taskService;
private final Preferences preferences;
@Inject
public GCalHelper(TaskService taskService) {
public GCalHelper(TaskService taskService, Preferences preferences) {
this.taskService = taskService;
this.preferences = preferences;
}
public String getTaskEventUri(Task task) {
@ -62,8 +65,8 @@ public class GCalHelper {
}
private void createTaskEventIfEnabled(Task t, boolean deleteEventIfExists) {
boolean gcalCreateEventEnabled = Preferences.getStringValue(R.string.gcal_p_default) != null
&& !Preferences.getStringValue(R.string.gcal_p_default).equals("-1"); //$NON-NLS-1$
boolean gcalCreateEventEnabled = preferences.getStringValue(R.string.gcal_p_default) != null
&& !preferences.getStringValue(R.string.gcal_p_default).equals("-1"); //$NON-NLS-1$
if (gcalCreateEventEnabled) {
ContentResolver cr = ContextManager.getContext().getContentResolver();
Uri calendarUri = createTaskEvent(t, cr, new ContentValues(), deleteEventIfExists);
@ -189,7 +192,7 @@ public class GCalHelper {
return eventDeleted;
}
static void createStartAndEndDate(Task task, ContentValues values) {
void createStartAndEndDate(Task task, ContentValues values) {
long dueDate = task.getDueDate();
long tzCorrectedDueDate = dueDate + TimeZone.getDefault().getOffset(dueDate);
long tzCorrectedDueDateNow = DateUtilities.now() + TimeZone.getDefault().getOffset(DateUtilities.now());
@ -200,7 +203,7 @@ public class GCalHelper {
if(estimatedTime <= 0) {
estimatedTime = DEFAULT_CAL_TIME;
}
if (Preferences.getBoolean(R.string.p_end_at_deadline, true)) {
if (preferences.getBoolean(R.string.p_end_at_deadline, true)) {
values.put("dtstart", dueDate);
values.put("dtend", dueDate + estimatedTime);
}else{

@ -15,7 +15,6 @@ import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Join;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.dao.MetadataDao.MetadataCriteria;
import com.todoroo.astrid.dao.StoreObjectDao;
import com.todoroo.astrid.dao.TaskDao;
@ -40,6 +39,7 @@ import com.todoroo.astrid.sync.SyncV2Provider;
import org.tasks.R;
import org.tasks.injection.ForApplication;
import org.tasks.preferences.Preferences;
import java.io.IOException;
import java.util.ArrayList;
@ -64,12 +64,13 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
private final GtasksListService gtasksListService;
private final GtasksMetadataService gtasksMetadataService;
private final GtasksTaskListUpdater gtasksTaskListUpdater;
private Context context;
private final Context context;
private final Preferences preferences;
@Inject
public GtasksSyncV2Provider(TaskService taskService, MetadataService metadataService, StoreObjectDao storeObjectDao, GtasksPreferenceService gtasksPreferenceService,
GtasksSyncService gtasksSyncService, GtasksListService gtasksListService, GtasksMetadataService gtasksMetadataService,
GtasksTaskListUpdater gtasksTaskListUpdater, @ForApplication Context context) {
GtasksTaskListUpdater gtasksTaskListUpdater, @ForApplication Context context, Preferences preferences) {
this.taskService = taskService;
this.metadataService = metadataService;
this.storeObjectDao = storeObjectDao;
@ -79,6 +80,7 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
this.gtasksMetadataService = gtasksMetadataService;
this.gtasksTaskListUpdater = gtasksTaskListUpdater;
this.context = context;
this.preferences = preferences;
}
@Override
@ -333,7 +335,7 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
mergeDates(task.task, local);
}
} else { // Set default importance and reminders for remotely created tasks
task.task.setImportance(Preferences.getIntegerFromString(
task.task.setImportance(preferences.getIntegerFromString(
R.string.p_default_importance_key, Task.IMPORTANCE_SHOULD_DO));
TaskDao.setDefaultReminders(task.task);
}

@ -13,7 +13,6 @@ import android.text.TextUtils;
import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.sql.Order;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.dao.MetadataDao.MetadataCriteria;
import com.todoroo.astrid.data.Metadata;
@ -23,6 +22,7 @@ import com.todoroo.astrid.service.TaskService;
import org.tasks.R;
import org.tasks.injection.InjectingBroadcastReceiver;
import org.tasks.preferences.Preferences;
import javax.inject.Inject;
@ -38,6 +38,7 @@ public class NotesDetailExposer extends InjectingBroadcastReceiver {
@Inject MetadataService metadataService;
@Inject TaskService taskService;
@Inject Preferences preferences;
@Override
public void onReceive(Context context, Intent intent) {
@ -63,7 +64,7 @@ public class NotesDetailExposer extends InjectingBroadcastReceiver {
}
private String getTaskDetails(long id) {
if(!Preferences.getBoolean(R.string.p_showNotes, false)) {
if(!preferences.getBoolean(R.string.p_showNotes, false)) {
return null;
}

@ -26,7 +26,6 @@ import android.widget.TextView.OnEditorActionListener;
import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.activity.AstridActivity;
import com.todoroo.astrid.activity.TaskEditFragment;
import com.todoroo.astrid.activity.TaskListFragment;
@ -48,6 +47,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tasks.R;
import org.tasks.injection.Injector;
import org.tasks.preferences.Preferences;
import java.util.HashSet;
@ -77,6 +77,7 @@ public class QuickAddBar extends LinearLayout {
@Inject MetadataService metadataService;
@Inject TaskService taskService;
@Inject GCalHelper gcalHelper;
@Inject Preferences preferences;
private VoiceRecognizer voiceRecognizer;
@ -130,10 +131,10 @@ public class QuickAddBar extends LinearLayout {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
final boolean controlsVisible = !TextUtils.isEmpty(s) && quickAddBox.hasFocus();
final boolean showControls = Preferences.getBoolean(R.string.p_show_quickadd_controls, true);
final boolean showControls = preferences.getBoolean(R.string.p_show_quickadd_controls, true);
final boolean plusVisible = !TextUtils.isEmpty(s);
final boolean hidePlus = Preferences.getBoolean(R.string.p_hide_plus_button, false);
final boolean hidePlus = preferences.getBoolean(R.string.p_hide_plus_button, false);
quickAddControlsContainer.postDelayed(new Runnable() {
@Override
public void run() {
@ -150,12 +151,12 @@ public class QuickAddBar extends LinearLayout {
public void afterTextChanged(Editable s) {/**/}
});
int fontSize = Preferences.getIntegerFromString(R.string.p_fontSize, 18);
int fontSize = preferences.getIntegerFromString(R.string.p_fontSize, 18);
quickAddBox.setTextSize(Math.min(fontSize, 22));
quickAddButton = ((ImageButton) findViewById(
R.id.quickAddButton));
quickAddButton.setVisibility(Preferences.getBoolean(R.string.p_hide_plus_button, false) ? View.GONE : View.VISIBLE);
quickAddButton.setVisibility(preferences.getBoolean(R.string.p_hide_plus_button, false) ? View.GONE : View.VISIBLE);
// set listener for quick add button
quickAddButton.setOnClickListener(new OnClickListener() {
@ -194,7 +195,7 @@ public class QuickAddBar extends LinearLayout {
}
});
if (Preferences.getBoolean(R.string.p_voiceInputEnabled, true)
if (preferences.getBoolean(R.string.p_voiceInputEnabled, true)
&& VoiceRecognizer.voiceInputAvailable(activity)) {
voiceAddButton.setVisibility(View.VISIBLE);
} else {
@ -281,7 +282,7 @@ public class QuickAddBar extends LinearLayout {
resetControlSets();
addToCalendar(gcalHelper, taskService, task, title);
addToCalendar(preferences, gcalHelper, taskService, task, title);
TextView quickAdd = (TextView) findViewById(R.id.quickAddText);
quickAdd.setText(""); //$NON-NLS-1$
@ -305,9 +306,9 @@ public class QuickAddBar extends LinearLayout {
}
}
private static void addToCalendar(GCalHelper gcalHelper, TaskService taskService, Task task, String title) {
boolean gcalCreateEventEnabled = Preferences.getStringValue(R.string.gcal_p_default) != null
&& !Preferences.getStringValue(R.string.gcal_p_default).equals("-1") && task.hasDueDate(); //$NON-NLS-1$
private static void addToCalendar(Preferences preferences, GCalHelper gcalHelper, TaskService taskService, Task task, String title) {
boolean gcalCreateEventEnabled = preferences.getStringValue(R.string.gcal_p_default) != null
&& !preferences.getStringValue(R.string.gcal_p_default).equals("-1") && task.hasDueDate(); //$NON-NLS-1$
if (!TextUtils.isEmpty(title) && gcalCreateEventEnabled && TextUtils.isEmpty(task.getCalendarURI())) {
Uri calendarUri = gcalHelper.createTaskEvent(task,
@ -322,7 +323,7 @@ public class QuickAddBar extends LinearLayout {
* Static method to quickly add tasks without all the control set nonsense.
* Used from the share link activity.
*/
public static Task basicQuickAddTask(GCalHelper gcalHelper, TaskService taskService, MetadataService metadataService, TagService tagService, String title) {
public static Task basicQuickAddTask(Preferences preferences, GCalHelper gcalHelper, TaskService taskService, MetadataService metadataService, TagService tagService, String title) {
if (TextUtils.isEmpty(title)) {
return null;
}
@ -330,7 +331,7 @@ public class QuickAddBar extends LinearLayout {
title = title.trim();
Task task = TaskService.createWithValues(taskService, metadataService, tagService, null, title);
addToCalendar(gcalHelper, taskService, task, title);
addToCalendar(preferences, gcalHelper, taskService, task, title);
return task;
}
@ -365,7 +366,7 @@ public class QuickAddBar extends LinearLayout {
// if user wants, create the task directly (with defaultvalues)
// after saying it
Flags.set(Flags.TLA_RESUMED_FROM_VOICE_ADD);
if (Preferences.getBoolean(R.string.p_voiceInputCreatesTask, false)) {
if (preferences.getBoolean(R.string.p_voiceInputCreatesTask, false)) {
quickAddTask(quickAddBox.getText().toString(), true);
}

@ -16,7 +16,6 @@ import android.widget.Button;
import android.widget.ListView;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.adapter.FilterAdapter;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.FilterListItem;
@ -27,6 +26,7 @@ import org.tasks.R;
import org.tasks.filters.FilterCounter;
import org.tasks.injection.InjectingListActivity;
import org.tasks.injection.Injector;
import org.tasks.preferences.Preferences;
import org.tasks.widget.WidgetHelper;
import javax.inject.Inject;
@ -47,6 +47,7 @@ public class WidgetConfigActivity extends InjectingListActivity {
@Inject WidgetHelper widgetHelper;
@Inject FilterCounter filterCounter;
@Inject Injector injector;
@Inject Preferences preferences;
private void updateWidget() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
@ -156,17 +157,17 @@ public class WidgetConfigActivity extends InjectingListActivity {
title = ((Filter)filterListItem).title;
}
Preferences.setString(WidgetConfigActivity.PREF_TITLE + mAppWidgetId, title);
Preferences.setString(WidgetConfigActivity.PREF_SQL + mAppWidgetId, sql);
Preferences.setString(WidgetConfigActivity.PREF_VALUES + mAppWidgetId, contentValuesString);
preferences.setString(WidgetConfigActivity.PREF_TITLE + mAppWidgetId, title);
preferences.setString(WidgetConfigActivity.PREF_SQL + mAppWidgetId, sql);
preferences.setString(WidgetConfigActivity.PREF_VALUES + mAppWidgetId, contentValuesString);
if(filterListItem instanceof FilterWithCustomIntent) {
String flattenedName = ((FilterWithCustomIntent)filterListItem).customTaskList.flattenToString();
Preferences.setString(WidgetConfigActivity.PREF_CUSTOM_INTENT + mAppWidgetId,
preferences.setString(WidgetConfigActivity.PREF_CUSTOM_INTENT + mAppWidgetId,
flattenedName);
String flattenedExtras = AndroidUtilities.bundleToSerializedString(((FilterWithCustomIntent)filterListItem).customExtras);
if (flattenedExtras != null) {
Preferences.setString(WidgetConfigActivity.PREF_CUSTOM_EXTRAS + mAppWidgetId,
preferences.setString(WidgetConfigActivity.PREF_CUSTOM_EXTRAS + mAppWidgetId,
flattenedExtras);
}
}

@ -14,7 +14,6 @@ import android.widget.RemoteViews;
import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.TagViewFragment;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.FilterWithCustomIntent;
@ -31,6 +30,7 @@ import com.todoroo.astrid.utility.Constants;
import org.tasks.R;
import org.tasks.injection.InjectingService;
import org.tasks.preferences.Preferences;
import org.tasks.widget.WidgetHelper;
import javax.inject.Inject;
@ -46,6 +46,7 @@ public class WidgetUpdateService extends InjectingService {
@Inject TaskListMetadataDao taskListMetadataDao;
@Inject TagDataService tagDataService;
@Inject WidgetHelper widgetHelper;
@Inject Preferences preferences;
@Override
public void onStart(final Intent intent, int startId) {
@ -112,7 +113,7 @@ public class WidgetUpdateService extends InjectingService {
String query = SortHelper.adjustQueryForFlagsAndSort(
filter.getSqlQuery(), flags, sort).replaceAll("LIMIT \\d+", "") + " LIMIT " + numberOfTasks;
String tagName = Preferences.getStringValue(WidgetConfigActivity.PREF_TITLE + widgetId);
String tagName = preferences.getStringValue(WidgetConfigActivity.PREF_TITLE + widgetId);
query = SubtasksHelper.applySubtasksToWidgetFilter(taskService, tagDataService, taskListMetadataDao, filter, query, tagName, numberOfTasks);
database.openForReading();

@ -12,6 +12,7 @@ import com.todoroo.astrid.activity.TaskEditActivity;
import com.todoroo.astrid.activity.TaskListActivity;
import com.todoroo.astrid.backup.BackupPreferences;
import com.todoroo.astrid.calls.MissedCallActivity;
import com.todoroo.astrid.core.CoreFilterExposer;
import com.todoroo.astrid.core.CustomFilterActivity;
import com.todoroo.astrid.core.CustomFilterExposer;
import com.todoroo.astrid.core.DefaultsPreferences;
@ -66,6 +67,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
OldTaskPreferences.class,
BackupPreferences.class,
FilterShortcutActivity.class,
CoreFilterExposer.class,
TimerFilterExposer.class,
CustomFilterExposer.class,
GtasksFilterExposer.class,

@ -6,7 +6,9 @@ import com.todoroo.astrid.alarms.AlarmDetailExposer;
import com.todoroo.astrid.alarms.AlarmTaskRepeatListener;
import com.todoroo.astrid.backup.BackupStartupReceiver;
import com.todoroo.astrid.calls.PhoneStateChangedReceiver;
import com.todoroo.astrid.core.CoreFilterExposer;
import com.todoroo.astrid.core.CustomFilterExposer;
import com.todoroo.astrid.gcal.CalendarAlarmReceiver;
import com.todoroo.astrid.gcal.GCalTaskCompleteListener;
import com.todoroo.astrid.gtasks.GtasksCustomFilterCriteriaExposer;
import com.todoroo.astrid.gtasks.GtasksDetailExposer;
@ -51,11 +53,13 @@ import dagger.Provides;
GtasksStartupReceiver.class,
PhoneStateChangedReceiver.class,
ShowNotificationReceiver.class,
CoreFilterExposer.class,
TimerFilterExposer.class,
CustomFilterExposer.class,
GtasksFilterExposer.class,
TagFilterExposer.class,
BackupStartupReceiver.class
BackupStartupReceiver.class,
CalendarAlarmReceiver.class
})
public class BroadcastModule {

@ -7,6 +7,7 @@ import com.todoroo.astrid.actfm.TagViewFragment;
import com.todoroo.astrid.activity.FilterListFragment;
import com.todoroo.astrid.activity.TaskEditFragment;
import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.core.CoreFilterExposer;
import com.todoroo.astrid.core.CustomFilterExposer;
import com.todoroo.astrid.gtasks.GtasksFilterExposer;
import com.todoroo.astrid.gtasks.GtasksListFragment;
@ -34,6 +35,7 @@ import static org.tasks.injection.ActivityModule.ForActivity;
TaskEditFragment.class,
FilterListFragment.class,
QuickAddBar.class,
CoreFilterExposer.class,
TimerFilterExposer.class,
CustomFilterExposer.class,
GtasksFilterExposer.class,

Loading…
Cancel
Save