本文整理汇总了Java中com.sonyericsson.extras.liveware.aef.widget.Widget类的典型用法代码示例。如果您正苦于以下问题:Java Widget类的具体用法?Java Widget怎么用?Java Widget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Widget类属于com.sonyericsson.extras.liveware.aef.widget包,在下文中一共展示了Widget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTouch
import com.sonyericsson.extras.liveware.aef.widget.Widget; //导入依赖的package包/类
/**
* 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);
}
示例2: createPendingRefreshIntent
import com.sonyericsson.extras.liveware.aef.widget.Widget; //导入依赖的package包/类
/**
* Utility that creates the pending intent used to schedule a refresh or to
* cancel refreshing
*
* @see #onScheduledRefresh()
*
* @return The pending intent
*/
private PendingIntent createPendingRefreshIntent(String extensionKey) {
Intent intent = new Intent(SCHEDULED_REFRESH_INTENT);
intent.putExtra(Widget.Intents.EXTRA_EXTENSION_KEY, extensionKey);
intent.putExtra(Widget.Intents.EXTRA_AHA_PACKAGE_NAME, mHostAppPackageName);
intent.setPackage(mContext.getPackageName());
PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
return pi;
}
示例3: sendImageToHostApp
import com.sonyericsson.extras.liveware.aef.widget.Widget; //导入依赖的package包/类
/**
* Sends an image to the host application.
*
* @param resourceId The image resource id.
*/
protected void sendImageToHostApp(final int resourceId) {
Intent intent = new Intent();
intent.setAction(Widget.Intents.WIDGET_IMAGE_UPDATE_INTENT);
BitmapDrawable bmd = (BitmapDrawable)mContext.getResources().getDrawable(resourceId);
ByteArrayOutputStream os = new ByteArrayOutputStream(256);
Bitmap bm = bmd.getBitmap();
bm.compress(CompressFormat.PNG, 100, os);
byte[] buffer = os.toByteArray();
intent.putExtra(Widget.Intents.EXTRA_WIDGET_IMAGE_DATA, buffer);
sendToHostApp(intent);
}
示例4: showBitmap
import com.sonyericsson.extras.liveware.aef.widget.Widget; //导入依赖的package包/类
/**
* Show bitmap on accessory.
*
* @param bitmap The bitmap to show.
*/
protected void showBitmap(final Bitmap bitmap) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(256);
bitmap.compress(CompressFormat.PNG, 100, outputStream);
Intent intent = new Intent(Widget.Intents.WIDGET_IMAGE_UPDATE_INTENT);
intent.putExtra(Widget.Intents.EXTRA_WIDGET_IMAGE_DATA, outputStream.toByteArray());
sendToHostApp(intent);
}
示例5: supportsAdvancedWidgets
import com.sonyericsson.extras.liveware.aef.widget.Widget; //导入依赖的package包/类
/**
* Checks if in intent is coming from a host application that supports the new Widget registration features.
* @param intent the intent from the host application
* @return true if advanced widget features are supported
*/
private boolean supportsAdvancedWidgets(Intent intent) {
// To avoid the performance hit of checking the Registration database
// for API level, this implementation simply checks for the instanceId,
// required in all intents for advanced widgets.
return intent.hasExtra(Widget.Intents.EXTRA_INSTANCE_ID);
}
示例6: createPendingRefreshIntent
import com.sonyericsson.extras.liveware.aef.widget.Widget; //导入依赖的package包/类
/**
* Utility that creates the pending intent used to schedule a refresh or to
* cancel refreshing
*
* @see #onScheduledRefresh()
* @return The pending intent
*/
private PendingIntent createPendingRefreshIntent(String extensionKey) {
Intent intent = new Intent(SCHEDULED_REFRESH_INTENT);
intent.putExtra(Widget.Intents.EXTRA_EXTENSION_KEY, extensionKey);
intent.putExtra(Widget.Intents.EXTRA_AHA_PACKAGE_NAME, mHostAppPackageName);
intent.putExtra(Widget.Intents.EXTRA_INSTANCE_ID, mInstanceId);
intent.setPackage(mContext.getPackageName());
PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, intent,
PendingIntent.FLAG_CANCEL_CURRENT);
return pi;
}
示例7: sendImageToHostApp
import com.sonyericsson.extras.liveware.aef.widget.Widget; //导入依赖的package包/类
/**
* Show image in the widget.
*
* @param resourceId The image resource id.
*/
protected void sendImageToHostApp(final int resourceId) {
Intent intent = new Intent();
intent.setAction(Widget.Intents.WIDGET_IMAGE_UPDATE_INTENT);
BitmapDrawable bmd = (BitmapDrawable) mContext.getResources().getDrawable(resourceId);
ByteArrayOutputStream os = new ByteArrayOutputStream(256);
Bitmap bm = bmd.getBitmap();
bm.compress(CompressFormat.PNG, 100, os);
byte[] buffer = os.toByteArray();
intent.putExtra(Widget.Intents.EXTRA_WIDGET_IMAGE_DATA, buffer);
sendToHostApp(intent);
}
示例8: sendToHostApp
import com.sonyericsson.extras.liveware.aef.widget.Widget; //导入依赖的package包/类
/**
* Send intent to host application. Adds host application package name and
* our package name.
*
* @param intent The intent to send.
*/
protected void sendToHostApp(final Intent intent) {
intent.putExtra(Widget.Intents.EXTRA_AEA_PACKAGE_NAME, mContext.getPackageName());
intent.putExtra(Widget.Intents.EXTRA_INSTANCE_ID, mInstanceId);
intent.setPackage(mHostAppPackageName);
mContext.sendBroadcast(intent, Registration.HOSTAPP_PERMISSION);
}
示例9: showBitmap
import com.sonyericsson.extras.liveware.aef.widget.Widget; //导入依赖的package包/类
/**
* Show bitmap in the widget.
*
* @param bitmap The bitmap to show.
*/
protected void showBitmap(final Bitmap bitmap) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(256);
bitmap.compress(CompressFormat.PNG, 100, outputStream);
Intent intent = new Intent(Widget.Intents.WIDGET_IMAGE_UPDATE_INTENT);
intent.putExtra(Widget.Intents.EXTRA_WIDGET_IMAGE_DATA, outputStream.toByteArray());
sendToHostApp(intent);
}
示例10: sendImage
import com.sonyericsson.extras.liveware.aef.widget.Widget; //导入依赖的package包/类
/**
* Update an image in a specific layout, in the widget.
*
* @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(Widget.Intents.WIDGET_SEND_IMAGE_INTENT);
intent.putExtra(Widget.Intents.EXTRA_LAYOUT_REFERENCE, layoutReference);
intent.putExtra(Widget.Intents.EXTRA_WIDGET_IMAGE_URI,
ExtensionUtils.getUriString(mContext, resourceId));
sendToHostApp(intent);
}
示例11: sendText
import com.sonyericsson.extras.liveware.aef.widget.Widget; //导入依赖的package包/类
/**
* Update a TextView in a specific layout, in the widget.
*
* @param layoutReference The referenced resource within the current layout.
* @param text The text to be shown.
*/
protected void sendText(final int layoutReference, final String text) {
Intent intent = new Intent(Widget.Intents.WIDGET_SEND_TEXT_INTENT);
intent.putExtra(Widget.Intents.EXTRA_LAYOUT_REFERENCE, layoutReference);
intent.putExtra(Widget.Intents.EXTRA_WIDGET_TEXT, text);
sendToHostApp(intent);
}
示例12: createPendingRefreshIntent
import com.sonyericsson.extras.liveware.aef.widget.Widget; //导入依赖的package包/类
/**
* Utility that creates the pending intent used to schedule a refresh or to
* cancel refreshing
*
* @see #onScheduledRefresh()
* @return The pending intent
*/
private PendingIntent createPendingRefreshIntent(String extensionKey) {
Intent intent = new Intent(SCHEDULED_REFRESH_INTENT);
intent.putExtra(Widget.Intents.EXTRA_EXTENSION_KEY, extensionKey);
intent.putExtra(Widget.Intents.EXTRA_AHA_PACKAGE_NAME, mHostAppPackageName);
intent.setPackage(mContext.getPackageName());
PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, intent,
PendingIntent.FLAG_CANCEL_CURRENT);
return pi;
}
示例13: sendImageToHostApp
import com.sonyericsson.extras.liveware.aef.widget.Widget; //导入依赖的package包/类
/**
* Sends an image to the host application.
*
* @param resourceId The image resource id.
*/
protected void sendImageToHostApp(final int resourceId) {
Intent intent = new Intent();
intent.setAction(Widget.Intents.WIDGET_IMAGE_UPDATE_INTENT);
BitmapDrawable bmd = (BitmapDrawable) mContext.getResources().getDrawable(resourceId);
ByteArrayOutputStream os = new ByteArrayOutputStream(256);
Bitmap bm = bmd.getBitmap();
bm.compress(CompressFormat.PNG, 100, os);
byte[] buffer = os.toByteArray();
intent.putExtra(Widget.Intents.EXTRA_WIDGET_IMAGE_DATA, buffer);
sendToHostApp(intent);
}
示例14: showBitmap
import com.sonyericsson.extras.liveware.aef.widget.Widget; //导入依赖的package包/类
/**
* Show bitmap on accessory.
*
* @param bitmap The bitmap to show.
*/
protected void showBitmap(final Bitmap bitmap) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(256);
bitmap.compress(CompressFormat.PNG, 100, outputStream);
Intent intent = new Intent(Widget.Intents.WIDGET_IMAGE_UPDATE_INTENT);
intent.putExtra(Widget.Intents.EXTRA_WIDGET_IMAGE_DATA, outputStream.toByteArray());
sendToHostApp(intent);
}
示例15: sendImage
import com.sonyericsson.extras.liveware.aef.widget.Widget; //导入依赖的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(Widget.Intents.WIDGET_SEND_IMAGE_INTENT);
intent.putExtra(Widget.Intents.EXTRA_LAYOUT_REFERENCE, layoutReference);
intent.putExtra(Widget.Intents.EXTRA_WIDGET_IMAGE_URI,
ExtensionUtils.getUriString(mContext, resourceId));
sendToHostApp(intent);
}