Remove history, apply inspections

* Remove unused method parameters
* Remove unnecessary throws
* Remove unused return values
* Remove constant return values
pull/46/head
Alex Baker 11 years ago
parent 264686d966
commit df321eda14

@ -89,7 +89,7 @@ public class DatabaseDao<TYPE extends AbstractModel> {
// --- listeners // --- listeners
public interface ModelUpdateListener<MTYPE> { public interface ModelUpdateListener<MTYPE> {
public void onModelUpdated(MTYPE model, boolean outstandingEntries); public void onModelUpdated(MTYPE model);
} }
private final ArrayList<ModelUpdateListener<TYPE>> listeners = private final ArrayList<ModelUpdateListener<TYPE>> listeners =
@ -99,10 +99,10 @@ public class DatabaseDao<TYPE extends AbstractModel> {
listeners.add(listener); listeners.add(listener);
} }
protected void onModelUpdated(TYPE model, boolean outstandingEntries) { protected void onModelUpdated(TYPE model) {
TYPE modelCopy = (TYPE) model.clone(); TYPE modelCopy = (TYPE) model.clone();
for(ModelUpdateListener<TYPE> listener : listeners) { for(ModelUpdateListener<TYPE> listener : listeners) {
listener.onModelUpdated(modelCopy, outstandingEntries); listener.onModelUpdated(modelCopy);
} }
} }
@ -320,7 +320,7 @@ public class DatabaseDao<TYPE extends AbstractModel> {
} }
} }
if (result.get()) { if (result.get()) {
onModelUpdated(item, recordOutstanding && numOutstanding > 0); onModelUpdated(item);
item.markSaved(); item.markSaved();
} }
} }

