Add days API
parent
93350812a3
commit
01d4bd8489
|
@ -27,6 +27,11 @@ public class NativeX {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
public void getLocalDays(final String call, final long _ignore) {
|
||||||
|
mJsService.runAsync(call, () -> mQuery.getDays().toString().getBytes());
|
||||||
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void getLocalByDayId(final String call, final long dayId) {
|
public void getLocalByDayId(final String call, final long dayId) {
|
||||||
mJsService.runAsync(call, () -> mQuery.getByDayId(dayId).toString().getBytes());
|
mJsService.runAsync(call, () -> mQuery.getByDayId(dayId).toString().getBytes());
|
||||||
|
|
|
@ -128,9 +128,27 @@ public class TimelineQuery {
|
||||||
return new JSONArray(files);
|
return new JSONArray(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public JSONArray getDays(final long dayId) {
|
public JSONArray getDays() {
|
||||||
//
|
try (Cursor cursor = mDb.rawQuery(
|
||||||
// }
|
"SELECT dayid, COUNT(local_id) FROM images GROUP BY dayid",
|
||||||
|
null
|
||||||
|
)) {
|
||||||
|
JSONArray days = new JSONArray();
|
||||||
|
while (cursor.moveToNext()) {
|
||||||
|
long id = cursor.getLong(0);
|
||||||
|
long count = cursor.getLong(1);
|
||||||
|
days.put(new JSONObject()
|
||||||
|
.put("dayid", id)
|
||||||
|
.put("count", count)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return days;
|
||||||
|
} catch (JSONException e) {
|
||||||
|
Log.e(TAG, "JSON error");
|
||||||
|
return new JSONArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void fullSyncDb() {
|
protected void fullSyncDb() {
|
||||||
Uri collection = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
|
Uri collection = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
|
||||||
|
|
Loading…
Reference in New Issue