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


Java DataMapItem.getDataMap方法代碼示例

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


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

示例1: onDataChanged

import com.google.android.gms.wearable.DataMapItem; //導入方法依賴的package包/類
@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,代碼行數:23,代碼來源:FeedbackWearableListenerService.java

示例2: onDataChanged

import com.google.android.gms.wearable.DataMapItem; //導入方法依賴的package包/類
@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,代碼行數:22,代碼來源:WatchFaceService.java

示例3: onDataChanged

import com.google.android.gms.wearable.DataMapItem; //導入方法依賴的package包/類
@Override // DataApi.DataListener
public void onDataChanged(DataEventBuffer 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,項目名稱:adrenaline_watch_face,代碼行數:21,代碼來源:SonicBoomFace.java

示例4: onDataChanged

import com.google.android.gms.wearable.DataMapItem; //導入方法依賴的package包/類
@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,項目名稱:adrenaline_watch_face,代碼行數:21,代碼來源:WatchFaceCompanionConfigActivity.java

示例5: onDataChanged

import com.google.android.gms.wearable.DataMapItem; //導入方法依賴的package包/類
@Override
public void onDataChanged(DataEventBuffer dataEventBuffer) {
    for (DataEvent dataEvent : dataEventBuffer) {
        if (dataEvent.getType() != DataEvent.TYPE_CHANGED) {
            continue;
        }

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

        DataMapItem dataMapItem = DataMapItem.fromDataItem(dataItem);
        DataMap config = dataMapItem.getDataMap();
        Log.d("WatchFace", "Config DataItem updated:" + config);
        updateUiForConfigDataMap(config);
    }
}
 
開發者ID:passiondroid,項目名稱:SunshineApp,代碼行數:20,代碼來源:WatchFace.java

示例6: onDataChanged

import com.google.android.gms.wearable.DataMapItem; //導入方法依賴的package包/類
@Override // DataApi.DataListener
public void onDataChanged(DataEventBuffer dataEvents) {
    for (DataEvent dataEvent : dataEvents) {
        if (dataEvent.getType() != DataEvent.TYPE_CHANGED) {
            continue;
        }

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

        DataMapItem dataMapItem = DataMapItem.fromDataItem(dataItem);
        DataMap config = dataMapItem.getDataMap();
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "Config DataItem updated:" + config);
        }
        updateUiForConfigDataMap(config);
    }
}
 
開發者ID:marcouberti,項目名稱:american_sunsets_watch_face,代碼行數:21,代碼來源:WatchFaceCompanionConfigActivity.java

示例7: onDataChanged

import com.google.android.gms.wearable.DataMapItem; //導入方法依賴的package包/類
@Override // DataApi.DataListener
public void onDataChanged(DataEventBuffer dataEvents) {
    for (DataEvent dataEvent : dataEvents) {
        if (dataEvent.getType() != DataEvent.TYPE_CHANGED) {
            continue;
        }

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

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

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

示例8: onDataChanged

import com.google.android.gms.wearable.DataMapItem; //導入方法依賴的package包/類
@Override // DataApi.DataListener
public void onDataChanged(DataEventBuffer dataEvents) {
    try {
        for (DataEvent dataEvent : dataEvents) {
            if (dataEvent.getType() != DataEvent.TYPE_CHANGED) {
                continue;
            }

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

            DataMapItem dataMapItem = DataMapItem.fromDataItem(dataItem);
            DataMap config = dataMapItem.getDataMap();
            if (Log.isLoggable(TAG, Log.DEBUG)) {
                Log.d(TAG, "Config DataItem updated:" + config);
            }
            updateUiForConfigDataMap(config);
        }
    } finally {
        dataEvents.close();
    }
}
 
開發者ID:AndroidAvanzato,項目名稱:Capitolo6,代碼行數:26,代碼來源:DigitalWatchFaceService.java

示例9: onDataChanged

import com.google.android.gms.wearable.DataMapItem; //導入方法依賴的package包/類
@Override // DataApi.DataListener
public void onDataChanged(DataEventBuffer dataEvents) {
    for (DataEvent dataEvent : dataEvents) {
        if (dataEvent.getType() != DataEvent.TYPE_CHANGED) {
            continue;
        }

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

        DataMapItem dataMapItem = DataMapItem.fromDataItem(dataItem);
        DataMap config = dataMapItem.getDataMap();
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "Config DataItem updated:" + config);
        }
        updateUiForConfigDataMap(config);
    }
}
 
開發者ID:googlesamples,項目名稱:android-WatchFace,代碼行數:22,代碼來源:DigitalWatchFaceService.java

示例10: onDataChanged

import com.google.android.gms.wearable.DataMapItem; //導入方法依賴的package包/類
@Override // DataApi.DataListener
public void onDataChanged(DataEventBuffer dataEvents) {
    try {
        for (DataEvent dataEvent : dataEvents) {
            if (dataEvent.getType() != DataEvent.TYPE_CHANGED) {
                continue;
            }

            DataItem dataItem = dataEvent.getDataItem();
            Log.d(TAG, "onDataChanged: Path" + dataItem.getUri().getPath());
            if (!dataItem.getUri().getPath().equals(
                    Constants.PATH_WEATHER_DATA)) {
                continue;
            }

            DataMapItem dataMapItem = DataMapItem.fromDataItem(dataItem);
            DataMap config = dataMapItem.getDataMap();
            if (Log.isLoggable(TAG, Log.DEBUG)) {
                Log.d(TAG, "Config DataItem updated:" + config);
            }
            updateUiForConfigDataMap(config);
        }
    } finally {
        dataEvents.close();
    }

}
 