@ -54,13 +54,11 @@ abstract public class AbstractDependencyInjector {
* Gets the injected object for this field. If implementing class does not * Gets the injected object for this field. If implementing class does not
* know how to handle this dependency, it should return null * know how to handle this dependency, it should return null
* *
* @param object
* object to perform dependency injection on
* @param field * @param field
* field tagged with {link Autowired} annotation * field tagged with {link Autowired} annotation
* @return object to assign to this field, or null * @return object to assign to this field, or null
*/ */
public Object getInjection(Object object, Field field) { public Object getInjection(Field field) {
if(injectables.containsKey(field.getName())) { if(injectables.containsKey(field.getName())) {
Object injection = injectables.get(field.getName()); Object injection = injectables.get(field.getName());

@ -107,7 +107,7 @@ public class DependencyInjectionService {
} }
for (AbstractDependencyInjector injector : injectors) { for (AbstractDependencyInjector injector : injectors) {
Object injection = injector.getInjection(caller, field); Object injection = injector.getInjection(field);
if (injection != null) { if (injection != null) {
field.set(caller, injection); field.set(caller, injection);
return; return;

@ -27,7 +27,6 @@ import android.view.View;
import android.view.View.OnTouchListener; import android.view.View.OnTouchListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.PopupWindow;
import android.widget.TextView; import android.widget.TextView;
import com.todoroo.andlib.service.ExceptionService; import com.todoroo.andlib.service.ExceptionService;
@ -605,15 +604,14 @@ public class AndroidUtilities {
* @param methodName method name to call * @param methodName method name to call
* @param params method parameter types * @param params method parameter types
* @param args arguments * @param args arguments
* @return method return value, or null if nothing was called or exception
*/ */
public static Object callApiMethod(int minSdk, Object receiver, public static void callApiMethod(int minSdk, Object receiver,
String methodName, Class<?>[] params, Object... args) { String methodName, Class<?>[] params, Object... args) {
if(getSdkVersion() < minSdk) { if(getSdkVersion() < minSdk) {
return null; return;
} }
return AndroidUtilities.callMethod(receiver.getClass(), AndroidUtilities.callMethod(receiver.getClass(),
receiver, methodName, params, args); receiver, methodName, params, args);
} }
@ -896,20 +894,6 @@ public class AndroidUtilities {
} }
} }
/**
* Dismiss a popup window (should call from main thread)
*/
public static void tryDismissPopup(Activity activity, final PopupWindow popup) {
if (popup == null) {
return;
}
try {
popup.dismiss();
} catch (Exception e) {
// window already closed or something
}
}
/** /**
* Tries to parse an int from a string, returning the default value on failure * Tries to parse an int from a string, returning the default value on failure
*/ */

@ -123,11 +123,10 @@ public class DateUtilities {
} }
/** /**
* @param context android context
* @param date date to format * @param date date to format
* @return date, with month, day, and year * @return date, with month, day, and year
*/ */
public static String getDateString(Context context, Date date, boolean includeYear) { public static String getDateString(Date date, boolean includeYear) {
String month = new SimpleDateFormat("MMM").format(date); String month = new SimpleDateFormat("MMM").format(date);
String value; String value;
String standardDate; String standardDate;
@ -151,16 +150,15 @@ public class DateUtilities {
} }
return standardDate;} return standardDate;}
public static String getDateString(Context context, Date date) { public static String getDateString(Date date) {
return getDateString(context, date, true); return getDateString(date, true);
} }
/** /**
* @param context android context
* @param date date to format * @param date date to format
* @return date, with month, day, and year * @return date, with month, day, and year
*/ */
public static String getDateStringHideYear(Context context, Date date) { public static String getDateStringHideYear(Date date) {
String month = DateUtils.getMonthString(date.getMonth() + String month = DateUtils.getMonthString(date.getMonth() +
Calendar.JANUARY, DateUtils.LENGTH_MEDIUM); Calendar.JANUARY, DateUtils.LENGTH_MEDIUM);
String value; String value;
@ -190,9 +188,9 @@ public class DateUtilities {
/** /**
* @return date format as getDateFormat with weekday * @return date format as getDateFormat with weekday
*/ */
public static String getDateStringWithWeekday(Context context, Date date) { public static String getDateStringWithWeekday(Date date) {
String weekday = getWeekday(date); String weekday = getWeekday(date);
return weekday + ", " + getDateString(context, date); return weekday + ", " + getDateString(date);
} }
/** /**
@ -214,14 +212,14 @@ public class DateUtilities {
* @return date format as getDateFormat with weekday * @return date format as getDateFormat with weekday
*/ */
public static String getDateStringWithTimeAndWeekday(Context context, Date date) { public static String getDateStringWithTimeAndWeekday(Context context, Date date) {
return getDateStringWithWeekday(context, date) + " " + getTimeString(context, date); return getDateStringWithWeekday(date) + " " + getTimeString(context, date);
} }
/** /**
* @return date with time at the end * @return date with time at the end
*/ */
public static String getDateStringWithTime(Context context, Date date) { public static String getDateStringWithTime(Context context, Date date) {
return getDateString(context, date) + " " + getTimeString(context, date); return getDateString(date) + " " + getTimeString(context, date);
} }
/** /**
@ -248,7 +246,7 @@ public class DateUtilities {
return abbreviated ? DateUtilities.getWeekdayShort(new Date(date)) : DateUtilities.getWeekday(new Date(date)); return abbreviated ? DateUtilities.getWeekdayShort(new Date(date)) : DateUtilities.getWeekday(new Date(date));
} }
return DateUtilities.getDateStringHideYear(context, new Date(date)); return DateUtilities.getDateStringHideYear(new Date(date));
} }
public static boolean isEndOfMonth(Date d) { public static boolean isEndOfMonth(Date d) {

@ -1,144 +0,0 @@
package com.todoroo.astrid.data;
import android.content.ContentValues;
import android.net.Uri;
import com.todoroo.andlib.data.AbstractModel;
import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.data.Property.LongProperty;
import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.andlib.data.Table;
import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.astrid.api.AstridApiConstants;
public class History extends AbstractModel {
/** table for this model */
public static final Table TABLE = new Table("history", History.class);
/** content uri for this model */
public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.API_PACKAGE + "/" +
TABLE.name);
// --- properties
/** ID */
public static final LongProperty ID = new LongProperty(
TABLE, ID_PROPERTY_NAME);
/** Remote ID */
public static final StringProperty UUID = new StringProperty(
TABLE, RemoteModel.UUID_PROPERTY_NAME);
/** Created at */
public static final LongProperty CREATED_AT = new LongProperty(
TABLE, "created_at", Property.PROP_FLAG_DATE);
/** User id */
public static final StringProperty USER_UUID = new StringProperty(
TABLE, "user_id", Property.PROP_FLAG_USER_ID);
/** Column name */
public static final StringProperty COLUMN = new StringProperty(
TABLE, "columnString");
/** Old value */
public static final StringProperty OLD_VALUE = new StringProperty(
TABLE, "old_value", Property.PROP_FLAG_NULLABLE);
/** New value */
public static final StringProperty NEW_VALUE = new StringProperty(
TABLE, "new_value", Property.PROP_FLAG_NULLABLE);
/** Table identifier */
public static final StringProperty TABLE_ID = new StringProperty(
TABLE, "table_id");
/** Target identifier */
public static final StringProperty TARGET_ID = new StringProperty(
TABLE, "target_id");
/** Task name and id (JSONArray) */
public static final StringProperty TASK = new StringProperty(
TABLE, "task");
/** Associated tag id */
public static final StringProperty TAG_ID = new StringProperty(
TABLE, "tag_id");
/** Default values container */
private static final ContentValues defaultValues = new ContentValues();
@Override
public ContentValues getDefaultValues() {
return defaultValues;
}
static {
defaultValues.put(UUID.name, 0L);
defaultValues.put(CREATED_AT.name, 0L);
defaultValues.put(USER_UUID.name, RemoteModel.NO_UUID);
defaultValues.put(OLD_VALUE.name, "");
defaultValues.put(NEW_VALUE.name, "");
defaultValues.put(TAG_ID.name, RemoteModel.NO_UUID);
defaultValues.put(TASK.name, "");
}
@Override
public long getId() {
return getIdHelper(ID);
}
public History() {
super();
}
public History(TodorooCursor<History> cursor) {
this();
readPropertiesFromCursor(cursor);
}
public void readFromCursor(TodorooCursor<History> cursor) {
super.readPropertiesFromCursor(cursor);
}
/** List of all properties for this model */
public static final Property<?>[] PROPERTIES = generateProperties(History.class);
private static final Creator<History> CREATOR = new ModelCreator<History>(History.class);
@Override
protected Creator<? extends AbstractModel> getCreator() {
return CREATOR;
}
// ---- Column ids
public static final String COL_TAG_ADDED = "tag_added";
public static final String COL_TAG_REMOVED = "tag_removed";
public static final String COL_SHARED_WITH = "shared_with";
public static final String COL_UNSHARED_WITH = "unshared_with";
public static final String COL_MEMBER_ADDED = "member_added";
public static final String COL_MEMBER_REMOVED = "member_removed";
public static final String COL_COMPLETED_AT = "completed_at";
public static final String COL_DELETED_AT = "deleted_at";
public static final String COL_IMPORTANCE = "importance";
public static final String COL_NOTES_LENGTH = "notes_length";
public static final String COL_PUBLIC = "public";
public static final String COL_DUE = "due";
public static final String COL_REPEAT = "repeat";
public static final String COL_TASK_REPEATED = "task_repeated";
public static final String COL_TITLE = "title";
public static final String COL_NAME = "name";
public static final String COL_DESCRIPTION = "description";
public static final String COL_PICTURE_ID = "picture_id";
public static final String COL_DEFAULT_LIST_IMAGE_ID = "default_list_image_id";
public static final String COL_IS_SILENT = "is_silent";
public static final String COL_IS_FAVORITE = "is_favorite";
public static final String COL_USER_ID = "user_id";
public static final String COL_ATTACHMENT_ADDED = "attachment_added";
public static final String COL_ATTACHMENT_REMOVED = "attachment_removed";
public static final String COL_ACKNOWLEDGED = "acknowledged";
}

@ -141,14 +141,6 @@ public final class TagData extends RemoteModel {
public static final StringProperty TAG_ORDERING = new StringProperty( public static final StringProperty TAG_ORDERING = new StringProperty(
TABLE, "tagOrdering"); TABLE, "tagOrdering");
/** History fetch date */
public static final LongProperty HISTORY_FETCH_DATE = new LongProperty(
TABLE, "historyFetch");
/** History has more*/
public static final IntegerProperty HISTORY_HAS_MORE = new IntegerProperty(
TABLE, "historyHasMore");
/** Last autosync */ /** Last autosync */
public static final LongProperty LAST_AUTOSYNC = new LongProperty( public static final LongProperty LAST_AUTOSYNC = new LongProperty(
TABLE, "lastAutosync"); TABLE, "lastAutosync");
@ -185,8 +177,6 @@ public final class TagData extends RemoteModel {
defaultValues.put(FLAGS.name, 0); defaultValues.put(FLAGS.name, 0);
defaultValues.put(COMPLETION_DATE.name, 0); defaultValues.put(COMPLETION_DATE.name, 0);
defaultValues.put(DELETION_DATE.name, 0); defaultValues.put(DELETION_DATE.name, 0);
defaultValues.put(HISTORY_FETCH_DATE.name, 0);
defaultValues.put(HISTORY_HAS_MORE.name, 0);
defaultValues.put(LAST_AUTOSYNC.name, 0); defaultValues.put(LAST_AUTOSYNC.name, 0);
defaultValues.put(THUMB.name, ""); defaultValues.put(THUMB.name, "");

@ -187,14 +187,6 @@ public final class Task extends RemoteModel {
public static final LongProperty USER_ACTIVITIES_PUSHED_AT = new LongProperty( public static final LongProperty USER_ACTIVITIES_PUSHED_AT = new LongProperty(
TABLE, "activities_pushed_at", Property.PROP_FLAG_DATE); TABLE, "activities_pushed_at", Property.PROP_FLAG_DATE);
/** History fetch time */
public static final LongProperty HISTORY_FETCH_DATE = new LongProperty(
TABLE, "historyFetch");
/** History has more*/
public static final IntegerProperty HISTORY_HAS_MORE = new IntegerProperty(
TABLE, "historyHasMore");
/** List of all properties for this model */ /** List of all properties for this model */
public static final Property<?>[] PROPERTIES = generateProperties(Task.class); public static final Property<?>[] PROPERTIES = generateProperties(Task.class);
@ -317,8 +309,6 @@ public final class Task extends RemoteModel {
defaultValues.put(IS_PUBLIC.name, 0); defaultValues.put(IS_PUBLIC.name, 0);
defaultValues.put(IS_READONLY.name, 0); defaultValues.put(IS_READONLY.name, 0);
defaultValues.put(CLASSIFICATION.name, ""); defaultValues.put(CLASSIFICATION.name, "");
defaultValues.put(HISTORY_FETCH_DATE.name, 0);
defaultValues.put(HISTORY_HAS_MORE.name, 0);
defaultValues.put(LAST_SYNC.name, 0); defaultValues.put(LAST_SYNC.name, 0);
defaultValues.put(UUID.name, NO_UUID); defaultValues.put(UUID.name, NO_UUID);

@ -81,7 +81,7 @@ public abstract class SyncProvider<TYPE extends SyncContainer> {
* @param task * @param task
* task to create * task to create
*/ */
abstract protected TYPE create(TYPE task) throws IOException; abstract protected void create(TYPE task);
/** /**
* Push variables from given task to the remote server, and read the newly * Push variables from given task to the remote server, and read the newly
@ -93,7 +93,7 @@ public abstract class SyncProvider<TYPE extends SyncContainer> {
* remote task that we merged with. may be null * remote task that we merged with. may be null
* @return task pulled on remote server * @return task pulled on remote server
*/ */
abstract protected TYPE push(TYPE task, TYPE remote) throws IOException; abstract protected TYPE push(TYPE task, TYPE remote);
/** /**
* Fetch remote task. Used to re-read merged tasks * Fetch remote task. Used to re-read merged tasks
@ -102,18 +102,18 @@ public abstract class SyncProvider<TYPE extends SyncContainer> {
* task with id's to re-read * task with id's to re-read
* @return new Task * @return new Task
*/ */
abstract protected TYPE pull(TYPE task) throws IOException; abstract protected TYPE pull(TYPE task);
/** /**
* Reads a task container from a task in the database * Reads a task container from a task in the database
*/ */
abstract protected TYPE read(TodorooCursor<Task> task) throws IOException; abstract protected TYPE read(TodorooCursor<Task> task);
/** /**
* Save task. Used to save local tasks that have been updated and remote * Save task. Used to save local tasks that have been updated and remote
* tasks that need to be created locally * tasks that need to be created locally
*/ */
abstract protected void write(TYPE task) throws IOException; abstract protected void write(TYPE task);
/** /**
* Finds a task in the list with the same remote identifier(s) as * Finds a task in the list with the same remote identifier(s) as
@ -159,7 +159,7 @@ public abstract class SyncProvider<TYPE extends SyncContainer> {
public void synchronize(final Context context, final boolean showSyncToast) { public void synchronize(final Context context, final boolean showSyncToast) {
// display toast // display toast
if(context instanceof Activity) { if(context instanceof Activity) {
if(getUtilities().isLoggedIn() && getUtilities().shouldShowToast()) { if(getUtilities().isLoggedIn()) {
((Activity) context).runOnUiThread(new Runnable() { ((Activity) context).runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -210,7 +210,7 @@ public abstract class SyncProvider<TYPE extends SyncContainer> {
* *
* @param data synchronization data structure * @param data synchronization data structure
*/ */
protected void synchronizeTasks(SyncData<TYPE> data) throws IOException { protected void synchronizeTasks(SyncData<TYPE> data) {
int length; int length;
// create internal data structures // create internal data structures
@ -246,7 +246,7 @@ public abstract class SyncProvider<TYPE extends SyncContainer> {
} }
} }
protected void readRemotelyUpdated(SyncData<TYPE> data) throws IOException { protected void readRemotelyUpdated(SyncData<TYPE> data) {
int length; int length;
// Rearrange remoteTasks so completed tasks get synchronized first. // Rearrange remoteTasks so completed tasks get synchronized first.
// This prevents bugs where a repeated task has two copies come down // This prevents bugs where a repeated task has two copies come down
@ -298,7 +298,7 @@ public abstract class SyncProvider<TYPE extends SyncContainer> {
} }
} }
protected void sendLocallyUpdated(SyncData<TYPE> data) throws IOException { protected void sendLocallyUpdated(SyncData<TYPE> data) {
int length; int length;
length = data.localUpdated.getCount(); length = data.localUpdated.getCount();
for(int i = 0; i < length; i++) { for(int i = 0; i < length; i++) {
@ -330,7 +330,7 @@ public abstract class SyncProvider<TYPE extends SyncContainer> {
} }
protected void sendLocallyCreated(SyncData<TYPE> data, protected void sendLocallyCreated(SyncData<TYPE> data,
HashMap<String, Integer> remoteNewTaskNameMap) throws IOException { HashMap<String, Integer> remoteNewTaskNameMap) {
int length; int length;
length = data.localCreated.getCount(); length = data.localCreated.getCount();
for(int i = 0; i < length; i++) { for(int i = 0; i < length; i++) {

@ -47,13 +47,6 @@ abstract public class SyncProviderUtilities {
return PreferenceManager.getDefaultSharedPreferences(ContextManager.getContext()); return PreferenceManager.getDefaultSharedPreferences(ContextManager.getContext());
} }
/**
* @return true if we should show sync toast when synchronizing
*/
public boolean shouldShowToast() {
return true;
}
/** /**
* @return true if we have a token for this user, false otherwise * @return true if we have a token for this user, false otherwise
*/ */

@ -5,8 +5,6 @@
*/ */
package com.todoroo.astrid.sync; package com.todoroo.astrid.sync;
import android.app.Activity;
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;
@ -75,7 +73,7 @@ abstract public class SyncV2Provider {
/** /**
* Sign out of service, deleting all synchronization metadata * Sign out of service, deleting all synchronization metadata
*/ */
abstract public void signOut(Activity activity); abstract public void signOut();
/** /**
* @return sync utility instance * @return sync utility instance

@ -10,7 +10,6 @@ import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import android.database.Cursor; import android.database.Cursor;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.text.Editable; import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
@ -39,7 +38,6 @@ import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.astrid.actfm.ActFmCameraModule.CameraResultCallback; import com.todoroo.astrid.actfm.ActFmCameraModule.CameraResultCallback;
import com.todoroo.astrid.actfm.ActFmCameraModule.ClearImageCallback; import com.todoroo.astrid.actfm.ActFmCameraModule.ClearImageCallback;
import com.todoroo.astrid.actfm.sync.messages.NameMaps;
import com.todoroo.astrid.activity.AstridActivity; import com.todoroo.astrid.activity.AstridActivity;
import com.todoroo.astrid.activity.TaskListActivity; import com.todoroo.astrid.activity.TaskListActivity;
import com.todoroo.astrid.adapter.UpdateAdapter; import com.todoroo.astrid.adapter.UpdateAdapter;
@ -103,8 +101,6 @@ public abstract class CommentsFragment extends SherlockListFragment {
protected abstract UserActivity createUpdate(); protected abstract UserActivity createUpdate();
protected abstract boolean canLoadMoreHistory();
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
@ -226,12 +222,9 @@ public abstract class CommentsFragment extends SherlockListFragment {
cursor = updateAdapter.getCursor(); cursor = updateAdapter.getCursor();
cursor.requery(); cursor.requery();
activity.startManagingCursor(cursor); activity.startManagingCursor(cursor);
if (footerView != null && !canLoadMoreHistory()) { if (footerView != null) {
listView.removeFooterView(footerView); listView.removeFooterView(footerView);
footerView = null; footerView = null;
} else if (footerView == null && canLoadMoreHistory()) {
addFooterToListView(listView);
listView.setAdapter(updateAdapter);
} }
} }
@ -246,29 +239,9 @@ public abstract class CommentsFragment extends SherlockListFragment {
if (footerView != null) { if (footerView != null) {
listView.removeFooterView(footerView); listView.removeFooterView(footerView);
} }
if (canLoadMoreHistory()) {
footerView = new Button(getActivity());
footerView.setText(R.string.TEA_load_more);
footerView.setBackgroundColor(Color.alpha(0));
footerView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int historyCount = 0;
Cursor c = updateAdapter.getCursor();
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
if (NameMaps.TABLE_ID_HISTORY.equals(c.getString(UpdateAdapter.TYPE_PROPERTY_INDEX))) {
historyCount++;
}
}
}
});
listView.addFooterView(footerView);
} else {
footerView = null; footerView = null;
} }
}
protected void setLastViewed() { protected void setLastViewed() {
// //
} }

@ -67,7 +67,7 @@ public class TagCommentsFragment extends CommentsFragment {
@Override @Override
protected Cursor getCursor() { protected Cursor getCursor() {
return tagDataService.getActivityAndHistoryForTagData(tagData, null, UpdateAdapter.USER_TABLE_ALIAS, UpdateAdapter.USER_PROPERTIES); return tagDataService.getActivityForTagData(tagData, null, UpdateAdapter.USER_TABLE_ALIAS, UpdateAdapter.USER_PROPERTIES);
} }
@Override @Override
@ -75,11 +75,6 @@ public class TagCommentsFragment extends CommentsFragment {
return (tagData == null) ? UpdateAdapter.FROM_RECENT_ACTIVITY_VIEW : UpdateAdapter.FROM_TAG_VIEW; return (tagData == null) ? UpdateAdapter.FROM_RECENT_ACTIVITY_VIEW : UpdateAdapter.FROM_TAG_VIEW;
} }
@Override
protected boolean canLoadMoreHistory() {
return hasModel() && tagData.getValue(TagData.HISTORY_HAS_MORE) > 0;
}
@Override @Override
protected void addHeaderToListView(ListView listView) { protected void addHeaderToListView(ListView listView) {
if (AstridPreferences.useTabletLayout(getActivity()) && tagData != null) { if (AstridPreferences.useTabletLayout(getActivity()) && tagData != null) {

@ -55,7 +55,7 @@ public class TaskCommentsFragment extends CommentsFragment {
@Override @Override
protected Cursor getCursor() { protected Cursor getCursor() {
return taskService.getActivityAndHistoryForTask(task); return taskService.getActivityForTask(task);
} }
@Override @Override
@ -68,11 +68,6 @@ public class TaskCommentsFragment extends CommentsFragment {
// Do nothing // Do nothing
} }
@Override
protected boolean canLoadMoreHistory() {
return hasModel() && task.getValue(Task.HISTORY_HAS_MORE) > 0;
}
@Override @Override
protected UserActivity createUpdate() { protected UserActivity createUpdate() {
UserActivity update = new UserActivity(); UserActivity update = new UserActivity();

@ -24,7 +24,6 @@ public class NameMaps {
public static final String TABLE_ID_TAGS = "tags"; public static final String TABLE_ID_TAGS = "tags";
public static final String TABLE_ID_USERS = "users"; public static final String TABLE_ID_USERS = "users";
public static final String TABLE_ID_USER_ACTIVITY = "user_activities"; public static final String TABLE_ID_USER_ACTIVITY = "user_activities";
public static final String TABLE_ID_HISTORY = "history";
public static final String TABLE_ID_ATTACHMENTS = "task_attachments"; public static final String TABLE_ID_ATTACHMENTS = "task_attachments";
public static final String TABLE_ID_TASK_LIST_METADATA = "task_list_metadata"; public static final String TABLE_ID_TASK_LIST_METADATA = "task_list_metadata";

@ -345,12 +345,7 @@ public class EditPreferences extends TodorooPreferenceActivity {
R.string.EPr_cal_end_at_due_time, R.string.EPr_cal_start_at_due_time)) { R.string.EPr_cal_end_at_due_time, R.string.EPr_cal_start_at_due_time)) {
; ;
} else if (r.getString(R.string.p_force_phone_layout).equals(preference.getKey())) { } else if (r.getString(R.string.p_force_phone_layout).equals(preference.getKey())) {
preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_CODE_PERFORMANCE_PREF_CHANGED) { preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_CODE_PERFORMANCE_PREF_CHANGED));
@Override
public boolean onPreferenceChange(Preference p, Object newValue) {
return super.onPreferenceChange(p, newValue);
}
});
} else if (r.getString(R.string.p_voiceInputEnabled).equals(preference.getKey())) { } else if (r.getString(R.string.p_voiceInputEnabled).equals(preference.getKey())) {
if (value != null && !(Boolean) value) { if (value != null && !(Boolean) value) {
preference.setSummary(R.string.EPr_voiceInputEnabled_desc_disabled); preference.setSummary(R.string.EPr_voiceInputEnabled_desc_disabled);
@ -395,7 +390,7 @@ public class EditPreferences extends TodorooPreferenceActivity {
return; return;
} }
try { try {
VoiceOutputService.getVoiceOutputInstance().handleActivityResult(requestCode, resultCode, data); VoiceOutputService.getVoiceOutputInstance().handleActivityResult(requestCode, resultCode);
} catch (VerifyError e) { } catch (VerifyError e) {
// unavailable // unavailable
} }

@ -114,12 +114,12 @@ public class FilterListFragment extends SherlockListFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
Activity activity = getActivity(); Activity activity = getActivity();
int layout = getLayout(activity); int layout = getLayout();
ViewGroup parent = (ViewGroup) activity.getLayoutInflater().inflate(layout, container, false); ViewGroup parent = (ViewGroup) activity.getLayoutInflater().inflate(layout, container, false);
return parent; return parent;
} }
protected int getLayout(Activity activity) { protected int getLayout() {
return R.layout.filter_list_activity; return R.layout.filter_list_activity;
} }
@ -265,7 +265,7 @@ public class FilterListFragment extends SherlockListFragment {
/** /**
* Creates a shortcut on the user's home screen * Creates a shortcut on the user's home screen
*/ */
private static void createShortcut(Activity activity, Filter filter, Intent shortcutIntent, String label) { private static void createShortcut(Activity activity, Intent shortcutIntent, String label) {
if(label.length() == 0) { if(label.length() == 0) {
return; return;
} }
@ -340,7 +340,7 @@ public class FilterListFragment extends SherlockListFragment {
@Override @Override
public void run() { public void run() {
String label = editText.getText().toString(); String label = editText.getText().toString();
createShortcut(activity, filter, shortcutIntent, label); createShortcut(activity, shortcutIntent, label);
} }
}; };
editText.setOnEditorActionListener(new OnEditorActionListener() { editText.setOnEditorActionListener(new OnEditorActionListener() {

@ -142,14 +142,8 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
*/ */
public static final String TOKEN_PICTURE_IN_PROGRESS = "picture_in_progress"; //$NON-NLS-1$ public static final String TOKEN_PICTURE_IN_PROGRESS = "picture_in_progress"; //$NON-NLS-1$
/**
* Tab to start on
*/
public static final String TOKEN_TAB = "tab"; //$NON-NLS-1$
// --- request codes // --- request codes
public static final int REQUEST_LOG_IN = 0;
private static final int REQUEST_VOICE_RECOG = 10; private static final int REQUEST_VOICE_RECOG = 10;
public static final int REQUEST_CODE_CONTACT = 20; public static final int REQUEST_CODE_CONTACT = 20;
public static final int REQUEST_CODE_RECORD = 30; public static final int REQUEST_CODE_RECORD = 30;
@ -237,14 +231,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
* ====================================================================== * ======================================================================
*/ */
/**
* Container Activity must implement this interface and we ensure that it
* does during the onAttach() callback
*/
public interface OnTaskEditDetailsClickedListener {
public void onTaskEditDetailsClicked(int category, int position);
}
public TaskEditFragment() { public TaskEditFragment() {
DependencyInjectionService.getInstance().inject(this); DependencyInjectionService.getInstance().inject(this);
} }
@ -358,7 +344,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
commentsBar.setVisibility(View.VISIBLE); commentsBar.setVisibility(View.VISIBLE);
} }
setCurrentTab(TAB_VIEW_UPDATES); setCurrentTab(TAB_VIEW_UPDATES);
setPagerHeightForPosition(TAB_VIEW_UPDATES); setPagerHeightForPosition();
Handler handler = new Handler(); Handler handler = new Handler();
handler.postDelayed(new Runnable() { handler.postDelayed(new Runnable() {
@Override @Override
@ -672,13 +658,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
} }
public long getTaskIdInProgress() {
if (model != null && model.getId() > 0) {
return model.getId();
}
return getActivity().getIntent().getLongExtra(TOKEN_ID, -1);
}
private void setIsNewTask(boolean isNewTask) { private void setIsNewTask(boolean isNewTask) {
this.isNewTask = isNewTask; this.isNewTask = isNewTask;
Activity activity = getActivity(); Activity activity = getActivity();
@ -710,12 +689,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
} }
public void refreshFilesDisplay() {
boolean hasAttachments = taskAttachmentDao.taskHasAttachments(model.getUuid());
filesControlSet.getDisplayView().setVisibility(hasAttachments ? View.VISIBLE : View.GONE);
filesControlSet.readFromTask(model);
}
/** Populate UI component values from the model */ /** Populate UI component values from the model */
private void populateFields() { private void populateFields() {
populateFields(getActivity().getIntent()); populateFields(getActivity().getIntent());
@ -758,8 +731,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
} }
} }
addDueTimeToToast(toast.toString());
boolean tagsChanged = Flags.check(Flags.TAGS_CHANGED); boolean tagsChanged = Flags.check(Flags.TAGS_CHANGED);
model.putTransitory(TaskService.TRANS_EDIT_SAVE, true); model.putTransitory(TaskService.TRANS_EDIT_SAVE, true);
taskService.save(model); taskService.save(model);
@ -852,28 +823,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
save(false); save(false);
} }
/**
* Displays a Toast reporting that the selected task has been saved and, if
* it has a due date, that is due in 'x' amount of time, to 1 time-unit of
* precision
*/
private String addDueTimeToToast(String additionalMessage) {
int stringResource;
long due = model.getValue(Task.DUE_DATE);
String toastMessage;
if (due != 0) {
stringResource = R.string.TEA_onTaskSave_due;
CharSequence formattedDate = DateUtilities.getRelativeDay(
getActivity(), due);
toastMessage = getString(stringResource, formattedDate);
} else {
toastMessage = getString(R.string.TEA_onTaskSave_notDue);
}
return toastMessage + additionalMessage;
}
protected void discardButtonClick() { protected void discardButtonClick() {
shouldSaveState = false; shouldSaveState = false;
@ -1157,43 +1106,15 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
* ====================================================================== * ======================================================================
*/ */
public int getTabForPosition(int position) { public View getPageView() {
int tab = TaskEditViewPager.getPageForPosition(position, tabStyle);
switch(tab) {
case TaskEditViewPager.TAB_SHOW_ACTIVITY:
return TAB_VIEW_UPDATES;
}
// error experienced
return TAB_VIEW_UPDATES;
}
/**
* Returns the correct view for TaskEditViewPager
*
* @param position
* in the horizontal scroll view
*/
public View getPageView(int position) {
switch(getTabForPosition(position)) {
case TAB_VIEW_UPDATES:
return editNotes; return editNotes;
} }
return null;
}
private void setPagerHeightForPosition(int position) { private void setPagerHeightForPosition() {
int height = 0; int height = 0;
View view = null; View view = editNotes;
switch(getTabForPosition(position)) { if (mPager == null) {
case TAB_VIEW_UPDATES:
view = editNotes;
break;
}
if (view == null || mPager == null) {
return; return;
} }
@ -1208,27 +1129,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
} }
} }
public static void setViewHeightBasedOnChildren(LinearLayout view) {
int totalHeight = 0;
int desiredWidth = MeasureSpec.makeMeasureSpec(view.getWidth(),
MeasureSpec.AT_MOST);
for (int i = 0; i < view.getChildCount(); i++) {
View listItem = view.getChildAt(i);
listItem.measure(desiredWidth, MeasureSpec.UNSPECIFIED);
totalHeight += listItem.getMeasuredHeight();
}
ViewGroup.LayoutParams params = view.getLayoutParams();
if(params == null) {
return;
}
params.height = totalHeight;
view.setLayoutParams(params);
view.requestLayout();
}
// Tab Page listener when page/tab changes // Tab Page listener when page/tab changes
@Override @Override
public void onPageScrolled(int position, float positionOffset, public void onPageScrolled(int position, float positionOffset,
@ -1237,7 +1137,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
@Override @Override
public void onPageSelected(final int position) { public void onPageSelected(final int position) {
setPagerHeightForPosition(position); setPagerHeightForPosition();
} }
@Override @Override
@ -1248,7 +1148,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
@Override @Override
public void updatesChanged() { public void updatesChanged() {
if (mPager != null && mPager.getCurrentItem() == TAB_VIEW_UPDATES) { if (mPager != null && mPager.getCurrentItem() == TAB_VIEW_UPDATES) {
setPagerHeightForPosition(TAB_VIEW_UPDATES); setPagerHeightForPosition();
} }
} }
@ -1256,7 +1156,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
@Override @Override
public void commentAdded() { public void commentAdded() {
setCurrentTab(TAB_VIEW_UPDATES); setCurrentTab(TAB_VIEW_UPDATES);
setPagerHeightForPosition(TAB_VIEW_UPDATES); setPagerHeightForPosition();
scrollToView(editNotes); scrollToView(editNotes);
} }

@ -51,7 +51,7 @@ public class TaskEditViewPager extends PagerAdapter {
@Override @Override
public Object instantiateItem(View pager, int position) { public Object instantiateItem(View pager, int position) {
View pageView = parent.getPageView(position); View pageView = parent.getPageView();
((ViewPager) pager).addView(pageView, 0); ((ViewPager) pager).addView(pageView, 0);
return pageView; return pageView;

@ -448,10 +448,10 @@ public class TaskListFragment extends SherlockListFragment implements OnSortSele
return; return;
} }
addMenuItems(menu, activity); addMenuItems(menu);
} }
protected void addMenuItems(Menu menu, Activity activity) { protected void addMenuItems(Menu menu) {
// ask about plug-ins // ask about plug-ins
Intent queryIntent = new Intent( Intent queryIntent = new Intent(
AstridApiConstants.ACTION_TASK_LIST_MENU); AstridApiConstants.ACTION_TASK_LIST_MENU);
@ -856,8 +856,8 @@ public class TaskListFragment extends SherlockListFragment implements OnSortSele
new OnCompletedTaskListener() { new OnCompletedTaskListener() {
@Override @Override
public void onCompletedTask(Task item, boolean newState) { public void onCompletedTask(Task item, boolean newState) {
if (newState == true) { if (newState) {
onTaskCompleted(item); onTaskCompleted();
} }
} }
}); });
@ -984,13 +984,7 @@ public class TaskListFragment extends SherlockListFragment implements OnSortSele
* ====================================================================== * ======================================================================
*/ */
/** protected void onTaskCompleted() {
* A task was completed from the task adapter
*
* @param item
* task that was completed
*/
protected void onTaskCompleted(Task item) {
if (isInbox) { if (isInbox) {
} else { } else {
} }
@ -1038,19 +1032,6 @@ public class TaskListFragment extends SherlockListFragment implements OnSortSele
menu.add(id, CONTEXT_MENU_COPY_TASK_ID, Menu.NONE, menu.add(id, CONTEXT_MENU_COPY_TASK_ID, Menu.NONE,
R.string.TAd_contextCopyTask); R.string.TAd_contextCopyTask);
for (int i = 0; i < contextItemExposers.length; i++) {
Object label = contextItemExposers[i].getLabel(task);
if (label != null) {
if (label instanceof Integer) {
menu.add(id, CONTEXT_MENU_PLUGIN_ID_FIRST + i,
Menu.NONE, (Integer) label);
} else {
menu.add(id, CONTEXT_MENU_PLUGIN_ID_FIRST + i,
Menu.NONE, (String) label);
}
}
}
long taskId = task.getId(); long taskId = task.getId();
for (ContextMenuItem item : contextMenuExtensionLoader.getList()) { for (ContextMenuItem item : contextMenuExtensionLoader.getList()) {
android.view.MenuItem menuItem = menu.add(id, android.view.MenuItem menuItem = menu.add(id,

@ -202,15 +202,14 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
offerFilter(item); offerFilter(item);
} }
public int addOrLookup(Filter filter) { public void addOrLookup(Filter filter) {
int index = getPosition(filter); int index = getPosition(filter);
if (index >= 0) { if (index >= 0) {
Filter existing = getItem(index); Filter existing = getItem(index);
transferImageReferences(filter, existing); transferImageReferences(filter, existing);
return index; return;
} }
add(filter); add(filter);
return getCount() - 1;
} }
// Helper function: if a filter was created from serialized extras, it may not // Helper function: if a filter was created from serialized extras, it may not
@ -223,7 +222,7 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
} }
} }
public int adjustFilterCount(Filter filter, int delta) { public void adjustFilterCount(Filter filter, int delta) {
int filterCount = 0; int filterCount = 0;
if (filterCounts.containsKey(filter)) { if (filterCounts.containsKey(filter)) {
filterCount = filterCounts.get(filter); filterCount = filterCounts.get(filter);
@ -231,15 +230,14 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
int newCount = Math.max(filterCount + delta, 0); int newCount = Math.max(filterCount + delta, 0);
filterCounts.put(filter, newCount); filterCounts.put(filter, newCount);
notifyDataSetChanged(); notifyDataSetChanged();
return newCount;
} }
public int incrementFilterCount(Filter filter) { public void incrementFilterCount(Filter filter) {
return adjustFilterCount(filter, 1); adjustFilterCount(filter, 1);
} }
public int decrementFilterCount(Filter filter) { public void decrementFilterCount(Filter filter) {
return adjustFilterCount(filter, -1); adjustFilterCount(filter, -1);
} }
public void refreshFilterCount(final Filter filter) { public void refreshFilterCount(final Filter filter) {
@ -348,10 +346,6 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
return selection; return selection;
} }
protected boolean shouldDirectlyPopulateFilters() {
return true;
}
/* ====================================================================== /* ======================================================================
* ============================================================= receiver * ============================================================= receiver
* ====================================================================== */ * ====================================================================== */
@ -376,7 +370,6 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
try { try {
if (shouldDirectlyPopulateFilters()) {
for (ResolveInfo filterExposerInfo : filterExposerList) { for (ResolveInfo filterExposerInfo : filterExposerList) {
String className = filterExposerInfo.activityInfo.name; String className = filterExposerInfo.activityInfo.name;
AstridFilterExposer filterExposer = null; AstridFilterExposer filterExposer = null;
@ -386,18 +379,6 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
populateFiltersToAdapter(filterExposer.getFilters()); populateFiltersToAdapter(filterExposer.getFilters());
} }
} }
} else {
try {
Bundle extras = intent.getExtras();
extras.setClassLoader(FilterListHeader.class.getClassLoader());
final Parcelable[] filters = extras.getParcelableArray(AstridApiConstants.EXTRAS_RESPONSE);
populateFiltersToAdapter(filters);
} catch (Exception e) {
Log.e("receive-filter-" + //$NON-NLS-1$
intent.getStringExtra(AstridApiConstants.EXTRAS_ADDON),
e.toString(), e);
}
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

@ -942,7 +942,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
return; return;
} }
reset(viewHolder, taskId); reset(viewHolder);
if(decorations.size() == 0) { if(decorations.size() == 0) {
return; return;
} }
@ -979,7 +979,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
} }
@Override @Override
protected void reset(ViewHolder viewHolder, long taskId) { protected void reset(ViewHolder viewHolder) {
if(viewHolder.decorations != null) { if(viewHolder.decorations != null) {
for(View view : viewHolder.decorations) { for(View view : viewHolder.decorations) {
viewHolder.rowBody.removeView(view); viewHolder.rowBody.removeView(view);
@ -993,11 +993,6 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
viewHolder.view.setBackgroundResource(android.R.drawable.list_selector_background); viewHolder.view.setBackgroundResource(android.R.drawable.list_selector_background);
} }
} }
@Override
protected Intent createBroadcastIntent(Task task) {
return null;
}
} }
/* ====================================================================== /* ======================================================================

@ -34,8 +34,6 @@ import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService; import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.messages.NameMaps; import com.todoroo.astrid.actfm.sync.messages.NameMaps;
import com.todoroo.astrid.activity.AstridActivity;
import com.todoroo.astrid.data.History;
import com.todoroo.astrid.data.RemoteModel; import com.todoroo.astrid.data.RemoteModel;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.User; import com.todoroo.astrid.data.User;
@ -67,7 +65,6 @@ public class UpdateAdapter extends CursorAdapter {
private static final StringProperty USER_NAME = User.NAME.cloneAs(USER_TABLE_ALIAS, "userName"); //$NON-NLS-1$ private static final StringProperty USER_NAME = User.NAME.cloneAs(USER_TABLE_ALIAS, "userName"); //$NON-NLS-1$
public static final StringProperty ACTIVITY_TYPE_PROPERTY = new StringProperty(null, "'" + NameMaps.TABLE_ID_USER_ACTIVITY + "' as type"); //$NON-NLS-1$//$NON-NLS-2$ public static final StringProperty ACTIVITY_TYPE_PROPERTY = new StringProperty(null, "'" + NameMaps.TABLE_ID_USER_ACTIVITY + "' as type"); //$NON-NLS-1$//$NON-NLS-2$
public static final StringProperty HISTORY_TYPE_PROPERTY = new StringProperty(null, "'" + NameMaps.TABLE_ID_HISTORY + "'"); //$NON-NLS-1$ //$NON-NLS-2$
public static final Property<?>[] USER_PROPERTIES = { public static final Property<?>[] USER_PROPERTIES = {
USER_PICTURE, USER_PICTURE,
@ -89,20 +86,6 @@ public class UpdateAdapter extends CursorAdapter {
ACTIVITY_TYPE_PROPERTY, ACTIVITY_TYPE_PROPERTY,
}; };
public static final Property<?>[] HISTORY_PROPERTIES = {
History.CREATED_AT,
History.USER_UUID,
History.COLUMN,
History.TABLE_ID,
History.OLD_VALUE,
History.NEW_VALUE,
History.TASK,
History.USER_UUID,
History.ID,
HISTORY_TYPE_PROPERTY,
};
public static final int TYPE_PROPERTY_INDEX = USER_ACTIVITY_PROPERTIES.length - 1; public static final int TYPE_PROPERTY_INDEX = USER_ACTIVITY_PROPERTIES.length - 1;
public static final String FROM_TAG_VIEW = "from_tag"; //$NON-NLS-1$ public static final String FROM_TAG_VIEW = "from_tag"; //$NON-NLS-1$
@ -176,7 +159,6 @@ public class UpdateAdapter extends CursorAdapter {
private class ModelHolder { private class ModelHolder {
public UserActivity activity = new UserActivity(); public UserActivity activity = new UserActivity();
public User user = new User(); public User user = new User();
public History history = new History();
} }
/** Creates a new view for use in the list view */ /** Creates a new view for use in the list view */
@ -206,18 +188,12 @@ public class UpdateAdapter extends CursorAdapter {
User user = mh.user; User user = mh.user;
user.clear(); user.clear();
History history = mh.history;
boolean isSelf; boolean isSelf;
if (NameMaps.TABLE_ID_USER_ACTIVITY.equals(type)) {
readUserActivityProperties(cursor, update); readUserActivityProperties(cursor, update);
isSelf = Task.USER_ID_SELF.equals(update.getValue(UserActivity.USER_UUID)); isSelf = Task.USER_ID_SELF.equals(update.getValue(UserActivity.USER_UUID));
} else {
readHistoryProperties(cursor, history);
isSelf = Task.USER_ID_SELF.equals(history.getValue(History.USER_UUID));
}
readUserProperties(cursor, user, self, isSelf); readUserProperties(cursor, user, self, isSelf);
setFieldContentsAndVisibility(view, update, user, history, type); setFieldContentsAndVisibility(view, update, type);
} }
public static void readUserActivityProperties(TodorooCursor<UserActivity> unionCursor, UserActivity activity) { public static void readUserActivityProperties(TodorooCursor<UserActivity> unionCursor, UserActivity activity) {
@ -231,17 +207,6 @@ public class UpdateAdapter extends CursorAdapter {
activity.setValue(UserActivity.USER_UUID, unionCursor.getString(7)); activity.setValue(UserActivity.USER_UUID, unionCursor.getString(7));
} }
public static void readHistoryProperties(TodorooCursor<UserActivity> unionCursor, History history) {
history.setValue(History.CREATED_AT, unionCursor.getLong(0));
history.setValue(History.USER_UUID, unionCursor.getString(1));
history.setValue(History.COLUMN, unionCursor.getString(2));
history.setValue(History.TABLE_ID, unionCursor.getString(3));
history.setValue(History.OLD_VALUE, unionCursor.getString(4));
history.setValue(History.NEW_VALUE, unionCursor.getString(5));
history.setValue(History.TASK, unionCursor.getString(6));
history.setValue(History.USER_UUID, unionCursor.getString(7));
}
public static void readUserProperties(TodorooCursor<UserActivity> joinCursor, User user, User self, boolean isSelf) { public static void readUserProperties(TodorooCursor<UserActivity> joinCursor, User user, User self, boolean isSelf) {
if (isSelf) { if (isSelf) {
user.mergeWith(self.getSetValues()); user.mergeWith(self.getSetValues());
@ -255,28 +220,27 @@ public class UpdateAdapter extends CursorAdapter {
} }
/** Helper method to set the contents and visibility of each field */ /** Helper method to set the contents and visibility of each field */
public synchronized void setFieldContentsAndVisibility(View view, UserActivity activity, User user, History history, String type) { public synchronized void setFieldContentsAndVisibility(View view, UserActivity activity, String type) {
// picture // picture
if (NameMaps.TABLE_ID_USER_ACTIVITY.equals(type)) { if (NameMaps.TABLE_ID_USER_ACTIVITY.equals(type)) {
setupUserActivityRow(view, activity, user); setupUserActivityRow(view, activity);
} }
} }
private void setupUserActivityRow(View view, UserActivity activity, User user) { private void setupUserActivityRow(View view, UserActivity activity) {
final ImageView commentPictureView = (ImageView)view.findViewById(R.id.comment_picture); { final ImageView commentPictureView = (ImageView)view.findViewById(R.id.comment_picture); {
String pictureThumb = activity.getPictureUrl(UserActivity.PICTURE, RemoteModel.PICTURE_MEDIUM); String pictureThumb = activity.getPictureUrl(UserActivity.PICTURE, RemoteModel.PICTURE_MEDIUM);
String pictureFull = activity.getPictureUrl(UserActivity.PICTURE, RemoteModel.PICTURE_LARGE);
Bitmap updateBitmap = null; Bitmap updateBitmap = null;
if (TextUtils.isEmpty(pictureThumb)) { if (TextUtils.isEmpty(pictureThumb)) {
updateBitmap = activity.getPictureBitmap(UserActivity.PICTURE); updateBitmap = activity.getPictureBitmap(UserActivity.PICTURE);
} }
setupImagePopupForCommentView(view, commentPictureView, pictureThumb, pictureFull, updateBitmap, setupImagePopupForCommentView(view, commentPictureView, pictureThumb, updateBitmap,
activity.getValue(UserActivity.MESSAGE), fragment); activity.getValue(UserActivity.MESSAGE), fragment);
} }
// name // name
final TextView nameView = (TextView)view.findViewById(R.id.title); { final TextView nameView = (TextView)view.findViewById(R.id.title); {
nameView.setText(getUpdateComment((AstridActivity)fragment.getActivity(), activity, user, linkColor, fromView)); nameView.setText(getUpdateComment(activity));
nameView.setMovementMethod(new LinkMovementMethod()); nameView.setMovementMethod(new LinkMovementMethod());
nameView.setTextColor(color); nameView.setTextColor(color);
} }
@ -296,7 +260,7 @@ public class UpdateAdapter extends CursorAdapter {
return false; return false;
} }
public static void setupImagePopupForCommentView(View view, ImageView commentPictureView, final String pictureThumb, final String pictureFull, final Bitmap updateBitmap, public static void setupImagePopupForCommentView(View view, ImageView commentPictureView, final String pictureThumb, final Bitmap updateBitmap,
final String message, final Fragment fragment) { final String message, final Fragment fragment) {
if ((!TextUtils.isEmpty(pictureThumb) && !"null".equals(pictureThumb)) || updateBitmap != null) { //$NON-NLS-1$ if ((!TextUtils.isEmpty(pictureThumb) && !"null".equals(pictureThumb)) || updateBitmap != null) { //$NON-NLS-1$
commentPictureView.setVisibility(View.VISIBLE); commentPictureView.setVisibility(View.VISIBLE);
@ -330,7 +294,7 @@ public class UpdateAdapter extends CursorAdapter {
} }
} }
public static Spanned getUpdateComment(final AstridActivity context, UserActivity activity, User user, String linkColor, String fromView) { public static Spanned getUpdateComment(UserActivity activity) {
String message = activity.getValue(UserActivity.MESSAGE); String message = activity.getValue(UserActivity.MESSAGE);
return Html.fromHtml(message); return Html.fromHtml(message);
} }

@ -97,7 +97,7 @@ public final class AlarmControlSet extends TaskEditControlSet {
return null; return null;
} }
private boolean addAlarm(Date alert) { private void addAlarm(Date alert) {
final View alertItem = LayoutInflater.from(activity).inflate(R.layout.alarm_edit_row, null); final View alertItem = LayoutInflater.from(activity).inflate(R.layout.alarm_edit_row, null);
alertsContainer.addView(alertItem); alertsContainer.addView(alertItem);
@ -143,7 +143,5 @@ public final class AlarmControlSet extends TaskEditControlSet {
alertsContainer.removeView(alertItem); alertsContainer.removeView(alertItem);
} }
}); });
return true;
} }
} }

@ -31,13 +31,6 @@ public interface TaskContextActionExposer {
} }
} }
/**
* Expose context menu item label, or null if item should not be shown
*
* @return null if no item should be displayed, or string or id
*/
public Object getLabel(Task task);
/** /**
* Call context menu action * Call context menu action
*/ */

@ -9,7 +9,6 @@ import android.os.Environment;
import java.io.File; import java.io.File;
/** /**
* Constants for backup XML attributes and nodes. * Constants for backup XML attributes and nodes.
* *
@ -46,8 +45,6 @@ public class BackupConstants {
public static final String TAG_TAG = "tag"; public static final String TAG_TAG = "tag";
public static final String TAG_ATTR_NAME = "name"; public static final String TAG_ATTR_NAME = "name";
public static final String ALERT_TAG = "alert";
public static final String ALERT_ATTR_DATE = "date";
public static final String SYNC_TAG = "sync"; public static final String SYNC_TAG = "sync";
public static final String SYNC_ATTR_SERVICE = "service"; public static final String SYNC_ATTR_SERVICE = "service";
public static final String SYNC_ATTR_REMOTE_ID = "remote_id"; public static final String SYNC_ATTR_REMOTE_ID = "remote_id";
@ -78,6 +75,4 @@ public class BackupConstants {
} }
return null; return null;
} }
} }

@ -474,9 +474,6 @@ public class TasksXmlImporter {
if (tag.equals(BackupConstants.TAG_TAG)) { if (tag.equals(BackupConstants.TAG_TAG)) {
// Process <tag ... > // Process <tag ... >
parseTag(); parseTag();
} else if (tag.equals(BackupConstants.ALERT_TAG)) {
// Process <alert ... >
parseAlert();
} else if (tag.equals(BackupConstants.SYNC_TAG)) { } else if (tag.equals(BackupConstants.SYNC_TAG)) {
// Process <sync ... > // Process <sync ... >
parseSync(); parseSync();
@ -491,7 +488,7 @@ public class TasksXmlImporter {
} }
} }
private boolean parseSync() { private void parseSync() {
String service = xpp.getAttributeValue(null, BackupConstants.SYNC_ATTR_SERVICE); String service = xpp.getAttributeValue(null, BackupConstants.SYNC_ATTR_SERVICE);
String remoteId = xpp.getAttributeValue(null, BackupConstants.SYNC_ATTR_REMOTE_ID); String remoteId = xpp.getAttributeValue(null, BackupConstants.SYNC_ATTR_REMOTE_ID);
if (service != null && remoteId != null) { if (service != null && remoteId != null) {
@ -507,20 +504,12 @@ public class TasksXmlImporter {
metadata.setValue(Metadata.VALUE3, (taskId)); metadata.setValue(Metadata.VALUE3, (taskId));
metadata.setValue(Metadata.VALUE4, syncOnComplete ? "1" : "0"); //$NON-NLS-1$ //$NON-NLS-2$ metadata.setValue(Metadata.VALUE4, syncOnComplete ? "1" : "0"); //$NON-NLS-1$ //$NON-NLS-2$
metadataService.save(metadata); metadataService.save(metadata);
return true;
}
return false;
} }
private boolean parseAlert() {
// drop it
return false;
} }
private boolean parseTag() { private void parseTag() {
String tagName = xpp.getAttributeValue(null, BackupConstants.TAG_ATTR_NAME); String tagName = xpp.getAttributeValue(null, BackupConstants.TAG_ATTR_NAME);
tags.add(tagName); tags.add(tagName);
return true;
} }
private void saveTags() { private void saveTags() {
@ -621,8 +610,7 @@ public class TasksXmlImporter {
if(preferred != null) { if(preferred != null) {
Date preferredDate = BackupDateUtilities.getDateFromIso8601String(value); Date preferredDate = BackupDateUtilities.getDateFromIso8601String(value);
upgradeNotes = "Project Deadline: " + upgradeNotes = "Project Deadline: " +
DateUtilities.getDateString(ContextManager.getContext(), DateUtilities.getDateString(preferredDate);
preferredDate);
} }
task.setValue(Task.DUE_DATE, task.setValue(Task.DUE_DATE,
BackupDateUtilities.getTaskDueDateFromIso8601String(value).getTime()); BackupDateUtilities.getTaskDueDateFromIso8601String(value).getTime());

@ -14,7 +14,6 @@ import com.todoroo.andlib.data.AbstractModel;
import com.todoroo.andlib.data.Property; import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.data.Table; import com.todoroo.andlib.data.Table;
import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.service.ContextManager;
import com.todoroo.astrid.data.History;
import com.todoroo.astrid.data.Metadata; import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.StoreObject; import com.todoroo.astrid.data.StoreObject;
import com.todoroo.astrid.data.TagData; import com.todoroo.astrid.data.TagData;
@ -68,7 +67,6 @@ public class Database extends AbstractDatabase {
User.TABLE, User.TABLE,
UserActivity.TABLE, UserActivity.TABLE,
TagMetadata.TABLE, TagMetadata.TABLE,
History.TABLE,
TaskAttachment.TABLE, TaskAttachment.TABLE,
TaskListMetadata.TABLE, TaskListMetadata.TABLE,
TaskOutstanding.TABLE, TaskOutstanding.TABLE,
@ -144,13 +142,6 @@ public class Database extends AbstractDatabase {
append(')'); append(')');
database.execSQL(sql.toString()); database.execSQL(sql.toString());
sql.setLength(0); sql.setLength(0);
sql.append("CREATE INDEX IF NOT EXISTS hist_tag_id ON ").
append(History.TABLE).append('(').
append(History.TAG_ID.name).
append(')');
database.execSQL(sql.toString());
sql.setLength(0);
} }
@Override @Override
@ -359,11 +350,9 @@ public class Database extends AbstractDatabase {
tryExecSQL(addColumnSql(Task.TABLE, Task.IS_PUBLIC, visitor, "0")); tryExecSQL(addColumnSql(Task.TABLE, Task.IS_PUBLIC, visitor, "0"));
tryExecSQL(addColumnSql(Task.TABLE, Task.IS_READONLY, visitor, "0")); tryExecSQL(addColumnSql(Task.TABLE, Task.IS_READONLY, visitor, "0"));
tryExecSQL(addColumnSql(Task.TABLE, Task.CLASSIFICATION, visitor, null)); tryExecSQL(addColumnSql(Task.TABLE, Task.CLASSIFICATION, visitor, null));
tryExecSQL(addColumnSql(Task.TABLE, Task.HISTORY_FETCH_DATE, visitor, null));
tryExecSQL(addColumnSql(Task.TABLE, Task.ATTACHMENTS_PUSHED_AT, visitor, null)); tryExecSQL(addColumnSql(Task.TABLE, Task.ATTACHMENTS_PUSHED_AT, visitor, null));
tryExecSQL(addColumnSql(Task.TABLE, Task.USER_ACTIVITIES_PUSHED_AT, visitor, null)); tryExecSQL(addColumnSql(Task.TABLE, Task.USER_ACTIVITIES_PUSHED_AT, visitor, null));
tryExecSQL(addColumnSql(TagData.TABLE, TagData.PUSHED_AT, visitor, null)); tryExecSQL(addColumnSql(TagData.TABLE, TagData.PUSHED_AT, visitor, null));
tryExecSQL(addColumnSql(TagData.TABLE, TagData.HISTORY_FETCH_DATE, visitor, null));
tryExecSQL(addColumnSql(TagData.TABLE, TagData.TASKS_PUSHED_AT, visitor, null)); tryExecSQL(addColumnSql(TagData.TABLE, TagData.TASKS_PUSHED_AT, visitor, null));
tryExecSQL(addColumnSql(TagData.TABLE, TagData.METADATA_PUSHED_AT, visitor, null)); tryExecSQL(addColumnSql(TagData.TABLE, TagData.METADATA_PUSHED_AT, visitor, null));
tryExecSQL(addColumnSql(TagData.TABLE, TagData.USER_ACTIVITIES_PUSHED_AT, visitor, null)); tryExecSQL(addColumnSql(TagData.TABLE, TagData.USER_ACTIVITIES_PUSHED_AT, visitor, null));
@ -374,11 +363,7 @@ public class Database extends AbstractDatabase {
case 30: case 30:
case 31: case 31:
tryExecSQL(addColumnSql(Task.TABLE, Task.HISTORY_HAS_MORE, visitor, null));
tryExecSQL(addColumnSql(TagData.TABLE, TagData.HISTORY_HAS_MORE, visitor, null));
case 32: case 32:
tryExecSQL("DROP TABLE " + History.TABLE.name);
tryExecSQL(createTableSql(visitor, History.TABLE.name, History.PROPERTIES));
tryExecSQL(addColumnSql(User.TABLE, User.TASKS_PUSHED_AT, visitor, null)); tryExecSQL(addColumnSql(User.TABLE, User.TASKS_PUSHED_AT, visitor, null));
case 33: case 33:
tryExecSQL(addColumnSql(TagData.TABLE, TagData.LAST_AUTOSYNC, visitor, null)); tryExecSQL(addColumnSql(TagData.TABLE, TagData.LAST_AUTOSYNC, visitor, null));

@ -368,7 +368,7 @@ public class TaskDao extends RemoteModelDao<Task> {
task.markSaved(); task.markSaved();
if(values.containsKey(Task.COMPLETION_DATE.name) && task.isCompleted()) { if(values.containsKey(Task.COMPLETION_DATE.name) && task.isCompleted()) {
afterComplete(task, values); afterComplete(task);
} else { } else {
if(values.containsKey(Task.DUE_DATE.name) || if(values.containsKey(Task.DUE_DATE.name) ||
values.containsKey(Task.REMINDER_FLAGS.name) || values.containsKey(Task.REMINDER_FLAGS.name) ||
@ -420,7 +420,7 @@ public class TaskDao extends RemoteModelDao<Task> {
/** /**
* Called after the task was just completed * Called after the task was just completed
*/ */
private static void afterComplete(Task task, ContentValues values) { private static void afterComplete(Task task) {
Notifications.cancelNotifications(task.getId()); Notifications.cancelNotifications(task.getId());
} }

@ -25,7 +25,7 @@ public class FileUtilities {
* @return Date string for use with file attachment names * @return Date string for use with file attachment names
*/ */
public static String getDateStringForFilename(Context context, Date date) { public static String getDateStringForFilename(Context context, Date date) {
return DateUtilities.getDateStringHideYear(context, date) + ", " + getTimeStringForFilename(context, date); //$NON-NLS-1$ return DateUtilities.getDateStringHideYear(date) + ", " + getTimeStringForFilename(context, date); //$NON-NLS-1$
} }
private static String getTimeStringForFilename(Context context, Date date) { private static String getTimeStringForFilename(Context context, Date date) {

@ -202,7 +202,7 @@ public class CalendarReminderActivity extends Activity {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
createNewList(tag.getValue(TagData.NAME) + " " createNewList(tag.getValue(TagData.NAME) + " "
+ DateUtilities.getDateStringHideYear(CalendarReminderActivity.this, new Date(startTime))); + DateUtilities.getDateStringHideYear(new Date(startTime)));
} }
}, },
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {

@ -10,7 +10,6 @@ import android.text.TextUtils;
import com.todoroo.andlib.data.AbstractModel; import com.todoroo.andlib.data.AbstractModel;
import com.todoroo.andlib.data.TodorooCursor; import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Field; import com.todoroo.andlib.sql.Field;
@ -44,7 +43,7 @@ public final class GtasksMetadataService extends SyncMetadataService<GtasksTaskC
@Autowired private GtasksPreferenceService gtasksPreferenceService; @Autowired private GtasksPreferenceService gtasksPreferenceService;
public GtasksMetadataService() { public GtasksMetadataService() {
super(ContextManager.getContext()); super();
DependencyInjectionService.getInstance().inject(this); DependencyInjectionService.getInstance().inject(this);
} }

@ -71,7 +71,7 @@ public class GtasksPreferences extends SyncProviderPreferences {
@Override @Override
public void logOut() { public void logOut() {
GtasksSyncV2Provider.getInstance().signOut(this); GtasksSyncV2Provider.getInstance().signOut();
} }
@Override @Override

@ -68,7 +68,7 @@ public class GtasksTaskListUpdater extends OrderedMetadataListUpdater<StoreObjec
} }
@Override @Override
protected Metadata getTaskMetadata(StoreObject list, long taskId) { protected Metadata getTaskMetadata(long taskId) {
return gtasksMetadataService.getTaskMetadata(taskId); return gtasksMetadataService.getTaskMetadata(taskId);
} }
@Override @Override
@ -84,7 +84,7 @@ public class GtasksTaskListUpdater extends OrderedMetadataListUpdater<StoreObjec
} }
@Override @Override
protected void iterateThroughList(Filter filter, StoreObject list, OrderedListIterator iterator) { protected void iterateThroughList(StoreObject list, OrderedListIterator iterator) {
gtasksMetadataService.iterateThroughList(list, iterator); gtasksMetadataService.iterateThroughList(list, iterator);
} }

@ -226,7 +226,7 @@ public class GtasksInvoker {
return toReturn; return toReturn;
} }
public Task updateGtask(String listId, Task task) throws IOException { public void updateGtask(String listId, Task task) throws IOException {
Task toReturn = null; Task toReturn = null;
try { try {
toReturn = service.tasks().update(listId, task.getId(), task).execute(); toReturn = service.tasks().update(listId, task.getId(), task).execute();
@ -236,7 +236,6 @@ public class GtasksInvoker {
} finally { } finally {
log("Update gtask, title: " + task.getTitle(), toReturn); log("Update gtask, title: " + task.getTitle(), toReturn);
} }
return toReturn;
} }
public Task moveGtask(String listId, String taskId, String parentId, String previousId) throws IOException { public Task moveGtask(String listId, String taskId, String parentId, String previousId) throws IOException {

@ -103,7 +103,7 @@ public final class GtasksSyncService {
taskDao.addListener(new ModelUpdateListener<Task>() { taskDao.addListener(new ModelUpdateListener<Task>() {
@Override @Override
public void onModelUpdated(final Task model, boolean outstandingEntries) { public void onModelUpdated(final Task model) {
if(model.checkAndClearTransitory(SyncFlags.GTASKS_SUPPRESS_SYNC)) { if(model.checkAndClearTransitory(SyncFlags.GTASKS_SUPPRESS_SYNC)) {
return; return;
} }

@ -5,7 +5,6 @@
*/ */
package com.todoroo.astrid.gtasks.sync; package com.todoroo.astrid.gtasks.sync;
import android.app.Activity;
import android.text.TextUtils; import android.text.TextUtils;
import com.google.api.services.tasks.model.Tasks; import com.google.api.services.tasks.model.Tasks;
@ -91,7 +90,7 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
} }
@Override @Override
public void signOut(Activity activity) { public void signOut() {
gtasksPreferenceService.clearLastSyncDate(); gtasksPreferenceService.clearLastSyncDate();
gtasksPreferenceService.setToken(null); gtasksPreferenceService.setToken(null);
Preferences.setString(GtasksPreferenceService.PREF_USER_NAME, null); Preferences.setString(GtasksPreferenceService.PREF_USER_NAME, null);
@ -340,7 +339,7 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
return container; return container;
} }
private void write(GtasksTaskContainer task) throws IOException { private void write(GtasksTaskContainer task) {
// merge astrid dates with google dates // merge astrid dates with google dates
if(task.task.isSaved()) { if(task.task.isSaved()) {

@ -3,13 +3,10 @@
*/ */
package com.todoroo.astrid.helper; package com.todoroo.astrid.helper;
import android.content.Intent;
import android.support.v4.app.ListFragment; import android.support.v4.app.ListFragment;
import android.widget.ListView; import android.widget.ListView;
import com.todoroo.astrid.adapter.TaskAdapter.ViewHolder; import com.todoroo.astrid.adapter.TaskAdapter.ViewHolder;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.data.Task;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -45,21 +42,14 @@ abstract public class TaskAdapterAddOnManager<TYPE> {
// request details // request details
draw(viewHolder, taskId, get(taskId)); draw(viewHolder, taskId, get(taskId));
Intent broadcastIntent = createBroadcastIntent(viewHolder.task);
if(broadcastIntent != null) {
fragment.getActivity().sendOrderedBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ);
}
return true; return true;
} }
/** creates a broadcast intent for requesting */
abstract protected Intent createBroadcastIntent(Task task);
/** updates the given view */ /** updates the given view */
abstract protected void draw(ViewHolder viewHolder, long taskId, Collection<TYPE> list); abstract protected void draw(ViewHolder viewHolder, long taskId, Collection<TYPE> list);
/** resets the view as if there was nothing */ /** resets the view as if there was nothing */
abstract protected void reset(ViewHolder viewHolder, long taskId); abstract protected void reset(ViewHolder viewHolder);
/** on receive an intent */ /** on receive an intent */
public void addNew(long taskId, String addOn, TYPE item, ViewHolder thisViewHolder) { public void addNew(long taskId, String addOn, TYPE item, ViewHolder thisViewHolder) {

@ -7,7 +7,6 @@ package com.todoroo.astrid.notes;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources;
import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteException;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Color; import android.graphics.Color;
@ -49,7 +48,6 @@ import com.todoroo.astrid.adapter.UpdateAdapter;
import com.todoroo.astrid.core.PluginServices; import com.todoroo.astrid.core.PluginServices;
import com.todoroo.astrid.dao.MetadataDao.MetadataCriteria; import com.todoroo.astrid.dao.MetadataDao.MetadataCriteria;
import com.todoroo.astrid.dao.UserActivityDao; import com.todoroo.astrid.dao.UserActivityDao;
import com.todoroo.astrid.data.History;
import com.todoroo.astrid.data.Metadata; import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.RemoteModel; import com.todoroo.astrid.data.RemoteModel;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
@ -82,7 +80,6 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
private final ArrayList<NoteOrUpdate> items = new ArrayList<NoteOrUpdate>(); private final ArrayList<NoteOrUpdate> items = new ArrayList<NoteOrUpdate>();
private EditText commentField; private EditText commentField;
private TextView loadingText;
private final View commentsBar; private final View commentsBar;
private View timerView; private View timerView;
private View commentButton; private View commentButton;
@ -93,11 +90,8 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
private final AstridActivity activity; private final AstridActivity activity;
private final Resources resources;
private final int cameraButton; private final int cameraButton;
private final String linkColor; private final String linkColor;
private int historyCount = 0;
private final int color; private final int color;
private final int grayColor; private final int grayColor;
@ -119,7 +113,6 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
this.activity = (AstridActivity) fragment.getActivity(); this.activity = (AstridActivity) fragment.getActivity();
this.resources = fragment.getResources();
TypedValue tv = new TypedValue(); TypedValue tv = new TypedValue();
fragment.getActivity().getTheme().resolveAttribute(R.attr.asTextColor, tv, false); fragment.getActivity().getTheme().resolveAttribute(R.attr.asTextColor, tv, false);
color = tv.data; color = tv.data;
@ -146,7 +139,7 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
} }
private void fetchTask(long id) { private void fetchTask(long id) {
task = PluginServices.getTaskService().fetchById(id, Task.NOTES, Task.ID, Task.UUID, Task.TITLE, Task.HISTORY_FETCH_DATE, Task.HISTORY_HAS_MORE, Task.USER_ACTIVITIES_PUSHED_AT, Task.ATTACHMENTS_PUSHED_AT); task = PluginServices.getTaskService().fetchById(id, Task.NOTES, Task.ID, Task.UUID, Task.TITLE, Task.USER_ACTIVITIES_PUSHED_AT, Task.ATTACHMENTS_PUSHED_AT);
} }
public void loadViewForTaskID(long t){ public void loadViewForTaskID(long t){
@ -262,16 +255,11 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
pictureButton.setImageBitmap(pendingCommentPicture); pictureButton.setImageBitmap(pendingCommentPicture);
} }
} }
//TODO add loading text back in
// loadingText = (TextView) findViewById(R.id.loading);
loadingText = new TextView(getContext());
} }
private void setUpListAdapter() { private void setUpListAdapter() {
items.clear(); items.clear();
this.removeAllViews(); this.removeAllViews();
historyCount = 0;
TodorooCursor<Metadata> notes = metadataService.query( TodorooCursor<Metadata> notes = metadataService.query(
Query.select(Metadata.PROPERTIES).where( Query.select(Metadata.PROPERTIES).where(
MetadataCriteria.byTaskAndwithKey(task.getId(), MetadataCriteria.byTaskAndwithKey(task.getId(),
@ -288,29 +276,22 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
User self = UpdateAdapter.getSelfUser(); User self = UpdateAdapter.getSelfUser();
TodorooCursor<UserActivity> updates = taskService.getActivityAndHistoryForTask(task); TodorooCursor<UserActivity> updates = taskService.getActivityForTask(task);
try { try {
UserActivity update = new UserActivity(); UserActivity update = new UserActivity();
History history = new History();
User user = new User(); User user = new User();
for(updates.moveToFirst(); !updates.isAfterLast(); updates.moveToNext()) { for(updates.moveToFirst(); !updates.isAfterLast(); updates.moveToNext()) {
update.clear(); update.clear();
user.clear(); user.clear();
String type = updates.getString(UpdateAdapter.TYPE_PROPERTY_INDEX); String type = updates.getString(UpdateAdapter.TYPE_PROPERTY_INDEX);
NoteOrUpdate noa; NoteOrUpdate noa = null;
boolean isSelf; boolean isSelf;
if (NameMaps.TABLE_ID_USER_ACTIVITY.equals(type)) { if (NameMaps.TABLE_ID_USER_ACTIVITY.equals(type)) {
UpdateAdapter.readUserActivityProperties(updates, update); UpdateAdapter.readUserActivityProperties(updates, update);
isSelf = Task.USER_ID_SELF.equals(update.getValue(UserActivity.USER_UUID)); isSelf = Task.USER_ID_SELF.equals(update.getValue(UserActivity.USER_UUID));
UpdateAdapter.readUserProperties(updates, user, self, isSelf); UpdateAdapter.readUserProperties(updates, user, self, isSelf);
noa = NoteOrUpdate.fromUpdateOrHistory(activity, update, null, user, linkColor); noa = NoteOrUpdate.fromUpdate(update, user);
} else {
UpdateAdapter.readHistoryProperties(updates, history);
isSelf = Task.USER_ID_SELF.equals(history.getValue(History.USER_UUID));
UpdateAdapter.readUserProperties(updates, user, self, isSelf);
noa = NoteOrUpdate.fromUpdateOrHistory(activity, null, history, user, linkColor);
historyCount++;
} }
if(noa != null) { if(noa != null) {
items.add(noa); items.add(noa);
@ -338,7 +319,7 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
this.addView(notesView); this.addView(notesView);
} }
if (items.size() > commentItems || task.getValue(Task.HISTORY_HAS_MORE) > 0) { if (items.size() > commentItems) {
Button loadMore = new Button(getContext()); Button loadMore = new Button(getContext());
loadMore.setText(R.string.TEA_load_more); loadMore.setText(R.string.TEA_load_more);
loadMore.setTextColor(activity.getResources().getColor(R.color.task_edit_deadline_gray)); loadMore.setTextColor(activity.getResources().getColor(R.color.task_edit_deadline_gray));
@ -349,8 +330,6 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
// Perform action on click // Perform action on click
commentItems += 10; commentItems += 10;
setUpListAdapter(); setUpListAdapter();
if (task.getValue(Task.HISTORY_HAS_MORE) > 0) {
}
} }
}); });
this.addView(loadMore); this.addView(loadMore);
@ -374,11 +353,7 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
// name // name
final TextView nameView = (TextView)view.findViewById(R.id.title); { final TextView nameView = (TextView)view.findViewById(R.id.title); {
nameView.setText(item.title); nameView.setText(item.title);
if (NameMaps.TABLE_ID_HISTORY.equals(item.type)) {
nameView.setTextColor(grayColor);
} else {
nameView.setTextColor(color); nameView.setTextColor(color);
}
Linkify.addLinks(nameView, Linkify.ALL); Linkify.addLinks(nameView, Linkify.ALL);
} }
@ -392,7 +367,7 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
// picture // picture
final ImageView commentPictureView = (ImageView)view.findViewById(R.id.comment_picture); final ImageView commentPictureView = (ImageView)view.findViewById(R.id.comment_picture);
UpdateAdapter.setupImagePopupForCommentView(view, commentPictureView, item.pictureThumb, item.pictureFull, item.commentBitmap, item.title.toString(), fragment); UpdateAdapter.setupImagePopupForCommentView(view, commentPictureView, item.pictureThumb, item.commentBitmap, item.title.toString(), fragment);
} }
public void refreshData() { public void refreshData() {
@ -486,7 +461,7 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
m.getValue(Metadata.CREATION_DATE), null); m.getValue(Metadata.CREATION_DATE), null);
} }
public static NoteOrUpdate fromUpdateOrHistory(AstridActivity context, UserActivity u, History history, User user, String linkColor) { public static NoteOrUpdate fromUpdate(UserActivity u, User user) {
String userImage = ""; //$NON-NLS-1$ String userImage = ""; //$NON-NLS-1$
String pictureThumb = ""; //$NON-NLS-1$ String pictureThumb = ""; //$NON-NLS-1$
String pictureFull = ""; //$NON-NLS-1$ String pictureFull = ""; //$NON-NLS-1$
@ -504,7 +479,7 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
if (TextUtils.isEmpty(pictureThumb)) { if (TextUtils.isEmpty(pictureThumb)) {
commentBitmap = u.getPictureBitmap(UserActivity.PICTURE); commentBitmap = u.getPictureBitmap(UserActivity.PICTURE);
} }
title = UpdateAdapter.getUpdateComment(context, u, user, linkColor, UpdateAdapter.FROM_TASK_VIEW); title = UpdateAdapter.getUpdateComment(u);
userImage = ""; //$NON-NLS-1$ userImage = ""; //$NON-NLS-1$
if (user.containsNonNullValue(UpdateAdapter.USER_PICTURE)) { if (user.containsNonNullValue(UpdateAdapter.USER_PICTURE)) {
userImage = user.getPictureUrl(UpdateAdapter.USER_PICTURE, RemoteModel.PICTURE_THUMB); userImage = user.getPictureUrl(UpdateAdapter.USER_PICTURE, RemoteModel.PICTURE_THUMB);

@ -50,7 +50,7 @@ public class NotificationFragment extends TaskListFragment {
private long taskId; private long taskId;
@Override @Override
protected void onTaskCompleted(Task item) { protected void onTaskCompleted() {
} }
@Override @Override

@ -19,14 +19,6 @@ public class ReminderDebugContextActions {
public static class WhenReminder implements TaskContextActionExposer { public static class WhenReminder implements TaskContextActionExposer {
@Override
public Object getLabel(Task task) {
if (Constants.DEBUG) {
return "when alarm?";
}
return null;
}
@Override @Override
public void invoke(Task task) { public void invoke(Task task) {
AlarmScheduler original = ReminderService.getInstance().getScheduler(); AlarmScheduler original = ReminderService.getInstance().getScheduler();
@ -52,14 +44,6 @@ public class ReminderDebugContextActions {
public static class MakeNotification implements TaskContextActionExposer { public static class MakeNotification implements TaskContextActionExposer {
@Override
public Object getLabel(Task task) {
if (Constants.DEBUG) {
return "when alarm?"; //$NON-NLS-1$
}
return null;
}
@Override @Override
public void invoke(Task task) { public void invoke(Task task) {
new Notifications().showTaskNotification(task.getId(), new Notifications().showTaskNotification(task.getId(),

@ -126,8 +126,7 @@ public class RepeatControlSet extends PopupControlSet {
new NumberPickerDialog(activity, new OnNumberPickedListener() { new NumberPickerDialog(activity, new OnNumberPickedListener() {
@Override @Override
public void onNumberPicked(NumberPicker view, public void onNumberPicked(int number) {
int number) {
setRepeatValue(number); setRepeatValue(number);
} }
}, activity.getResources().getString(R.string.repeat_interval_prompt), }, activity.getResources().getString(R.string.repeat_interval_prompt),

@ -23,11 +23,6 @@ public class AddOnService {
/** Astrid Power Pack package */ /** Astrid Power Pack package */
public static final String POWER_PACK_PACKAGE = "com.todoroo.astrid.ppack"; public static final String POWER_PACK_PACKAGE = "com.todoroo.astrid.ppack";
/** Checks whether power pack should be enabled */
public boolean hasPowerPack() {
return true;
}
/** /**
* Check whether a given add-on is installed * Check whether a given add-on is installed
*/ */

@ -72,8 +72,8 @@ public class MetadataService {
/** /**
* Delete from metadata table where rows match a certain condition * Delete from metadata table where rows match a certain condition
*/ */
public int deleteWhere(Criterion where) { public void deleteWhere(Criterion where) {
return metadataDao.deleteWhere(where); metadataDao.deleteWhere(where);
} }
/** /**
@ -81,8 +81,8 @@ public class MetadataService {
* @param where predicate for which rows to update * @param where predicate for which rows to update
* @param metadata values to set * @param metadata values to set
*/ */
public int update(Criterion where, Metadata metadata) { public void update(Criterion where, Metadata metadata) {
return metadataDao.update(where, metadata); metadataDao.update(where, metadata);
} }
/** /**

@ -230,7 +230,7 @@ public class StartupService {
// the corresponding metadata will also update // the corresponding metadata will also update
tagDataDao.addListener(new ModelUpdateListener<TagData>() { tagDataDao.addListener(new ModelUpdateListener<TagData>() {
@Override @Override
public void onModelUpdated(TagData model, boolean outstandingEntries) { public void onModelUpdated(TagData model) {
ContentValues values = model.getSetValues(); ContentValues values = model.getSetValues();
Metadata m = new Metadata(); Metadata m = new Metadata();
if (values != null) { if (values != null) {

@ -24,7 +24,6 @@ import com.todoroo.astrid.api.PermaSql;
import com.todoroo.astrid.dao.MetadataDao.MetadataCriteria; import com.todoroo.astrid.dao.MetadataDao.MetadataCriteria;
import com.todoroo.astrid.dao.TagDataDao; import com.todoroo.astrid.dao.TagDataDao;
import com.todoroo.astrid.dao.UserActivityDao; import com.todoroo.astrid.dao.UserActivityDao;
import com.todoroo.astrid.data.History;
import com.todoroo.astrid.data.Metadata; import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.RemoteModel; import com.todoroo.astrid.data.RemoteModel;
import com.todoroo.astrid.data.TagData; import com.todoroo.astrid.data.TagData;
@ -59,8 +58,8 @@ public class TagDataService {
/** /**
* Save a single piece of metadata * Save a single piece of metadata
*/ */
public boolean save(TagData tagData) { public void save(TagData tagData) {
return tagDataDao.persist(tagData); tagDataDao.persist(tagData);
} }
/** /**
@ -155,22 +154,11 @@ public class TagDataService {
return userActivityDao.query(queryForTagData(tagData, criterion, null, UserActivity.PROPERTIES, null).orderBy(Order.desc(UserActivity.CREATED_AT))); return userActivityDao.query(queryForTagData(tagData, criterion, null, UserActivity.PROPERTIES, null).orderBy(Order.desc(UserActivity.CREATED_AT)));
} }
public Cursor getActivityAndHistoryForTagData(TagData tagData, Criterion extraCriterion, String userTableAlias, Property<?>...userProperties) { public Cursor getActivityForTagData(TagData tagData, Criterion extraCriterion, String userTableAlias, Property<?>... userProperties) {
Query activityQuery = queryForTagData(tagData, extraCriterion, userTableAlias, UpdateAdapter.USER_ACTIVITY_PROPERTIES, userProperties) Query activityQuery = queryForTagData(tagData, extraCriterion, userTableAlias, UpdateAdapter.USER_ACTIVITY_PROPERTIES, userProperties)
.from(UserActivity.TABLE); .from(UserActivity.TABLE);
Criterion historyCriterion; Query resultQuery = activityQuery.orderBy(Order.desc("1")); //$NON-NLS-1$
if (tagData == null) {
historyCriterion = Criterion.none;
} else {
historyCriterion = History.TAG_ID.eq(tagData.getUuid());
}
Query historyQuery = Query.select(AndroidUtilities.addToArray(Property.class, UpdateAdapter.HISTORY_PROPERTIES, userProperties)).from(History.TABLE)
.where(historyCriterion)
.join(Join.left(User.TABLE.as(userTableAlias), History.USER_UUID.eq(Field.field(userTableAlias + "." + User.UUID.name)))); //$NON-NLS-1$
Query resultQuery = activityQuery.union(historyQuery).orderBy(Order.desc("1")); //$NON-NLS-1$
return userActivityDao.query(resultQuery); return userActivityDao.query(resultQuery);
} }

@ -22,7 +22,6 @@ import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService; import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.messages.NameMaps;
import com.todoroo.astrid.adapter.UpdateAdapter; import com.todoroo.astrid.adapter.UpdateAdapter;
import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.PermaSql; import com.todoroo.astrid.api.PermaSql;
@ -33,7 +32,6 @@ import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.dao.TaskDao.TaskCriteria; import com.todoroo.astrid.dao.TaskDao.TaskCriteria;
import com.todoroo.astrid.dao.TaskOutstandingDao; import com.todoroo.astrid.dao.TaskOutstandingDao;
import com.todoroo.astrid.dao.UserActivityDao; import com.todoroo.astrid.dao.UserActivityDao;
import com.todoroo.astrid.data.History;
import com.todoroo.astrid.data.Metadata; import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.RemoteModel; import com.todoroo.astrid.data.RemoteModel;
import com.todoroo.astrid.data.SyncFlags; import com.todoroo.astrid.data.SyncFlags;
@ -344,13 +342,11 @@ public class TaskService {
/** /**
* Clear details cache. Useful if user performs some operation that * Clear details cache. Useful if user performs some operation that
* affects details * affects details
*
* @return # of affected rows
*/ */
public int clearDetails(Criterion criterion) { public void clearDetails(Criterion criterion) {
Task template = new Task(); Task template = new Task();
template.setValue(Task.DETAILS_DATE, 0L); template.setValue(Task.DETAILS_DATE, 0L);
return taskDao.update(criterion, template); taskDao.update(criterion, template);
} }
/** /**
@ -540,15 +536,10 @@ public class TaskService {
return task; return task;
} }
public TodorooCursor<UserActivity> getActivityAndHistoryForTask(Task task) { public TodorooCursor<UserActivity> getActivityForTask(Task task) {
Query taskQuery = queryForTask(task, UpdateAdapter.USER_TABLE_ALIAS, UpdateAdapter.USER_ACTIVITY_PROPERTIES, UpdateAdapter.USER_PROPERTIES); Query taskQuery = queryForTask(task, UpdateAdapter.USER_TABLE_ALIAS, UpdateAdapter.USER_ACTIVITY_PROPERTIES, UpdateAdapter.USER_PROPERTIES);
Query historyQuery = Query.select(AndroidUtilities.addToArray(Property.class, UpdateAdapter.HISTORY_PROPERTIES, UpdateAdapter.USER_PROPERTIES)).from(History.TABLE) Query resultQuery = taskQuery.orderBy(Order.desc("1")); //$NON-NLS-1$
.where(Criterion.and(History.TABLE_ID.eq(NameMaps.TABLE_ID_TASKS), History.TARGET_ID.eq(task.getUuid())))
.from(History.TABLE)
.join(Join.left(User.TABLE.as(UpdateAdapter.USER_TABLE_ALIAS), History.USER_UUID.eq(Field.field(UpdateAdapter.USER_TABLE_ALIAS + "." + User.UUID.name)))); //$NON-NLS-1$;
Query resultQuery = taskQuery.union(historyQuery).orderBy(Order.desc("1")); //$NON-NLS-1$
return userActivityDao.query(resultQuery); return userActivityDao.query(resultQuery);
} }

@ -436,15 +436,11 @@ public abstract class AstridOrderedListUpdater<LIST> {
return tree.toString(); return tree.toString();
} }
try {
recursivelySerialize(root, tree); recursivelySerialize(root, tree);
} catch (JSONException e) {
Log.e("OrderedListUpdater", "Error serializing tree model", e); //$NON-NLS-1$//$NON-NLS-2$
}
return tree.toString(); return tree.toString();
} }
private static void recursivelySerialize(Node node, JSONArray serializeTo) throws JSONException { private static void recursivelySerialize(Node node, JSONArray serializeTo) {
ArrayList<Node> children = node.children; ArrayList<Node> children = node.children;
serializeTo.put(node.uuid); serializeTo.put(node.uuid);
for (Node child : children) { for (Node child : children) {

@ -146,9 +146,9 @@ public class OrderedMetadataListFragmentHelper<LIST> implements OrderedListFragm
try { try {
if(to >= getListView().getCount()) { if(to >= getListView().getCount()) {
updater.moveTo(getFilter(), list, targetTaskId, -1); updater.moveTo(list, targetTaskId, -1);
} else { } else {
updater.moveTo(getFilter(), list, targetTaskId, destinationTaskId); updater.moveTo(list, targetTaskId, destinationTaskId);
} }
} catch (Exception e) { } catch (Exception e) {
Log.e("drag", "Drag Error", e); //$NON-NLS-1$ //$NON-NLS-2$ Log.e("drag", "Drag Error", e); //$NON-NLS-1$ //$NON-NLS-2$
@ -175,7 +175,7 @@ public class OrderedMetadataListFragmentHelper<LIST> implements OrderedListFragm
return; // This can happen with gestures on empty parts of the list (e.g. extra space below tasks) return; // This can happen with gestures on empty parts of the list (e.g. extra space below tasks)
} }
try { try {
updater.indent(getFilter(), list, targetTaskId, delta); updater.indent(list, targetTaskId, delta);
} catch (Exception e) { } catch (Exception e) {
Log.e("drag", "Indent Error", e); //$NON-NLS-1$ //$NON-NLS-2$ Log.e("drag", "Indent Error", e); //$NON-NLS-1$ //$NON-NLS-2$
} }
@ -283,12 +283,12 @@ public class OrderedMetadataListFragmentHelper<LIST> implements OrderedListFragm
final ArrayList<Long> chained = new ArrayList<Long>(); final ArrayList<Long> chained = new ArrayList<Long>();
final int parentIndent = item.getValue(updater.indentProperty()); final int parentIndent = item.getValue(updater.indentProperty());
updater.applyToChildren(getFilter(), list, itemId, new OrderedListNodeVisitor() { updater.applyToChildren(list, itemId, new OrderedListNodeVisitor() {
@Override @Override
public void visitNode(Node node) { public void visitNode(Node node) {
Task childTask = taskService.fetchById(node.taskId, Task.RECURRENCE); Task childTask = taskService.fetchById(node.taskId, Task.RECURRENCE);
if(!TextUtils.isEmpty(childTask.getValue(Task.RECURRENCE))) { if(!TextUtils.isEmpty(childTask.getValue(Task.RECURRENCE))) {
Metadata metadata = updater.getTaskMetadata(list, node.taskId); Metadata metadata = updater.getTaskMetadata(node.taskId);
metadata.setValue(updater.indentProperty(), parentIndent); metadata.setValue(updater.indentProperty(), parentIndent);
metadataService.save(metadata); metadataService.save(metadata);
} }
@ -320,7 +320,7 @@ public class OrderedMetadataListFragmentHelper<LIST> implements OrderedListFragm
@Override @Override
public void onDeleteTask(Task task) { public void onDeleteTask(Task task) {
updater.onDeleteTask(getFilter(), list, task.getId()); updater.onDeleteTask(list, task.getId());
taskAdapter.notifyDataSetInvalidated(); taskAdapter.notifyDataSetInvalidated();
} }

@ -8,7 +8,6 @@ package com.todoroo.astrid.subtasks;
import com.todoroo.andlib.data.Property.IntegerProperty; import com.todoroo.andlib.data.Property.IntegerProperty;
import com.todoroo.andlib.data.Property.LongProperty; import com.todoroo.andlib.data.Property.LongProperty;
import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.core.PluginServices; import com.todoroo.astrid.core.PluginServices;
import com.todoroo.astrid.data.Metadata; import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
@ -31,7 +30,7 @@ abstract public class OrderedMetadataListUpdater<LIST> {
// --- abstract and empty // --- abstract and empty
abstract protected Metadata getTaskMetadata(LIST list, long taskId); abstract protected Metadata getTaskMetadata(long taskId);
abstract protected IntegerProperty indentProperty(); abstract protected IntegerProperty indentProperty();
@ -39,7 +38,7 @@ abstract public class OrderedMetadataListUpdater<LIST> {
abstract protected LongProperty parentProperty(); abstract protected LongProperty parentProperty();
abstract protected void iterateThroughList(Filter filter, LIST list, OrderedListIterator iterator); abstract protected void iterateThroughList(LIST list, OrderedListIterator iterator);
abstract protected Metadata createEmptyMetadata(LIST list, long taskId); abstract protected Metadata createEmptyMetadata(LIST list, long taskId);
@ -56,7 +55,7 @@ abstract public class OrderedMetadataListUpdater<LIST> {
/** /**
* Indent a task and all its children * Indent a task and all its children
*/ */
public void indent(final Filter filter, final LIST list, final long targetTaskId, final int delta) { public void indent(final LIST list, final long targetTaskId, final int delta) {
if(list == null) { if(list == null) {
return; return;
} }
@ -68,7 +67,7 @@ abstract public class OrderedMetadataListUpdater<LIST> {
final AtomicLong previousTask = new AtomicLong(Task.NO_ID); final AtomicLong previousTask = new AtomicLong(Task.NO_ID);
final AtomicLong globalOrder = new AtomicLong(-1); final AtomicLong globalOrder = new AtomicLong(-1);
iterateThroughList(filter, list, new OrderedListIterator() { iterateThroughList(list, new OrderedListIterator() {
@Override @Override
public void processTask(long taskId, Metadata metadata) { public void processTask(long taskId, Metadata metadata) {
if(!metadata.isSaved()) { if(!metadata.isSaved()) {
@ -87,7 +86,7 @@ abstract public class OrderedMetadataListUpdater<LIST> {
metadata.setValue(indentProperty(), indent + delta); metadata.setValue(indentProperty(), indent + delta);
if(parentProperty() != null) { if(parentProperty() != null) {
long newParent = computeNewParent(filter, list, long newParent = computeNewParent(list,
taskId, indent + delta - 1); taskId, indent + delta - 1);
if (newParent == taskId) { if (newParent == taskId) {
metadata.setValue(parentProperty(), Task.NO_ID); metadata.setValue(parentProperty(), Task.NO_ID);
@ -116,20 +115,20 @@ abstract public class OrderedMetadataListUpdater<LIST> {
} }
}); });
onMovedOrIndented(getTaskMetadata(list, targetTaskId)); onMovedOrIndented(getTaskMetadata(targetTaskId));
} }
/** /**
* Helper function to iterate through a list and compute a new parent for the target task * Helper function to iterate through a list and compute a new parent for the target task
* based on the target parent's indent * based on the target parent's indent
*/ */
private long computeNewParent(Filter filter, LIST list, long targetTaskId, int targetParentIndent) { private long computeNewParent(LIST list, long targetTaskId, int targetParentIndent) {
final AtomicInteger desiredParentIndent = new AtomicInteger(targetParentIndent); final AtomicInteger desiredParentIndent = new AtomicInteger(targetParentIndent);
final AtomicLong targetTask = new AtomicLong(targetTaskId); final AtomicLong targetTask = new AtomicLong(targetTaskId);
final AtomicLong lastPotentialParent = new AtomicLong(Task.NO_ID); final AtomicLong lastPotentialParent = new AtomicLong(Task.NO_ID);
final AtomicBoolean computedParent = new AtomicBoolean(false); final AtomicBoolean computedParent = new AtomicBoolean(false);
iterateThroughList(filter, list, new OrderedListIterator() { iterateThroughList(list, new OrderedListIterator() {
@Override @Override
public void processTask(long taskId, Metadata metadata) { public void processTask(long taskId, Metadata metadata) {
if (targetTask.get() == taskId) { if (targetTask.get() == taskId) {
@ -155,13 +154,13 @@ abstract public class OrderedMetadataListUpdater<LIST> {
* Move a task and all its children to the position right above * Move a task and all its children to the position right above
* taskIdToMoveto. Will change the indent level to match taskIdToMoveTo. * taskIdToMoveto. Will change the indent level to match taskIdToMoveTo.
*/ */
public void moveTo(Filter filter, LIST list, final long targetTaskId, public void moveTo(LIST list, final long targetTaskId,
final long moveBeforeTaskId) { final long moveBeforeTaskId) {
if(list == null) { if(list == null) {
return; return;
} }
Node root = buildTreeModel(filter, list); Node root = buildTreeModel(list);
Node target = findNode(root, targetTaskId); Node target = findNode(root, targetTaskId);
if(target != null && target.parent != null) { if(target != null && target.parent != null) {
@ -187,7 +186,7 @@ abstract public class OrderedMetadataListUpdater<LIST> {
} }
traverseTreeAndWriteValues(list, root, new AtomicLong(0), -1); traverseTreeAndWriteValues(list, root, new AtomicLong(0), -1);
onMovedOrIndented(getTaskMetadata(list, targetTaskId)); onMovedOrIndented(getTaskMetadata(targetTaskId));
} }
private boolean ancestorOf(Node ancestor, Node descendant) { private boolean ancestorOf(Node ancestor, Node descendant) {
@ -213,7 +212,7 @@ abstract public class OrderedMetadataListUpdater<LIST> {
protected void traverseTreeAndWriteValues(LIST list, Node node, AtomicLong order, int indent) { protected void traverseTreeAndWriteValues(LIST list, Node node, AtomicLong order, int indent) {
if(node.taskId != Task.NO_ID) { if(node.taskId != Task.NO_ID) {
Metadata metadata = getTaskMetadata(list, node.taskId); Metadata metadata = getTaskMetadata(node.taskId);
if(metadata == null) { if(metadata == null) {
metadata = createEmptyMetadata(list, node.taskId); metadata = createEmptyMetadata(list, node.taskId);
} }
@ -249,12 +248,12 @@ abstract public class OrderedMetadataListUpdater<LIST> {
return null; return null;
} }
protected Node buildTreeModel(Filter filter, LIST list) { protected Node buildTreeModel(LIST list) {
final Node root = new Node(Task.NO_ID, null); final Node root = new Node(Task.NO_ID, null);
final AtomicInteger previoustIndent = new AtomicInteger(-1); final AtomicInteger previoustIndent = new AtomicInteger(-1);
final AtomicReference<Node> currentNode = new AtomicReference<Node>(root); final AtomicReference<Node> currentNode = new AtomicReference<Node>(root);
iterateThroughList(filter, list, new OrderedListIterator() { iterateThroughList(list, new OrderedListIterator() {
@Override @Override
public void processTask(long taskId, Metadata metadata) { public void processTask(long taskId, Metadata metadata) {
int indent = metadata.getValue(indentProperty()); int indent = metadata.getValue(indentProperty());
@ -303,10 +302,10 @@ abstract public class OrderedMetadataListUpdater<LIST> {
/** /**
* Apply an operation only to the children of the task * Apply an operation only to the children of the task
*/ */
public void applyToChildren(Filter filter, LIST list, long targetTaskId, public void applyToChildren(LIST list, long targetTaskId,
OrderedListNodeVisitor visitor) { OrderedListNodeVisitor visitor) {
Node root = buildTreeModel(filter, list); Node root = buildTreeModel(list);
Node target = findNode(root, targetTaskId); Node target = findNode(root, targetTaskId);
if(target != null) { if(target != null) {
@ -326,12 +325,12 @@ abstract public class OrderedMetadataListUpdater<LIST> {
/** /**
* Removes a task from the order hierarchy and un-indent children * Removes a task from the order hierarchy and un-indent children
*/ */
public void onDeleteTask(Filter filter, LIST list, final long targetTaskId) { public void onDeleteTask(LIST list, final long targetTaskId) {
if(list == null) { if(list == null) {
return; return;
} }
Node root = buildTreeModel(filter, list); Node root = buildTreeModel(list);
Node target = findNode(root, targetTaskId); Node target = findNode(root, targetTaskId);
if(target != null && target.parent != null) { if(target != null && target.parent != null) {
@ -345,32 +344,4 @@ abstract public class OrderedMetadataListUpdater<LIST> {
traverseTreeAndWriteValues(list, root, new AtomicLong(0), -1); traverseTreeAndWriteValues(list, root, new AtomicLong(0), -1);
} }
// --- utility
public void debugPrint(Filter filter, LIST list) {
iterateThroughList(filter, list, new OrderedListIterator() {
@Override
public void processTask(long taskId, Metadata metadata) {
System.err.format("id %d: order %d, indent:%d, parent:%d\n", taskId, //$NON-NLS-1$
metadata.getValue(orderProperty()),
metadata.getValue(indentProperty()),
parentProperty() == null ? Task.NO_ID : metadata.getValue(parentProperty()));
}
});
}
public void debugPrint(Node root, int depth) {
for(int i = 0; i < depth; i++) {
System.err.print(" + ");
}
System.err.format("%03d", root.taskId);
System.err.print("\n");
for(int i = 0; i < root.children.size(); i++) {
debugPrint(root.children.get(i), depth + 1);
}
}
} }

@ -210,8 +210,7 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE
} }
DependencyInjectionService.getInstance().inject(this); DependencyInjectionService.getInstance().inject(this);
TagData tagData = tagDataDao.fetch(uuid, TagData.MEMBER_COUNT, TagData.USER_ID); showDialog();
showDialog(tagData);
} }
protected DialogInterface.OnClickListener getOkListener() { protected DialogInterface.OnClickListener getOkListener() {
@ -253,7 +252,7 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
} }
protected abstract void showDialog(TagData tagData); protected abstract void showDialog();
protected abstract Intent ok(); protected abstract Intent ok();
} }
@ -261,7 +260,7 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE
public static class DeleteTagActivity extends TagActivity { public static class DeleteTagActivity extends TagActivity {
@Override @Override
protected void showDialog(TagData tagData) { protected void showDialog() {
DialogUtilities.okCancelDialog(this, getString(R.string.DLG_delete_this_tag_question, tag), getOkListener(), getCancelListener()); DialogUtilities.okCancelDialog(this, getString(R.string.DLG_delete_this_tag_question, tag), getOkListener(), getCancelListener());
} }
@ -277,7 +276,7 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE
private EditText editor; private EditText editor;
@Override @Override
protected void showDialog(TagData tagData) { protected void showDialog() {
editor = new EditText(this); editor = new EditText(this);
DialogUtilities.viewDialog(this, getString(R.string.DLG_rename_this_tag_header, tag), editor, getOkListener(), getCancelListener()); DialogUtilities.viewDialog(this, getString(R.string.DLG_rename_this_tag_header, tag), editor, getOkListener(), getCancelListener());
} }

@ -144,7 +144,7 @@ public final class TagsControlSet extends PopupControlSet {
} }
/** Adds a tag to the tag field */ /** Adds a tag to the tag field */
boolean addTag(String tagName, boolean reuse) { void addTag(String tagName, boolean reuse) {
LayoutInflater inflater = activity.getLayoutInflater(); LayoutInflater inflater = activity.getLayoutInflater();
// check if already exists // check if already exists
@ -153,7 +153,7 @@ public final class TagsControlSet extends PopupControlSet {
View view = newTags.getChildAt(i); View view = newTags.getChildAt(i);
lastText = (TextView) view.findViewById(R.id.text1); lastText = (TextView) view.findViewById(R.id.text1);
if(lastText.getText().equals(tagName)) { if(lastText.getText().equals(tagName)) {
return false; return;
} }
} }
@ -222,8 +222,6 @@ public final class TagsControlSet extends PopupControlSet {
} }
} }
}); });
return true;
} }
/** /**
@ -310,10 +308,9 @@ public final class TagsControlSet extends PopupControlSet {
LinkedHashSet<String> tags = getTagSet(); LinkedHashSet<String> tags = getTagSet();
if(TagService.getInstance().synchronizeTags(task.getId(), task.getValue(Task.UUID), tags)) { TagService.getInstance().synchronizeTags(task.getId(), task.getValue(Task.UUID), tags);
Flags.set(Flags.TAGS_CHANGED); Flags.set(Flags.TAGS_CHANGED);
task.setValue(Task.MODIFICATION_DATE, DateUtilities.now()); task.setValue(Task.MODIFICATION_DATE, DateUtilities.now());
}
return null; return null;
} }

@ -55,7 +55,7 @@ public class AstridDialog extends Dialog {
return this; return this;
} }
public AstridDialog setButtonListeners(View.OnClickListener... listeners) { public void setButtonListeners(View.OnClickListener... listeners) {
int index = 0; int index = 0;
for (View.OnClickListener l : listeners) { for (View.OnClickListener l : listeners) {
buttons[index].setOnClickListener(l); buttons[index].setOnClickListener(l);
@ -64,7 +64,6 @@ public class AstridDialog extends Dialog {
break; break;
} }
} }
return this;
} }
public AstridDialog setAstridText(int resId) { public AstridDialog setAstridText(int resId) {

@ -119,7 +119,7 @@ public class AstridTimePicker extends LinearLayout {
NumberPicker.OnChangedListener autoEnableTimeCheck = new NumberPicker.OnChangedListener() { NumberPicker.OnChangedListener autoEnableTimeCheck = new NumberPicker.OnChangedListener() {
@Override @Override
public int onChanged(NumberPicker picker, int oldVal, int newVal) { public int onChanged(int newVal) {
setHasTime(true); setHasTime(true);
return newVal; return newVal;
} }

@ -297,9 +297,9 @@ public class DateAndTimePicker extends LinearLayout {
Date d = new Date(forDate); Date d = new Date(forDate);
if (d.getTime() > 0) { if (d.getTime() > 0) {
if (hideYear) { if (hideYear) {
displayString.append(DateUtilities.getDateStringHideYear(context, d)); displayString.append(DateUtilities.getDateStringHideYear(d));
} else { } else {
displayString.append(DateUtilities.getDateString(context, d)); displayString.append(DateUtilities.getDateString(d));
} }
if (Task.hasDueTime(forDate) && !hideTime) { if (Task.hasDueTime(forDate) && !hideTime) {
displayString.append(useNewline ? "\n" : ", "); //$NON-NLS-1$ //$NON-NLS-2$ displayString.append(useNewline ? "\n" : ", "); //$NON-NLS-1$ //$NON-NLS-2$

@ -20,10 +20,6 @@ public class DeadlineNumberPicker extends NumberPicker {
super(context, attrs); super(context, attrs);
} }
public DeadlineNumberPicker(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override @Override
protected int getLayout() { protected int getLayout() {
return R.layout.deadline_number_picker; return R.layout.deadline_number_picker;

@ -112,10 +112,6 @@ public class DraggableListView extends ListView {
this.mItemHeightNormal = itemHeightNormal; this.mItemHeightNormal = itemHeightNormal;
} }
protected boolean isDraggableRow(View view) {
return true;
}
/* /*
* pointToPosition() doesn't consider invisible views, but we need to, so * pointToPosition() doesn't consider invisible views, but we need to, so
* implement a slightly different version. * implement a slightly different version.
@ -177,7 +173,6 @@ public class DraggableListView extends ListView {
} }
} }
if (isDraggableRow(v)) {
ViewGroup.LayoutParams params = v.getLayoutParams(); ViewGroup.LayoutParams params = v.getLayoutParams();
params.height = LayoutParams.WRAP_CONTENT; params.height = LayoutParams.WRAP_CONTENT;
v.setLayoutParams(params); v.setLayoutParams(params);
@ -185,7 +180,6 @@ public class DraggableListView extends ListView {
v.setPadding(0, 0, 0, 0); v.setPadding(0, 0, 0, 0);
} }
} }
}
/* /*
* Adjust visibility and size to make it appear as though an item is being * Adjust visibility and size to make it appear as though an item is being
@ -228,14 +222,12 @@ public class DraggableListView extends ListView {
} }
} }
if (isDraggableRow(vv)) {
ViewGroup.LayoutParams params = vv.getLayoutParams(); ViewGroup.LayoutParams params = vv.getLayoutParams();
params.height = height; params.height = height;
vv.setLayoutParams(params); vv.setLayoutParams(params);
vv.setVisibility(visibility); vv.setVisibility(visibility);
vv.setPadding(0, marginTop, 0, 0); vv.setPadding(0, marginTop, 0, 0);
} }
}
// Request re-layout since we changed the items layout // Request re-layout since we changed the items layout
// and not doing this would cause bogus hitbox calculation // and not doing this would cause bogus hitbox calculation
// in myPointToPosition // in myPointToPosition
@ -366,24 +358,17 @@ public class DraggableListView extends ListView {
} }
}; };
/** protected void initiateDrag(MotionEvent ev) {
* @return true if drag was initiated
*/
protected boolean initiateDrag(MotionEvent ev) {
int x = (int) mTouchCurrentX; int x = (int) mTouchCurrentX;
int y = (int) mTouchCurrentY; int y = (int) mTouchCurrentY;
int itemNum = pointToPosition(x, y); int itemNum = pointToPosition(x, y);
if (itemNum == AdapterView.INVALID_POSITION) { if (itemNum == AdapterView.INVALID_POSITION) {
return false; return;
} }
View item = (View) getChildAt(itemNum - getFirstVisiblePosition()); View item = (View) getChildAt(itemNum - getFirstVisiblePosition());
if(!isDraggableRow(item)) {
return false;
}
mDragPoint = new Point(x - item.getLeft(), y - item.getTop()); mDragPoint = new Point(x - item.getLeft(), y - item.getTop());
mCoordOffset = new Point((int)ev.getRawX() - x, (int)ev.getRawY() - y); mCoordOffset = new Point((int)ev.getRawX() - x, (int)ev.getRawY() - y);
@ -409,8 +394,6 @@ public class DraggableListView extends ListView {
Vibrator v = (Vibrator) getContext().getSystemService(Context.VIBRATOR_SERVICE); Vibrator v = (Vibrator) getContext().getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(50); v.vibrate(50);
return true;
} }
private void startDragging(Bitmap bm, int x, int y) { private void startDragging(Bitmap bm, int x, int y) {

@ -94,7 +94,7 @@ public class EditTitleControlSet extends TaskEditControlSet implements Importanc
} }
@Override @Override
public void importanceChanged(int i, int color) { public void importanceChanged(int i) {
importanceValue = i; importanceValue = i;
updateCompleteBox(); updateCompleteBox();
} }

@ -99,7 +99,7 @@ public class HideUntilControlSet extends PopupControlSet implements OnItemSelect
} }
Date hideUntilAsDate = new Date(specificDate); Date hideUntilAsDate = new Date(specificDate);
if(hideUntilAsDate.getHours() == 0 && hideUntilAsDate.getMinutes() == 0 && hideUntilAsDate.getSeconds() == 0) { if(hideUntilAsDate.getHours() == 0 && hideUntilAsDate.getMinutes() == 0 && hideUntilAsDate.getSeconds() == 0) {
updated[0] = new HideUntilValue(DateUtilities.getDateString(activity, new Date(specificDate)), updated[0] = new HideUntilValue(DateUtilities.getDateString(new Date(specificDate)),
Task.HIDE_UNTIL_SPECIFIC_DAY, specificDate); Task.HIDE_UNTIL_SPECIFIC_DAY, specificDate);
existingDate = specificDate; existingDate = specificDate;
} else { } else {

@ -36,7 +36,7 @@ public class ImportanceControlSet extends TaskEditControlSet {
private static final int TEXT_SIZE = 18; private static final int TEXT_SIZE = 18;
public interface ImportanceChangedListener { public interface ImportanceChangedListener {
public void importanceChanged(int i, int color); public void importanceChanged(int i);
} }
public ImportanceControlSet(Activity activity, int layout) { public ImportanceControlSet(Activity activity, int layout) {
@ -56,7 +56,7 @@ public class ImportanceControlSet extends TaskEditControlSet {
} }
for (ImportanceChangedListener l : listeners) { for (ImportanceChangedListener l : listeners) {
l.importanceChanged(i, colors[i]); l.importanceChanged(i);
} }
} }

@ -32,7 +32,7 @@ public class NumberPicker extends LinearLayout implements OnClickListener,
public interface OnChangedListener { public interface OnChangedListener {
/** return new value */ /** return new value */
int onChanged(NumberPicker picker, int oldVal, int newVal); int onChanged(int newVal);
} }
public interface Formatter { public interface Formatter {
@ -69,10 +69,10 @@ public class NumberPicker extends LinearLayout implements OnClickListener,
@Override @Override
public void run() { public void run() {
if (mIncrement) { if (mIncrement) {
changeCurrent(mCurrent + incrementBy, mSlideUpInAnimation, mSlideUpOutAnimation); changeCurrent(mCurrent + incrementBy);
mHandler.postDelayed(this, mSpeed); mHandler.postDelayed(this, mSpeed);
} else if (mDecrement) { } else if (mDecrement) {
changeCurrent(mCurrent - incrementBy, mSlideDownInAnimation, mSlideDownOutAnimation); changeCurrent(mCurrent - incrementBy);
mHandler.postDelayed(this, mSpeed); mHandler.postDelayed(this, mSpeed);
} }
} }
@ -104,10 +104,6 @@ public class NumberPicker extends LinearLayout implements OnClickListener,
this(context, null); this(context, null);
} }
public NumberPicker(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
protected int getLayout() { protected int getLayout() {
return R.layout.number_picker; return R.layout.number_picker;
} }
@ -120,7 +116,7 @@ public class NumberPicker extends LinearLayout implements OnClickListener,
return -1; return -1;
} }
public NumberPicker(Context context, AttributeSet attrs, int defStyle) { public NumberPicker(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
setOrientation(VERTICAL); setOrientation(VERTICAL);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@ -243,11 +239,9 @@ public class NumberPicker extends LinearLayout implements OnClickListener,
// now perform the increment/decrement // now perform the increment/decrement
if (R.id.increment == v.getId()) { if (R.id.increment == v.getId()) {
changeCurrent(mCurrent + incrementBy, mSlideUpInAnimation, changeCurrent(mCurrent + incrementBy);
mSlideUpOutAnimation);
} else if (R.id.decrement == v.getId()) { } else if (R.id.decrement == v.getId()) {
changeCurrent(mCurrent - incrementBy, mSlideDownInAnimation, changeCurrent(mCurrent - incrementBy);
mSlideDownOutAnimation);
} }
} }
@ -256,7 +250,7 @@ public class NumberPicker extends LinearLayout implements OnClickListener,
.valueOf(value); .valueOf(value);
} }
private void changeCurrent(int current, Animation in, Animation out) { private void changeCurrent(int current) {
current = notifyChange(current); current = notifyChange(current);
// Wrap around the values if we go past the start or end // Wrap around the values if we go past the start or end
@ -272,7 +266,7 @@ public class NumberPicker extends LinearLayout implements OnClickListener,
private int notifyChange(int current) { private int notifyChange(int current) {
if (mListener != null) { if (mListener != null) {
return mListener.onChanged(this, mCurrent, current); return mListener.onChanged(current);
} else { } else {
return current; return current;
} }

@ -17,7 +17,7 @@ import org.tasks.R;
public class NumberPickerDialog extends AlertDialog implements OnClickListener { public class NumberPickerDialog extends AlertDialog implements OnClickListener {
public interface OnNumberPickedListener { public interface OnNumberPickedListener {
void onNumberPicked(NumberPicker view, int number); void onNumberPicked(int number);
} }
private final NumberPicker mPicker; private final NumberPicker mPicker;
@ -51,7 +51,7 @@ public class NumberPickerDialog extends AlertDialog implements OnClickListener {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if (mCallback != null) { if (mCallback != null) {
mPicker.clearFocus(); mPicker.clearFocus();
mCallback.onNumberPicked(mPicker, mPicker.getCurrent()); mCallback.onNumberPicked(mPicker.getCurrent());
} }
} }
} }

@ -103,7 +103,7 @@ public class TimeDurationControlSet implements OnNNumberPickedListener,
}); });
minutePicker.setOnChangeListener(new NumberPicker.OnChangedListener() { minutePicker.setOnChangeListener(new NumberPicker.OnChangedListener() {
@Override @Override
public int onChanged(NumberPicker picker, int oldVal, int newVal) { public int onChanged(int newVal) {
if(newVal < 0) { if(newVal < 0) {
if(hourPicker.getCurrent() == 0) { if(hourPicker.getCurrent() == 0) {
return 0; return 0;

@ -5,8 +5,6 @@
*/ */
package com.todoroo.astrid.utility; package com.todoroo.astrid.utility;
import android.content.Context;
import com.todoroo.andlib.data.Property; import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.data.TodorooCursor; import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.Autowired;
@ -59,7 +57,7 @@ abstract public class SyncMetadataService<TYPE extends SyncContainer> {
// --- implementation // --- implementation
public SyncMetadataService(Context context) { public SyncMetadataService() {
DependencyInjectionService.getInstance().inject(this); DependencyInjectionService.getInstance().inject(this);
} }

@ -52,7 +52,7 @@ public class Api6VoiceOutputAssistant implements OnInitListener, VoiceOutputAssi
} }
@Override @Override
public boolean handleActivityResult(int requestCode, int resultCode, Intent data) { public void handleActivityResult(int requestCode, int resultCode) {
if (requestCode == MY_DATA_CHECK_CODE) { if (requestCode == MY_DATA_CHECK_CODE) {
if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) { if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
// success, create the TTS instance // success, create the TTS instance
@ -63,11 +63,7 @@ public class Api6VoiceOutputAssistant implements OnInitListener, VoiceOutputAssi
installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA); installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
context.startActivity(installIntent); context.startActivity(installIntent);
} }
return true;
} }
return false;
} }
private void initTTS() { private void initTTS() {

@ -6,8 +6,6 @@
package com.todoroo.astrid.voice; package com.todoroo.astrid.voice;
import android.content.Intent;
import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.AndroidUtilities;
@ -28,7 +26,7 @@ public class VoiceOutputService {
public interface VoiceOutputAssistant { public interface VoiceOutputAssistant {
public void checkIsTTSInstalled(); public void checkIsTTSInstalled();
public boolean handleActivityResult(int requestCode, int resultCode, Intent data); public void handleActivityResult(int requestCode, int resultCode);
public void queueSpeak(String textToSpeak); public void queueSpeak(String textToSpeak);
@ -43,9 +41,7 @@ public class VoiceOutputService {
} }
@Override @Override
public boolean handleActivityResult(int requestCode, int resultCode, public void handleActivityResult(int requestCode, int resultCode) {
Intent data) {
return false;
} }
@Override @Override

@ -123,8 +123,6 @@
<string name="TEA_menu_save">Desa els canvis</string> <string name="TEA_menu_save">Desa els canvis</string>
<string name="TEA_menu_discard">No ho desis</string> <string name="TEA_menu_discard">No ho desis</string>
<string name="TEA_menu_comments">Comentaris</string> <string name="TEA_menu_comments">Comentaris</string>
<string name="TEA_onTaskSave_due">Tasca desada: venç %s</string>
<string name="TEA_onTaskSave_notDue">Tasca desada</string>
<string name="TEA_tab_activity">Activitat</string> <string name="TEA_tab_activity">Activitat</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">
<item>Sense venciment</item> <item>Sense venciment</item>

@ -115,8 +115,6 @@
<string name="TEA_menu_save">Uložit změny</string> <string name="TEA_menu_save">Uložit změny</string>
<string name="TEA_menu_discard">Neukládat</string> <string name="TEA_menu_discard">Neukládat</string>
<string name="TEA_menu_comments">Komentáře</string> <string name="TEA_menu_comments">Komentáře</string>
<string name="TEA_onTaskSave_due">Úkol uložen: termín je %s</string>
<string name="TEA_onTaskSave_notDue">Úkol uložen</string>
<string name="TEA_tab_activity">Činnost</string> <string name="TEA_tab_activity">Činnost</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">
<item>Bez termínu</item> <item>Bez termínu</item>

@ -81,8 +81,6 @@
<string name="TEA_elapsedDuration_label">Tid allerede brugt på denne opgave</string> <string name="TEA_elapsedDuration_label">Tid allerede brugt på denne opgave</string>
<string name="TEA_menu_save">Gem ændringer</string> <string name="TEA_menu_save">Gem ændringer</string>
<string name="TEA_menu_discard">Gem ikke</string> <string name="TEA_menu_discard">Gem ikke</string>
<string name="TEA_onTaskSave_due">Opgave gemt: deadline %s</string>
<string name="TEA_onTaskSave_notDue">Opgave gemt</string>
<string name="TEA_tab_activity">Aktivitet</string> <string name="TEA_tab_activity">Aktivitet</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">
<item>No date</item> <item>No date</item>

@ -120,8 +120,6 @@
<string name="TEA_menu_discard">Nicht speichern</string> <string name="TEA_menu_discard">Nicht speichern</string>
<string name="TEA_menu_refresh_comments">Kommentare aktualisieren</string> <string name="TEA_menu_refresh_comments">Kommentare aktualisieren</string>
<string name="TEA_menu_comments">Kommentare</string> <string name="TEA_menu_comments">Kommentare</string>
<string name="TEA_onTaskSave_due">Aufgabe gespeichert: fällig %s</string>
<string name="TEA_onTaskSave_notDue">Aufgabe gespeichert</string>
<string name="TEA_tab_activity">Aktivität</string> <string name="TEA_tab_activity">Aktivität</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">
<item>Kein Datum</item> <item>Kein Datum</item>

@ -126,8 +126,6 @@
<string name="TEA_menu_discard">No guardar</string> <string name="TEA_menu_discard">No guardar</string>
<string name="TEA_menu_refresh_comments">Actualizar comentarios</string> <string name="TEA_menu_refresh_comments">Actualizar comentarios</string>
<string name="TEA_menu_comments">Comentarios</string> <string name="TEA_menu_comments">Comentarios</string>
<string name="TEA_onTaskSave_due">Tarea guardada: finaliza %s</string>
<string name="TEA_onTaskSave_notDue">Tarea guardada</string>
<string name="TEA_tab_activity">Actividad</string> <string name="TEA_tab_activity">Actividad</string>
<string name="TEA_timer_est">Estimado %s</string> <string name="TEA_timer_est">Estimado %s</string>
<string name="TEA_timer_elap">Transcurrido %s</string> <string name="TEA_timer_elap">Transcurrido %s</string>

@ -123,8 +123,6 @@
<string name="TEA_menu_discard">Ne pas enregistrer</string> <string name="TEA_menu_discard">Ne pas enregistrer</string>
<string name="TEA_menu_refresh_comments">Mettre à jour les commentaires</string> <string name="TEA_menu_refresh_comments">Mettre à jour les commentaires</string>
<string name="TEA_menu_comments">Commentaires</string> <string name="TEA_menu_comments">Commentaires</string>
<string name="TEA_onTaskSave_due">Tâche enregistrée : prévue dans %s</string>
<string name="TEA_onTaskSave_notDue">Tâche enregistrée</string>
<string name="TEA_tab_activity">Activité</string> <string name="TEA_tab_activity">Activité</string>
<string name="TEA_timer_est">Restant %s</string> <string name="TEA_timer_est">Restant %s</string>
<string name="TEA_timer_elap">Passé %s</string> <string name="TEA_timer_elap">Passé %s</string>

@ -114,8 +114,6 @@
<string name="TEA_menu_save">Salva le modifiche</string> <string name="TEA_menu_save">Salva le modifiche</string>
<string name="TEA_menu_discard">Non salvare</string> <string name="TEA_menu_discard">Non salvare</string>
<string name="TEA_menu_comments">Commenti</string> <string name="TEA_menu_comments">Commenti</string>
<string name="TEA_onTaskSave_due">Attività Salvata: entro %s</string>
<string name="TEA_onTaskSave_notDue">Attvità salvata</string>
<string name="TEA_tab_activity">Attività</string> <string name="TEA_tab_activity">Attività</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">
<item>No date</item> <item>No date</item>

@ -122,8 +122,6 @@
<string name="TEA_menu_discard">לא לשמור</string> <string name="TEA_menu_discard">לא לשמור</string>
<string name="TEA_menu_refresh_comments">רַעְנֵן הערות</string> <string name="TEA_menu_refresh_comments">רַעְנֵן הערות</string>
<string name="TEA_menu_comments">הערות</string> <string name="TEA_menu_comments">הערות</string>
<string name="TEA_onTaskSave_due">המשימה נשמרה: יעד %s</string>
<string name="TEA_onTaskSave_notDue">המשימה נשמרה</string>
<string name="TEA_tab_activity">פעילות</string> <string name="TEA_tab_activity">פעילות</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">
<item>ללא תאריך</item> <item>ללא תאריך</item>

@ -99,8 +99,6 @@
<string name="TEA_menu_save">変更の保存</string> <string name="TEA_menu_save">変更の保存</string>
<string name="TEA_menu_discard">保存しない</string> <string name="TEA_menu_discard">保存しない</string>
<string name="TEA_menu_comments">コメント</string> <string name="TEA_menu_comments">コメント</string>
<string name="TEA_onTaskSave_due">タスクは保存されました: 期限は%s</string>
<string name="TEA_onTaskSave_notDue">タスクは保存されました</string>
<string name="TEA_tab_activity">活動</string> <string name="TEA_tab_activity">活動</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">
<item>No date</item> <item>No date</item>

@ -129,8 +129,6 @@
<string name="TEA_menu_discard">저장하지 않음</string> <string name="TEA_menu_discard">저장하지 않음</string>
<string name="TEA_menu_refresh_comments">댓글 새로고침</string> <string name="TEA_menu_refresh_comments">댓글 새로고침</string>
<string name="TEA_menu_comments">댓글</string> <string name="TEA_menu_comments">댓글</string>
<string name="TEA_onTaskSave_due">일정 저장: 마감일 %s</string>
<string name="TEA_onTaskSave_notDue">일정을 저장했습니다</string>
<string name="TEA_tab_activity">활동 내역</string> <string name="TEA_tab_activity">활동 내역</string>
<string name="TEA_timer_est">동부표준시 %s</string> <string name="TEA_timer_est">동부표준시 %s</string>
<string name="TEA_timer_elap">경과 시간: %s</string> <string name="TEA_timer_elap">경과 시간: %s</string>

@ -74,8 +74,6 @@
<string name="TEA_elapsedDuration_label">Tid brukt på oppgaven til nå</string> <string name="TEA_elapsedDuration_label">Tid brukt på oppgaven til nå</string>
<string name="TEA_menu_save">Lagre endringer</string> <string name="TEA_menu_save">Lagre endringer</string>
<string name="TEA_menu_discard">Ikke lagre</string> <string name="TEA_menu_discard">Ikke lagre</string>
<string name="TEA_onTaskSave_due">Oppgave lagret: forfaller %s</string>
<string name="TEA_onTaskSave_notDue">Oppgave lagret</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">
<item>No date</item> <item>No date</item>
<item>Specific day</item> <item>Specific day</item>

@ -124,8 +124,6 @@
<string name="TEA_menu_discard">Niet opslaan</string> <string name="TEA_menu_discard">Niet opslaan</string>
<string name="TEA_menu_refresh_comments">Opmerkingen vernieuwen</string> <string name="TEA_menu_refresh_comments">Opmerkingen vernieuwen</string>
<string name="TEA_menu_comments">Opmerkingen</string> <string name="TEA_menu_comments">Opmerkingen</string>
<string name="TEA_onTaskSave_due">Taak opgeslagen: eind %s</string>
<string name="TEA_onTaskSave_notDue">Taak opgeslagen</string>
<string name="TEA_tab_activity">Activiteit</string> <string name="TEA_tab_activity">Activiteit</string>
<string name="TEA_timer_est">Gesch. %s</string> <string name="TEA_timer_est">Gesch. %s</string>
<string name="TEA_timer_elap">Verstreken %s</string> <string name="TEA_timer_elap">Verstreken %s</string>

@ -120,8 +120,6 @@
<string name="TEA_menu_discard">Nie zapisuj</string> <string name="TEA_menu_discard">Nie zapisuj</string>
<string name="TEA_menu_refresh_comments">Odśwież komentarze</string> <string name="TEA_menu_refresh_comments">Odśwież komentarze</string>
<string name="TEA_menu_comments">Komentarze</string> <string name="TEA_menu_comments">Komentarze</string>
<string name="TEA_onTaskSave_due">Zadanie zapisano: termin do %s</string>
<string name="TEA_onTaskSave_notDue">Zadanie zapisane</string>
<string name="TEA_tab_activity">Aktywność</string> <string name="TEA_tab_activity">Aktywność</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">
<item>Brak daty</item> <item>Brak daty</item>

@ -123,8 +123,6 @@
<string name="TEA_menu_discard">Não salvar</string> <string name="TEA_menu_discard">Não salvar</string>
<string name="TEA_menu_refresh_comments">Atualizar comentários</string> <string name="TEA_menu_refresh_comments">Atualizar comentários</string>
<string name="TEA_menu_comments">Comentários</string> <string name="TEA_menu_comments">Comentários</string>
<string name="TEA_onTaskSave_due">Tarefa salva: vence em %s</string>
<string name="TEA_onTaskSave_notDue">Tarefa salva</string>
<string name="TEA_tab_activity">Atividades</string> <string name="TEA_tab_activity">Atividades</string>
<string name="TEA_timer_elap">Decorrido %s</string> <string name="TEA_timer_elap">Decorrido %s</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">

@ -80,7 +80,6 @@
<string name="TEA_elapsedDuration_label">Tempo já gasto na tarefa</string> <string name="TEA_elapsedDuration_label">Tempo já gasto na tarefa</string>
<string name="TEA_menu_save">Guardar Alterações</string> <string name="TEA_menu_save">Guardar Alterações</string>
<string name="TEA_menu_discard">Não Gravar</string> <string name="TEA_menu_discard">Não Gravar</string>
<string name="TEA_onTaskSave_notDue">Tarefa Guardada</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">
<item>No date</item> <item>No date</item>
<item>Specific day</item> <item>Specific day</item>

@ -124,8 +124,6 @@
<string name="TEA_menu_discard">Не сохранять</string> <string name="TEA_menu_discard">Не сохранять</string>
<string name="TEA_menu_refresh_comments">Обновить комментарии</string> <string name="TEA_menu_refresh_comments">Обновить комментарии</string>
<string name="TEA_menu_comments">Комментарии</string> <string name="TEA_menu_comments">Комментарии</string>
<string name="TEA_onTaskSave_due">Задача сохранена: срок %s</string>
<string name="TEA_onTaskSave_notDue">Задача сохранена</string>
<string name="TEA_tab_activity">Действия</string> <string name="TEA_tab_activity">Действия</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">
<item>Без даты</item> <item>Без даты</item>

@ -116,8 +116,6 @@
<string name="TEA_menu_discard">Spara inte</string> <string name="TEA_menu_discard">Spara inte</string>
<string name="TEA_menu_refresh_comments">Uppdatera kommentarer</string> <string name="TEA_menu_refresh_comments">Uppdatera kommentarer</string>
<string name="TEA_menu_comments">Kommentarer</string> <string name="TEA_menu_comments">Kommentarer</string>
<string name="TEA_onTaskSave_due">Uppgift sparad: förfaller %s</string>
<string name="TEA_onTaskSave_notDue">Uppgift sparad</string>
<string name="TEA_tab_activity">Aktivitet</string> <string name="TEA_tab_activity">Aktivitet</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">
<item>No date</item> <item>No date</item>

@ -57,7 +57,6 @@
<string name="TEA_note_label">บันทึกย่อ</string> <string name="TEA_note_label">บันทึกย่อ</string>
<string name="TEA_menu_save">บันทึกการเปลี่ยนแปลง</string> <string name="TEA_menu_save">บันทึกการเปลี่ยนแปลง</string>
<string name="TEA_menu_discard">ไม่บันทึก</string> <string name="TEA_menu_discard">ไม่บันทึก</string>
<string name="TEA_onTaskSave_notDue">งานที่บันทึกไว้</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">
<item>No date</item> <item>No date</item>
<item>Specific day</item> <item>Specific day</item>

@ -112,8 +112,6 @@
<string name="TEA_menu_save">Değişiklikleri Kaydet</string> <string name="TEA_menu_save">Değişiklikleri Kaydet</string>
<string name="TEA_menu_discard">Kaydetme</string> <string name="TEA_menu_discard">Kaydetme</string>
<string name="TEA_menu_comments">Yorumlar</string> <string name="TEA_menu_comments">Yorumlar</string>
<string name="TEA_onTaskSave_due">Görev Kaydedildi: tarihi %s</string>
<string name="TEA_onTaskSave_notDue">Görev kaydedildi</string>
<string name="TEA_tab_activity">Etkinlik</string> <string name="TEA_tab_activity">Etkinlik</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">
<item>No date</item> <item>No date</item>

@ -129,8 +129,6 @@
<string name="TEA_menu_discard">Не зберігати зміни</string> <string name="TEA_menu_discard">Не зберігати зміни</string>
<string name="TEA_menu_refresh_comments">Оновити коментарі</string> <string name="TEA_menu_refresh_comments">Оновити коментарі</string>
<string name="TEA_menu_comments">Коментарі</string> <string name="TEA_menu_comments">Коментарі</string>
<string name="TEA_onTaskSave_due">Завдання збережено: завдяки %s</string>
<string name="TEA_onTaskSave_notDue">Завдання збережено</string>
<string name="TEA_tab_activity">Активність</string> <string name="TEA_tab_activity">Активність</string>
<string name="TEA_timer_est">Зал. %s</string> <string name="TEA_timer_est">Зал. %s</string>
<string name="TEA_timer_elap">Час, що минув %s</string> <string name="TEA_timer_elap">Час, що минув %s</string>

@ -115,8 +115,6 @@
<string name="TEA_menu_save">保存更改</string> <string name="TEA_menu_save">保存更改</string>
<string name="TEA_menu_discard">不保存</string> <string name="TEA_menu_discard">不保存</string>
<string name="TEA_menu_comments">注释</string> <string name="TEA_menu_comments">注释</string>
<string name="TEA_onTaskSave_due">已设截止日期的任务:按 %s</string>
<string name="TEA_onTaskSave_notDue">任务已储存</string>
<string name="TEA_tab_activity">活动</string> <string name="TEA_tab_activity">活动</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">
<item>No date</item> <item>No date</item>

@ -115,8 +115,6 @@
<string name="TEA_menu_save">儲存變更</string> <string name="TEA_menu_save">儲存變更</string>
<string name="TEA_menu_discard">不要儲存</string> <string name="TEA_menu_discard">不要儲存</string>
<string name="TEA_menu_comments">註釋</string> <string name="TEA_menu_comments">註釋</string>
<string name="TEA_onTaskSave_due">工作已儲存: %s 到期</string>
<string name="TEA_onTaskSave_notDue">工作已儲存</string>
<string name="TEA_tab_activity">活動</string> <string name="TEA_tab_activity">活動</string>
<string-array name="TEA_urgency"> <string-array name="TEA_urgency">
<item>No date</item> <item>No date</item>

@ -261,12 +261,6 @@
<string name="TEA_menu_comments">Comments</string> <string name="TEA_menu_comments">Comments</string>
<!-- Toast: task saved with deadline (%s => preposition + time units) -->
<string name="TEA_onTaskSave_due">Task Saved: due %s</string>
<!-- Toast: task saved without deadlines -->
<string name="TEA_onTaskSave_notDue">Task Saved</string>
<!-- slide 15b: Task edit tab: activity --> <!-- slide 15b: Task edit tab: activity -->
<string name="TEA_tab_activity">Activity</string> <string name="TEA_tab_activity">Activity</string>

Loading…
Cancel
Save