本文整理汇总了Java中com.sonyericsson.extras.liveware.extension.util.ExtensionUtils类的典型用法代码示例。如果您正苦于以下问题:Java ExtensionUtils类的具体用法?Java ExtensionUtils怎么用?Java ExtensionUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExtensionUtils类属于com.sonyericsson.extras.liveware.extension.util包,在下文中一共展示了ExtensionUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExtensionRegistrationConfiguration
import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入依赖的package包/类
@Override
public ContentValues getExtensionRegistrationConfiguration() {
String iconHostapp = ExtensionUtils.getUriString(mContext, R.drawable.iconshka);
String iconExtension = ExtensionUtils.getUriString(mContext, R.drawable.iconshka);
ContentValues values = new ContentValues();
values.put(Registration.ExtensionColumns.CONFIGURATION_ACTIVITY,
ClockWidgetPreferenceActivity.class.getName());
values.put(Registration.ExtensionColumns.CONFIGURATION_TEXT,
mContext.getString(R.string.app_name));
values.put(Registration.ExtensionColumns.NAME, mContext.getString(R.string.app_name));
values.put(Registration.ExtensionColumns.EXTENSION_KEY, getExtensionKey());
values.put(Registration.ExtensionColumns.HOST_APP_ICON_URI, iconHostapp);
values.put(Registration.ExtensionColumns.EXTENSION_ICON_URI, iconExtension);
values.put(Registration.ExtensionColumns.NOTIFICATION_API_VERSION,
getRequiredNotificationApiVersion());
values.put(Registration.ExtensionColumns.PACKAGE_NAME, mContext.getPackageName());
return values;
}
开发者ID:AlexanderKirillov,项目名称:MaXimus-WatchFaces-for-SmartWatch-2,代码行数:21,代码来源:ClockWidgetRegistrationInformation.java
示例2: getImage
import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入依赖的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;
}
}
}
示例3: getName
import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入依赖的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;
}
}
}
示例4: getExtensionRegistrationConfiguration
import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入依赖的package包/类
/**
* Get the extension registration information.
*
* @return The registration configuration.
*/
@Override
public ContentValues getExtensionRegistrationConfiguration() {
String iconHostapp = ExtensionUtils.getUriString( mContext, R.drawable.icon );
String iconExtension = ExtensionUtils.getUriString( mContext, R.drawable.icon );
ContentValues values = new ContentValues();
values.put( Registration.ExtensionColumns.CONFIGURATION_ACTIVITY,
SettingsActivity.class.getName() );
values.put( Registration.ExtensionColumns.CONFIGURATION_TEXT,
mContext.getString( R.string.configuration_text ) );
values.put( Registration.ExtensionColumns.NAME, mContext.getString( R.string.extension_name ) );
values.put( Registration.ExtensionColumns.EXTENSION_KEY,
ExtensionService.EXTENSION_KEY );
values.put( Registration.ExtensionColumns.HOST_APP_ICON_URI, iconHostapp );
values.put( Registration.ExtensionColumns.EXTENSION_ICON_URI, iconExtension );
values.put( Registration.ExtensionColumns.NOTIFICATION_API_VERSION,
getRequiredNotificationApiVersion() );
values.put( Registration.ExtensionColumns.PACKAGE_NAME, mContext.getPackageName() );
return values;
}
示例5: registerOrUpdateWidgetRegistration
import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入依赖的package包/类
/**
* Register or update widget registration.
*
* @param apiRegistrationId The API registration ID.
* @param values The content values to register.
* @return True if the registration was successful.
*/
private boolean registerOrUpdateWidgetRegistration(long apiRegistrationId, ContentValues values) {
if (ExtensionUtils.getRegistrationVersion(mContext) < 3) {
// Widget registration only possible if Registration API version 3 or later.
return false;
}
values.put(Registration.WidgetRegistrationColumns.API_REGISTRATION_ID, apiRegistrationId);
long widgetRegistrationId = getWidgetRegistrationId(apiRegistrationId,
values.getAsString(Registration.WidgetRegistrationColumns.KEY));
if (widgetRegistrationId != ExtensionUtils.INVALID_ID) {
return mContext.getContentResolver().update(Registration.WidgetRegistration.URI,
values, Registration.WidgetRegistrationColumns._ID + " = ?", new String[] {
Long.toString(widgetRegistrationId)
}) > 0;
} else {
return mContext.getContentResolver()
.insert(Registration.WidgetRegistration.URI, values) != null;
}
}
示例6: getExtensionRegistrationConfiguration
import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入依赖的package包/类
/**
* Returns the properties of this extension.
*
* @return The registration configuration.
*/
@Override
public ContentValues getExtensionRegistrationConfiguration() {
String iconHostapp = ExtensionUtils.getUriString(mContext, R.drawable.icon);
String iconExtension = ExtensionUtils.getUriString(mContext, R.drawable.icon_extension);
ContentValues values = new ContentValues();
values.put(Registration.ExtensionColumns.CONFIGURATION_ACTIVITY, SWSettingMainActivity.class.getName());
values.put(Registration.ExtensionColumns.CONFIGURATION_TEXT, "SW Device Plugin");
values.put(Registration.ExtensionColumns.NAME, "SW Device Plugin");
values.put(Registration.ExtensionColumns.EXTENSION_KEY, getExtensionKey());
values.put(Registration.ExtensionColumns.HOST_APP_ICON_URI, iconHostapp);
values.put(Registration.ExtensionColumns.EXTENSION_ICON_URI, iconExtension);
values.put(Registration.ExtensionColumns.NOTIFICATION_API_VERSION,
getRequiredNotificationApiVersion());
values.put(Registration.ExtensionColumns.PACKAGE_NAME, mContext.getPackageName());
return values;
}
示例7: getExtensionRegistrationConfiguration
import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入依赖的package包/类
/**
* Return the extension registration information. Specify the properties of
* the extension that will be used when it is registered.
*
* @return The registration configuration.
*/
@Override
public ContentValues getExtensionRegistrationConfiguration() {
String iconHostApp = ExtensionUtils.getUriString(_context, R.drawable.ic_launcher);
String iconExtension = ExtensionUtils.getUriString(_context, R.drawable.ic_extension);
String iconExtension48 = ExtensionUtils.getUriString(_context, R.drawable.ic_extension48);
ContentValues values = new ContentValues();
values.put(Registration.ExtensionColumns.CONFIGURATION_ACTIVITY,
PreferenceActivity.class.getName());
values.put(Registration.ExtensionColumns.CONFIGURATION_TEXT,
_context.getString(R.string.configuration_text));
values.put(Registration.ExtensionColumns.NAME, _context.getString(R.string.extension_name));
values.put(Registration.ExtensionColumns.EXTENSION_KEY, getExtensionKey());
values.put(Registration.ExtensionColumns.HOST_APP_ICON_URI, iconHostApp);
values.put(Registration.ExtensionColumns.EXTENSION_ICON_URI, iconExtension);
values.put(Registration.ExtensionColumns.EXTENSION_48PX_ICON_URI, iconExtension48);
values.put(Registration.ExtensionColumns.NOTIFICATION_API_VERSION,
getRequiredNotificationApiVersion());
values.put(Registration.ExtensionColumns.PACKAGE_NAME, _context.getPackageName());
return values;
}
示例8: getExtensionRegistrationConfiguration
import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入依赖的package包/类
@Override
public ContentValues getExtensionRegistrationConfiguration() {
String iconHostapp = ExtensionUtils.getUriString(mContext, R.drawable.ic_launcher);
String iconExtension = ExtensionUtils.getUriString(mContext, R.drawable.applevel_icon);
ContentValues values = new ContentValues();
values.put(Registration.ExtensionColumns.NAME, "wePoker");
values.put(Registration.ExtensionColumns.EXTENSION_KEY, WePokerSWService.SMARTWATCH_KEY);
values.put(Registration.ExtensionColumns.HOST_APP_ICON_URI, iconHostapp);
values.put(Registration.ExtensionColumns.EXTENSION_ICON_URI, iconExtension);
values.put(Registration.ExtensionColumns.NOTIFICATION_API_VERSION,
getRequiredNotificationApiVersion());
values.put(Registration.ExtensionColumns.PACKAGE_NAME, mContext.getPackageName());
return values;
}
示例9: isHostAppRegistered
import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入依赖的package包/类
/**
* Checks if the extension is registered with a host application.
*
* This method is called from the the background
*
* @param packageName The package name of the host application.
*
* @return True if the extension is registered with the host application.
*/
private boolean isHostAppRegistered(String packageName) {
Cursor cursor = null;
boolean isRegistered = false;
long extensionId = ExtensionUtils.getExtensionId(mContext);
String selection = Registration.ApiRegistrationColumns.EXTENSION_ID + " = " + extensionId
+ " AND " + Registration.ApiRegistrationColumns.HOST_APPLICATION_PACKAGE + " = ?";
String[] selectionArgs = new String[] {
packageName
};
try {
cursor = mContext.getContentResolver().query(Registration.ApiRegistration.URI,
new String[] {
Registration.ApiRegistrationColumns.HOST_APPLICATION_PACKAGE
}, selection, selectionArgs, null);
if (cursor != null) {
isRegistered = (cursor.getCount() > 0);
}
} finally {
if (cursor != null) {
cursor.close();
}
}
return isRegistered;
}
示例10: applyInnerLayout
import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入依赖的package包/类
@Override
protected void applyInnerLayout(LinearLayout innerLayout) {
Bitmap backgroundBitmap = mEvent.getImage();
if (null != backgroundBitmap) {
((ImageView)innerLayout
.findViewById(R.id.smart_watch_notification_widget_background))
.setImageBitmap(backgroundBitmap);
((ImageView)innerLayout
.findViewById(R.id.smart_watch_notification_widget_text_background))
.setVisibility(View.VISIBLE);
}
// set title
((TextView)innerLayout.findViewById(R.id.smart_watch_notification_widget_text_title))
.setText(mEvent.getTitle());
// set time stamp
String time = ExtensionUtils.getFormattedTime(mEvent.getTime());
((TextView)innerLayout.findViewById(R.id.smart_watch_notification_widget_text_time))
.setText(time);
// set name
((TextView)innerLayout.findViewById(R.id.smart_watch_notification_widget_text_name))
.setText(mEvent.getName());
}
示例11: sendImage
import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入依赖的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);
}
示例12: isHostAppRegistered
import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入依赖的package包/类
/**
* Checks if the extension is registered with a host application. This
* method is called from the the background
*
* @param packageName The package name of the host application.
* @return True if the extension is registered with the host application.
*/
private boolean isHostAppRegistered(String packageName) {
Cursor cursor = null;
boolean isRegistered = false;
long extensionId = ExtensionUtils.getExtensionId(mContext);
String selection = Registration.ApiRegistrationColumns.EXTENSION_ID + " = " + extensionId
+ " AND " + Registration.ApiRegistrationColumns.HOST_APPLICATION_PACKAGE + " = ?";
String[] selectionArgs = new String[] {
packageName
};
try {
cursor = mContext.getContentResolver().query(Registration.ApiRegistration.URI,
new String[] {
Registration.ApiRegistrationColumns.HOST_APPLICATION_PACKAGE
},
selection, selectionArgs, null);
if (cursor != null) {
isRegistered = (cursor.getCount() > 0);
}
} finally {
if (cursor != null) {
cursor.close();
}
}
return isRegistered;
}
示例13: getWidgetRegistrationId
import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入依赖的package包/类
/**
* Get the widget registration id from a widget registration key.
*
* @param apiRegistrationId The API registration id.
* @param key The key.
* @return The widget registration id.
*/
private long getWidgetRegistrationId(long apiRegistrationId, String key) {
if (ExtensionUtils.getRegistrationVersion(mContext) < 3) {
// Widget registration only possible if Registration API version 3 or later.
return ExtensionUtils.INVALID_ID;
}
Cursor cursor = null;
try {
cursor = mContext.getContentResolver().query(
Registration.WidgetRegistration.URI,
new String[] {
Registration.WidgetRegistrationColumns._ID
}
,Registration.WidgetRegistrationColumns.API_REGISTRATION_ID + " = ? AND "
+ Registration.WidgetRegistrationColumns.KEY + " = ?", new String[] {
Long.toString(apiRegistrationId), key
}, null);
if (cursor != null && cursor.moveToFirst()) {
return cursor.getLong(cursor.getColumnIndexOrThrow(Registration.WidgetRegistrationColumns._ID));
}
} finally {
if (cursor != null) {
cursor.close();
}
}
return ExtensionUtils.INVALID_ID;
}
示例14: getWidgetRegistrationKeys
import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入依赖的package包/类
/**
* Get all widget registration keys for a specific API registration ID.
*
* @param apiRegistrationId The API registration id.
* @return A list with the keys.
*/
private List<String> getWidgetRegistrationKeys(long apiRegistrationId) {
List<String> keys = new ArrayList<String>();
if (ExtensionUtils.getRegistrationVersion(mContext) < 3) {
return keys;
}
Cursor cursor = null;
try {
cursor = mContext.getContentResolver().query(Registration.WidgetRegistration.URI,
new String[] {
Registration.WidgetRegistrationColumns.KEY
}, Registration.WidgetRegistrationColumns.API_REGISTRATION_ID + " = ?",
new String[] {
Long.toString(apiRegistrationId)
}, null);
while (cursor != null && cursor.moveToNext()) {
String key = cursor.getString(cursor
.getColumnIndex(Registration.WidgetRegistrationColumns.KEY));
keys.add(key);
}
} finally {
if (cursor != null) {
cursor.close();
}
}
return keys;
}
示例15: getWidgetRegistrationValues
import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils; //导入依赖的package包/类
/**
* Get widget registration values for a host application widget.
*
* @param context The context.
* @param hostAppPackageName The host application package name
* @param widgetContainer The host application widget the registration is for.
* @param registrationVersion
* @return Content values with widget registration values.
*/
public List<ContentValues> getWidgetRegistrationValues(Context context,
String packageName, WidgetContainer widgetContainer, int registrationVersion) {
List<ContentValues> widgetList = new ArrayList<ContentValues>();
WidgetClassList widgetRegistrations = getWidgetClasses(context,
packageName,
widgetContainer);
for (Class<?> widgetClass : widgetRegistrations) {
BaseWidget wr = getWidgetInstanceFromClass(context, packageName,
WidgetExtension.NOT_SET, widgetClass.getName());
ContentValues values = new ContentValues();
values.put(WidgetRegistrationColumns.NAME, context.getString(wr.getName()));
values.put(WidgetRegistrationColumns.WIDTH, wr.getWidth());
values.put(WidgetRegistrationColumns.HEIGHT, wr.getHeight());
values.put(WidgetRegistrationColumns.TYPE, widgetContainer.getType());
if (Dbg.DEBUG) {
Dbg.w("Registraton version: " + registrationVersion);
}
if (registrationVersion >= CATEGORY_SUPPORT_API_VERSION) {
values.put(WidgetRegistrationColumns.CATEGORY, wr.getCategory());
}
values.put(WidgetRegistrationColumns.KEY, widgetClass.getName());
values.put(WidgetRegistrationColumns.PREVIEW_IMAGE_URI,
ExtensionUtils.getUriString(context,
wr.getPreviewUri()));
widgetList.add(values);
}
return widgetList;
}