本文整理汇总了Java中com.getpebble.android.kit.util.PebbleTuple类的典型用法代码示例。如果您正苦于以下问题:Java PebbleTuple类的具体用法?Java PebbleTuple怎么用?Java PebbleTuple使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PebbleTuple类属于com.getpebble.android.kit.util包,在下文中一共展示了PebbleTuple类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clearDictionary
import com.getpebble.android.kit.util.PebbleTuple; //导入依赖的package包/类
private void clearDictionary() {
synchronized (this.dictionary) {
// might just be easier to instantiate a new dictionary
final List<Integer> temp = new ArrayList<>();
for (PebbleTuple aDictionary : this.dictionary) {
temp.add(aDictionary.key);
}
for (Integer i : temp) {
this.dictionary.remove(i);
}
}
/* this.dictionary.remove(ICON_KEY);
this.dictionary.remove(BG_KEY);
this.dictionary.remove(NAME_KEY);
this.dictionary.remove(BG_DELTA_KEY);
this.dictionary.remove(PHONE_TIME_KEY);
this.dictionary.remove(RECORD_TIME_KEY);
this.dictionary.remove(UPLOADER_BATTERY_KEY);
this.dictionary.remove(VIBE_KEY);
this.dictionary.remove(COLLECT_HEALTH_KEY);
this.dictionary.remove(NO_BLUETOOTH_KEY);
*/
}
示例2: getBytesLeft
import com.getpebble.android.kit.util.PebbleTuple; //导入依赖的package包/类
/**
* @param message Current AppMessage.
* @param pebbleCapabilities Capabilities of the Pebble you want to send message to
* @return Maximum size of the byte array than you still can add to this message and have it successfully sent.
*
* @see <a href="https://developer.pebble.com/docs/c/Foundation/Dictionary/#dict_calc_buffer_size">Pebble documentation</a>
*/
public static int getBytesLeft(PebbleDictionary message, PebbleCapabilities pebbleCapabilities)
{
int bytesLeft = pebbleCapabilities.getMaxAppmessageSize();
bytesLeft--; // One byte of dictionary header overhead (presumably for number of entries in AppMessage)
for (PebbleTuple entry : message)
{
bytesLeft -= 7; //Every entry has 7 bytes of overhead.
bytesLeft -= entry.length;
}
return bytesLeft - 7; // 7 bytes is the additional overhead that would to-be-added byte array need
}