Actually remove that implicit "current date" handling

We now manage days explicitly in the UI.
This commit is contained in:
cpfeiffer 2015-09-01 22:43:31 +02:00
parent d791054e42
commit c49c795b1d
2 changed files with 5 additions and 11 deletions

View File

@ -272,9 +272,6 @@ public abstract class AbstractChartFragment extends AbstractGBFragment {
* @param tsTo
*/
protected List<ActivitySample> getAllSamples(DBHandler db, GBDevice device, int tsFrom, int tsTo) {
if (tsFrom == -1) {
tsFrom = getTSLast24Hours(tsTo);
}
SampleProvider provider = getProvider(device);
return db.getAllActivitySamples(tsFrom, tsTo, provider);
}
@ -284,18 +281,12 @@ public abstract class AbstractChartFragment extends AbstractGBFragment {
}
protected List<ActivitySample> getActivitySamples(DBHandler db, GBDevice device, int tsFrom, int tsTo) {
if (tsFrom == -1) {
tsFrom = getTSLast24Hours(tsTo);
}
SampleProvider provider = getProvider(device);
return db.getActivitySamples(tsFrom, tsTo, provider);
}
protected List<ActivitySample> getSleepSamples(DBHandler db, GBDevice device, int tsFrom, int tsTo) {
if (tsFrom == -1) {
tsFrom = getTSLast24Hours(tsTo);
}
SampleProvider provider = getProvider(device);
return db.getSleepSamples(tsFrom, tsTo, provider);
}

View File

@ -162,8 +162,11 @@ public class ActivityDatabaseHandler extends SQLiteOpenHelper implements DBHandl
* @return
*/
private ArrayList<ActivitySample> getGBActivitySamples(int timestamp_from, int timestamp_to, int activityTypes, SampleProvider provider) {
if (timestamp_to == -1) {
timestamp_to = Integer.MAX_VALUE; // dont know what happens when I use more than max of a signed int
if (timestamp_to < 0) {
throw new IllegalArgumentException("negative timestamp_to");
}
if (timestamp_from < 0) {
throw new IllegalArgumentException("negative timestamp_from");
}
ArrayList<ActivitySample> samples = new ArrayList<ActivitySample>();
final String where = "(provider=" + provider.getID() + " and timestamp>=" + timestamp_from + " and timestamp<=" + timestamp_to + getWhereClauseFor(activityTypes, provider) + ")";