Fix for AST-85

pull/14/head
Tim Su 15 years ago
parent da8dcc0432
commit 8314bb97f7

@ -69,6 +69,14 @@
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<!-- Activity launched from shortcut -->
<activity android:name="com.todoroo.astrid.activity.ShortcutActivity"
android:clearTaskOnLaunch="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- Activity that displays filter list --> <!-- Activity that displays filter list -->
<activity android:name="com.todoroo.astrid.activity.FilterListActivity" <activity android:name="com.todoroo.astrid.activity.FilterListActivity"
android:launchMode="singleInstance" android:launchMode="singleInstance"

@ -113,7 +113,7 @@ public class FilterListActivity extends ExpandableListActivity {
String query = intent.getStringExtra(SearchManager.QUERY).trim(); String query = intent.getStringExtra(SearchManager.QUERY).trim();
Filter filter = new Filter(null, getString(R.string.FLA_search_filter, query), Filter filter = new Filter(null, getString(R.string.FLA_search_filter, query),
new QueryTemplate().where(Functions.upper(Task.TITLE).like("%" + //$NON-NLS-1$ new QueryTemplate().where(Functions.upper(Task.TITLE).like("%" + //$NON-NLS-1$
query.toUpperCase() + "%")), query.toUpperCase() + "%")), //$NON-NLS-1$
null); null);
intent = new Intent(FilterListActivity.this, TaskListActivity.class); intent = new Intent(FilterListActivity.this, TaskListActivity.class);
intent.putExtra(TaskListActivity.TOKEN_FILTER, filter); intent.putExtra(TaskListActivity.TOKEN_FILTER, filter);
@ -310,12 +310,12 @@ public class FilterListActivity extends ExpandableListActivity {
Filter filter = (Filter) item; Filter filter = (Filter) item;
info.targetView.setTag(filter); info.targetView.setTag(filter);
menuItem = menu.add(0, CONTEXT_MENU_SHORTCUT, 0, R.string.FLA_context_shortcut); menuItem = menu.add(0, CONTEXT_MENU_SHORTCUT, 0, R.string.FLA_context_shortcut);
Intent shortcutIntent = new Intent(this, TaskListActivity.class); Intent shortcutIntent = new Intent(this, ShortcutActivity.class);
shortcutIntent.setAction(Intent.ACTION_VIEW); shortcutIntent.setAction(Intent.ACTION_VIEW);
shortcutIntent.putExtra(TaskListActivity.TOKEN_FILTER_TITLE, filter.title); shortcutIntent.putExtra(ShortcutActivity.TOKEN_FILTER_TITLE, filter.title);
shortcutIntent.putExtra(TaskListActivity.TOKEN_FILTER_SQL, filter.sqlQuery); shortcutIntent.putExtra(ShortcutActivity.TOKEN_FILTER_SQL, filter.sqlQuery);
if(filter.valuesForNewTasks != null) { if(filter.valuesForNewTasks != null) {
shortcutIntent.putExtra(TaskListActivity.TOKEN_FILTER_VALUES, shortcutIntent.putExtra(ShortcutActivity.TOKEN_FILTER_VALUES,
filter.valuesForNewTasks.toString()); filter.valuesForNewTasks.toString());
} }

@ -46,7 +46,6 @@ import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.service.ExceptionService; import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.sql.QueryTemplate;
import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Pair; import com.todoroo.andlib.utility.Pair;
@ -107,21 +106,6 @@ public class TaskListActivity extends ListActivity implements OnScrollListener {
/** token for passing a reminder string through extras */ /** token for passing a reminder string through extras */
public static final String TOKEN_REMINDER = "reminder"; //$NON-NLS-1$ public static final String TOKEN_REMINDER = "reminder"; //$NON-NLS-1$
/** token for passing a {@link Filter}'s title through extras */
public static final String TOKEN_FILTER_TITLE = "title"; //$NON-NLS-1$
/** token for passing a {@link Filter}'s sql through extras */
public static final String TOKEN_FILTER_SQL = "sql"; //$NON-NLS-1$
/** token for passing a {@link Filter}'s values for new tasks through extras */
public static final String TOKEN_FILTER_VALUES = "v4nt"; //$NON-NLS-1$
/** token for passing a {@link Filter}'s values for new tasks through extras (keys) */
public static final String TOKEN_FILTER_VALUES_KEYS = "v4ntk"; //$NON-NLS-1$
/** token for passing a {@link Filter}'s values for new tasks through extras (values) */
public static final String TOKEN_FILTER_VALUES_VALUES = "v4ntv"; //$NON-NLS-1$
// --- instance variables // --- instance variables
@Autowired @Autowired
@ -164,18 +148,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener {
Bundle extras = getIntent().getExtras(); Bundle extras = getIntent().getExtras();
if(extras != null && extras.containsKey(TOKEN_FILTER)) { if(extras != null && extras.containsKey(TOKEN_FILTER)) {
// probably launched from filter list activity
filter = extras.getParcelable(TOKEN_FILTER); filter = extras.getParcelable(TOKEN_FILTER);
} else if(extras != null && extras.containsKey(TOKEN_FILTER_SQL)) {
// launched from desktop shortcut, must create a fake filter
String title = extras.getString(TOKEN_FILTER_TITLE);
String sql = extras.getString(TOKEN_FILTER_SQL);
ContentValues values = null;
if(extras.containsKey(TOKEN_FILTER_VALUES))
values = AndroidUtilities.contentValuesFromString(extras.getString(TOKEN_FILTER_VALUES));
filter = new Filter("", title, new QueryTemplate(), values); //$NON-NLS-1$ //$NON-NLS-2$
filter.sqlQuery = sql;
} else { } else {
filter = CoreFilterExposer.buildInboxFilter(getResources()); filter = CoreFilterExposer.buildInboxFilter(getResources());
} }

Loading…
Cancel
Save