當前位置: 首頁>>代碼示例>>Java>>正文


Java DataEvent.TYPE_CHANGED屬性代碼示例

本文整理匯總了Java中com.google.android.gms.wearable.DataEvent.TYPE_CHANGED屬性的典型用法代碼示例。如果您正苦於以下問題:Java DataEvent.TYPE_CHANGED屬性的具體用法?Java DataEvent.TYPE_CHANGED怎麽用?Java DataEvent.TYPE_CHANGED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.google.android.gms.wearable.DataEvent的用法示例。


在下文中一共展示了DataEvent.TYPE_CHANGED屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onDataChanged

@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,代碼行數:19,代碼來源:MyWatchFace.java

示例2: onDataChanged

@Override
public void onDataChanged(DataEventBuffer dataEvents) {
    LOGD(TAG, "onDataChanged: " + dataEvents + " for " + getPackageName());

    for (DataEvent event : dataEvents) {
        LOGD(TAG, "Uri is: " + event.getDataItem().getUri());
        DataMapItem mapItem = DataMapItem.fromDataItem(event.getDataItem());
        String path = event.getDataItem().getUri().getPath();
        if (event.getType() == DataEvent.TYPE_CHANGED) {
            if (PATH_RESPONSE.equals(path)) {
                // we have a response
                DataMap data = mapItem.getDataMap();
                saveFeedback(data);
            }
        } else if (event.getType() == DataEvent.TYPE_DELETED) {
            if (path.startsWith(SessionAlarmService.PATH_FEEDBACK)) {
                Uri uri = event.getDataItem().getUri();
                dismissLocalNotification(uri.getLastPathSegment());
            }
        }
    }
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:22,代碼來源:FeedbackWearableListenerService.java

示例3: onDataChanged

/**
 * This method is activated when a data is receive from the phone
 * @param dataEvents
 */
@Override
public void onDataChanged(DataEventBuffer dataEvents) {

    DataMap dataMap;
    for (DataEvent event : dataEvents) {
        // Check the data type
        if (event.getType() == DataEvent.TYPE_CHANGED) {
            // Check the data path
            dataMap = DataMapItem.fromDataItem(event.getDataItem()).getDataMap();

            //get the new rule send by the phone
            CustomRules rule= getRuleFromMap(dataMap);

            //save the rule in the database
            RulesRepository.getInstance().insertOrUpdate(rule);

            //send the value to the activty to change the display of bar

            Intent messageIntent = new Intent();
            messageIntent.setAction(Intent.ACTION_SEND);
            messageIntent.putExtra(Const.KEY_BROADCASTdATA, dataMap.toBundle());
            LocalBroadcastManager.getInstance(this).sendBroadcast(messageIntent);
        }
    }
}
 
開發者ID:kflauri2312lffds,項目名稱:Android_watch_magpie,代碼行數:29,代碼來源:ListenerSyncRule.java

示例4: onDataChanged

@Override
public void onDataChanged(DataEventBuffer dataEvents) {
    super.onDataChanged(dataEvents);

    for (DataEvent event : dataEvents) {
        if (event.getType() == DataEvent.TYPE_CHANGED) {
            // DataItem changed
            DataItem item = event.getDataItem();
            if (item.getUri().getPath().compareTo("/SHAKEINTENSITY") == 0) {
                DataMap dataMap = DataMapItem.fromDataItem(item).getDataMap();

                Log.e("Data Event", "value->"+dataMap.getString(SHAKE_INTENSITY_KEY));
                LocalStoreUtils.setShakeIntensity(dataMap.getString(SHAKE_INTENSITY_KEY), this);
            }
        }
    }

}
 
開發者ID:squareboat,項目名稱:Excuser,代碼行數:18,代碼來源:DataLayerListenerService.java

示例5: onDataChanged

@Override
public void onDataChanged(DataEventBuffer dataEvents) {
    for (DataEvent dataEvent : dataEvents) {
        if (dataEvent.getType() == DataEvent.TYPE_CHANGED) {
            if (ZabbkitConstants.PATH_DATA_REQUEST.equals(dataEvent.getDataItem().getUri().getPath())) {

                Map<String, Object> params = new ArrayMap<String, Object>();

                params.put(Constants.REQ_SELECT_HOSTS, new String[]{
                        Constants.REQ_VAL_HOST_ID, Constants.REQ_VAL_HOST});
                params.put(Constants.REQ_SORT_FIELD, Constants.REQ_VAL_DESCRIPTION);
                params.put(Constants.REQ_OUTPUT, Constants.REQ_VAL_EXTEND);
                params.put(Constants.REQ_MONITORED, true);
                params.put(Constants.REQ_EXPAND_DESCRIPTION, true);
                Communicator.getInstance().getTriggers(params, this);

            }
        }
    }
}
 
開發者ID:CactusSoft,項目名稱:zabbkit-android,代碼行數:20,代碼來源:TriggersRequestService.java

示例6: onDataChanged

@Override
public void onDataChanged(DataEventBuffer dataEvents) {

    DataMap dataMap;
    for (DataEvent event : dataEvents) {
        Log.v("myTag", "DataMap received on watch: " + DataMapItem.fromDataItem(event.getDataItem()).getDataMap());
        // Check the data type
        if (event.getType() == DataEvent.TYPE_CHANGED) {
            // Check the data path
            String path = event.getDataItem().getUri().getPath();
            if (path.equals(WEARABLE_DATA_PATH)) {}
            dataMap = DataMapItem.fromDataItem(event.getDataItem()).getDataMap();


            // Broadcast DataMap contents to wearable activity for display
            // The content has the golf hole number and distances to the front,
            // middle and back pin placements.

            Intent messageIntent = new Intent();
            messageIntent.setAction(Intent.ACTION_SEND);
            messageIntent.putExtra("datamap", dataMap.toBundle());
            LocalBroadcastManager.getInstance(this).sendBroadcast(messageIntent);

        }
    }
}
 
開發者ID:fhstp-mfg,項目名稱:geowahl-android,代碼行數:26,代碼來源:ListenerService.java

示例7: onDataChanged

@Override
public void onDataChanged(DataEventBuffer dataEvents) {

    for (int i = 0; i < dataEvents.getCount(); i++) {
        DataEvent event = dataEvents.get(i);

        if (event.getType() == DataEvent.TYPE_CHANGED &&
                event.getDataItem().getUri().getPath().equals(APP_DATA_UPDATE_REQUEST)) {
            DataMap dataMap = DataMapItem.fromDataItem(event.getDataItem()).getDataMap();

            Asset asset = dataMap.getAsset("dataIcon");
            WatchFaceService.highTemp = dataMap.getInt("dataHigh");
            WatchFaceService.lowTemp = dataMap.getInt("dataLow");

            doLoadBitmap(asset);
        }
    }
}
 
開發者ID:hieple7985,項目名稱:nano-go-ubiquitous,代碼行數:18,代碼來源:SunshineWearListenerService.java

示例8: onDataChanged

@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,代碼行數:25,代碼來源:SunshineWatchFace.java

示例9: onDataChanged

@Override // DataApi.DataListener
public void onDataChanged(DataEventBuffer dataEvents) {
    Log.d(TAG, "Data changed");
    for (DataEvent dataEvent : dataEvents) {
        if (dataEvent.getType() != DataEvent.TYPE_CHANGED) {
            continue;
        }

        DataItem dataItem = dataEvent.getDataItem();
        if (!dataItem.getUri().getPath().equals(
                ConfigurationHelper.PATH_WITH_FEATURE)) {
            continue;
        }

        DataMapItem dataMapItem = DataMapItem.fromDataItem(dataItem);
        DataMap config = dataMapItem.getDataMap();
        Log.d(TAG, "Config DataItem updated:" + config);
        // This can happen from this method more often when phone changes
        updateUiForConfigDataMap(config);
    }
}
 
開發者ID:jimmykane,項目名稱:Athletica,代碼行數:21,代碼來源:WatchFaceService.java

示例10: onDataChanged

@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);
            }
        }
    }
}
 
