当前位置: 首页>>代码示例>>Java>>正文


Java DataMap.getDouble方法代码示例

本文整理汇总了Java中com.google.android.gms.wearable.DataMap.getDouble方法的典型用法代码示例。如果您正苦于以下问题:Java DataMap.getDouble方法的具体用法?Java DataMap.getDouble怎么用?Java DataMap.getDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.wearable.DataMap的用法示例。


在下文中一共展示了DataMap.getDouble方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDataChanged

import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
@Override
public void onDataChanged(DataEventBuffer dataEvents) {
    Log.d(LOG_TAG, " in data changed");
    for (DataEvent event : dataEvents) {
        if (event.getType() == DataEvent.TYPE_CHANGED) {
            // DataItem changed
            DataItem item = event.getDataItem();
            if (item.getUri().getPath().compareTo(WEATHER_PATH) == 0) {
                DataMap dataMap = DataMapItem.fromDataItem(item).getDataMap();
                weather_id = dataMap.getInt(WEATHER_ID);
                high_temp = dataMap.getDouble(HIGH_TEMP);
                low_temp = dataMap.getDouble(LOW_TEMP);
            }
        } else if (event.getType() == DataEvent.TYPE_DELETED) {
            // DataItem deleted
        }
    }
    invalidate();
}
 
开发者ID:rashikaranpuria,项目名称:ubiquitous,代码行数:20,代码来源:MyWatchFace.java

示例2: addDataMap

