Java Code Examples for com.google.android.gms.wearable.DataMap#keySet()
The following examples show how to use
com.google.android.gms.wearable.DataMap#keySet() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DigitalWatchFaceService.java From wear-os-samples with Apache License 2.0 | 6 votes |
private void updateUiForConfigDataMap(final DataMap config) { boolean uiUpdated = false; for (String configKey : config.keySet()) { if (!config.containsKey(configKey)) { continue; } int color = config.getInt(configKey); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Found watch face config key: " + configKey + " -> " + Integer.toHexString(color)); } if (updateUiForKey(configKey, color)) { uiUpdated = true; } } if (uiUpdated) { invalidate(); } }
Example 2
Source File: DataLayerListenerService.java From LibreAlarm with GNU General Public License v3.0 | 6 votes |
@Override public void onDataChanged(DataEventBuffer dataEvents) { for (DataEvent event : dataEvents) { if (event.getType() == DataEvent.TYPE_CHANGED) { // Check the data path String path = event.getDataItem().getUri().getPath(); if (WearableApi.SETTINGS.equals(path)) { HashMap<String, String> newSettings = new HashMap<>(); DataMap dataMap = DataMapItem.fromDataItem(event.getDataItem()).getDataMap(); for (String key : dataMap.keySet()) { newSettings.put(key, dataMap.getString(key, null)); PreferencesUtil.putString(this, key, newSettings.get(key)); } WearableApi.sendMessage(mGoogleApiClient, WearableApi.SETTINGS, PreferencesUtil.toString(newSettings), null); sendStatus(mGoogleApiClient); } } } }
Example 3
Source File: SunsetsWatchFace.java From american-sunsets-watch-face with Apache License 2.0 | 6 votes |
private void updateUiForConfigDataMap(final DataMap config) { boolean uiUpdated = false; for (String configKey : config.keySet()) { if (!config.containsKey(configKey)) { continue; } int color = config.getInt(configKey); Log.d(TAG, "Found watch face config key: " + configKey + " -> " + color); if (updateUiForKey(configKey, color)) { uiUpdated = true; } } if (uiUpdated) { invalidate(); } }
Example 4
Source File: ConfigHelper.java From FORMWatchFace with Apache License 2.0 | 6 votes |
public void putConfigSharedPrefsToDataLayer() { DataMap newDataMap = readConfigDataMapFromSharedPrefs(); if (newDataMap == null) { return; } DataMap currentDataMap = readConfigDataMapFromDataLayer(); boolean dirty = true; if (currentDataMap != null) { dirty = false; for (String key : newDataMap.keySet()) { Object newValue = newDataMap.get(key); if (newValue != null && !newValue.equals(currentDataMap.get(key))) { dirty = true; break; } } } if (dirty) { putConfigDataMapToDataLayer(newDataMap); } disconnect(); }
Example 5
Source File: BundleMock.java From AndroidAPS with GNU Affero General Public License v3.0 | 5 votes |
public static Bundle mock(DataMap dataMap) { HashMap<String, Object> hm = new HashMap<>(); for (String key : dataMap.keySet()) { hm.put(key, dataMap.get(key)); } return mock(hm); }
Example 6
Source File: SunsetsGeneralWearableConfigActivity.java From american-sunsets-watch-face with Apache License 2.0 | 5 votes |
private void updateUiForConfigDataMap(final DataMap config) { boolean uiUpdated = false; for (String configKey : config.keySet()) { if (!config.containsKey(configKey)) { continue; } int color = config.getInt(configKey); Log.d(TAG, "Found watch face config key: " + configKey + " -> " + color); if (updateUiForKey(configKey, color)) { uiUpdated = true; } } }
Example 7
Source File: WatchFaceCompanionConfigActivity.java From american-sunsets-watch-face with Apache License 2.0 | 5 votes |
private void updateUiForConfigDataMap(final DataMap config) { boolean uiUpdated = false; for (String configKey : config.keySet()) { if (!config.containsKey(configKey)) { continue; } int color = config.getInt(configKey); Log.d(TAG, "Found watch face config key: " + configKey + " -> " + color); if (updateUiForKey(configKey, color)) { uiUpdated = true; } } }
Example 8
Source File: DataBundleUtil.java From android_external_GmsLib with Apache License 2.0 | 5 votes |
private static List<DataBundleEntry> createEntryList(DataMap dataMap, List<Asset> assets) { List<DataBundleEntry> entries = new ArrayList<DataBundleEntry>(); for (String key : dataMap.keySet()) { entries.add(getTypeHelper(dataMap.getType(key)).loadAndCreateEntry(dataMap, key, assets)); } return entries; }