Rename GoogleTaskListPicker to RemoteListPicker

pull/645/head
Alex Baker 7 years ago
parent 7e6cad1937
commit c7a7d5267d

@ -1,12 +1,12 @@
package org.tasks.ui; package org.tasks.ui;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import org.tasks.R; import org.tasks.R;
import org.tasks.data.GoogleTaskList;
import org.tasks.injection.FragmentComponent; import org.tasks.injection.FragmentComponent;
public class GoogleTaskListFragment extends TaskEditControlFragment { public class RemoteListFragment extends TaskEditControlFragment {
public static final int TAG = R.string.TEA_ctrl_google_task_list; public static final int TAG = R.string.TEA_ctrl_google_task_list;
@Override @Override
@ -34,7 +34,7 @@ public class GoogleTaskListFragment extends TaskEditControlFragment {
} }
public void setList(GoogleTaskList list) { public void setList(Filter filter) {
} }
} }

@ -1,12 +1,12 @@
package org.tasks.ui; package org.tasks.ui;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import org.tasks.R; import org.tasks.R;
import org.tasks.data.GoogleTaskList;
import org.tasks.injection.FragmentComponent; import org.tasks.injection.FragmentComponent;
public class GoogleTaskListFragment extends TaskEditControlFragment { public class RemoteListFragment extends TaskEditControlFragment {
public static final int TAG = R.string.TEA_ctrl_google_task_list; public static final int TAG = R.string.TEA_ctrl_google_task_list;
@Override @Override
@ -34,7 +34,7 @@ public class GoogleTaskListFragment extends TaskEditControlFragment {
} }
public void setList(GoogleTaskList list) { public void setList(Filter filter) {
} }
} }

@ -12,6 +12,8 @@ import android.preference.Preference;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.GtasksFilter;
import com.todoroo.astrid.gtasks.auth.GtasksLoginActivity; import com.todoroo.astrid.gtasks.auth.GtasksLoginActivity;
import org.tasks.R; import org.tasks.R;
@ -20,8 +22,8 @@ import org.tasks.analytics.Tracking;
import org.tasks.data.GoogleTaskDao; import org.tasks.data.GoogleTaskDao;
import org.tasks.data.GoogleTaskList; import org.tasks.data.GoogleTaskList;
import org.tasks.dialogs.DialogBuilder; import org.tasks.dialogs.DialogBuilder;
import org.tasks.gtasks.GoogleTaskListSelectionHandler;
import org.tasks.gtasks.PlayServicesAvailability; import org.tasks.gtasks.PlayServicesAvailability;
import org.tasks.gtasks.RemoteListSelectionHandler;
import org.tasks.gtasks.SyncAdapterHelper; import org.tasks.gtasks.SyncAdapterHelper;
import org.tasks.injection.ActivityComponent; import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingPreferenceActivity; import org.tasks.injection.InjectingPreferenceActivity;
@ -31,9 +33,9 @@ import org.tasks.preferences.PermissionRequestor;
import javax.inject.Inject; import javax.inject.Inject;
import static org.tasks.PermissionUtil.verifyPermissions; import static org.tasks.PermissionUtil.verifyPermissions;
import static org.tasks.activities.NativeGoogleTaskListPicker.newNativeGoogleTaskListPicker; import static org.tasks.activities.RemoteListNativePicker.newRemoteListNativePicker;
public class GtasksPreferences extends InjectingPreferenceActivity implements GoogleTaskListSelectionHandler { public class GtasksPreferences extends InjectingPreferenceActivity implements RemoteListSelectionHandler {
private static final String FRAG_TAG_GOOGLE_TASK_LIST_SELECTION = "frag_tag_google_task_list_selection"; private static final String FRAG_TAG_GOOGLE_TASK_LIST_SELECTION = "frag_tag_google_task_list_selection";
@ -96,7 +98,7 @@ public class GtasksPreferences extends InjectingPreferenceActivity implements Go
}); });
Preference defaultListPreference = findPreference(R.string.p_gtasks_default_list); Preference defaultListPreference = findPreference(R.string.p_gtasks_default_list);
defaultListPreference.setOnPreferenceClickListener(preference -> { defaultListPreference.setOnPreferenceClickListener(preference -> {
newNativeGoogleTaskListPicker(getDefaultList()) newRemoteListNativePicker(new GtasksFilter(getDefaultList()))
.show(getFragmentManager(), FRAG_TAG_GOOGLE_TASK_LIST_SELECTION); .show(getFragmentManager(), FRAG_TAG_GOOGLE_TASK_LIST_SELECTION);
return false; return false;
}); });
@ -158,10 +160,14 @@ public class GtasksPreferences extends InjectingPreferenceActivity implements Go
} }
@Override @Override
public void selectedList(GoogleTaskList list) { public void selectedList(Filter list) {
if (list instanceof GtasksFilter) {
tracker.reportEvent(Tracking.Events.GTASK_DEFAULT_LIST); tracker.reportEvent(Tracking.Events.GTASK_DEFAULT_LIST);
String listId = list.getRemoteId(); String listId = ((GtasksFilter) list).getRemoteId();
gtasksPreferenceService.setDefaultList(listId); gtasksPreferenceService.setDefaultList(listId);
findPreference(R.string.p_gtasks_default_list).setSummary(list.getTitle()); } else {
throw new RuntimeException("Unhandled filter type");
}
findPreference(R.string.p_gtasks_default_list).setSummary(list.listingTitle);
} }
} }