開發者ID:pimpimmi,項目名稱:LibreAlarm,代碼行數:21,代碼來源:DataLayerListenerService.java

示例11: onDataChanged

@Override
public void onDataChanged(DataEventBuffer dataEvents) {
    Log.i("DEV", "Wear: MainActivity.onDataChangeListener");
    for (DataEvent event : dataEvents) {
        if (event.getType() == DataEvent.TYPE_CHANGED) {
            // DataItem changed
            DataItem item = event.getDataItem();
            if (item.getUri().getPath().compareTo("/stayawhile/queue") == 0) {
                DataMap dataMap = DataMapItem.fromDataItem(item).getDataMap();
                queueUpdated(dataMap.getString(QUEUE_KEY));
            }
        } else if (event.getType() == DataEvent.TYPE_DELETED) {
            // DataItem deleted
        }
    }
}
 
開發者ID:MVK16,項目名稱:stayawhile-android,代碼行數:16,代碼來源:MainActivity.java

示例12: onDataChanged

@Override
public void onDataChanged(DataEventBuffer dataEvents) {
    super.onDataChanged(dataEvents);
    DataMap dataMap = new DataMap();

    for(DataEvent dataEvent : dataEvents){
        if(dataEvent.getType()==DataEvent.TYPE_CHANGED){
            String path = dataEvent.getDataItem().getUri().getPath();

            if(path.equalsIgnoreCase(MOBILE_MESSAGE_PATH)){
                dataMap = DataMapItem.fromDataItem(dataEvent.getDataItem()).getDataMap();
            }
        }
    }

    Intent messageIntent = new Intent();
    messageIntent.setAction(Intent.ACTION_SEND);
    messageIntent.putExtra("datamap", dataMap.toBundle());
    LocalBroadcastManager.getInstance(this).sendBroadcast(messageIntent);
}
 
