use ORDER BY timestamp in SQL statement
Also optimize imports...
This commit is contained in:
parent
e79f4523c3
commit
900b3f3833
|
@ -1,21 +1,12 @@
|
||||||
package nodomain.freeyourgadget.gadgetbridge;
|
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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommand;
|
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.GBDeviceCommandSendBytes;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandSleepMonitorResult;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandVersionInfo;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceProtocol;
|
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceProtocol;
|
||||||
|
|
||||||
public abstract class AbstractBTDeviceSupport extends AbstractDeviceSupport {
|
public abstract class AbstractBTDeviceSupport extends AbstractDeviceSupport {
|
||||||
|
|
|
@ -12,7 +12,6 @@ import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommand;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandAppInfo;
|
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandAppInfo;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandCallControl;
|
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandCallControl;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandMusicControl;
|
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandMusicControl;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandSendBytes;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandSleepMonitorResult;
|
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandSleepMonitorResult;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandVersionInfo;
|
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceCommandVersionInfo;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBActivitySample;
|
import nodomain.freeyourgadget.gadgetbridge.GBActivitySample;
|
||||||
|
|
||||||
|
@ -85,7 +84,7 @@ public class ActivityDatabaseHandler extends SQLiteOpenHelper {
|
||||||
}
|
}
|
||||||
ArrayList<GBActivitySample> GBActivitySampleList = new ArrayList<GBActivitySample>();
|
ArrayList<GBActivitySample> GBActivitySampleList = new ArrayList<GBActivitySample>();
|
||||||
String selectQuery = "SELECT * FROM " + TABLE_GBACTIVITYSAMPLES
|
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();
|
SQLiteDatabase db = this.getWritableDatabase();
|
||||||
Cursor cursor = db.rawQuery(selectQuery, null);
|
Cursor cursor = db.rawQuery(selectQuery, null);
|
||||||
|
|
Loading…
Reference in New Issue