mirror of https://github.com/tasks/tasks
done reading/display-side of producteev-dashboard in the TaskDetailExposer
at least the reading/displaying part is ready for testing, the part where dashboard-infos are written into metadata-db and dataservice-cache is missing and should be done by tim, i think.pull/14/head
parent
9110b3f544
commit
d1ccce4e68
@ -0,0 +1,86 @@
|
|||||||
|
/**
|
||||||
|
* See the file "LICENSE" for the full license governing this code.
|
||||||
|
*/
|
||||||
|
package com.todoroo.astrid.producteev.sync;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.ContentValues;
|
||||||
|
|
||||||
|
import com.todoroo.andlib.data.AbstractModel;
|
||||||
|
import com.todoroo.andlib.data.Property;
|
||||||
|
import com.todoroo.andlib.data.Table;
|
||||||
|
import com.todoroo.andlib.data.TodorooCursor;
|
||||||
|
import com.todoroo.andlib.data.Property.LongProperty;
|
||||||
|
import com.todoroo.andlib.data.Property.StringProperty;
|
||||||
|
import com.todoroo.astrid.model.Task;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data Model which represents a dashboard in Producteev
|
||||||
|
*
|
||||||
|
* @author Tim Su <tim@todoroo.com>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
public class ProducteevDashboard extends AbstractModel {
|
||||||
|
|
||||||
|
// --- table
|
||||||
|
|
||||||
|
public static final Table TABLE = new Table("dashboards", ProducteevDashboard.class);
|
||||||
|
|
||||||
|
// --- properties
|
||||||
|
|
||||||
|
/** ID (corresponds to RTM ID) */
|
||||||
|
public static final LongProperty ID = new LongProperty(
|
||||||
|
TABLE, ID_PROPERTY_NAME);
|
||||||
|
|
||||||
|
/** Name */
|
||||||
|
public static final StringProperty NAME = new StringProperty(
|
||||||
|
TABLE, "name");
|
||||||
|
|
||||||
|
/** List of all properties for this model */
|
||||||
|
public static final Property<?>[] PROPERTIES = generateProperties(ProducteevDashboard.class);
|
||||||
|
|
||||||
|
// --- defaults
|
||||||
|
|
||||||
|
/** Default values container */
|
||||||
|
private static final ContentValues defaultValues = new ContentValues();
|
||||||
|
|
||||||
|
// static {
|
||||||
|
// defaultValues.put(POSITION.name, 0);
|
||||||
|
// defaultValues.put(ARCHIVED.name, 0);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ContentValues getDefaultValues() {
|
||||||
|
return defaultValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- data access boilerplate
|
||||||
|
|
||||||
|
public ProducteevDashboard() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProducteevDashboard(TodorooCursor<ProducteevDashboard> cursor) {
|
||||||
|
this();
|
||||||
|
readPropertiesFromCursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readFromCursor(TodorooCursor<ProducteevDashboard> cursor) {
|
||||||
|
super.readPropertiesFromCursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getId() {
|
||||||
|
return getIdHelper(ID);
|
||||||
|
};
|
||||||
|
|
||||||
|
// --- parcelable helpers
|
||||||
|
|
||||||
|
private static final Creator<Task> CREATOR = new ModelCreator<Task>(Task.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Creator<? extends AbstractModel> getCreator() {
|
||||||
|
return CREATOR;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009, Todoroo Inc
|
||||||
|
* All Rights Reserved
|
||||||
|
* http://www.todoroo.com
|
||||||
|
*/
|
||||||
|
package com.todoroo.astrid.producteev.sync;
|
||||||
|
|
||||||
|
import com.todoroo.andlib.data.AbstractDatabase;
|
||||||
|
import com.todoroo.andlib.data.GenericDao;
|
||||||
|
import com.todoroo.andlib.data.Table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database wrapper
|
||||||
|
*
|
||||||
|
* @author Tim Su <tim@todoroo.com>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
public class ProducteevDatabase extends AbstractDatabase {
|
||||||
|
|
||||||
|
// --- constants
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database version number. This variable must be updated when database
|
||||||
|
* tables are updated, as it determines whether a database needs updating.
|
||||||
|
*/
|
||||||
|
public static final int VERSION = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database name (must be unique)
|
||||||
|
*/
|
||||||
|
private static final String NAME = "producteev";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of table/ If you're adding a new table, add it to this list and
|
||||||
|
* also make sure that our SQLite helper does the right thing.
|
||||||
|
*/
|
||||||
|
public static final Table[] TABLES = new Table[] {
|
||||||
|
ProducteevDashboard.TABLE,
|
||||||
|
};
|
||||||
|
|
||||||
|
// --- implementation
|
||||||
|
|
||||||
|
private final GenericDao<ProducteevDashboard> dao = new GenericDao<ProducteevDashboard>(ProducteevDashboard.class, this);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getVersion() {
|
||||||
|
return VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Table[] getTables() {
|
||||||
|
return TABLES;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenericDao<ProducteevDashboard> getDao() {
|
||||||
|
return dao;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreateTables() {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean onUpgrade(int oldVersion, int newVersion) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue