• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Dbg类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sonyericsson.extras.liveware.extension.util.Dbg的典型用法代码示例。如果您正苦于以下问题:Java Dbg类的具体用法?Java Dbg怎么用?Java Dbg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Dbg类属于com.sonyericsson.extras.liveware.extension.util包,在下文中一共展示了Dbg类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: 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);
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:22,代码来源:ControlExtension.java


示例2: doInBackground

import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入依赖的package包/类
@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;
    }
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:24,代码来源:RegisterExtensionTask.java


示例3: isSupportedWidgetAvailable

import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:37,代码来源:RegistrationInformation.java


示例4: closeSocket

import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:26,代码来源:AccessorySensor.java


示例5: run

import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入依赖的package包/类
@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);
        }
    }
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:20,代码来源:AccessorySensor.java


示例6: 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));
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:28,代码来源:NotificationWidgetExtension.java


示例7: getImage

import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入依赖的package包/类
/**
 * 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;
        }
    }
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:23,代码来源:NotificationWidgetEvent.java


示例8: getName

import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入依赖的package包/类
/**
 * Get the name.
 *
 * @return The name.
 */
public String getName() {
    // If display name explicitly set then use it.
    // Otherwise get the display name from the contact.
    if (mName != null) {
        return mName;
    } else {
        if (mContactReference != null) {
            Uri uri = Uri.parse(mContactReference);
            return ExtensionUtils.getContactName(mContext, uri);
        } else {
            if (Dbg.DEBUG) {
                Dbg.e("No name");
            }
            return null;
        }
    }
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:23,代码来源:NotificationWidgetEvent.java


示例9: 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;
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:33,代码来源:DeviceInfoHelper.java


示例10: 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;
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:30,代码来源:DeviceInfoHelper.java


示例11: 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;
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:28,代码来源:DeviceInfoHelper.java


示例12: performRegistration

import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入依赖的package包/类
/**
 * 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;
    }
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:29,代码来源:RegistrationHelper.java


示例13: isSupportedWidgetAvailable

import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:35,代码来源:RegistrationInformation.java


示例14: isSupportedControlAvailable

import com.sonyericsson.extras.liveware.extension.util.Dbg; //导入依赖的package包/类
/**
 * Check if control shall be supported for this host application by checking
 * that the host application has a device with a supported display size.
 * This method can be override to provide extension specific
 * implementations.
 *
 * @param context The context.
 * @param hostApplication The host application.
 * @return True if control shall be supported.
 */
public boolean isSupportedControlAvailable(final Context context,
        final HostApplicationInfo hostApplication) {
    if (getRequiredControlApiVersion() == API_NOT_REQUIRED) {
        return false;
    }

    if (hostApplication.getControlApiVersion() == 0) {
        return false;
    }

    if (getRequiredControlApiVersion() > hostApplication.getControlApiVersion()) {
        if (Dbg.DEBUG) {
            Dbg.w("isSupportedControlAvailable: required control API version not supported");
        }
        return false;
    }

    for (DeviceInfo device : hostApplication.getDevices()) {
        if (isControlDeviceSupported(device)) {
            return true;
        }
    }

    return false;
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:36,代码来源:RegistrationInformation.java


示例15: 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);
}
 
开发者ID:sonyxperiadev,项目名称:DroneControl,代码行数:22,代码来源:ControlExtension.java


示例16: 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;
}
 
开发者ID:jphacks,项目名称:KB_1511,代码行数:33,代码来源:DeviceInfoHelper.java



注:本文中的com.sonyericsson.extras.liveware.extension.util.Dbg类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PostDeleteEvent类代码示例发布时间:2022-05-23
下一篇:
Java Matrix类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap