本文整理汇总了Java中com.getpebble.android.kit.util.PebbleDictionary.contains方法的典型用法代码示例。如果您正苦于以下问题:Java PebbleDictionary.contains方法的具体用法?Java PebbleDictionary.contains怎么用?Java PebbleDictionary.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.getpebble.android.kit.util.PebbleDictionary
的用法示例。
在下文中一共展示了PebbleDictionary.contains方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: gotMessageFromPebble
import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
@Override
public void gotMessageFromPebble(PebbleDictionary message)
{
int id = 0;
if (message.contains(1)) //Open message from older Pebble app does not have entry at 1.
id = message.getUnsignedIntegerAsLong(1).intValue();
Timber.d("system packet %d", id);
switch (id)
{
case 0: //Pebble opened
gotMessagePebbleOpened(message);
break;
case 1: //Menu entry picked
gotMessageMenuItem(message);
break;
case 2: //Close me
closeApp();
break;
}
}
示例2: receiveData
import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
@Override
public void receiveData(final Context context, final int transactionId, final PebbleDictionary data) {
Log.i(TAG, "receiveData" + transactionId);
((PebbleBikeApplication)context.getApplicationContext()).inject(this);
_messageManager.sendAckToPebble(transactionId);
if (data.contains(Constants.CMD_BUTTON_PRESS)) {
handleButtonData(context,data);
}
if (data.contains(Constants.MSG_VERSION_PEBBLE)) {
handleVersion(context,data);
}
if (data.contains(Constants.MSG_CONFIG)) {
handleConfig(context, data);
}
/*if (data.contains(Constants.MSG_LIVE_ASK_NAMES)) {
live_max_name = data.getInteger(Constants.MSG_LIVE_ASK_NAMES).intValue();
Log.d(TAG, "Constants.MSG_LIVE_ASK_NAMES, live_max_name: " + live_max_name);
start = true;
}*/
}
示例3: gotMessageFromPebble
import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
@Override
public void gotMessageFromPebble(PebbleDictionary message)
{
int id = 0;
if (message.contains(1)) //Open message from older Pebble app does not have entry at 1.
id = message.getUnsignedIntegerAsLong(1).intValue();
Timber.d("system packet %d", id);
switch (id)
{
case 0: //Pebble opened
gotMessagePebbleOpened(message);
break;
case 1: //Menu entry picked
gotMessageMenuItem(message);
break;
case 2: //Config change
gotMessageConfigChange(message);
break;
case 3: //Close me
gotCloseMessage(message);
break;
}
}
示例4: gotMessagePebbleOpened
import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
private void gotMessagePebbleOpened(PebbleDictionary message)
{
closeTries = 0;
int version = 0;
if (message.contains(2))
version = message.getUnsignedIntegerAsLong(2).intValue();
final int finalVersion = version;
Timber.d("Version %d", version);
if (version == WatchappHandler.SUPPORTED_PROTOCOL)
{
runOnNext = new Callable<Boolean>()
{
@Override
public Boolean call() throws Exception
{
sendConfig();
return true;
}
};
int pebbleCapabilities = message.getUnsignedIntegerAsLong(3).intValue();
getService().getPebbleCommunication().setConnectedWatchCapabilities(pebbleCapabilities);
fullscreenImageWidth = message.getUnsignedIntegerAsLong(4).intValue();
fullscreenImageHeight = message.getUnsignedIntegerAsLong(5).intValue();
SparseArray<CommModule> modules = getService().getAllModules();
for (int i = 0 ; i < modules.size(); i++)
modules.valueAt(i).pebbleAppOpened();
}
else if (version == 0)
{
runOnNext = new Callable<Boolean>()
{
@Override
public Boolean call() throws Exception
{
sendFakeCall();
return true;
}
};
}
else
{
runOnNext = new Callable<Boolean>()
{
@Override
public Boolean call()
{
sendConfigInvalidVersion(finalVersion);
return true;
}
};
}
PebbleCommunication communication = getService().getPebbleCommunication();
communication.queueModulePriority(this);
communication.resetBusy();
communication.sendNext();
}
示例5: gotMessagePebbleOpened
import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
private void gotMessagePebbleOpened(PebbleDictionary message)
{
closeTries = 0;
int version = 0;
if (message.contains(2))
version = message.getUnsignedIntegerAsLong(2).intValue();
Timber.d("Version %d", version);
final int finalVersion = version;
if (version == WatchappHandler.SUPPORTED_PROTOCOL)
{
runOnNext = new Callable<Boolean>()
{
@Override
public Boolean call() throws Exception
{
sendConfig();
return true;
}
};
int pebbleCapabilities = message.getUnsignedIntegerAsLong(3).intValue();
getService().getPebbleCommunication().setConnectedWatchCapabilities(pebbleCapabilities);
SparseArray<CommModule> modules = getService().getAllModules();
for (int i = 0 ; i < modules.size(); i++)
modules.valueAt(i).pebbleAppOpened();
}
else
{
runOnNext = new Callable<Boolean>()
{
@Override
public Boolean call()
{
sendConfigInvalidVersion(finalVersion);
return true;
}
};
}
PebbleCommunication communication = getService().getPebbleCommunication();
communication.queueModulePriority(this);
communication.resetBusy();
communication.sendNext();
}