import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
public void addDataMap(DataMap dataMap) {//KS
    double sgv = dataMap.getDouble("sgvDouble");
    double high = dataMap.getDouble("high");
    double low = dataMap.getDouble("low");
    double timestamp = dataMap.getDouble("timestamp");

    //Log.d(TAG, "addToWatchSet entry=" + dataMap);

    final int size = bgDataList.size();
    BgWatchData bgdata = new BgWatchData(sgv, high, low, timestamp);
    if (size > 0) {
        if (bgDataList.contains(bgdata)) {
            int i = bgDataList.indexOf(bgdata);
            BgWatchData bgd = bgDataList.get(bgDataList.indexOf(bgdata));
            //Log.d(TAG, "addToWatchSet replace indexOf=" + i + " bgDataList.sgv=" + bgd.sgv + " bgDataList.timestamp" + bgd.timestamp);
            bgDataList.set(i, bgdata);
        } else {
            //Log.d(TAG, "addToWatchSet add " + " entry.sgv=" + bgdata.sgv + " entry.timestamp" + bgdata.timestamp);
            bgDataList.add(bgdata);
        }
    }
    else {
        bgDataList.add(bgdata);
    }
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:26,代码来源:BIGChart.java

示例3: createTreatment

import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
public synchronized static void createTreatment(DataMap dataMap, Context context) {
    Log.d(TAG, "createTreatment dataMap=" + dataMap);
    double timeoffset = dataMap.getDouble("timeoffset", 0);
    double carbs = dataMap.getDouble("carbs", 0);
    double insulin = dataMap.getDouble("insulin", 0);
    double bloodtest = dataMap.getDouble("bloodtest", 0);
    String notes = dataMap.getString("notes", "");

    long timestamp_ms = Treatments.getTimeStampWithOffset(timeoffset);
    Treatments treatment = Treatments.create(carbs, insulin, notes, timestamp_ms);
    if (bloodtest > 0) {
        Log.d(TAG, "createTreatment bloodtest=" + bloodtest);
        BloodTest.createFromCal(bloodtest, timeoffset, "Manual Entry", treatment.uuid);
    }
    else Log.d(TAG, "createTreatment bloodtest=0 " + bloodtest);
    showTreatments(context, "all");
    SendData(context, SYNC_TREATMENTS_PATH, null);
    //requestData(context);//send to phone if connected
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:20,代码来源:ListenerService.java

示例4: resetDataToLatest

import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
private boolean resetDataToLatest(DataMap dataMap, Context context) {//KS
    if (dataMap != null) {
        Double dmTimestamp = dataMap.getDouble("timestamp");
        Log.d(TAG, "resetDataToLatest dataMap.datetime=" + JoH.dateTimeText(dmTimestamp.longValue()) + " dataMap.sgvDouble=" + dataMap.getDouble("sgvDouble"));
        Sensor.InitDb(context);//ensure database has already been initialized
        final BgReading last = BgReading.last();
        if (last != null) {
            long bgTimestamp = last.timestamp;
            Log.d(TAG, "resetDataToLatest last.timestamp=" + JoH.dateTimeText(bgTimestamp) + " last.calculated_value=" + last.calculated_value);
            if (bgTimestamp > dmTimestamp) {
                dataMap(dataMap, last, mPrefs, new com.eveningoutpost.dexdrip.UtilityModels.BgGraphBuilder(context));
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:18,代码来源:ListenerService.java

示例5: onDataChanged

import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
@Override
public void onDataChanged(DataEventBuffer dataEventBuffer) {
    Log.d(TAG, "onDataChanged");
    for (DataEvent event : dataEventBuffer) {
        if (event.getType() == DataEvent.TYPE_CHANGED) {
            // DataItem changed
            DataItem item = event.getDataItem();
            String path = item.getUri().getPath();
            Log.d(TAG, "path: " + path);

            if (path.equals(REQ_PATH)) {
                DataMap dataMap = DataMapItem.fromDataItem(item).getDataMap();

                mWeatherId = dataMap.getInt(KEY_WEATHER_ID);
                mMaxTemperature = dataMap.getDouble(KEY_TEMP_MAX);
                mMinTemperature = dataMap.getDouble(KEY_TEMP_MIN);
                mLocation = dataMap.getString(KEY_LOCATION);

                invalidate();
            }
        }
    }

    dataEventBuffer.release();
}
 
开发者ID:pmatushkin,项目名称:Sunshine.Wear,代码行数:26,代码来源:SunshineWatchFace.java

示例6: onDataChanged

import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
@Override
public void onDataChanged(DataEventBuffer dataEventBuffer) {
    Log.d(LOG_TAG, "Weather data has been changed!");
    for (DataEvent event : dataEventBuffer) {
        DataItem item = event.getDataItem();
        if (WEATHER_DATA_PATH.equals(item.getUri().getPath())) {
            DataMap dataMap = DataMapItem.fromDataItem(item).getDataMap();
            double high = dataMap.getDouble(WEATHER_DATA_HIGH);
            double low = dataMap.getDouble(WEATHER_DATA_LOW);
            long id = dataMap.getLong(WEATHER_DATA_ID);

            mWeather = (int) Math.round(high) + "/" +  (int) Math.round(low);
            mWeatherId = (int) id;

            loadIconForWeatherId();

            SharedPreferences preferences = getSharedPreferences(PREFERENCES, MODE_PRIVATE);
            SharedPreferences.Editor editor = preferences.edit();
            editor.putString(KEY_WEATHER, mWeather);
            editor.putInt(KEY_WEATHER_ID, mWeatherId);
            editor.apply();
        }
    }
}
 
开发者ID:DmitryMalkovich,项目名称:go-ubiquitous,代码行数:25,代码来源:SunshineWatchFace.java

示例7: loadBasalsAndTemps

import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
private void loadBasalsAndTemps(DataMap dataMap) {
    ArrayList<DataMap> temps = dataMap.getDataMapArrayList("temps");
    if (temps != null) {
        tempWatchDataList = new ArrayList<>();
        for (DataMap temp : temps) {
            TempWatchData twd = new TempWatchData();
            twd.startTime = temp.getLong("starttime");
            twd.startBasal =  temp.getDouble("startBasal");
            twd.endTime = temp.getLong("endtime");
            twd.endBasal = temp.getDouble("endbasal");
            twd.amount = temp.getDouble("amount");
            tempWatchDataList.add(twd);
        }
    }
    ArrayList<DataMap> basals = dataMap.getDataMapArrayList("basals");
    if (basals != null) {
        basalWatchDataList = new ArrayList<>();
        for (DataMap basal : basals) {
            BasalWatchData bwd = new BasalWatchData();
            bwd.startTime = basal.getLong("starttime");
            bwd.endTime = basal.getLong("endtime");
            bwd.amount = basal.getDouble("amount");
            basalWatchDataList.add(bwd);
        }
    }
}
 
开发者ID:MilosKozak,项目名称:AndroidAPS,代码行数:27,代码来源:BIGChart.java

示例8: onDataChanged

import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
@Override
public void onDataChanged(DataEventBuffer dataEventBuffer) {
    if (dataEventBuffer == null) {
        weatherInformationListener.onWeatherInformationFetchFailure();
        return;
    }
    for (DataEvent dataEvent : dataEventBuffer) {
        if (doesHaveWeatherData(dataEvent)) {
            DataMap weatherDataMap = getWeatherDataMap(dataEvent);
            Double high = weatherDataMap.getDouble(WeatherRequestKeys.HIGH);
            Double low = weatherDataMap.getDouble(WeatherRequestKeys.LOW);
            weatherInformationListener.onTemperatureFetchSuccess(high, low);
            fetchWeatherIconAsynchronously(weatherDataMap);
            return;
        }
    }
}
 
开发者ID:chi6rag,项目名称:SunshineWear,代码行数:18,代码来源:SunshineClient.java

示例9: extractMeasureFromDataMap

import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
/**
 *
 * @param dataMap data map filled with measure information
 * @return the measure object created via the datamap
 */
private Measure extractMeasureFromDataMap(DataMap dataMap)
{
    Measure measure=new Measure();
    measure.setId(dataMap.getLong(Const.KEY_MEASURE_ID));
    measure.setCategory(dataMap.getString(Const.KEY_MEASURE_CATEGORY));
    measure.setTimeStamp(dataMap.getLong(Const.KEY_MEASURE_TIMESTAMP));
    measure.setValue1(dataMap.getDouble(Const.KEY_MEASURE_VALUE1));
    Double measure2=null;
    //the 10000 is identifed as a null value
    if (dataMap.getDouble(Const.KEY_MEASURE_VALUE2)!=Const.NULL_IDENTIFIER)
        measure2=dataMap.getDouble(Const.KEY_MEASURE_VALUE2);
    measure.setValue2(measure2);
    return measure;
}
 
开发者ID:kflauri2312lffds,项目名称:Android_watch_magpie,代码行数:20,代码来源:Listener_data_measure.java

示例10: addDataMapTreats

import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
public void addDataMapTreats(DataMap dataMap, ArrayList<BgWatchData> dataList) {//KS
    double sgv = dataMap.getDouble("sgvDouble");
    double high = dataMap.getDouble("high");//carbs
    double low = dataMap.getDouble("low");//insulin
    double timestamp = dataMap.getDouble("timestamp");

    if (d) Log.d(TAG, "addDataMapTreats entry=" + dataMap);

    final int size = (dataList != null ? dataList.size() : 0);
    BgWatchData bgdata = new BgWatchData(sgv, high, low, timestamp);
    if (d) Log.d(TAG, "addDataMapTreats bgdata.sgv=" + bgdata.sgv + " bgdata.carbs=" + bgdata.high  + " bgdata.insulin=" + bgdata.low + " bgdata.timestamp=" + bgdata.timestamp + " timestamp=" + JoH.dateTimeText((long)bgdata.timestamp));
    if (size > 0) {
        if (dataList.contains(bgdata)) {
            int i = dataList.indexOf(bgdata);
            if (d) {
                BgWatchData data = dataList.get(dataList.indexOf(bgdata));
                Log.d(TAG, "addDataMapTreats replace indexOf=" + i + " treatsDataList.carbs=" + data.high + " treatsDataList.insulin=" + data.low + " treatsDataList.timestamp=" + data.timestamp);
            }
            dataList.set(i, bgdata);
        } else {
            if (d) Log.d(TAG, "addDataMapTreats add " + " treatsDataList.carbs=" + bgdata.high  + " treatsDataList.insulin=" + bgdata.low + " entry.timestamp=" + bgdata.timestamp);
            dataList.add(bgdata);
        }
    }
    else {
        dataList.add(bgdata);
    }
    if (d) Log.d(TAG, "addDataMapTreats dataList.size()=" + dataList.size());
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:30,代码来源:BIGChart.java

示例11: addDataMapTreats

import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
public void addDataMapTreats(DataMap dataMap, ArrayList<BgWatchData> dataList) {//KS
    double sgv = dataMap.getDouble("sgvDouble");
    double high = dataMap.getDouble("high");//carbs
    double low = dataMap.getDouble("low");//insulin
    double timestamp = dataMap.getDouble("timestamp");

     if (d) Log.d(TAG, "addDataMapTreats entry=" + dataMap);

    final int size = (dataList != null ? dataList.size() : 0);
    BgWatchData bgdata = new BgWatchData(sgv, high, low, timestamp);
    if (d) Log.d(TAG, "addDataMapTreats bgdata.sgv=" + bgdata.sgv + " bgdata.carbs=" + bgdata.high  + " bgdata.insulin=" + bgdata.low + " bgdata.timestamp=" + bgdata.timestamp + " timestamp=" + JoH.dateTimeText((long)bgdata.timestamp));
    if (size > 0) {
        if (dataList.contains(bgdata)) {
            int i = dataList.indexOf(bgdata);
            if (d) {
                BgWatchData data = dataList.get(dataList.indexOf(bgdata));
                Log.d(TAG, "addDataMapTreats replace indexOf=" + i + " treatsDataList.carbs=" + data.high + " treatsDataList.insulin=" + data.low + " treatsDataList.timestamp=" + data.timestamp);
            }
            dataList.set(i, bgdata);
        } else {
            if (d) Log.d(TAG, "addDataMapTreats add " + " treatsDataList.carbs=" + bgdata.high  + " treatsDataList.insulin=" + bgdata.low + " entry.timestamp=" + bgdata.timestamp);
            dataList.add(bgdata);
        }
    }
    else {
        dataList.add(bgdata);
    }
     if (d) Log.d(TAG, "addDataMapTreats dataList.size()=" + dataList.size());
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:30,代码来源:BaseWatchFace.java


注:本文中的com.google.android.gms.wearable.DataMap.getDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。