From 900b3f3833ecfc5f62b4487021f3a115e84e5c79 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sat, 30 May 2015 17:40:23 +0200 Subject: [PATCH] use ORDER BY timestamp in SQL statement Also optimize imports... --- .../gadgetbridge/AbstractBTDeviceSupport.java | 9 --------- .../gadgetbridge/AbstractDeviceSupport.java | 1 - .../gadgetbridge/database/ActivityDatabaseHandler.java | 3 +-- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/AbstractBTDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/AbstractBTDeviceSupport.java index 39daeaad..abb3ca3d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/AbstractBTDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/AbstractBTDeviceSupport.java @@ -1,21 +1,12 @@ package nodomain.freeyourgadget.gadgetbridge; -import android.content.Context; -import android.content.Intent; -import android.support.v4.content.LocalBroadcastManager; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.UUID; import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommand; -import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandAppInfo; -import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandCallControl; -import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandMusicControl; import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandSendBytes; -import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandSleepMonitorResult; -import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandVersionInfo; import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceProtocol; public abstract class AbstractBTDeviceSupport extends AbstractDeviceSupport { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/AbstractDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/AbstractDeviceSupport.java index f811f724..4b2603e1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/AbstractDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/AbstractDeviceSupport.java @@ -12,7 +12,6 @@ import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommand; import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandAppInfo; import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandCallControl; import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandMusicControl; -import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandSendBytes; import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandSleepMonitorResult; import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandVersionInfo; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/ActivityDatabaseHandler.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/ActivityDatabaseHandler.java index e073cc1a..442e53d6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/ActivityDatabaseHandler.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/ActivityDatabaseHandler.java @@ -7,7 +7,6 @@ import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import java.util.ArrayList; -import java.util.List; import nodomain.freeyourgadget.gadgetbridge.GBActivitySample; @@ -85,7 +84,7 @@ public class ActivityDatabaseHandler extends SQLiteOpenHelper { } ArrayList GBActivitySampleList = new ArrayList(); String selectQuery = "SELECT * FROM " + TABLE_GBACTIVITYSAMPLES - + " where (provider=" + provider + " and timestamp>=" + timestamp_from + " and timestamp<=" + timestamp_to + ")"; + + " where (provider=" + provider + " and timestamp>=" + timestamp_from + " and timestamp<=" + timestamp_to + ") order by timestamp"; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null);