本文整理汇总了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();
}
示例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();
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}