本文整理汇总了Java中com.sonyericsson.extras.liveware.extension.util.Dbg.d方法的典型用法代码示例。如果您正苦于以下问题:Java Dbg.d方法的具体用法?Java Dbg.d怎么用?Java Dbg.d使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sonyericsson.extras.liveware.extension.util.Dbg
的用法示例。
在下文中一共展示了Dbg.d方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeUnsafeValues
import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入方法依赖的package包/类
/**
* Iterates through ContentValues and removes values that are not available
* for the given SmartConnect version, regardless of which table the value
* is in. Current implementation only supports API levels 1 and 2. May not
* be complete.
*
* @param context
* @param apiLevel The version of the current API level, contentvalues not
* supported in this API level will be removed
* @param values the ContentValues to be scanned for unsafe values
* @return
*/
static int removeUnsafeValues(Context context, int apiLevel, ContentValues values) {
int removedValues = 0;
if (apiLevel < 2) {
for (String key : API_2_KEYS) {
if (values.containsKey(key)) {
values.remove(key);
Dbg.d("Removing " + key + " key from contentvalues");
removedValues++;
}
}
}
Dbg.e("Removed " + removedValues + " values from contentvalues");
return removedValues;
}
示例2: isSensorSupported
import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入方法依赖的package包/类
/**
* Checks if host application supports a specific sensor.
*
* @param context The context.
* @param hostAppPackageName The package name of the host application
* @param sensorType The sensor type
* @return true if the host application supports the sensor
*/
public static boolean isSensorSupported(Context context, String hostAppPackageName,
String sensorType) {
boolean sensorSupported = false;
HostApplicationInfo hostApp = getHostApp(context, hostAppPackageName);
if (hostApp == null) {
Dbg.d("Host app was null, bailing.");
}
else if (hostApp.getSensorApiVersion() > 0) {
for (DeviceInfo device : hostApp.getDevices()) {
for (AccessorySensor sensor : device.getSensors()) {
if (TextUtils.equals(sensor.getType().getName(), sensorType)) {
sensorSupported = true;
break;
}
}
}
}
return sensorSupported;
}
示例3: showImage
import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入方法依赖的package包/类
/**
* Show an image on the accessory.
*
* @param resourceId The image resource id.
*/
protected void showImage(final int resourceId) {
if (Dbg.DEBUG) {
Dbg.d("showImage: " + resourceId);
}
Intent intent = new Intent();
intent.setAction(Control.Intents.CONTROL_DISPLAY_DATA_INTENT);
Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), resourceId,
mBitmapOptions);
ByteArrayOutputStream os = new ByteArrayOutputStream(256);
bitmap.compress(CompressFormat.PNG, 100, os);
byte[] buffer = os.toByteArray();
intent.putExtra(Control.Intents.EXTRA_DATA, buffer);
sendToHostApp(intent);
}
示例4: updateWidget
import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入方法依赖的package包/类
/**
* Update widget.
*
* @param checkEvent True if we shall check if the event is new before we
* update. False to disable check.
*/
protected void updateWidget(boolean checkEvent) {
if (Dbg.DEBUG) {
Dbg.d("updateWidget");
}
NotificationWidgetEvent event = getEvent();
if (checkEvent) {
// Check if the info is the same as the one already shown.
if (mLastEvent != null && mLastEvent.equals(event) || mLastEvent == null
&& event == null) {
if (Dbg.DEBUG) {
Dbg.d("No change in widget data. No update.");
}
return;
}
}
mLastEvent = event;
showBitmap(getBitmap(event));
}
示例5: isSmartWatch2ApiAndScreenDetected
import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入方法依赖的package包/类
/**
* Checks host app API level and screen size to check if SmartWatch 2 is
* supported.
*
* @param context The context.
* @return true if SmartWatch is supported.
*/
public static boolean isSmartWatch2ApiAndScreenDetected(Context context,
String hostAppPackageName) {
HostApplicationInfo hostApp = getHostApp(context, hostAppPackageName);
if (hostApp == null) {
Dbg.d("Host app was null, returning");
return false;
}
// Get screen dimensions, unscaled
final int controlSWWidth = getSmartWatch2Width(context);
final int controlSWHeight = getSmartWatch2Height(context);
if (hostApp.getControlApiVersion() >= SMARTWATCH_2_API_LEVEL) {
for (DeviceInfo device : RegistrationAdapter.getHostApplication(context,
hostAppPackageName).getDevices()) {
for (DisplayInfo display : device.getDisplays()) {
if (display.sizeEquals(controlSWWidth, controlSWHeight)) {
return true;
}
}
}
} else {
Dbg.d("Host had control API version: " + hostApp.getControlApiVersion() + ", returning");
}
return false;
}
示例6: removeUnsafeValues
import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入方法依赖的package包/类
/**
* Iterates through ContentValues and removes values that are not available
* for the given SmartConnect version, regardless of which table the value
* is in. Current implementation only supports API levels 1 and 2. May not
* be complete.
*
* @param context
* @param apiLevel The version of the current API level, contentvalues not
* supported in this API level will be removed
* @param values the ContentValues to be scanned for unsafe values
* @return
*/
static int removeUnsafeValues(Context context, int apiLevel, ContentValues values) {
int removedValues = 0;
if (apiLevel < 2) {
for (String key : API_2_KEYS) {
if (values.containsKey(key)) {
values.remove(key);
Dbg.d("Removing " + key + " key from contentvalues");
removedValues++;
}
}
}
Dbg.e("Removed " + removedValues + " values from contentvalues");
return removedValues;
}
示例7: showBitmap
import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入方法依赖的package包/类
/**
* Show bitmap on accessory.
*
* @param bitmap The bitmap to show.
*/
protected void showBitmap(final Bitmap bitmap) {
if (Dbg.DEBUG) {
Dbg.d("showBitmap");
}
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(256);
bitmap.compress(CompressFormat.PNG, 100, outputStream);
Intent intent = new Intent(Control.Intents.CONTROL_DISPLAY_DATA_INTENT);
intent.putExtra(Control.Intents.EXTRA_DATA, outputStream.toByteArray());
sendToHostApp(intent);
}
示例8: registerOrUpdateExtension
import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入方法依赖的package包/类
/**
* Register the extension or update the registration if already registered.
* This method is called from the the background
*
* @return True if the extension was registered properly.
*/
private boolean registerOrUpdateExtension() {
if (Dbg.DEBUG) {
Dbg.d("Start registration of extension.");
}
try {
// Register or update extension
if (!isRegistered()) {
register();
if (Dbg.DEBUG) {
Dbg.d("Registered extension.");
}
} else {
updateRegistration();
if (Dbg.DEBUG) {
Dbg.d("Updated extension.");
}
}
if (mRegistrationInformation.getRequiredNotificationApiVersion() > 0) {
// Register all sources
registerOrUpdateSources();
}
} catch (RegisterExtensionException exception) {
if (Dbg.DEBUG) {
Dbg.e("Failed to register extension", exception);
}
return false;
}
return true;
}
示例9: registerOrUpdateSources
import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入方法依赖的package包/类
/**
* Register or update source. This method is called from the the background
*
* @param extensionSpecificId The source type to register.
* @throws RegisterExtensionException
*/
private void registerOrUpdateSources() throws RegisterExtensionException {
ArrayList<String> oldExtensionSpecificIds = NotificationUtil
.getExtensionSpecificIds(mContext);
for (ContentValues sourceConfiguration : mRegistrationInformation
.getSourceRegistrationConfigurations()) {
String extensionSpecificId = (String)sourceConfiguration
.get(Notification.SourceColumns.EXTENSION_SPECIFIC_ID);
// If we find the source id in the database then we have already
// registered.
long sourceId = NotificationUtil.getSourceId(mContext, extensionSpecificId);
// Package name is not required but many of the SDK utility
// methods are dependent of the package name.
sourceConfiguration.put(SourceColumns.PACKAGE_NAME, mContext.getPackageName());
if (sourceId == NotificationUtil.INVALID_ID) {
sourceId = registerSource(sourceConfiguration);
} else {
updateSource(sourceConfiguration, sourceId);
}
if (Dbg.DEBUG) {
Dbg.d("SourceType:" + extensionSpecificId + " SourceId:" + sourceId);
}
oldExtensionSpecificIds.remove(extensionSpecificId);
}
// Remove any sources that are no longer used.
for (String deletedExtensionSpecificId : oldExtensionSpecificIds) {
unregisterSource(deletedExtensionSpecificId);
}
}
示例10: startRequest
import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入方法依赖的package包/类
/**
* Send request to start control extension.
*/
protected void startRequest() {
if (Dbg.DEBUG) {
Dbg.d("Sending start request");
}
Intent intent = new Intent(Control.Intents.CONTROL_START_REQUEST_INTENT);
sendToHostApp(intent);
}
示例11: registerOrUpdateSources
import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入方法依赖的package包/类
/**
* Register or update source. This method is called from the the background
*
* @param extensionSpecificId The source type to register.
* @throws RegisterExtensionException
*/
private void registerOrUpdateSources() throws RegisterExtensionException {
ArrayList<String> oldExtensionSpecificIds = NotificationUtil
.getExtensionSpecificIds(mContext);
for (ContentValues sourceConfiguration : mRegistrationInformation
.getSourceRegistrationConfigurations()) {
String extensionSpecificId = (String) sourceConfiguration
.get(Notification.SourceColumns.EXTENSION_SPECIFIC_ID);
// If we find the source id in the database then we have already
// registered.
long sourceId = NotificationUtil.getSourceId(mContext, extensionSpecificId);
// Package name is not required but many of the SDK utility
// methods are dependent of the package name.
sourceConfiguration.put(SourceColumns.PACKAGE_NAME, mContext.getPackageName());
if (sourceId == NotificationUtil.INVALID_ID) {
sourceId = registerSource(sourceConfiguration);
} else {
updateSource(sourceConfiguration, sourceId);
}
if (Dbg.DEBUG) {
Dbg.d("SourceType:" + extensionSpecificId + " SourceId:" + sourceId);
}
oldExtensionSpecificIds.remove(extensionSpecificId);
}
// Remove any sources that are no longer used.
for (String deletedExtensionSpecificId : oldExtensionSpecificIds) {
unregisterSource(deletedExtensionSpecificId);
}
}
示例12: showLayout
import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入方法依赖的package包/类
/**
* Show a layout on the accessory.
*
* @param layoutId The layout resource id.
* @param layoutData The layout data.
* @see Control#Intents.EXTRA_LAYOUT_DATA
*/
protected void showLayout(final int layoutId, final Bundle[] layoutData) {
if (Dbg.DEBUG) {
Dbg.d("showLayout");
}
Intent intent = new Intent(Control.Intents.CONTROL_PROCESS_LAYOUT_INTENT);
intent.putExtra(Control.Intents.EXTRA_DATA_XML_LAYOUT, layoutId);
if (layoutData != null && layoutData.length > 0) {
intent.putExtra(Control.Intents.EXTRA_LAYOUT_DATA, layoutData);
}
sendToHostApp(intent);
}
示例13: sendText
import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入方法依赖的package包/类
/**
* Update text in a specific layout, on the accessory.
*
* @param layoutReference The referenced resource within the current layout.
* @param text The text to show.
*/
protected void sendText(final int layoutReference, final String text) {
if (Dbg.DEBUG) {
Dbg.d("sendText: " + text);
}
Intent intent = new Intent(Control.Intents.CONTROL_SEND_TEXT_INTENT);
intent.putExtra(Control.Intents.EXTRA_LAYOUT_REFERENCE, layoutReference);
intent.putExtra(Control.Intents.EXTRA_TEXT, text);
sendToHostApp(intent);
}
示例14: onTouch
import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入方法依赖的package包/类
/**
* The widget has been touched.
*
* @param type The type of touch event.
* @param x The x position of the touch event.
* @param y The y position of the touch event.
*/
@Override
public void onTouch(final int type, final int x, final int y) {
if (!SmartWatchConst.ACTIVE_WIDGET_TOUCH_AREA.contains(x, y)) {
if (Dbg.DEBUG) {
Dbg.d("Touch outside active area x: " + x + " y: " + y);
}
return;
}
// Both short and long tap enters next level.
// Enter next level.
Intent intent = new Intent(Widget.Intents.WIDGET_ENTER_NEXT_LEVEL_INTENT);
sendToHostApp(intent);
}
示例15: sendImage
import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入方法依赖的package包/类
/**
* Update an image in a specific layout, on the accessory.
*
* @param layoutReference The referenced resource within the current layout.
* @param resourceId The image resource id.
*/
protected void sendImage(final int layoutReference, final int resourceId) {
if (Dbg.DEBUG) {
Dbg.d("sendImage");
}
Intent intent = new Intent(Control.Intents.CONTROL_SEND_IMAGE_INTENT);
intent.putExtra(Control.Intents.EXTRA_LAYOUT_REFERENCE, layoutReference);
intent.putExtra(Control.Intents.EXTRA_DATA_URI,
ExtensionUtils.getUriString(mContext, resourceId));
sendToHostApp(intent);
}