開發者ID:mladenbabic,項目名稱:Advanced_Android_Development_Wear,代碼行數:28,代碼來源:SunshineWatchFace.java

示例11: onDataChanged

import com.google.android.gms.wearable.DataMapItem; //導入方法依賴的package包/類
@Override
public void onDataChanged(DataEventBuffer dataEvents) {
    Log.d(TAG, "onDataChanged: ");
    try {
        
        for (DataEvent dataEvent : dataEvents) {
            if (dataEvent.getType() != DataEvent.TYPE_CHANGED) {
                continue;
            }

            DataItem dataItem = dataEvent.getDataItem();

            Log.d(TAG, "path: " + dataItem.getUri().getPath());

            if (!dataItem.getUri().getPath().equals(Constants.PATH_WEATHER_DATA)) {
                continue;
            }

            DataMapItem dataMapItem = DataMapItem.fromDataItem(dataItem);
            DataMap config = dataMapItem.getDataMap();
            if (Log.isLoggable(TAG, Log.DEBUG)) {
                Log.d(TAG, "Config DataItem updated:" + config);
            }
            DigitalWatchFaceUtil.overwriteKeysInConfigDataMap(mGoogleApiClient, config, Constants.PATH_WEATHER_DATA);
        }
    } finally {
        dataEvents.close();
    }
}
 
開發者ID:mladenbabic,項目名稱:Advanced_Android_Development_Wear,代碼行數:30,代碼來源:ConfigDataListenerService.java

示例12: onResult

import com.google.android.gms.wearable.DataMapItem; //導入方法依賴的package包/類
@Override
public void onResult(DataApi.DataItemResult dataItemResult) {
    if (dataItemResult.getStatus().isSuccess()) {
        if (dataItemResult.getDataItem() != null) {
            DataItem configDataItem = dataItemResult.getDataItem();
            DataMapItem dataMapItem = DataMapItem.fromDataItem(configDataItem);
            DataMap config = dataMapItem.getDataMap();
            mCallback.onConfigDataMapFetched(config);
        } else {
            mCallback.onConfigDataMapFetched(new DataMap());
        }
    }
}
 
開發者ID:mladenbabic,項目名稱:Advanced_Android_Development_Wear,代碼行數:14,代碼來源:DigitalWatchFaceUtil.java

示例13: onResult

import com.google.android.gms.wearable.DataMapItem; //導入方法依賴的package包/類
@Override
public void onResult(@NonNull DataApi.DataItemResult dataItemResult) {
    if (dataItemResult.getStatus().isSuccess()) {
        if (dataItemResult.getDataItem() != null) {
            DataItem configDataItem = dataItemResult.getDataItem();
            DataMapItem dataMapItem = DataMapItem.fromDataItem(configDataItem);
            DataMap config = dataMapItem.getDataMap();
            mCallback.onConfigDataMapFetched(config);
        } else {
            mCallback.onConfigDataMapFetched(new DataMap());
        }
    }
}
 
開發者ID:jimmykane,項目名稱:Athletica,代碼行數:14,代碼來源:ConfigurationHelper.java

示例14: onResult

import com.google.android.gms.wearable.DataMapItem; //導入方法依賴的package包/類
@Override // ResultCallback<DataApi.DataItemResult>
public void onResult(DataApi.DataItemResult dataItemResult) {
    if (dataItemResult.getStatus().isSuccess() && dataItemResult.getDataItem() != null) {
        DataItem configDataItem = dataItemResult.getDataItem();
        DataMapItem dataMapItem = DataMapItem.fromDataItem(configDataItem);
        DataMap config = dataMapItem.getDataMap();
        Log.d(TAG, "startup setup UI...");
        updateUiForConfigDataMap(config);
        //setUpAllPickers(config);
    } else {
        // If DataItem with the current config can't be retrieved, select the default items on
        // each picker.
        //setUpAllPickers(null);
    }
}
 
開發者ID:marcouberti,項目名稱:adrenaline_watch_face,代碼行數:16,代碼來源:WatchFaceCompanionConfigActivity.java

示例15: onResult

import com.google.android.gms.wearable.DataMapItem; //導入方法依賴的package包/類
@Override // ResultCallback<DataApi.DataItemResult>
public void onResult(DataApi.DataItemResult dataItemResult) {
    if (dataItemResult.getStatus().isSuccess() && dataItemResult.getDataItem() != null) {
        DataItem configDataItem = dataItemResult.getDataItem();
        DataMapItem dataMapItem = DataMapItem.fromDataItem(configDataItem);
        DataMap config = dataMapItem.getDataMap();
        Log.d(TAG,"startup setup UI...");
        updateUiForConfigDataMap(config);
        //setUpAllPickers(config);
    } else {
        // If DataItem with the current config can't be retrieved, select the default items on
        // each picker.
        //setUpAllPickers(null);
    }
}
 
開發者ID:marcouberti,項目名稱:american_sunsets_watch_face,代碼行數:16,代碼來源:WatchFaceCompanionConfigActivity.java


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