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

Java Widget类代码示例

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

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



Widget类属于com.sonyericsson.extras.liveware.aef.widget包,在下文中一共展示了Widget类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:22,代码来源:NotificationWidgetExtension.java


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


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


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


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


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


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


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


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


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


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


示例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;
}
 
开发者ID:hecosire,项目名称:hecosire-androidapp,代码行数:17,代码来源:WidgetExtension.java


示例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);
}
 
开发者ID:hecosire,项目名称:hecosire-androidapp,代码行数:18,代码来源:WidgetExtension.java


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


示例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);
}
 
开发者ID:hecosire,项目名称:hecosire-androidapp,代码行数:18,代码来源:WidgetExtension.java


示例16: sendText

import com.sonyericsson.extras.liveware.aef.widget.Widget; //导入依赖的package包/类
/**
 * Update a TextView in a specific layout, on the accessory.
 * 
 * @param layoutReference The referenced resource within the current layout.
 * @param text The text to be updated.
 */
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);
}
 
开发者ID:hecosire,项目名称:hecosire-androidapp,代码行数:13,代码来源:WidgetExtension.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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