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

@ -1,5 +1,6 @@
package com.todoroo.astrid.actfm.sync.messages;
import java.text.ParseException;
import java.util.Iterator;
import org.json.JSONObject;
@ -10,6 +11,7 @@ import android.util.Log;
import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.data.Property.LongProperty;
import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.dao.RemoteModelDao;
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);
}
} else if (NameMaps.TABLE_ID_PUSHED_AT.equals(table)) {
long pushedAt = changes.optLong(NameMaps.TABLE_ID_PUSHED_AT);
if (pushedAt > 0) {
long tablePushedAt = 0;
try {
tablePushedAt = DateUtilities.parseIso8601(changes.optString(NameMaps.TABLE_ID_PUSHED_AT));
} catch (ParseException e) {
//
}
if (tablePushedAt > 0) {
String pushedAtKey = null;
if (NameMaps.TABLE_ID_TASKS.equals(uuid))
pushedAtKey = NameMaps.PUSHED_AT_TASKS;
@ -81,7 +88,7 @@ public class MakeChanges<TYPE extends RemoteModel> extends ServerToClientMessage
pushedAtKey = NameMaps.PUSHED_AT_TAGS;
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.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.EditText;
import android.widget.Toast;
@ -66,6 +67,8 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE
@SuppressWarnings("nls")
public static FilterWithCustomIntent filterFromTag(Context context, Tag tag, Criterion criterion) {
String title = tag.tag;
if (TextUtils.isEmpty(title))
return null;
QueryTemplate tagTemplate = tag.queryTemplate(criterion);
ContentValues contentValues = new ContentValues();
contentValues.put(Metadata.KEY.name, TagMetadata.KEY);
@ -155,8 +158,7 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE
boolean shouldAddUntagged = addUntaggedFilter &&
Preferences.getBoolean(R.string.p_show_not_in_list_filter, true);
int length = shouldAddUntagged ? tags.length + 1 : tags.length;
Filter[] filters = new Filter[length];
ArrayList<Filter> filters = new ArrayList<Filter>(tags.length);
Context context = ContextManager.getContext();
Resources r = context.getResources();
@ -173,14 +175,15 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE
null);
untagged.listingIcon = ((BitmapDrawable)r.getDrawable(
ThemeService.getDrawable(R.drawable.gl_lists, themeFlags))).getBitmap();
filters[0] = untagged;
filters.add(untagged);
}
for(int i = 0; i < tags.length; i++) {
int index = shouldAddUntagged ? i + 1 : i;
filters[index] = constructFilter(context, tags[i]);
Filter f = 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;
}

Loading…
Cancel
Save