@ -5,24 +5,24 @@ import android.app.Dialog;
import android.os.Bundle; import android.os.Bundle;
import com.todoroo.astrid.adapter.FilterAdapter; import com.todoroo.astrid.adapter.FilterAdapter;
import com.todoroo.astrid.api.Filter;
import org.tasks.data.GoogleTaskList;
import org.tasks.dialogs.DialogBuilder; import org.tasks.dialogs.DialogBuilder;
import org.tasks.gtasks.GoogleTaskListSelectionHandler; import org.tasks.gtasks.RemoteListSelectionHandler;
import org.tasks.injection.InjectingNativeDialogFragment; import org.tasks.injection.InjectingNativeDialogFragment;
import org.tasks.injection.NativeDialogFragmentComponent; import org.tasks.injection.NativeDialogFragmentComponent;
import javax.inject.Inject; import javax.inject.Inject;
import static org.tasks.activities.SupportGoogleTaskListPicker.createDialog; import static org.tasks.activities.RemoteListSupportPicker.createDialog;
public class NativeGoogleTaskListPicker extends InjectingNativeDialogFragment { public class RemoteListNativePicker extends InjectingNativeDialogFragment {
public static NativeGoogleTaskListPicker newNativeGoogleTaskListPicker(GoogleTaskList defaultList) { public static RemoteListNativePicker newRemoteListNativePicker(Filter selected) {
NativeGoogleTaskListPicker dialog = new NativeGoogleTaskListPicker(); RemoteListNativePicker dialog = new RemoteListNativePicker();
Bundle arguments = new Bundle(); Bundle arguments = new Bundle();
if (defaultList != null) { if (selected != null) {
arguments.putParcelable(EXTRA_SELECTED, defaultList); arguments.putParcelable(EXTRA_SELECTED, selected);
} }
dialog.setArguments(arguments); dialog.setArguments(arguments);
return dialog; return dialog;
@ -33,12 +33,12 @@ public class NativeGoogleTaskListPicker extends InjectingNativeDialogFragment {
@Inject DialogBuilder dialogBuilder; @Inject DialogBuilder dialogBuilder;
@Inject FilterAdapter filterAdapter; @Inject FilterAdapter filterAdapter;
private GoogleTaskListSelectionHandler handler; private RemoteListSelectionHandler handler;
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
Bundle arguments = getArguments(); Bundle arguments = getArguments();
GoogleTaskList selected = arguments.getParcelable(EXTRA_SELECTED); Filter selected = arguments.getParcelable(EXTRA_SELECTED);
return createDialog(filterAdapter, dialogBuilder, selected, list -> handler.selectedList(list)); return createDialog(filterAdapter, dialogBuilder, selected, list -> handler.selectedList(list));
} }
@ -46,7 +46,7 @@ public class NativeGoogleTaskListPicker extends InjectingNativeDialogFragment {
public void onAttach(Activity activity) { public void onAttach(Activity activity) {
super.onAttach(activity); super.onAttach(activity);
handler = (GoogleTaskListSelectionHandler) activity; handler = (RemoteListSelectionHandler) activity;
} }
@Override @Override

@ -7,21 +7,21 @@ import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import com.todoroo.astrid.adapter.FilterAdapter; import com.todoroo.astrid.adapter.FilterAdapter;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.FilterListItem; import com.todoroo.astrid.api.FilterListItem;
import com.todoroo.astrid.api.GtasksFilter; import com.todoroo.astrid.api.GtasksFilter;
import org.tasks.data.GoogleTaskList;
import org.tasks.dialogs.DialogBuilder; import org.tasks.dialogs.DialogBuilder;
import org.tasks.gtasks.GoogleTaskListSelectionHandler; import org.tasks.gtasks.RemoteListSelectionHandler;
import org.tasks.injection.DialogFragmentComponent; import org.tasks.injection.DialogFragmentComponent;
import org.tasks.injection.InjectingDialogFragment; import org.tasks.injection.InjectingDialogFragment;
import javax.inject.Inject; import javax.inject.Inject;
public class SupportGoogleTaskListPicker extends InjectingDialogFragment { public class RemoteListSupportPicker extends InjectingDialogFragment {
public static SupportGoogleTaskListPicker newSupportGoogleTaskListPicker(GoogleTaskList selected) { public static RemoteListSupportPicker newRemoteListSupportPicker(Filter selected) {
SupportGoogleTaskListPicker dialog = new SupportGoogleTaskListPicker(); RemoteListSupportPicker dialog = new RemoteListSupportPicker();
Bundle arguments = new Bundle(); Bundle arguments = new Bundle();
if (selected != null) { if (selected != null) {
arguments.putParcelable(EXTRA_SELECTED, selected); arguments.putParcelable(EXTRA_SELECTED, selected);
@ -35,13 +35,13 @@ public class SupportGoogleTaskListPicker extends InjectingDialogFragment {
@Inject DialogBuilder dialogBuilder; @Inject DialogBuilder dialogBuilder;
@Inject FilterAdapter filterAdapter; @Inject FilterAdapter filterAdapter;
private GoogleTaskListSelectionHandler handler; private RemoteListSelectionHandler handler;
@NonNull @NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
Bundle arguments = getArguments(); Bundle arguments = getArguments();
GoogleTaskList selected = arguments == null ? null : arguments.getParcelable(EXTRA_SELECTED); Filter selected = arguments == null ? null : arguments.getParcelable(EXTRA_SELECTED);
return createDialog(filterAdapter, dialogBuilder, selected, list -> handler.selectedList(list)); return createDialog(filterAdapter, dialogBuilder, selected, list -> handler.selectedList(list));
} }
@ -49,18 +49,18 @@ public class SupportGoogleTaskListPicker extends InjectingDialogFragment {
public void onAttach(Activity activity) { public void onAttach(Activity activity) {
super.onAttach(activity); super.onAttach(activity);
handler = (GoogleTaskListSelectionHandler) activity; handler = (RemoteListSelectionHandler) activity;
} }
public static AlertDialog createDialog(FilterAdapter filterAdapter, DialogBuilder dialogBuilder, public static AlertDialog createDialog(FilterAdapter filterAdapter, DialogBuilder dialogBuilder,
GoogleTaskList selected, GoogleTaskListSelectionHandler handler) { Filter selected, RemoteListSelectionHandler handler) {
filterAdapter.populateRemoteListPicker(); filterAdapter.populateRemoteListPicker();
int selectedIndex = filterAdapter.indexOf(new GtasksFilter(selected)); int selectedIndex = filterAdapter.indexOf(selected);
return dialogBuilder.newDialog() return dialogBuilder.newDialog()
.setSingleChoiceItems(filterAdapter, selectedIndex, (dialog, which) -> { .setSingleChoiceItems(filterAdapter, selectedIndex, (dialog, which) -> {
FilterListItem item = filterAdapter.getItem(which); FilterListItem item = filterAdapter.getItem(which);
if (item instanceof GtasksFilter) { if (item instanceof GtasksFilter) {
handler.selectedList(((GtasksFilter) item).getList()); handler.selectedList((GtasksFilter) item);
} }
dialog.dismiss(); dialog.dismiss();
}) })

@ -1,7 +1,7 @@
package org.tasks.injection; package org.tasks.injection;
import org.tasks.activities.CalendarSelectionDialog; import org.tasks.activities.CalendarSelectionDialog;
import org.tasks.activities.SupportGoogleTaskListPicker; import org.tasks.activities.RemoteListSupportPicker;
import org.tasks.dialogs.AddAttachmentDialog; import org.tasks.dialogs.AddAttachmentDialog;
import org.tasks.dialogs.ColorPickerDialog; import org.tasks.dialogs.ColorPickerDialog;
import org.tasks.dialogs.RecordAudioDialog; import org.tasks.dialogs.RecordAudioDialog;
@ -19,7 +19,7 @@ import dagger.Subcomponent;
@Subcomponent(modules = DialogFragmentModule.class) @Subcomponent(modules = DialogFragmentModule.class)
public interface DialogFragmentComponent { public interface DialogFragmentComponent {
void inject(SupportGoogleTaskListPicker supportGoogleTaskListPicker); void inject(RemoteListSupportPicker remoteListSupportPicker);
void inject(NotificationDialog notificationDialog); void inject(NotificationDialog notificationDialog);

@ -1,6 +1,6 @@
package org.tasks.injection; package org.tasks.injection;
import org.tasks.activities.NativeGoogleTaskListPicker; import org.tasks.activities.RemoteListNativePicker;
import org.tasks.dialogs.DonationDialog; import org.tasks.dialogs.DonationDialog;
import org.tasks.dialogs.ExportTasksDialog; import org.tasks.dialogs.ExportTasksDialog;
import org.tasks.dialogs.ImportTasksDialog; import org.tasks.dialogs.ImportTasksDialog;
@ -13,7 +13,7 @@ import dagger.Subcomponent;
@Subcomponent(modules = NativeDialogFragmentModule.class) @Subcomponent(modules = NativeDialogFragmentModule.class)
public interface NativeDialogFragmentComponent { public interface NativeDialogFragmentComponent {
void inject(NativeGoogleTaskListPicker nativeGoogleTaskListPicker); void inject(RemoteListNativePicker remoteListNativePicker);
void inject(LocalePickerDialog localePickerDialog); void inject(LocalePickerDialog localePickerDialog);

@ -7,6 +7,8 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.GtasksFilter;
import com.todoroo.astrid.data.SyncFlags; import com.todoroo.astrid.data.SyncFlags;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.gtasks.GtasksListService; import com.todoroo.astrid.gtasks.GtasksListService;
@ -17,7 +19,6 @@ import org.tasks.analytics.Tracker;
import org.tasks.analytics.Tracking; import org.tasks.analytics.Tracking;
import org.tasks.data.GoogleTask; import org.tasks.data.GoogleTask;
import org.tasks.data.GoogleTaskDao; import org.tasks.data.GoogleTaskDao;
import org.tasks.data.GoogleTaskList;
import org.tasks.injection.FragmentComponent; import org.tasks.injection.FragmentComponent;
import javax.inject.Inject; import javax.inject.Inject;
@ -26,9 +27,9 @@ import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import static com.todoroo.andlib.utility.DateUtilities.now; import static com.todoroo.andlib.utility.DateUtilities.now;
import static org.tasks.activities.SupportGoogleTaskListPicker.newSupportGoogleTaskListPicker; import static org.tasks.activities.RemoteListSupportPicker.newRemoteListSupportPicker;
public class GoogleTaskListFragment extends TaskEditControlFragment { public class RemoteListFragment extends TaskEditControlFragment {
private static final String FRAG_TAG_GOOGLE_TASK_LIST_SELECTION = "frag_tag_google_task_list_selection"; private static final String FRAG_TAG_GOOGLE_TASK_LIST_SELECTION = "frag_tag_google_task_list_selection";
private static final String EXTRA_ORIGINAL_LIST = "extra_original_list"; private static final String EXTRA_ORIGINAL_LIST = "extra_original_list";
@ -43,8 +44,8 @@ public class GoogleTaskListFragment extends TaskEditControlFragment {
@Inject GoogleTaskDao googleTaskDao; @Inject GoogleTaskDao googleTaskDao;
@Inject Tracker tracker; @Inject Tracker tracker;
@Nullable private GoogleTaskList originalList; @Nullable private Filter originalList;
@Nullable private GoogleTaskList selectedList; @Nullable private Filter selectedList;
@Nullable @Nullable
@Override @Override
@ -55,15 +56,15 @@ public class GoogleTaskListFragment extends TaskEditControlFragment {
selectedList = savedInstanceState.getParcelable(EXTRA_SELECTED_LIST); selectedList = savedInstanceState.getParcelable(EXTRA_SELECTED_LIST);
} else { } else {
if (task.isNew()) { if (task.isNew()) {
originalList = gtasksListService.getList(task.getTransitory(GoogleTask.KEY)); originalList = new GtasksFilter(gtasksListService.getList(task.getTransitory(GoogleTask.KEY)));
} else { } else {
GoogleTask googleTask = googleTaskDao.getByTaskId(task.getId()); GoogleTask googleTask = googleTaskDao.getByTaskId(task.getId());
if (googleTask != null) { if (googleTask != null) {
originalList = gtasksListService.getList(googleTask.getListId()); originalList = new GtasksFilter(gtasksListService.getList(googleTask.getListId()));
} }
} }
if (originalList == null) { if (originalList == null) {
originalList = gtasksListService.getList(gtasksPreferenceService.getDefaultList()); originalList = new GtasksFilter(gtasksListService.getList(gtasksPreferenceService.getDefaultList()));
} }
selectedList = originalList; selectedList = originalList;
} }
@ -101,7 +102,7 @@ public class GoogleTaskListFragment extends TaskEditControlFragment {
@OnClick(R.id.google_task_list) @OnClick(R.id.google_task_list)
void clickGoogleTaskList(View view) { void clickGoogleTaskList(View view) {
newSupportGoogleTaskListPicker(selectedList) newRemoteListSupportPicker(selectedList)
.show(getChildFragmentManager(), FRAG_TAG_GOOGLE_TASK_LIST_SELECTION); .show(getChildFragmentManager(), FRAG_TAG_GOOGLE_TASK_LIST_SELECTION);
} }
@ -113,13 +114,13 @@ public class GoogleTaskListFragment extends TaskEditControlFragment {
GoogleTask googleTask = googleTaskDao.getByTaskId(task.getId()); GoogleTask googleTask = googleTaskDao.getByTaskId(task.getId());
if (googleTask == null) { if (googleTask == null) {
googleTaskDao.insert(new GoogleTask(task.getId(), selectedList.getRemoteId())); googleTaskDao.insert(new GoogleTask(task.getId(), ((GtasksFilter) selectedList).getRemoteId()));
} else if (!googleTask.getListId().equals(selectedList.getRemoteId())) { } else if (!googleTask.getListId().equals(((GtasksFilter) selectedList).getRemoteId())) {
tracker.reportEvent(Tracking.Events.GTASK_MOVE); tracker.reportEvent(Tracking.Events.GTASK_MOVE);
task.putTransitory(SyncFlags.FORCE_SYNC, true); task.putTransitory(SyncFlags.FORCE_SYNC, true);
googleTask.setDeleted(now()); googleTask.setDeleted(now());
googleTaskDao.update(googleTask); googleTaskDao.update(googleTask);
googleTaskDao.insert(new GoogleTask(task.getId(), selectedList.getRemoteId())); googleTaskDao.insert(new GoogleTask(task.getId(), ((GtasksFilter) selectedList).getRemoteId()));
} }
} }
@ -133,14 +134,18 @@ public class GoogleTaskListFragment extends TaskEditControlFragment {
component.inject(this); component.inject(this);
} }
public void setList(GoogleTaskList list) { public void setList(Filter list) {
if (list instanceof GtasksFilter) {
this.selectedList = list; this.selectedList = list;
} else {
throw new RuntimeException("Unhandled filter type");
}
refreshView(); refreshView();
} }
private void refreshView() { private void refreshView() {
if (selectedList != null) { if (selectedList != null) {
textView.setText(selectedList.getTitle()); textView.setText(selectedList.listingTitle);
} }
} }
} }

@ -21,6 +21,7 @@ import android.widget.LinearLayout;
import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.files.FilesControlSet; import com.todoroo.astrid.files.FilesControlSet;
@ -34,7 +35,6 @@ import com.todoroo.astrid.utility.Flags;
import org.tasks.LocalBroadcastManager; import org.tasks.LocalBroadcastManager;
import org.tasks.R; import org.tasks.R;
import org.tasks.analytics.Tracker; import org.tasks.analytics.Tracker;
import org.tasks.data.GoogleTaskList;
import org.tasks.data.UserActivity; import org.tasks.data.UserActivity;
import org.tasks.data.UserActivityDao; import org.tasks.data.UserActivityDao;
import org.tasks.dialogs.DialogBuilder; import org.tasks.dialogs.DialogBuilder;
@ -44,7 +44,7 @@ import org.tasks.injection.FragmentComponent;
import org.tasks.injection.InjectingFragment; import org.tasks.injection.InjectingFragment;
import org.tasks.notifications.NotificationManager; import org.tasks.notifications.NotificationManager;
import org.tasks.preferences.Preferences; import org.tasks.preferences.Preferences;
import org.tasks.ui.GoogleTaskListFragment; import org.tasks.ui.RemoteListFragment;
import org.tasks.ui.MenuColorizer; import org.tasks.ui.MenuColorizer;
import org.tasks.ui.TaskEditControlFragment; import org.tasks.ui.TaskEditControlFragment;
@ -227,8 +227,8 @@ public final class TaskEditFragment extends InjectingFragment implements Toolbar
return getFragment(EditTitleControlSet.TAG); return getFragment(EditTitleControlSet.TAG);
} }
private GoogleTaskListFragment getGoogleTaskListFragment() { private RemoteListFragment getRemoteListFragment() {
return getFragment(GoogleTaskListFragment.TAG); return getFragment(RemoteListFragment.TAG);
} }
private RepeatControlSet getRepeatControlSet() { private RepeatControlSet getRepeatControlSet() {
@ -307,8 +307,8 @@ public final class TaskEditFragment extends InjectingFragment implements Toolbar
getEditTitleControlSet().repeatChanged(repeat); getEditTitleControlSet().repeatChanged(repeat);
} }
public void onGoogleTaskListChanged(GoogleTaskList list) { public void onRemoteListChanged(Filter list) {
getGoogleTaskListFragment().setList(list); getRemoteListFragment().setList(list);
} }
public void onDueDateChanged(long dueDate) { public void onDueDateChanged(long dueDate) {

@ -43,7 +43,7 @@ import org.tasks.data.TagData;
import org.tasks.data.TagDataDao; import org.tasks.data.TagDataDao;
import org.tasks.dialogs.SortDialog; import org.tasks.dialogs.SortDialog;
import org.tasks.fragments.CommentBarFragment; import org.tasks.fragments.CommentBarFragment;
import org.tasks.gtasks.GoogleTaskListSelectionHandler; import org.tasks.gtasks.RemoteListSelectionHandler;
import org.tasks.gtasks.SyncAdapterHelper; import org.tasks.gtasks.SyncAdapterHelper;
import org.tasks.injection.ActivityComponent; import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity; import org.tasks.injection.InjectingAppCompatActivity;
@ -83,7 +83,7 @@ public class TaskListActivity extends InjectingAppCompatActivity implements
TaskEditFragment.TaskEditFragmentCallbackHandler, TaskEditFragment.TaskEditFragmentCallbackHandler,
CommentBarFragment.CommentBarFragmentCallback, CommentBarFragment.CommentBarFragmentCallback,
SortDialog.SortDialogCallback, SortDialog.SortDialogCallback,
GoogleTaskListSelectionHandler { RemoteListSelectionHandler {
@Inject Preferences preferences; @Inject Preferences preferences;
@Inject SubtasksHelper subtasksHelper; @Inject SubtasksHelper subtasksHelper;
@ -480,8 +480,8 @@ public class TaskListActivity extends InjectingAppCompatActivity implements
} }
@Override @Override
public void selectedList(GoogleTaskList list) { public void selectedList(Filter list) {
getTaskEditFragment().onGoogleTaskListChanged(list); getTaskEditFragment().onRemoteListChanged(list);
} }
@Override @Override

@ -107,4 +107,8 @@ public class GtasksFilter extends Filter {
public GoogleTaskList getList() { public GoogleTaskList getList() {
return list; return list;
} }
public String getRemoteId() {
return list.getRemoteId();
}
} }

@ -21,7 +21,7 @@ import org.tasks.preferences.Preferences;
import org.tasks.ui.CalendarControlSet; import org.tasks.ui.CalendarControlSet;
import org.tasks.ui.DeadlineControlSet; import org.tasks.ui.DeadlineControlSet;
import org.tasks.ui.DescriptionControlSet; import org.tasks.ui.DescriptionControlSet;
import org.tasks.ui.GoogleTaskListFragment; import org.tasks.ui.RemoteListFragment;
import org.tasks.ui.PriorityControlSet; import org.tasks.ui.PriorityControlSet;
import org.tasks.ui.TaskEditControlFragment; import org.tasks.ui.TaskEditControlFragment;
@ -61,7 +61,7 @@ public class TaskEditControlSetFragmentManager {
TagsControlSet.TAG, TagsControlSet.TAG,
RepeatControlSet.TAG, RepeatControlSet.TAG,
CommentBarFragment.TAG, CommentBarFragment.TAG,
GoogleTaskListFragment.TAG RemoteListFragment.TAG
}; };
static { static {
@ -150,9 +150,9 @@ public class TaskEditControlSetFragmentManager {
return new RepeatControlSet(); return new RepeatControlSet();
case CommentBarFragment.TAG: case CommentBarFragment.TAG:
return new CommentBarFragment(); return new CommentBarFragment();
case GoogleTaskListFragment.TAG: case RemoteListFragment.TAG:
return syncAdapterHelper.isEnabled() return syncAdapterHelper.isEnabled()
? new GoogleTaskListFragment() ? new RemoteListFragment()
: null; : null;
default: default:
throw new RuntimeException("Unsupported fragment"); throw new RuntimeException("Unsupported fragment");

@ -1,7 +0,0 @@
package org.tasks.gtasks;
import org.tasks.data.GoogleTaskList;
public interface GoogleTaskListSelectionHandler {
void selectedList(GoogleTaskList list);
}

@ -0,0 +1,7 @@
package org.tasks.gtasks;
import com.todoroo.astrid.api.Filter;
public interface RemoteListSelectionHandler {
void selectedList(Filter list);
}

@ -19,7 +19,7 @@ import org.tasks.tasklist.TagListFragment;
import org.tasks.ui.CalendarControlSet; import org.tasks.ui.CalendarControlSet;
import org.tasks.ui.DeadlineControlSet; import org.tasks.ui.DeadlineControlSet;
import org.tasks.ui.DescriptionControlSet; import org.tasks.ui.DescriptionControlSet;
import org.tasks.ui.GoogleTaskListFragment; import org.tasks.ui.RemoteListFragment;
import org.tasks.ui.NavigationDrawerFragment; import org.tasks.ui.NavigationDrawerFragment;
import org.tasks.ui.PriorityControlSet; import org.tasks.ui.PriorityControlSet;
@ -66,7 +66,7 @@ public interface FragmentComponent {
void inject(SubtasksTagListFragment subtasksTagListFragment); void inject(SubtasksTagListFragment subtasksTagListFragment);
void inject(GoogleTaskListFragment googleTaskListFragment); void inject(RemoteListFragment remoteListFragment);
void inject(GtasksListFragment gtasksListFragment); void inject(GtasksListFragment gtasksListFragment);
} }

Loading…
Cancel
Save