Don't show tags with null titles, fixed pushed_at dates for tables

pull/14/head
Sam Bosley 13 years ago
parent 36861c0f3c
commit c70c83f988

@ -50,7 +50,7 @@ public class ActFmInvoker {
private static final int API_VERSION = 7; private static final int API_VERSION = 7;
private static final boolean SYNC_DEBUG = Constants.DEBUG || true; public static final boolean SYNC_DEBUG = Constants.DEBUG || true;
@Autowired private RestClient restClient; @Autowired private RestClient restClient;

@ -31,7 +31,6 @@ import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.TagOutstanding; import com.todoroo.astrid.data.TagOutstanding;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.TaskOutstanding; import com.todoroo.astrid.data.TaskOutstanding;
import com.todoroo.astrid.utility.Constants;
import com.todoroo.astrid.utility.Flags; import com.todoroo.astrid.utility.Flags;
public class ActFmSyncThread { public class ActFmSyncThread {
@ -158,10 +157,9 @@ public class ActFmSyncThread {
JSONObject serialized = message.serializeToJSON(); JSONObject serialized = message.serializeToJSON();
if (serialized != null) { if (serialized != null) {
payload.put(serialized); payload.put(serialized);
if (true || Constants.DEBUG) if (ActFmInvoker.SYNC_DEBUG)
Log.w("actfm-sync-message", serialized.toString()); Log.e("actfm-send-message", serialized.toString());
} }
} }
try { try {

@ -1,5 +1,6 @@
package com.todoroo.astrid.actfm.sync.messages; package com.todoroo.astrid.actfm.sync.messages;
import java.text.ParseException;
import java.util.Iterator; import java.util.Iterator;
import org.json.JSONObject; import org.json.JSONObject;
@ -10,6 +11,7 @@ import android.util.Log;
import com.todoroo.andlib.data.Property; import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.data.Property.LongProperty; import com.todoroo.andlib.data.Property.LongProperty;
import com.todoroo.andlib.data.Property.StringProperty; import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.dao.RemoteModelDao; import com.todoroo.astrid.dao.RemoteModelDao;
import com.todoroo.astrid.data.RemoteModel; import com.todoroo.astrid.data.RemoteModel;
@ -72,8 +74,13 @@ public class MakeChanges<TYPE extends RemoteModel> extends ServerToClientMessage
Log.e(ERROR_TAG, "Error instantiating model for MakeChanges", e); Log.e(ERROR_TAG, "Error instantiating model for MakeChanges", e);
} }
} else if (NameMaps.TABLE_ID_PUSHED_AT.equals(table)) { } else if (NameMaps.TABLE_ID_PUSHED_AT.equals(table)) {
long pushedAt = changes.optLong(NameMaps.TABLE_ID_PUSHED_AT); long tablePushedAt = 0;
if (pushedAt > 0) { try {
tablePushedAt = DateUtilities.parseIso8601(changes.optString(NameMaps.TABLE_ID_PUSHED_AT));
} catch (ParseException e) {
//
}
if (tablePushedAt > 0) {
String pushedAtKey = null; String pushedAtKey = null;
if (NameMaps.TABLE_ID_TASKS.equals(uuid)) if (NameMaps.TABLE_ID_TASKS.equals(uuid))
pushedAtKey = NameMaps.PUSHED_AT_TASKS; pushedAtKey = NameMaps.PUSHED_AT_TASKS;
@ -81,7 +88,7 @@ public class MakeChanges<TYPE extends RemoteModel> extends ServerToClientMessage
pushedAtKey = NameMaps.PUSHED_AT_TAGS; pushedAtKey = NameMaps.PUSHED_AT_TAGS;
if (pushedAtKey != null) if (pushedAtKey != null)
Preferences.setLong(pushedAtKey, pushedAt); Preferences.setLong(pushedAtKey, tablePushedAt);
} }
} }

@ -18,6 +18,7 @@ import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Toast; import android.widget.Toast;
@ -66,6 +67,8 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE
@SuppressWarnings("nls") @SuppressWarnings("nls")
public static FilterWithCustomIntent filterFromTag(Context context, Tag tag, Criterion criterion) { public static FilterWithCustomIntent filterFromTag(Context context, Tag tag, Criterion criterion) {
String title = tag.tag; String title = tag.tag;
if (TextUtils.isEmpty(title))
return null;
QueryTemplate tagTemplate = tag.queryTemplate(criterion); QueryTemplate tagTemplate = tag.queryTemplate(criterion);
ContentValues contentValues = new ContentValues(); ContentValues contentValues = new ContentValues();
contentValues.put(Metadata.KEY.name, TagMetadata.KEY); contentValues.put(Metadata.KEY.name, TagMetadata.KEY);
@ -155,8 +158,7 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE
boolean shouldAddUntagged = addUntaggedFilter && boolean shouldAddUntagged = addUntaggedFilter &&
Preferences.getBoolean(R.string.p_show_not_in_list_filter, true); Preferences.getBoolean(R.string.p_show_not_in_list_filter, true);
int length = shouldAddUntagged ? tags.length + 1 : tags.length; ArrayList<Filter> filters = new ArrayList<Filter>(tags.length);
Filter[] filters = new Filter[length];
Context context = ContextManager.getContext(); Context context = ContextManager.getContext();
Resources r = context.getResources(); Resources r = context.getResources();
@ -173,14 +175,15 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE
null); null);
untagged.listingIcon = ((BitmapDrawable)r.getDrawable( untagged.listingIcon = ((BitmapDrawable)r.getDrawable(
ThemeService.getDrawable(R.drawable.gl_lists, themeFlags))).getBitmap(); ThemeService.getDrawable(R.drawable.gl_lists, themeFlags))).getBitmap();
filters[0] = untagged; filters.add(untagged);
} }
for(int i = 0; i < tags.length; i++) { for(int i = 0; i < tags.length; i++) {
int index = shouldAddUntagged ? i + 1 : i; Filter f = constructFilter(context, tags[i]);
filters[index] = constructFilter(context, tags[i]); if (f != null)
filters.add(f);
} }
FilterCategory filter = new FilterCategory(context.getString(name), filters); FilterCategory filter = new FilterCategory(context.getString(name), filters.toArray(new Filter[filters.size()]));
return filter; return filter;
} }

Loading…
Cancel
Save