本文整理汇总了Java中com.google.android.gms.wearable.DataMap.putDouble方法的典型用法代码示例。如果您正苦于以下问题:Java DataMap.putDouble方法的具体用法?Java DataMap.putDouble怎么用?Java DataMap.putDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.wearable.DataMap
的用法示例。
在下文中一共展示了DataMap.putDouble方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateDataMap
import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
private DataMap generateDataMap(CustomRules aRule)
{
DataMap dataMap=new DataMap();
dataMap.putLong(Const.KEY_CURRENTTIMESTAMP,System.currentTimeMillis());
dataMap.putLong(Const.KEY_RULE_ID,aRule.getId());
dataMap.putString(Const.KEY_RULE_CATEGORY,aRule.getCategory());
dataMap.putString(Const.KEY_RULE_CONSTRAINT1,aRule.getConstraint_1());
dataMap.putString(Const.KEY_RULE_CONSTRAINT2,aRule.getConstraint_2());
dataMap.putString(Const.KEY_RULE_CONSTRAINT3,aRule.getConstraint_3());
//if null, we send the number -100000. We will have to check on the other side
dataMap.putDouble(Const.KEY_RULE_VAL1_MIN, formatValue(aRule.getVal_1_min()));
dataMap.putDouble(Const.KEY_RULE_VAL1_MAX,formatValue(aRule.getVal_1_max()));
dataMap.putDouble(Const.KEY_RULE_VAL2_MIN,formatValue(aRule.getVal_2_min()));
dataMap.putDouble(Const.KEY_RULE_VAL2_MAX, formatValue(aRule.getVal_2_max()));
return dataMap;
}
示例2: prepareDataMap
import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
/**
* Used when a user update a rule. It will be send to the watch
* @param rule : The current rule we want to send though a datamap (container)
* @return The datamap that contain the rule
*/
private DataMap prepareDataMap(CustomRules rule)
{
//create the value container
DataMap dataContainer=new DataMap();
//insert the rule value
dataContainer.putLong(Const.KEY_RULE_ID,rule.getId());
dataContainer.putString(Const.KEY_RULE_CATEGORY,rule.getCategory());
dataContainer.putString(Const.KEY_RULE_CONSTRAINT1,rule.getConstraint_1());
dataContainer.putString(Const.KEY_RULE_CONSTRAINT2,rule.getConstraint_2());
dataContainer.putString(Const.KEY_RULE_CONSTRAINT3,rule.getConstraint_3());
dataContainer.putDouble(Const.KEY_RULE_VAL1_MIN,formatDataMapValue( rule.getVal_1_min()));
dataContainer.putDouble(Const.KEY_RULE_VAL1_MAX,formatDataMapValue(rule.getVal_1_max()));
dataContainer.putDouble(Const.KEY_RULE_VAL2_MIN,formatDataMapValue(rule.getVal_2_min()));
dataContainer.putDouble(Const.KEY_RULE_VAL2_MAX,formatDataMapValue(rule.getVal_2_max()));
dataContainer.putLong(Const.KEY_CURRENTTIMESTAMP,System.currentTimeMillis());
return dataContainer;
}
示例3: sendData
import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
private void sendData() {
ArrayList<Double> tempValues = ForecastFragment.getTempValues();
Log.v("TAG", tempValues.size()+"");
final DataMap dataMap = new DataMap();
dataMap.putDouble("max", tempValues.get(0));
dataMap.putDouble("min", tempValues.get(1));
dataMap.putInt("icon", ForecastFragment.getIconId());
dataMap.putLong("timestamp", System.currentTimeMillis());
new Thread( new Runnable() {
@Override
public void run() {
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(MOBILE_MESSAGE_PATH).setUrgent();
dataMapRequest.getDataMap().putAll(dataMap);
PutDataRequest request = dataMapRequest.asPutDataRequest();
DataApi.DataItemResult result = Wearable.DataApi.putDataItem(mApiClient, request).await();
if(result.getStatus().isSuccess()){
Log.v("TAG", "Sent successfully");
}else {
Log.v("TAG", "Failed to send");
}
}
}).start();
}
示例4: Approve
import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
public void Approve(View myview) {
if (watchkeypad) {
//Treatments.create(carbs, insulin, thisnotes, new Date().getTime());
DataMap dataMap = new DataMap();
dataMap.putDouble("timeoffset", timeoffset);
dataMap.putDouble("carbs", carbs);
dataMap.putDouble("insulin", insulin);
dataMap.putDouble("bloodtest", bloodtest);
dataMap.putString("notes", thisnotes);
//dataMap.putLong("timestamp", System.currentTimeMillis());
ListenerService.createTreatment(dataMap, this);
}
else
SendData(this, WEARABLE_APPROVE_TREATMENT, null);
finish();
}
示例5: buildWeatherRequest
import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
@NonNull
private PutDataRequest buildWeatherRequest(double high, double low, Asset weatherAsset) {
PutDataMapRequest weatherDataMapRequest = PutDataMapRequest.create(PATH_DATA_WEATHER + System.currentTimeMillis());
DataMap weatherRequestDataMap = weatherDataMapRequest.getDataMap();
weatherRequestDataMap.putDouble("high", high);
weatherRequestDataMap.putDouble("low", low);
weatherRequestDataMap.putAsset("icon", weatherAsset);
PutDataRequest weatherRequest = weatherDataMapRequest.asPutDataRequest();
weatherRequest.setUrgent();
return weatherRequest;
}
示例6: sendTreatment
import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
public synchronized static void sendTreatment(String notes) {
Log.d(TAG, "sendTreatment WEARABLE_TREATMENT_PAYLOAD notes=" + notes);
DataMap dataMap = new DataMap();
dataMap.putDouble("timestamp", System.currentTimeMillis());
dataMap.putBoolean("watchkeypad", true);
dataMap.putString("notes", notes);
dataMap.putBoolean("ismgdl", doMgdl(PreferenceManager.getDefaultSharedPreferences(xdrip.getAppContext())));
Intent intent = new Intent(xdrip.getAppContext(), Simulation.class);
intent.putExtra(WEARABLE_TREATMENT_PAYLOAD, dataMap.toBundle());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
xdrip.getAppContext().startActivity(intent);
}
示例7: dataMapForWatchface
import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
private static DataMap dataMapForWatchface(Treatments data) {
DataMap dataMap = new DataMap();
//dataMap.putString("notes", data.notes);//TODO
dataMap.putDouble("timestamp", data.timestamp);
dataMap.putDouble("high", data.carbs);
dataMap.putDouble("low", data.insulin);
return dataMap;
}
示例8: tempDatamap
import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
private DataMap tempDatamap(long startTime, double startBasal, long to, double toBasal, double amount) {
DataMap dm = new DataMap();
dm.putLong("starttime", startTime);
dm.putDouble("startBasal", startBasal);
dm.putLong("endtime", to);
dm.putDouble("endbasal", toBasal);
dm.putDouble("amount", amount);
return dm;
}
示例9: basalMap
import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
private DataMap basalMap(long startTime, long endTime, double amount) {
DataMap dm = new DataMap();
dm.putLong("starttime", startTime);
dm.putLong("endtime", endTime);
dm.putDouble("amount", amount);
return dm;
}
示例10: dataMapSingleBG
import com.google.android.gms.wearable.DataMap; //导入方法依赖的package包/类
private DataMap dataMapSingleBG(BgReading lastBG, GlucoseStatus glucoseStatus) {
String units = MainApp.getConfigBuilder().getProfileUnits();
Double lowLine = SafeParse.stringToDouble(mPrefs.getString("low_mark", "0"));
Double highLine = SafeParse.stringToDouble(mPrefs.getString("high_mark", "0"));
//convert to mg/dl
if (!units.equals(Constants.MGDL)) {
lowLine *= Constants.MMOLL_TO_MGDL;
highLine *= Constants.MMOLL_TO_MGDL;
}
if (lowLine < 1) {
lowLine = OverviewPlugin.bgTargetLow;
}
if (highLine < 1) {
highLine = OverviewPlugin.bgTargetHigh;
}
long sgvLevel = 0l;
if (lastBG.value > highLine) {
sgvLevel = 1;
} else if (lastBG.value < lowLine) {
sgvLevel = -1;
}
DataMap dataMap = new DataMap();
int battery = getBatteryLevel(getApplicationContext());
dataMap.putString("sgvString", lastBG.valueToUnitsToString(units));
dataMap.putDouble("timestamp", lastBG.date);
if (glucoseStatus == null) {
dataMap.putString("slopeArrow", "");
dataMap.putString("delta", "");
dataMap.putString("avgDelta", "");
} else {
dataMap.putString("slopeArrow", slopeArrow(glucoseStatus.delta));
dataMap.putString("delta", deltastring(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units));
dataMap.putString("avgDelta", deltastring(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, units));
}
dataMap.putString("battery", "" + battery);
dataMap.putLong("sgvLevel", sgvLevel);
dataMap.putInt("batteryLevel", (battery >= 30) ? 1 : 0);
dataMap.putDouble("sgvDouble", lastBG.value);
dataMap.putDouble("high", highLine);
dataMap.putDouble("low", lowLine);
return dataMap;
}