diff --git a/api/src/com/todoroo/astrid/api/Filter.java b/api/src/com/todoroo/astrid/api/Filter.java
index 2570cf691..6d7af4959 100644
--- a/api/src/com/todoroo/astrid/api/Filter.java
+++ b/api/src/com/todoroo/astrid/api/Filter.java
@@ -102,6 +102,8 @@ public class Filter extends FilterListItem {
this.valuesForNewTasks = valuesForNewTasks;
}
+
+
/**
* Utility constructor
*
@@ -121,6 +123,38 @@ public class Filter extends FilterListItem {
return 0;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((sqlQuery == null) ? 0 : sqlQuery.hashCode());
+ result = prime * result + ((title == null) ? 0 : title.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Filter other = (Filter) obj;
+ if (sqlQuery == null) {
+ if (other.sqlQuery != null)
+ return false;
+ } else if (!sqlQuery.equals(other.sqlQuery))
+ return false;
+ if (title == null) {
+ if (other.title != null)
+ return false;
+ } else if (!title.equals(other.title))
+ return false;
+ return true;
+ }
+
/**
* {@inheritDoc}
*/
diff --git a/astrid/plugin-src/com/timsu/astrid/C2DMReceiver.java b/astrid/plugin-src/com/timsu/astrid/C2DMReceiver.java
index 5c35e277a..b1c115713 100644
--- a/astrid/plugin-src/com/timsu/astrid/C2DMReceiver.java
+++ b/astrid/plugin-src/com/timsu/astrid/C2DMReceiver.java
@@ -233,7 +233,7 @@ public class C2DMReceiver extends BroadcastReceiver {
}
notifyIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- notifyIntent.putExtra(TaskListFragment.TOKEN_SOURCE, Constants.SOURCE_C2DM);
+ notifyIntent.putExtra(TaskListActivity.TOKEN_SOURCE, Constants.SOURCE_C2DM);
PendingIntent pendingIntent = PendingIntent.getActivity(context,
notifId, notifyIntent, 0);
diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewFragment.java b/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewFragment.java
index e4ff1407a..0f11107ea 100644
--- a/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewFragment.java
+++ b/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewFragment.java
@@ -178,8 +178,8 @@ public class TagViewFragment extends TaskListFragment {
}
TaskListActivity activity = (TaskListActivity) getActivity();
- String tag = activity.getIntent().getStringExtra(EXTRA_TAG_NAME);
- long remoteId = activity.getIntent().getLongExtra(EXTRA_TAG_REMOTE_ID, 0);
+ String tag = extras.getString(EXTRA_TAG_NAME);
+ long remoteId = extras.getLong(EXTRA_TAG_REMOTE_ID, 0);
if(tag == null && remoteId == 0)
return;
@@ -205,8 +205,8 @@ public class TagViewFragment extends TaskListFragment {
super.onNewIntent(intent);
- if (activity.getIntent().getBooleanExtra(TOKEN_START_ACTIVITY, false)) {
- activity.getIntent().removeExtra(TOKEN_START_ACTIVITY);
+ if (extras.getBoolean(TOKEN_START_ACTIVITY, false)) {
+ extras.remove(TOKEN_START_ACTIVITY);
activity.showComments();
}
}
@@ -465,6 +465,7 @@ public class TagViewFragment extends TaskListFragment {
tagData = tagDataService.fetchById(tagData.getId(), TagData.PROPERTIES);
filter = TagFilterExposer.filterFromTagData(getActivity(), tagData);
getActivity().getIntent().putExtra(TOKEN_FILTER, filter);
+ extras.putParcelable(TOKEN_FILTER, filter);
Activity activity = getActivity();
if (activity instanceof TaskListActivity) {
((TaskListActivity) activity).setListsTitle(filter.title);
diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksFilterExposer.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksFilterExposer.java
index 624e078d4..8d918a459 100644
--- a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksFilterExposer.java
+++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksFilterExposer.java
@@ -22,7 +22,6 @@ import com.todoroo.andlib.sql.Functions;
import com.todoroo.andlib.sql.Join;
import com.todoroo.andlib.sql.Order;
import com.todoroo.andlib.sql.QueryTemplate;
-import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.AstridFilterExposer;
import com.todoroo.astrid.api.Filter;
@@ -72,7 +71,6 @@ public class GtasksFilterExposer extends BroadcastReceiver implements AstridFilt
filter.listingIcon = ((BitmapDrawable)context.getResources().getDrawable(R.drawable.gtasks_icon)).getBitmap();
filter.customTaskList = new ComponentName(ContextManager.getContext(), GtasksListFragment.class);
Bundle extras = new Bundle();
- extras.putBoolean(TaskListFragment.TOKEN_OVERRIDE_ANIM, true);
extras.putLong(GtasksListFragment.TOKEN_STORE_ID, list.getId());
filter.customExtras = extras;
diff --git a/astrid/plugin-src/com/todoroo/astrid/reminders/NotificationFragment.java b/astrid/plugin-src/com/todoroo/astrid/reminders/NotificationFragment.java
index ecab8b894..57a900f95 100644
--- a/astrid/plugin-src/com/todoroo/astrid/reminders/NotificationFragment.java
+++ b/astrid/plugin-src/com/todoroo/astrid/reminders/NotificationFragment.java
@@ -120,7 +120,7 @@ public class NotificationFragment extends TaskListFragment implements OnTimeSetL
// hide quick add
getView().findViewById(R.id.taskListFooter).setVisibility(View.GONE);
- String title = getActivity().getIntent().getStringExtra(Notifications.EXTRAS_TEXT);
+ String title = extras.getString(Notifications.EXTRAS_TEXT);
new ReminderDialog((AstridActivity) getActivity(), taskId, title).show();
}
diff --git a/astrid/plugin-src/com/todoroo/astrid/reminders/Notifications.java b/astrid/plugin-src/com/todoroo/astrid/reminders/Notifications.java
index 415f810ec..4dcb10671 100644
--- a/astrid/plugin-src/com/todoroo/astrid/reminders/Notifications.java
+++ b/astrid/plugin-src/com/todoroo/astrid/reminders/Notifications.java
@@ -25,7 +25,6 @@ import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.activity.TaskListActivity;
-import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.Task;
@@ -181,7 +180,7 @@ public class Notifications extends BroadcastReceiver {
notifyIntent.putExtra(NotificationFragment.TOKEN_ID, id);
notifyIntent.putExtra(EXTRAS_TEXT, text);
notifyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
- notifyIntent.putExtra(TaskListFragment.TOKEN_SOURCE, Constants.SOURCE_NOTIFICATION);
+ notifyIntent.putExtra(TaskListActivity.TOKEN_SOURCE, Constants.SOURCE_NOTIFICATION);
requestNotification((int)id, notifyIntent, type, title, text, ringTimes);
return true;
diff --git a/astrid/plugin-src/com/todoroo/astrid/tags/TagFilterExposer.java b/astrid/plugin-src/com/todoroo/astrid/tags/TagFilterExposer.java
index e3e13ba6c..feba4eb58 100644
--- a/astrid/plugin-src/com/todoroo/astrid/tags/TagFilterExposer.java
+++ b/astrid/plugin-src/com/todoroo/astrid/tags/TagFilterExposer.java
@@ -29,7 +29,6 @@ import com.todoroo.andlib.sql.QueryTemplate;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.astrid.actfm.TagViewFragment;
-import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.AstridFilterExposer;
import com.todoroo.astrid.api.Filter;
@@ -112,7 +111,6 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE
Bundle extras = new Bundle();
extras.putString(TagViewFragment.EXTRA_TAG_NAME, tag.tag);
extras.putLong(TagViewFragment.EXTRA_TAG_REMOTE_ID, tag.remoteId);
- extras.putBoolean(TaskListFragment.TOKEN_OVERRIDE_ANIM, true);
filter.customExtras = extras;
return filter;
diff --git a/astrid/res/layout/task_list_wrapper_activity.xml b/astrid/res/layout/task_list_wrapper_activity.xml
index 7f3cc135c..c66aab46c 100644
--- a/astrid/res/layout/task_list_wrapper_activity.xml
+++ b/astrid/res/layout/task_list_wrapper_activity.xml
@@ -5,4 +5,8 @@
android:layout_height="match_parent"
style="@style/Content"
android:id="@+id/tasklist_fragment_container">
+
\ No newline at end of file
diff --git a/astrid/src/com/todoroo/astrid/activity/AstridActivity.java b/astrid/src/com/todoroo/astrid/activity/AstridActivity.java
index 39b48986a..fcd366897 100644
--- a/astrid/src/com/todoroo/astrid/activity/AstridActivity.java
+++ b/astrid/src/com/todoroo/astrid/activity/AstridActivity.java
@@ -161,21 +161,12 @@ public class AstridActivity extends FragmentActivity
if(item instanceof Filter) {
Filter filter = (Filter)item;
- if(filter instanceof FilterWithCustomIntent) {
- int lastSelectedList = intent.getIntExtra(FilterListFragment.TOKEN_LAST_SELECTED, 0);
- intent = ((FilterWithCustomIntent)filter).getCustomIntent();
- intent.putExtra(FilterListFragment.TOKEN_LAST_SELECTED, lastSelectedList);
- } else {
- intent.putExtra(TaskListFragment.TOKEN_FILTER, filter);
- }
-
- setIntent(intent);
+ Bundle extras = configureIntentAndExtrasWithFilter(intent, filter);
if (fragmentLayout == LAYOUT_TRIPLE && getTaskEditFragment() != null) {
onBackPressed(); // remove the task edit fragment when switching between lists
}
-
- setupTasklistFragmentWithFilter(filter);
+ setupTasklistFragmentWithFilter(filter, extras);
// no animation for dualpane-layout
AndroidUtilities.callOverridePendingTransition(this, 0, 0);
@@ -192,6 +183,23 @@ public class AstridActivity extends FragmentActivity
}
}
+ protected Bundle configureIntentAndExtrasWithFilter(Intent intent, Filter filter) {
+ if(filter instanceof FilterWithCustomIntent) {
+ int lastSelectedList = intent.getIntExtra(FilterListFragment.TOKEN_LAST_SELECTED, 0);
+ intent = ((FilterWithCustomIntent)filter).getCustomIntent();
+ intent.putExtra(FilterListFragment.TOKEN_LAST_SELECTED, lastSelectedList);
+ } else {
+ intent.putExtra(TaskListFragment.TOKEN_FILTER, filter);
+ }
+
+ setIntent(intent);
+
+ Bundle extras = intent.getExtras();
+ if (extras != null)
+ extras = (Bundle) extras.clone();
+ return extras;
+ }
+
public void setupActivityFragment(TagData tagData) {
if (fragmentLayout == LAYOUT_SINGLE)
return;
@@ -206,7 +214,7 @@ public class AstridActivity extends FragmentActivity
transaction.commit();
}
- public final void setupTasklistFragmentWithFilter(Filter filter) {
+ public void setupTasklistFragmentWithFilter(Filter filter, Bundle extras) {
Class> customTaskList = TaskListFragment.class;
if(filter == null || CoreFilterExposer.isInbox(filter)) {
@@ -216,23 +224,15 @@ public class AstridActivity extends FragmentActivity
customTaskList = SubtasksListFragment.class;
}
- setupTasklistFragmentWithFilterAndCustomTaskList(filter, customTaskList);
+ setupTasklistFragmentWithFilterAndCustomTaskList(filter, extras, customTaskList);
}
- public final void setupTasklistFragmentWithFilterAndCustomTaskList(Filter filter, Class> customTaskList) {
- Class> component = customTaskList;
- if (filter instanceof FilterWithCustomIntent) {
- try {
- component = Class.forName(((FilterWithCustomIntent) filter).customTaskList.getClassName());
- } catch (Exception e) {
- // Invalid
- }
- }
- FragmentManager manager = getSupportFragmentManager();
- FragmentTransaction transaction = manager.beginTransaction();
+ public void setupTasklistFragmentWithFilterAndCustomTaskList(Filter filter, Bundle extras, Class> customTaskList) {
+ TaskListFragment newFragment = TaskListFragment.instantiateWithFilterAndExtras(filter, extras, customTaskList);
try {
- TaskListFragment newFragment = (TaskListFragment) component.newInstance();
+ FragmentManager manager = getSupportFragmentManager();
+ FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.tasklist_fragment_container, newFragment,
TaskListFragment.TAG_TASKLIST_FRAGMENT);
transaction.commit();
@@ -308,8 +308,8 @@ public class AstridActivity extends FragmentActivity
}
}
- protected Fragment setupFragment(String tag, int container, Class extends Fragment> cls) {
- FragmentManager fm = getSupportFragmentManager();
+ protected Fragment setupFragment(String tag, int container, Class extends Fragment> cls, boolean createImmediate) {
+ final FragmentManager fm = getSupportFragmentManager();
Fragment fragment = fm.findFragmentByTag(tag);
if(fragment == null) {
try {
@@ -326,6 +326,13 @@ public class AstridActivity extends FragmentActivity
else
ft.replace(container, fragment, tag);
ft.commit();
+ if (createImmediate)
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ fm.executePendingTransactions();
+ }
+ });
}
return fragment;
}
diff --git a/astrid/src/com/todoroo/astrid/activity/FilterListFragment.java b/astrid/src/com/todoroo/astrid/activity/FilterListFragment.java
index 5838dbdc3..5181ac20c 100644
--- a/astrid/src/com/todoroo/astrid/activity/FilterListFragment.java
+++ b/astrid/src/com/todoroo/astrid/activity/FilterListFragment.java
@@ -122,6 +122,8 @@ public class FilterListFragment extends ListFragment {
// Check that the container activity has implemented the callback interface
try {
mListener = (OnFilterItemClickedListener) activity;
+ adapter = new FilterAdapter(getActivity(), null,
+ R.layout.filter_adapter_row, false);
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement OnFilterItemClickedListener"); //$NON-NLS-1$
@@ -257,8 +259,7 @@ public class FilterListFragment extends ListFragment {
/** Sets up the coach list adapter */
protected void setUpList() {
- adapter = new FilterAdapter(getActivity(), getListView(),
- R.layout.filter_adapter_row, false);
+ adapter.setListView(getListView());
setListAdapter(adapter);
adapter.setLastSelected(mSelectedIndex);
diff --git a/astrid/src/com/todoroo/astrid/activity/ShortcutActivity.java b/astrid/src/com/todoroo/astrid/activity/ShortcutActivity.java
index 7be0f763c..690904818 100644
--- a/astrid/src/com/todoroo/astrid/activity/ShortcutActivity.java
+++ b/astrid/src/com/todoroo/astrid/activity/ShortcutActivity.java
@@ -87,8 +87,8 @@ public class ShortcutActivity extends Activity {
Intent taskListIntent = new Intent(this, TaskListActivity.class);
- if(extras != null && extras.containsKey(TaskListFragment.TOKEN_SOURCE))
- taskListIntent.putExtra(TaskListFragment.TOKEN_SOURCE, extras.getInt(TaskListFragment.TOKEN_SOURCE));
+ if(extras != null && extras.containsKey(TaskListActivity.TOKEN_SOURCE))
+ taskListIntent.putExtra(TaskListActivity.TOKEN_SOURCE, extras.getInt(TaskListActivity.TOKEN_SOURCE));
if(extras != null && extras.containsKey(TOKEN_CUSTOM_CLASS)) {
taskListIntent.putExtras(intent.getExtras());
diff --git a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java
index ef19a3839..bbb835a16 100644
--- a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java
+++ b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java
@@ -9,6 +9,7 @@ import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v4.app.ActionBar;
import android.support.v4.app.Fragment;
+import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.MotionEvent;
@@ -29,32 +30,44 @@ import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.actfm.TagSettingsActivity;
import com.todoroo.astrid.actfm.TagUpdatesFragment;
import com.todoroo.astrid.actfm.TagViewFragment;
+import com.todoroo.astrid.adapter.FilterAdapter;
+import com.todoroo.astrid.adapter.TaskListFragmentPagerAdapter;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.FilterListItem;
+import com.todoroo.astrid.core.CoreFilterExposer;
import com.todoroo.astrid.core.CustomFilterExposer;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.reminders.NotificationFragment;
+import com.todoroo.astrid.service.StatisticsConstants;
+import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.tags.TagFilterExposer;
import com.todoroo.astrid.ui.DateChangedAlerts;
import com.todoroo.astrid.ui.FragmentPopover;
import com.todoroo.astrid.ui.MainMenuPopover;
import com.todoroo.astrid.ui.MainMenuPopover.MainMenuListener;
+import com.todoroo.astrid.ui.TaskListFragmentPager;
import com.todoroo.astrid.utility.Constants;
import com.todoroo.astrid.utility.Flags;
import com.todoroo.astrid.welcome.tutorial.WelcomeWalkthrough;
-public class TaskListActivity extends AstridActivity implements MainMenuListener {
+public class TaskListActivity extends AstridActivity implements MainMenuListener, OnPageChangeListener {
public static final String TOKEN_SELECTED_FILTER = "selectedFilter"; //$NON-NLS-1$
+ /** token for indicating source of TLA launch */
+ public static final String TOKEN_SOURCE = "source"; //$NON-NLS-1$
+
private View listsNav;
private ImageView listsNavDisclosure;
private TextView lists;
private ImageView mainMenu;
private Button commentsButton;
+ private TaskListFragmentPager tlfPager;
+ private TaskListFragmentPagerAdapter tlfPagerAdapter;
+
private FragmentPopover listsPopover;
private FragmentPopover editPopover;
private FragmentPopover commentsPopover;
@@ -142,16 +155,55 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
commentsButton.setOnClickListener(commentsButtonClickListener);
Filter savedFilter = getIntent().getParcelableExtra(TaskListFragment.TOKEN_FILTER);
+ if (savedFilter == null)
+ savedFilter = CoreFilterExposer.buildInboxFilter(getResources());
+
+ Bundle extras = getIntent().getExtras();
+ if (extras != null)
+ extras = (Bundle) extras.clone();
+
+ if (fragmentLayout == LAYOUT_SINGLE) {
+ FilterListFragment flf = getFilterListFragment();
+ if (flf == null)
+ throw new RuntimeException("Filterlist fragment was null, needs to exist to construct the fragment pager"); //$NON-NLS-1$
+ FilterAdapter adapter = flf.adapter;
+ tlfPager = (TaskListFragmentPager) findViewById(R.id.pager);
+ tlfPagerAdapter = new TaskListFragmentPagerAdapter(getSupportFragmentManager(), adapter);
+ tlfPager.setAdapter(tlfPagerAdapter);
+ tlfPager.setOnPageChangeListener(this);
+ }
- if (getIntent().getIntExtra(TaskListFragment.TOKEN_SOURCE, Constants.SOURCE_DEFAULT) ==
+ if (getIntent().getIntExtra(TOKEN_SOURCE, Constants.SOURCE_DEFAULT) ==
Constants.SOURCE_NOTIFICATION)
- setupTasklistFragmentWithFilterAndCustomTaskList(savedFilter, NotificationFragment.class);
+ setupTasklistFragmentWithFilterAndCustomTaskList(savedFilter, extras, NotificationFragment.class);
else
- setupTasklistFragmentWithFilter(savedFilter);
+ setupTasklistFragmentWithFilter(savedFilter, extras);
if (savedFilter != null)
setListsTitle(savedFilter.title);
- }
+
+ if (getIntent().hasExtra(TOKEN_SOURCE)) {
+ trackActivitySource();
+ }
+ }
+
+ @Override
+ public void setupTasklistFragmentWithFilter(Filter filter, Bundle extras) {
+ if (fragmentLayout == LAYOUT_SINGLE) {
+ tlfPager.showFilter(filter); // TODO: make sure we handle the extras and the custom task list
+ } else {
+ super.setupTasklistFragmentWithFilter(filter, extras);
+ }
+ }
+
+ @Override
+ public void setupTasklistFragmentWithFilterAndCustomTaskList(Filter filter, Bundle extras, Class> customTaskList) {
+ if (fragmentLayout == LAYOUT_SINGLE) {
+ tlfPager.showFilter(filter); // TODO: make sure we handle the extras and the custom task list
+ } else {
+ super.setupTasklistFragmentWithFilterAndCustomTaskList(filter, extras, customTaskList);
+ }
+ }
/**
*
@@ -161,29 +213,29 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
View filterFragment = findViewById(R.id.filterlist_fragment_container);
View editFragment = findViewById(R.id.taskedit_fragment_container);
- if (filterFragment != null) {
- actionBar.setDisplayHomeAsUpEnabled(false);
- actionBar.getCustomView().findViewById(R.id.list_disclosure_arrow).setVisibility(View.GONE);
- listsNav.setOnClickListener(null);
-
- if(editFragment != null && editFragment.getVisibility() == View.INVISIBLE) {
- fragmentLayout = LAYOUT_TRIPLE;
- actionBar.getCustomView().findViewById(R.id.comments).setVisibility(View.GONE);
- } else {
- fragmentLayout = LAYOUT_DOUBLE;
- createEditPopover();
- createCommentsPopover();
- }
-
- setupFragment(FilterListFragment.TAG_FILTERLIST_FRAGMENT,
- R.id.filterlist_fragment_container, FilterListFragment.class);
- } else {
- fragmentLayout = LAYOUT_SINGLE;
- actionBar.setDisplayHomeAsUpEnabled(true);
- listsNav.setOnClickListener(popupMenuClickListener);
- createListsPopover();
- setupPopoverWithFilterList((FilterListFragment) setupFragment(FilterListFragment.TAG_FILTERLIST_FRAGMENT, 0, FilterListFragment.class));
- }
+ if (filterFragment != null) {
+ actionBar.setDisplayHomeAsUpEnabled(false);
+ actionBar.getCustomView().findViewById(R.id.list_disclosure_arrow).setVisibility(View.GONE);
+ listsNav.setOnClickListener(null);
+
+ if(editFragment != null && editFragment.getVisibility() == View.INVISIBLE) {
+ fragmentLayout = LAYOUT_TRIPLE;
+ actionBar.getCustomView().findViewById(R.id.comments).setVisibility(View.GONE);
+ } else {
+ fragmentLayout = LAYOUT_DOUBLE;
+ createEditPopover();
+ createCommentsPopover();
+ }
+
+ setupFragment(FilterListFragment.TAG_FILTERLIST_FRAGMENT,
+ R.id.filterlist_fragment_container, FilterListFragment.class, false);
+ } else {
+ fragmentLayout = LAYOUT_SINGLE;
+ actionBar.setDisplayHomeAsUpEnabled(true);
+ listsNav.setOnClickListener(popupMenuClickListener);
+ createListsPopover();
+ setupPopoverWithFilterList((FilterListFragment) setupFragment(FilterListFragment.TAG_FILTERLIST_FRAGMENT, 0, FilterListFragment.class, true));
+ }
}
private void createListsPopover() {
@@ -256,34 +308,39 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
@Override
public void onTaskListItemClicked(long taskId) {
- super.onTaskListItemClicked(taskId);
- if (fragmentLayout == LAYOUT_DOUBLE && getTaskEditFragment() != null) {
- DisplayMetrics metrics = getResources().getDisplayMetrics();
- setupPopoverWithFragment(editPopover, getTaskEditFragment(), new LayoutParams((int) (400 * metrics.density), (int) (600 * metrics.density)));
- editPopover.show(listsNav);
- }
- }
-
-
- @Override
- public boolean onFilterItemClicked(FilterListItem item) {
- if (listsPopover != null)
- listsPopover.dismiss();
- setCommentsCount(0);
- return super.onFilterItemClicked(item);
- }
-
- private void setListsDropdownSelected(boolean selected) {
- int oldTextColor = lists.getTextColors().getDefaultColor();
- int textStyle = (selected ? R.style.TextAppearance_ActionBar_ListsHeader_Selected :
- R.style.TextAppearance_ActionBar_ListsHeader);
-
- TypedValue listDisclosure = new TypedValue();
- getTheme().resolveAttribute(R.attr.asListsDisclosure, listDisclosure, false);
- lists.setTextAppearance(this, textStyle);
- listsNav.setBackgroundColor(selected ? oldTextColor : android.R.color.transparent);
- listsNavDisclosure.setSelected(selected);
- }
+ super.onTaskListItemClicked(taskId);
+ if (fragmentLayout == LAYOUT_DOUBLE && getTaskEditFragment() != null) {
+ DisplayMetrics metrics = getResources().getDisplayMetrics();
+ setupPopoverWithFragment(editPopover, getTaskEditFragment(), new LayoutParams((int) (400 * metrics.density), (int) (600 * metrics.density)));
+ editPopover.show(listsNav);
+ }
+ }
+
+
+ @Override
+ public boolean onFilterItemClicked(FilterListItem item) {
+ if (listsPopover != null)
+ listsPopover.dismiss();
+ setCommentsCount(0);
+
+ if (fragmentLayout == LAYOUT_SINGLE) {
+ tlfPager.showFilter((Filter) item);
+ return true;
+ }
+ return super.onFilterItemClicked(item);
+ }
+
+ private void setListsDropdownSelected(boolean selected) {
+ int oldTextColor = lists.getTextColors().getDefaultColor();
+ int textStyle = (selected ? R.style.TextAppearance_ActionBar_ListsHeader_Selected :
+ R.style.TextAppearance_ActionBar_ListsHeader);
+
+ TypedValue listDisclosure = new TypedValue();
+ getTheme().resolveAttribute(R.attr.asListsDisclosure, listDisclosure, false);
+ lists.setTextAppearance(this, textStyle);
+ listsNav.setBackgroundColor(selected ? oldTextColor : android.R.color.transparent);
+ listsNavDisclosure.setSelected(selected);
+ }
@Override
protected void onPostResume() {
@@ -333,6 +390,21 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
lists.setText(item.title);
}
+ @Override
+ public void onPageSelected(int position) {
+ if (tlfPagerAdapter != null) {
+ configureIntentAndExtrasWithFilter(getIntent(), tlfPagerAdapter.getFilter(position));
+ setListsTitle(tlfPagerAdapter.getPageTitle(position).toString());
+ }
+ }
+
+ @Override
+ public void onPageScrolled(int position, float positionOffset,
+ int positionOffsetPixels) { /* Nothing */ }
+
+ @Override
+ public void onPageScrollStateChanged(int state) { /* Nothing */ }
+
public void setCommentsCount(int count) {
TypedValue tv = new TypedValue();
@@ -452,6 +524,31 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
}
}
+ /**
+ * Report who launched this activity
+ */
+ protected void trackActivitySource() {
+ switch (getIntent().getIntExtra(TOKEN_SOURCE,
+ Constants.SOURCE_DEFAULT)) {
+ case Constants.SOURCE_NOTIFICATION:
+ StatisticsService.reportEvent(StatisticsConstants.LAUNCH_FROM_NOTIFICATION);
+ break;
+ case Constants.SOURCE_OTHER:
+ StatisticsService.reportEvent(StatisticsConstants.LAUNCH_FROM_OTHER);
+ break;
+ case Constants.SOURCE_PPWIDGET:
+ StatisticsService.reportEvent(StatisticsConstants.LAUNCH_FROM_PPW);
+ break;
+ case Constants.SOURCE_WIDGET:
+ StatisticsService.reportEvent(StatisticsConstants.LAUNCH_FROM_WIDGET);
+ break;
+ case Constants.SOURCE_C2DM:
+ StatisticsService.reportEvent(StatisticsConstants.LAUNCH_FROM_C2DM);
+ break;
+ }
+ getIntent().putExtra(TOKEN_SOURCE, Constants.SOURCE_DEFAULT); // Only report source once
+ }
+
@Override
public void mainMenuItemSelected(int item) {
TaskListFragment tla = getTaskListFragment();
diff --git a/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java b/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java
index 175542e1d..40de3bcb8 100644
--- a/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java
+++ b/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java
@@ -26,6 +26,7 @@ import android.support.v4.app.SupportActivity;
import android.support.v4.view.Menu;
import android.support.v4.view.MenuItem;
import android.text.TextUtils;
+import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.KeyEvent;
@@ -65,6 +66,7 @@ import com.todoroo.astrid.adapter.TaskAdapter.OnCompletedTaskListener;
import com.todoroo.astrid.adapter.TaskAdapter.ViewHolder;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.Filter;
+import com.todoroo.astrid.api.FilterWithCustomIntent;
import com.todoroo.astrid.api.TaskContextActionExposer;
import com.todoroo.astrid.api.TaskDecoration;
import com.todoroo.astrid.core.CoreFilterExposer;
@@ -141,10 +143,7 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
/** token for passing a {@link Filter} object through extras */
public static final String TOKEN_FILTER = "filter"; //$NON-NLS-1$
- /** token for indicating source of TLA launch */
- public static final String TOKEN_SOURCE = "source"; //$NON-NLS-1$
-
- public static final String TOKEN_OVERRIDE_ANIM = "finishAnim"; //$NON-NLS-1$
+ private static final String TOKEN_EXTRAS = "extras"; //$NON-NLS-1$
// --- instance variables
@@ -179,10 +178,10 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
protected Filter filter;
protected int sortFlags;
protected int sortSort;
- protected boolean overrideFinishAnim;
protected QuickAddBar quickAddBar;
private Timer backgroundTimer;
+ protected Bundle extras;
private boolean isInbox;
private final TaskListContextMenuExtensionLoader contextMenuExtensionLoader = new TaskListContextMenuExtensionLoader();
@@ -201,6 +200,32 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
AstridDependencyInjector.initialize();
}
+ @SuppressWarnings("nls")
+ public static TaskListFragment instantiateWithFilterAndExtras(Filter filter, Bundle extras, Class> customComponent) {
+ Class> component = customComponent;
+ if (filter instanceof FilterWithCustomIntent) {
+ try {
+ component = Class.forName(((FilterWithCustomIntent) filter).customTaskList.getClassName());
+ } catch (Exception e) {
+ // Invalid
+ }
+ }
+ TaskListFragment newFragment;
+ try {
+ newFragment = (TaskListFragment) component.newInstance();
+ } catch (java.lang.InstantiationException e) {
+ Log.e("tla-instantiate", "tla-instantiate", e);
+ newFragment = new TaskListFragment();
+ } catch (IllegalAccessException e) {
+ Log.e("tla-instantiate", "tla-instantiate", e);
+ newFragment = new TaskListFragment();
+ }
+ Bundle args = new Bundle();
+ args.putBundle(TOKEN_EXTRAS, extras);
+ newFragment.setArguments(args);
+ return newFragment;
+ }
+
/**
* Container Activity must implement this interface and we ensure that it
* does during the onAttach() callback
@@ -237,6 +262,7 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
public void onCreate(Bundle savedInstanceState) {
DependencyInjectionService.getInstance().inject(this);
super.onCreate(savedInstanceState);
+ extras = getArguments() != null ? getArguments().getBundle(TOKEN_EXTRAS) : null;
}
/*
@@ -280,10 +306,6 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
upgradeService.showChangeLog(getActivity(),
Preferences.getInt(AstridPreferences.P_UPGRADE_FROM, -1));
- if (getActivity().getIntent().hasExtra(TOKEN_SOURCE)) {
- trackActivitySource();
- }
-
getActivity().runOnUiThread(new Runnable() {
public void run() {
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
@@ -291,31 +313,6 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
});
}
- /**
- * Report who launched this activity
- */
- protected void trackActivitySource() {
- switch (getActivity().getIntent().getIntExtra(TOKEN_SOURCE,
- Constants.SOURCE_DEFAULT)) {
- case Constants.SOURCE_NOTIFICATION:
- StatisticsService.reportEvent(StatisticsConstants.LAUNCH_FROM_NOTIFICATION);
- break;
- case Constants.SOURCE_OTHER:
- StatisticsService.reportEvent(StatisticsConstants.LAUNCH_FROM_OTHER);
- break;
- case Constants.SOURCE_PPWIDGET:
- StatisticsService.reportEvent(StatisticsConstants.LAUNCH_FROM_PPW);
- break;
- case Constants.SOURCE_WIDGET:
- StatisticsService.reportEvent(StatisticsConstants.LAUNCH_FROM_WIDGET);
- break;
- case Constants.SOURCE_C2DM:
- StatisticsService.reportEvent(StatisticsConstants.LAUNCH_FROM_C2DM);
- break;
- }
- getActivity().getIntent().putExtra(TOKEN_SOURCE, Constants.SOURCE_DEFAULT); // Only report source once
- }
-
/**
* @return the current tag you are viewing, or null if you're not viewing a tag
*/
@@ -324,12 +321,6 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
}
protected void onNewIntent(Intent intent) {
- Bundle extras = intent.getExtras();
- if (extras != null) {
- overrideFinishAnim = extras.getBoolean(TOKEN_OVERRIDE_ANIM);
- } else {
- overrideFinishAnim = false;
- }
String intentAction = intent.getAction();
if (Intent.ACTION_SEARCH.equals(intentAction)) {
String query = intent.getStringExtra(SearchManager.QUERY).trim();
@@ -339,17 +330,14 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
"%" + //$NON-NLS-1$
query.toUpperCase() + "%")), //$NON-NLS-1$
null);
- intent = new Intent(getActivity(), TaskListActivity.class);
- intent.putExtra(TaskListFragment.TOKEN_FILTER, searchFilter);
- startActivity(intent);
+ Intent searchIntent = new Intent(getActivity(), TaskListActivity.class);
+ searchIntent.putExtra(TaskListFragment.TOKEN_FILTER, searchFilter);
+ startActivity(searchIntent);
getActivity().finish();
- if (overrideFinishAnim) {
- AndroidUtilities.callOverridePendingTransition(getActivity(),
- R.anim.slide_right_in, R.anim.slide_right_out);
- }
return;
} else if (extras != null && extras.containsKey(TOKEN_FILTER)) {
filter = extras.getParcelable(TOKEN_FILTER);
+ extras.remove(TOKEN_FILTER); // Otherwise writing this filter to parcel gives infinite recursion
} else {
filter = CoreFilterExposer.buildInboxFilter(getResources());
}
@@ -659,16 +647,16 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
@Override
public void onReceive(Context context, Intent intent) {
try {
- Bundle extras = intent.getExtras();
- long taskId = extras.getLong(AstridApiConstants.EXTRAS_TASK_ID);
- String addOn = extras.getString(AstridApiConstants.EXTRAS_ADDON);
+ Bundle receivedExtras = intent.getExtras();
+ long taskId = receivedExtras.getLong(AstridApiConstants.EXTRAS_TASK_ID);
+ String addOn = receivedExtras.getString(AstridApiConstants.EXTRAS_ADDON);
if (AstridApiConstants.BROADCAST_SEND_DECORATIONS.equals(intent.getAction())) {
- TaskDecoration deco = extras.getParcelable(AstridApiConstants.EXTRAS_RESPONSE);
+ TaskDecoration deco = receivedExtras.getParcelable(AstridApiConstants.EXTRAS_RESPONSE);
taskAdapter.decorationManager.addNew(taskId, addOn, deco,
null);
} else if (AstridApiConstants.BROADCAST_SEND_DETAILS.equals(intent.getAction())) {
- String detail = extras.getString(AstridApiConstants.EXTRAS_RESPONSE);
+ String detail = receivedExtras.getString(AstridApiConstants.EXTRAS_RESPONSE);
taskAdapter.addDetails(taskId, detail);
}
} catch (Exception e) {
@@ -694,10 +682,6 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
if (requestCode == ACTIVITY_SETTINGS) {
if (resultCode == EditPreferences.RESULT_CODE_THEME_CHANGED) {
getActivity().finish();
- if (overrideFinishAnim) {
- AndroidUtilities.callOverridePendingTransition(getActivity(),
- R.anim.slide_right_in, R.anim.slide_right_out);
- }
getActivity().startActivity(getActivity().getIntent());
} else if (resultCode == SyncProviderPreferences.RESULT_CODE_SYNCHRONIZE) {
Preferences.setLong(SyncActionHelper.PREF_LAST_AUTO_SYNC, 0); // Forces autosync to occur after login
@@ -1176,10 +1160,10 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
protected void toggleDragDrop(boolean newState) {
if(newState)
((AstridActivity)getActivity()).setupTasklistFragmentWithFilterAndCustomTaskList(null,
- SubtasksListFragment.class);
+ extras, SubtasksListFragment.class);
else
((AstridActivity)getActivity()).setupTasklistFragmentWithFilterAndCustomTaskList(null,
- TaskListFragment.class);
+ extras, TaskListFragment.class);
}
protected boolean isDraggable() {
diff --git a/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java b/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java
index b35cbc29d..5b6648385 100644
--- a/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java
+++ b/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java
@@ -54,6 +54,10 @@ import com.todoroo.astrid.tags.TagService;
public class FilterAdapter extends ArrayAdapter {
+ public static interface FilterDataSourceChangedListener {
+ public void filterDataSourceChanged();
+ }
+
// --- style constants
public int filterStyle = R.style.TextAppearance_FLA_Filter;
@@ -68,7 +72,7 @@ public class FilterAdapter extends ArrayAdapter {
protected final Activity activity;
/** owner listview */
- protected final ListView listView;
+ protected ListView listView;
/** display metrics for scaling icons */
private final DisplayMetrics metrics = new DisplayMetrics();
@@ -92,6 +96,8 @@ public class FilterAdapter extends ArrayAdapter {
private int mSelectedIndex;
+ private FilterDataSourceChangedListener listener;
+
// Previous solution involved a queue of filters and a filterSizeLoadingThread. The filterSizeLoadingThread had
// a few problems: how to make sure that the thread is resumed when the controlling activity is resumed, and
// how to make sure that the the filterQueue does not accumulate filters without being processed. I am replacing
@@ -164,10 +170,24 @@ public class FilterAdapter extends ArrayAdapter {
offerFilter(item);
}
+ public int addOrLookup(Filter filter) {
+ int index = getPosition(filter);
+ if (index >= 0) return index;
+ add(filter);
+ return getCount() - 1;
+ }
+
public void setLastSelected(int lastSelected) {
mSelectedIndex = lastSelected;
}
+ public void setDataSourceChangedListener(FilterDataSourceChangedListener listener) {
+ this.listener = listener;
+ }
+
+ public void setListView(ListView listView) {
+ this.listView = listView;
+ }
/**
* Create or reuse a view
@@ -293,10 +313,10 @@ public class FilterAdapter extends ArrayAdapter {
if (filter instanceof FilterCategory) {
Filter[] children = ((FilterCategory) filter).children;
for (Filter f : children) {
- add(f);
+ addOrLookup(f);
}
} else if (filter instanceof Filter){
- add((Filter) filter);
+ addOrLookup((Filter) filter);
}
}
@@ -351,6 +371,13 @@ public class FilterAdapter extends ArrayAdapter {
}
}
+ @Override
+ public void notifyDataSetChanged() {
+ super.notifyDataSetChanged();
+ if (listener != null)
+ listener.filterDataSourceChanged();
+ }
+
/**
* Broadcast a request for lists. The request is sent to every
* application registered to listen for this broadcast. Each application
@@ -379,8 +406,7 @@ public class FilterAdapter extends ArrayAdapter {
IntentFilter bladeFilter = new IntentFilter(AstridApiConstants.BROADCAST_SEND_FILTERS);
bladeFilter.setPriority(1);
activity.registerReceiver(bladeFilterReceiver, bladeFilter);
- if(getCount() == 0)
- getLists();
+ getLists();
}
/**
diff --git a/astrid/src/com/todoroo/astrid/adapter/TaskListFragmentPagerAdapter.java b/astrid/src/com/todoroo/astrid/adapter/TaskListFragmentPagerAdapter.java
new file mode 100644
index 000000000..5569e2cc4
--- /dev/null
+++ b/astrid/src/com/todoroo/astrid/adapter/TaskListFragmentPagerAdapter.java
@@ -0,0 +1,74 @@
+package com.todoroo.astrid.adapter;
+
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentStatePagerAdapter;
+
+import com.todoroo.astrid.activity.TaskListFragment;
+import com.todoroo.astrid.adapter.FilterAdapter.FilterDataSourceChangedListener;
+import com.todoroo.astrid.api.Filter;
+import com.todoroo.astrid.api.FilterWithCustomIntent;
+
+public class TaskListFragmentPagerAdapter extends FragmentStatePagerAdapter implements FilterDataSourceChangedListener {
+
+ private final FilterAdapter filterAdapter;
+
+ public TaskListFragmentPagerAdapter(FragmentManager fm, FilterAdapter filterAdapter) {
+ super(fm);
+ this.filterAdapter = filterAdapter;
+ filterAdapter.setDataSourceChangedListener(this);
+ }
+
+ @Override
+ public void filterDataSourceChanged() {
+ notifyDataSetChanged();
+ }
+
+ @Override
+ public Fragment getItem(int position) {
+ return getFragmentForFilter(filterAdapter.getItem(position));
+ }
+
+ @Override
+ public CharSequence getPageTitle(int position) {
+ return filterAdapter.getItem(position).title;
+ }
+
+ public int addOrLookup(Filter filter) {
+ return filterAdapter.addOrLookup(filter);
+ }
+
+ public Filter getFilter(int position) {
+ return filterAdapter.getItem(position);
+ }
+
+ @Override
+ public int getCount() {
+ return filterAdapter.getCount();
+ }
+
+ private Fragment getFragmentForFilter(Filter filter) {
+ Bundle extras = getExtrasForFilter(filter);
+ return TaskListFragment.instantiateWithFilterAndExtras(filter, extras, TaskListFragment.class);
+ }
+
+ private Bundle getExtrasForFilter(Filter filter) {
+ Bundle extras;
+ if (filter instanceof FilterWithCustomIntent) {
+ extras = ((FilterWithCustomIntent) filter).customExtras;
+ } else {
+ extras = new Bundle();
+ }
+ if (filter != null)
+ extras.putParcelable(TaskListFragment.TOKEN_FILTER, filter);
+ return extras;
+ }
+
+ @Override
+ public Parcelable saveState() {
+ return null; // Don't save state
+ }
+
+}
diff --git a/astrid/src/com/todoroo/astrid/ui/TaskListFragmentPager.java b/astrid/src/com/todoroo/astrid/ui/TaskListFragmentPager.java
new file mode 100644
index 000000000..1cecc3270
--- /dev/null
+++ b/astrid/src/com/todoroo/astrid/ui/TaskListFragmentPager.java
@@ -0,0 +1,40 @@
+package com.todoroo.astrid.ui;
+
+import android.content.Context;
+import android.support.v4.view.PagerAdapter;
+import android.support.v4.view.ViewPager;
+import android.util.AttributeSet;
+
+import com.todoroo.astrid.adapter.TaskListFragmentPagerAdapter;
+import com.todoroo.astrid.api.Filter;
+
+public class TaskListFragmentPager extends ViewPager {
+
+ public TaskListFragmentPager(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ public void setAdapter(PagerAdapter adapter) {
+ if (!(adapter instanceof TaskListFragmentPagerAdapter))
+ throw new ClassCastException("TaskListFragmentPager requires an adapter of type TaskListFragmentPagerAdapter"); //$NON-NLS-1$
+ super.setAdapter(adapter);
+ }
+
+ /**
+ * Show the supplied filter, adding it to the data source if it doesn't exist
+ * @param f
+ */
+ public void showFilter(Filter f) {
+ TaskListFragmentPagerAdapter adapter = (TaskListFragmentPagerAdapter) getAdapter();
+ showFilter(adapter.addOrLookup(f));
+ }
+
+ /**
+ * Show the filter at the supplied index
+ * @param index
+ */
+ public void showFilter(int index) {
+ setCurrentItem(index, true);
+ }
+}
diff --git a/astrid/src/com/todoroo/astrid/widget/TasksWidget.java b/astrid/src/com/todoroo/astrid/widget/TasksWidget.java
index c88365f3c..df7d9fd4c 100644
--- a/astrid/src/com/todoroo/astrid/widget/TasksWidget.java
+++ b/astrid/src/com/todoroo/astrid/widget/TasksWidget.java
@@ -217,7 +217,7 @@ public class TasksWidget extends AppWidgetProvider {
Bundle extras = AndroidUtilities.bundleFromSerializedString(serializedExtras);
listIntent.putExtras(extras);
}
- listIntent.putExtra(TaskListFragment.TOKEN_SOURCE, Constants.SOURCE_WIDGET);
+ listIntent.putExtra(TaskListActivity.TOKEN_SOURCE, Constants.SOURCE_WIDGET);
listIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
if(filter != null) {
listIntent.putExtra(TaskListFragment.TOKEN_FILTER, filter);