開發者ID:sahilandroid19,項目名稱:WearApp,代碼行數:20,代碼來源:DataListenerService.java

示例13: onDataChanged

@Override
public void onDataChanged(DataEventBuffer dataEvents) {//KS does not seem to get triggered; therefore use OnMessageReceived instead

    DataMap dataMap;

    for (DataEvent event : dataEvents) {

        if (event.getType() == DataEvent.TYPE_CHANGED) {

            String path = event.getDataItem().getUri().getPath();

            switch (path) {
                case WEARABLE_PREF_DATA_PATH:
                    dataMap = DataMapItem.fromDataItem(event.getDataItem()).getDataMap();
                    if (dataMap != null) {
                        Log.d(TAG, "onDataChanged WEARABLE_PREF_DATA_PATH dataMap=" + dataMap);
                        syncPrefData(dataMap);
                    }
                    break;
                default:
                    Log.d(TAG, "Unknown wearable path: " + path);
                    break;
            }
        }
    }
}
 
開發者ID:NightscoutFoundation,項目名稱:xDrip,代碼行數:26,代碼來源:WatchUpdaterService.java

示例14: onDataChanged

@Override
public void onDataChanged(DataEventBuffer dataEvents) {
    Log.d(LOG_TAG, "onDataChanged" );
    for (DataEvent dataEvent : dataEvents) {
        if (DataEvent.TYPE_CHANGED == dataEvent.getType()) {
            DataItem dataItem = dataEvent.getDataItem();
            DataMap dataMap = DataMapItem.fromDataItem(dataItem).getDataMap();

            String path = dataEvent.getDataItem().getUri().getPath();
            if (path.equals(WEATHER_PATH)) {
                Log.d(LOG_TAG, "/weather id=" + dataMap.getString(KEY_UUID));
                SunshineSyncAdapter.syncImmediately(this);
            }
        }
    }
}
 
開發者ID:jenniferlimtan,項目名稱:UdacityProject6,代碼行數:16,代碼來源:WatchFaceService.java

示例15: onDataChanged

@Override // DataApi.DataListener
public void onDataChanged(DataEventBuffer dataEvents) {
    Log.d(TAG,"onDataChanged "+dataEvents);
    for (DataEvent dataEvent : dataEvents) {
        if (dataEvent.getType() != DataEvent.TYPE_CHANGED) {
            continue;
        }

        DataItem dataItem = dataEvent.getDataItem();
        if (!dataItem.getUri().getPath().equals(WatchFaceUtil.PATH_WITH_FEATURE)) {
            continue;
        }

        DataMapItem dataMapItem = DataMapItem.fromDataItem(dataItem);
        DataMap config = dataMapItem.getDataMap();
        Log.d(TAG, "Config DataItem updated:" + config);

        updateUiForConfigDataMap(config);
    }
}
 
開發者ID:marcouberti,項目名稱:airhero_watch_face,代碼行數:20,代碼來源:WatchFaceCompanionConfigActivity.java


注:本文中的com.google.android.gms.wearable.DataEvent.TYPE_CHANGED屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。