当前位置: 首页>>代码示例>>Java>>正文


Java DeviceInfoHelper类代码示例

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


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

示例1: SWControlExtension

import com.sonyericsson.extras.liveware.extension.util.registration.DeviceInfoHelper; //导入依赖的package包/类
/**
 * Creates a control extension.
 * 
 * @param hostAppPackageName Package name of host application.
 * @param context The context.
 */
SWControlExtension(final Context context, final String hostAppPackageName) {
    super(context, hostAppPackageName);
    mContext = context;
    // Determine host application screen size.
    if (DeviceInfoHelper.isSmartWatch2ApiAndScreenDetected(context, hostAppPackageName)) {
        mWidth = context.getResources().getDimensionPixelSize(R.dimen.smart_watch_2_control_width);
        mHeight = context.getResources().getDimensionPixelSize(R.dimen.smart_watch_2_control_height);
    } else {
        mWidth = context.getResources().getDimensionPixelSize(R.dimen.smart_watch_control_width);
        mHeight = context.getResources().getDimensionPixelSize(R.dimen.smart_watch_control_height);
    }

    AccessorySensorManager manager = new AccessorySensorManager(context, hostAppPackageName);

    // Add accelerometer, if supported by the host application.
    if (DeviceInfoHelper.isSensorSupported(context, hostAppPackageName, SensorTypeValue.ACCELEROMETER)) {
        mSensor = manager.getSensor(SensorTypeValue.ACCELEROMETER);
    }
    initializeMenus();
    showDisplay();
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:28,代码来源:SWControlExtension.java

示例2: onViewEvent

import com.sonyericsson.extras.liveware.extension.util.registration.DeviceInfoHelper; //导入依赖的package包/类
@Override
protected void onViewEvent(Intent intent) {
    String action = intent.getStringExtra(Notification.Intents.EXTRA_ACTION);
    String hostAppPackageName = intent
            .getStringExtra(Registration.Intents.EXTRA_AHA_PACKAGE_NAME);
    boolean advancedFeaturesSupported = DeviceInfoHelper.isSmartWatch2ApiAndScreenDetected(
            this, hostAppPackageName);

    int eventId = intent.getIntExtra(Notification.Intents.EXTRA_EVENT_ID, -1);
    if (Notification.SourceColumns.ACTION_1.equals(action)) {
        NotificationUtil.deleteAllEvents(this);
    } else if (Notification.SourceColumns.ACTION_2.equals(action)) {
        NotificationUtil.deleteAllEvents(this);
    } else if (Notification.SourceColumns.ACTION_3.equals(action)) {
        Toast.makeText(this, "Action 3", Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:grimpy,项目名称:Botifier,代码行数:18,代码来源:SWExtensionService.java

示例3: createControlExtension

import com.sonyericsson.extras.liveware.extension.util.registration.DeviceInfoHelper; //导入依赖的package包/类
@Override
public ControlExtension createControlExtension(String hostAppPackageName) {
	// First we check if the API level and screen size required for
	// SampleControlSmartWatch2 is supported
	boolean advancedFeaturesSupported = DeviceInfoHelper.
			isSmartWatch2ApiAndScreenDetected(this, hostAppPackageName);
	if (advancedFeaturesSupported) {
		return new ControlSmartWatch2(
				hostAppPackageName, this, new Handler());
	} else {
		// If not we return an API level 1 control based on screen size
		throw new IllegalArgumentException("No control for: "
				+ hostAppPackageName);
	}
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:16,代码来源:MainExtensionService.java

示例4: determineDisplaySize

import com.sonyericsson.extras.liveware.extension.util.registration.DeviceInfoHelper; //导入依赖的package包/类
/**
 * 指定されたホストアプリケーションに対応するSWの画面サイズを返す.
 *
 * @param context            コンテキスト
 * @param hostAppPackageName ホストアプリケーション名(SW1orSW2)
 * @return 画面サイズ
 */
private static DisplaySize determineDisplaySize(final Context context, final String hostAppPackageName) {
    boolean smartWatch2Supported = DeviceInfoHelper.isSmartWatch2ApiAndScreenDetected(context, hostAppPackageName);
    int width;
    int height;
    if (smartWatch2Supported) {
        width = context.getResources().getDimensionPixelSize(R.dimen.smart_watch_2_control_width);
        height = context.getResources().getDimensionPixelSize(R.dimen.smart_watch_2_control_height);
    } else {
        width = context.getResources().getDimensionPixelSize(R.dimen.smart_watch_control_width);
        height = context.getResources().getDimensionPixelSize(R.dimen.smart_watch_control_height);
    }
    return new DisplaySize(width, height);
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:21,代码来源:SWCanvasProfile.java

示例5: createControlExtension

import com.sonyericsson.extras.liveware.extension.util.registration.DeviceInfoHelper; //导入依赖的package包/类
@Override
public ControlExtension createControlExtension(String hostAppPackageName) {
    // First we check if the API level and screen size required for
    // SampleControlSmartWatch2 is supported
    boolean advancedFeaturesSupported = DeviceInfoHelper.isSmartWatch2ApiAndScreenDetected(
            this, hostAppPackageName);
    if (advancedFeaturesSupported) {
        return new SampleControlSmartWatch2(hostAppPackageName, this, new Handler());
    }
    throw new IllegalArgumentException("No control for: " + hostAppPackageName);

}
 
开发者ID:hecosire,项目名称:hecosire-androidapp,代码行数:13,代码来源:SampleExtensionService.java

示例6: createControlExtension

import com.sonyericsson.extras.liveware.extension.util.registration.DeviceInfoHelper; //导入依赖的package包/类
@Override
public ControlExtension createControlExtension(String hostAppPackageName) {
    // First we check if the host application API level and screen size
    // is supported by the extension.
    boolean advancedFeaturesSupported = DeviceInfoHelper.isSmartWatch2ApiAndScreenDetected(
        this, hostAppPackageName);
    if (advancedFeaturesSupported) {
        return new ScreenControl(hostAppPackageName, this, new Handler());
    } else {
        throw new IllegalArgumentException("No control for: " + hostAppPackageName);
    }
}
 
开发者ID:zasadnyy,项目名称:vision-trainer-sw2,代码行数:13,代码来源:ExtensionService.java

示例7: createControlExtension

import com.sonyericsson.extras.liveware.extension.util.registration.DeviceInfoHelper; //导入依赖的package包/类
@Override
public ControlExtension createControlExtension(String hostAppPackageName) {
  if (!DeviceInfoHelper.isSmartWatch2ApiAndScreenDetected(this, hostAppPackageName))
    throw new IllegalArgumentException("SmartWatch 2 not found");

  return new SwControlFlow(hostAppPackageName);
}
 
开发者ID:trashkalmar,项目名称:MrParkingNavigator,代码行数:8,代码来源:SwService.java

示例8: updateSources

import com.sonyericsson.extras.liveware.extension.util.registration.DeviceInfoHelper; //导入依赖的package包/类
/**
 * Update sources, limit scope to sources in this extension
 * <p>
 *
 * This method is mainly aimed for extensions that shares user id and
 * process in which case they can access and modify data that belongs to
 * other extensions.
 * <p>
 *
 * Note that no runtime exceptions, such as {@link SecurityException} and
 * {@link SQLException}, will be handled by this method. Exceptions shall
 * instead be handled in the calling method if needed.
 *
 * @param context The context
 * @param values The new field values. The key is the column name for the
 *            field. A null value will remove an existing field value.
 * @param where A filter to apply to rows before updating, formatted as an
 *            SQL WHERE clause (excluding the WHERE itself).
 * @param selectionArgs Arguments to where String
 * @return The number of rows updated
 */
public static int updateSources(Context context, ContentValues values, String where,
        String[] selectionArgs) {
    String extensionWhere = getSourcesWhere(context);
    if (!TextUtils.isEmpty(where)) {
        extensionWhere += " AND (" + where + ")";
    }
    DeviceInfoHelper.removeUnsafeValues(context, values);
    return context.getContentResolver().update(Notification.Source.URI, values, extensionWhere,
            selectionArgs);
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:32,代码来源:NotificationUtil.java

示例9: updateSources

import com.sonyericsson.extras.liveware.extension.util.registration.DeviceInfoHelper; //导入依赖的package包/类
/**
 * Update sources, limit scope to sources in this extension
 * <p>
 *
 * This method is mainly aimed for extensions that shares user id and
 * process in which case they can access and modify data that belongs to
 * other extensions.
 * <p>
 *
 * Note that no runtime exceptions, such as {@link SecurityException} and
 * {@link SQLException}, will be handled by this method. Exceptions shall
 * instead be handled in the calling method if needed.
 *
 * @param context       The context
 * @param values        The new field values. The key is the column name for the
 *                      field. A null value will remove an existing field value.
 * @param where         A filter to apply to rows before updating, formatted as an
 *                      SQL WHERE clause (excluding the WHERE itself).
 * @param selectionArgs Arguments to where String
 * @return The number of rows updated
 */
public static int updateSources(Context context, ContentValues values, String where,
                                String[] selectionArgs) {
  String extensionWhere = getSourcesWhere(context);
  if (!TextUtils.isEmpty(where)) {
    extensionWhere += " AND (" + where + ")";
  }
  DeviceInfoHelper.removeUnsafeValues(context, values);
  return context.getContentResolver().update(Notification.Source.URI, values, extensionWhere,
                                             selectionArgs);
}
 
开发者ID:trashkalmar,项目名称:MrParkingNavigator,代码行数:32,代码来源:NotificationUtil.java


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