Search in sources :

Example 6 with DataMap

use of com.google.android.gms.wearable.DataMap in project ETSMobile-Android2 by ApplETS.

the class Seances method putData.

public DataMap putData() {
    DataMap map = new DataMap();
    map.putString("dateDebut", dateDebut);
    map.putString("dateFin", dateFin);
    map.putString("coursGroupe", coursGroupe);
    map.putString("nomActivite", nomActivite);
    map.putString("local", local);
    map.putString("descriptionActivite", descriptionActivite);
    map.putString("libelleCours", libelleCours);
    return map;
}
Also used : DataMap(com.google.android.gms.wearable.DataMap)

Example 7 with DataMap

use of com.google.android.gms.wearable.DataMap in project xDrip by NightscoutFoundation.

the class BaseWatchFace method addToWatchSet.

public void addToWatchSet(DataMap dataMap) {
    Log.d(TAG, "addToWatchSet bgDataList.size()=" + bgDataList.size());
    ArrayList<DataMap> entries = dataMap.getDataMapArrayList("entries");
    if (entries != null) {
        Log.d(TAG, "addToWatchSet entries.size()=" + entries.size());
        for (DataMap entry : entries) {
            addDataMap(entry);
        }
    } else {
        addDataMap(dataMap);
    }
    for (int i = 0; i < bgDataList.size(); i++) {
        if (bgDataList.get(i).timestamp < (new Date().getTime() - (1000 * 60 * 60 * 5))) {
            Log.d(TAG, "addToWatchSet Remove bgDataList.get(i).timestamp: " + JoH.dateTimeText((long) bgDataList.get(i).timestamp) + " i: " + i);
            // Get rid of anything more than 5 hours old
            bgDataList.remove(i);
        }
    }
}
Also used : Point(android.graphics.Point) Paint(android.graphics.Paint) Date(java.util.Date) DataMap(com.google.android.gms.wearable.DataMap)

Example 8 with DataMap

use of com.google.android.gms.wearable.DataMap in project xDrip by NightscoutFoundation.

the class BIGChart method addToWatchSetTreats.

public void addToWatchSetTreats(DataMap dataMap, ArrayList<BgWatchData> dataList) {
    if (d)
        Log.d(TAG, "addToWatchSetTreats dataList.size()=" + (dataList != null ? dataList.size() : "0"));
    // necessary since treatments, bloodtest and calibrations can be deleted/invalidated
    dataList.clear();
    ArrayList<DataMap> entries = dataMap.getDataMapArrayList("entries");
    if (entries != null) {
        if (d)
            Log.d(TAG, "addToWatchSetTreats entries.size()=" + entries.size() + " entries=" + entries);
        for (DataMap entry : entries) {
            addDataMapTreats(entry, dataList);
        }
    }
    if (d)
        Log.d(TAG, "addToWatchSetTreats dataList.size()=" + dataList.size());
}
Also used : DataMap(com.google.android.gms.wearable.DataMap)

Example 9 with DataMap

use of com.google.android.gms.wearable.DataMap in project xDrip by NightscoutFoundation.

the class ListenerService method dataMap.

private DataMap dataMap(Treatments log) {
    DataMap dataMap = new DataMap();
    // String json = log.toS();
    // Log.d(TAG, "dataMap PebbleMovement GSON: " + json);
    // dataMap.putString("entry", json);
    // dataMap.putLong("timestamp", log.timestamp);
    String notes = log.uuid + " uuid " + log.notes;
    Log.d(TAG, "dataMap Treatments notes:" + notes);
    dataMap.putString("entry", notes);
    dataMap.putLong("timestamp", log.systimestamp);
    return dataMap;
}
Also used : DataMap(com.google.android.gms.wearable.DataMap)

Example 10 with DataMap

use of com.google.android.gms.wearable.DataMap in project xDrip by NightscoutFoundation.

the class ListenerService method getTreatments.

public static DataMap getTreatments(long startTime) {
    Treatments last = Treatments.last();
    if (last != null) {
        Log.d(TAG, "getTreatments last.timestamp:" + JoH.dateTimeText(last.timestamp));
    }
    List<Treatments> graph = Treatments.latestForGraph(60, startTime);
    if (!graph.isEmpty()) {
        Log.d(TAG, "getTreatments graph size=" + graph.size());
        final ArrayList<DataMap> dataMaps = new ArrayList<>(graph.size());
        DataMap entries = null;
        // if (includeTreatment(last)) entries = dataMapForWatchface(last);
        for (Treatments data : graph) {
            if (includeTreatment(data)) {
                if (entries == null) {
                    entries = dataMapForWatchface(data);
                    dataMaps.add(dataMapForWatchface(data));
                } else
                    dataMaps.add(dataMapForWatchface(data));
            }
        }
        if (entries != null) {
            entries.putDataMapArrayList("entries", dataMaps);
            Log.d(TAG, "getTreatments entries=" + entries);
        }
        return entries;
    } else
        return null;
}
Also used : ArrayList(java.util.ArrayList) Treatments(com.eveningoutpost.dexdrip.Models.Treatments) DataMap(com.google.android.gms.wearable.DataMap)

Aggregations

DataMap (com.google.android.gms.wearable.DataMap)157 Date (java.util.Date)42 ArrayList (java.util.ArrayList)38 Gson (com.google.gson.Gson)20 BgReading (com.eveningoutpost.dexdrip.Models.BgReading)18 GsonBuilder (com.google.gson.GsonBuilder)18 DateTypeAdapter (com.google.gson.internal.bind.DateTypeAdapter)18 Intent (android.content.Intent)17 Sensor (com.eveningoutpost.dexdrip.Models.Sensor)14 SuppressLint (android.annotation.SuppressLint)12 PendingIntent (android.app.PendingIntent)11 Context (android.content.Context)8 Calibration (com.eveningoutpost.dexdrip.Models.Calibration)8 Treatments (com.eveningoutpost.dexdrip.Models.Treatments)8 Bundle (android.os.Bundle)6 HeartRate (com.eveningoutpost.dexdrip.Models.HeartRate)6 Paint (android.graphics.Paint)5 BloodTest (com.eveningoutpost.dexdrip.Models.BloodTest)5 BroadcastReceiver (android.content.BroadcastReceiver)4 SharedPreferences (android.content.SharedPreferences)4