本文整理汇总了Java中com.sonyericsson.extras.liveware.extension.util.Dbg.DEBUG属性的典型用法代码示例。如果您正苦于以下问题:Java Dbg.DEBUG属性的具体用法?Java Dbg.DEBUG怎么用?Java Dbg.DEBUG使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sonyericsson.extras.liveware.extension.util.Dbg
的用法示例。
在下文中一共展示了Dbg.DEBUG属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: closeSocket
/**
* Close socket to be able to read sensor data
*/
private void closeSocket() {
// Close socket
if (mLocalServerSocket != null) {
try {
mLocalServerSocket.close();
mLocalServerSocket = null;
} catch (IOException e) {
if (Dbg.DEBUG) {
Dbg.w(e.getMessage(), e);
}
}
}
// Stop thread
if (mServerThread != null) {
mServerThread.interrupt();
mServerThread = null;
}
// Send intent to Aha
sendSensorStopListeningIntent();
}
示例2: performRegistration
/**
* Perform the registration.
*
* @param onlySources True if only notification sources shall be refreshed.
* @return True if registration was successful.
*/
boolean performRegistration(boolean onlySources) {
if (onlySources) {
try {
registerOrUpdateSources();
return true;
} catch (RegisterExtensionException e) {
if (Dbg.DEBUG) {
Dbg.e("Source refresh failed", e);
}
return false;
}
} else {
boolean registrationSuccess = registerOrUpdateExtension();
if (registrationSuccess) {
if (mRegistrationInformation.getRequiredWidgetApiVersion() > 0
|| mRegistrationInformation.getRequiredControlApiVersion() > 0) {
registerWithAllHostApps();
}
}
return registrationSuccess;
}
}
示例3: run
@Override
public void run() {
try {
DataInputStream inStream = new DataInputStream(mLocalServerSocket.accept()
.getInputStream());
while (!isInterrupted()) {
AccessorySensorEvent event = decodeSensorData(inStream);
if (event != null) {
Message msg = new Message();
msg.obj = event;
mHandler.sendMessage(msg);
}
}
} catch (IOException e) {
if (Dbg.DEBUG) {
Dbg.w(e.getMessage(), e);
}
}
}
示例4: doInBackground
@Override
protected Boolean doInBackground(Void... params) {
if (mOnlySources) {
try {
registerOrUpdateSources();
return true;
} catch (RegisterExtensionException e) {
if (Dbg.DEBUG) {
Dbg.e("Source refresh failed", e);
}
return false;
}
} else {
boolean registrationSuccess = registerOrUpdateExtension();
if (registrationSuccess) {
if (mRegistrationInformation.getRequiredWidgetApiVersion() > 0
|| mRegistrationInformation.getRequiredControlApiVersion() > 0) {
registerWithAllHostApps();
}
}
return registrationSuccess;
}
}
示例5: updateWidget
/**
* 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));
}
示例6: getImage
/**
* Get the widget image.
*
* @return The image.
*/
public Bitmap getImage() {
// If profile image explicitly set then use it.
// Otherwise get the contact photo.
if (mProfileImageUri != null) {
return ExtensionUtils.getBitmapFromUri(mContext, mProfileImageUri);
} else {
if (mContactReference != null) {
Uri uri = Uri.parse(mContactReference);
return ExtensionUtils.getContactPhoto(mContext, uri);
} else {
if (Dbg.DEBUG) {
Dbg.e("No image available");
}
return null;
}
}
}
示例7: isSupportedWidgetAvailable
/**
* Check if widget shall be supported for this host application by checking
* that the host application has device with a supported widget size. This
* method can be override to provide extension specific implementations.
*
* @param context The context.
* @param hostApplication The host application.
* @return True if widget shall be supported.
*/
public boolean isSupportedWidgetAvailable(final Context context,
final HostApplicationInfo hostApplication) {
if (getRequiredWidgetApiVersion() == API_NOT_REQUIRED) {
return false;
}
if (hostApplication.getWidgetApiVersion() == 0) {
return false;
}
if (getRequiredWidgetApiVersion() > hostApplication.getWidgetApiVersion()) {
if (Dbg.DEBUG) {
Dbg.w("isSupportedWidgetAvailable: required widget API version not supported");
}
return false;
}
for (DeviceInfo device : hostApplication.getDevices()) {
if (isWidgetSizeSupported(device.getWidgetWidth(), device.getWidgetHeight())) {
return true;
}
}
return false;
}
示例8: stopRequest
/**
* Send request to stop to host application.
*/
protected void stopRequest() {
if (Dbg.DEBUG) {
Dbg.d("Sending stop request");
}
Intent intent = new Intent(Control.Intents.CONTROL_STOP_REQUEST_INTENT);
sendToHostApp(intent);
}
示例9: showBitmap
/**
* 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);
}
示例10: startRequest
/**
* 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: sendText
/**
* 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);
}
示例12: startVibrator
/**
* Start repeating vibrator
*
* @param onDuration On duration in milliseconds.
* @param offDuration Off duration in milliseconds.
* @param repeats The number of repeats of the on/off pattern. Use
* {@link Control.Intents#REPEAT_UNTIL_STOP_INTENT} to repeat
* until explicitly stopped.
*/
protected void startVibrator(int onDuration, int offDuration, int repeats) {
if (Dbg.DEBUG) {
Dbg.v("startVibrator: onDuration: " + onDuration + ", offDuration: " + offDuration
+ ", repeats: " + repeats);
}
Intent intent = new Intent(Control.Intents.CONTROL_VIBRATE_INTENT);
intent.putExtra(Control.Intents.EXTRA_ON_DURATION, onDuration);
intent.putExtra(Control.Intents.EXTRA_OFF_DURATION, offDuration);
intent.putExtra(Control.Intents.EXTRA_REPEATS, repeats);
sendToHostApp(intent);
}
示例13: onTouch
/**
* 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);
}
示例14: clearDisplay
/**
* Clear accessory diplay.
*/
protected void clearDisplay() {
if (Dbg.DEBUG) {
Dbg.v("Clear display");
}
Intent intent = new Intent(Control.Intents.CONTROL_CLEAR_DISPLAY_INTENT);
sendToHostApp(intent);
}
示例15: registerOrUpdateExtension
/**
* 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;
}