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


Java WidgetExtension类代码示例

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


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

示例1: destroyAllWidgets

import com.sonyericsson.extras.liveware.extension.util.widget.WidgetExtension; //导入依赖的package包/类
/**
 * Destroy all widgets. Inform all widgets that they shall free any
 * resources such as threads and registered broad cast receivers.
 */
public void destroyAllWidgets() {

    Iterator<WidgetExtension> iterator = mWidgets.values().iterator();
    while (iterator.hasNext()) {
        WidgetExtension widget = iterator.next();
        widget.destroy();
    }
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:13,代码来源:ExtensionService.java

示例2: getWidgetRegistrationValues

import com.sonyericsson.extras.liveware.extension.util.widget.WidgetExtension; //导入依赖的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;
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:39,代码来源:RegistrationInformation.java

示例3: onStartCommand

import com.sonyericsson.extras.liveware.extension.util.widget.WidgetExtension; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (intent != null) {
        IntentRunner runner = new IntentRunner(intent, startId) {
            @Override
            public void run() {
                ExtensionService.this.mStartId = mRunnerStartId;
                String action = mIntent.getAction();
                if (Registration.Intents.EXTENSION_REGISTER_REQUEST_INTENT.equals(action)) {
                    onRegisterRequest();
                    // Registration done in async task.
                    // Stopped when task is completed
                } else if (Intent.ACTION_LOCALE_CHANGED.equals(action)) {
                    onLocaleChanged();
                    stopSelfCheck();
                } else if (Registration.Intents.ACCESSORY_CONNECTION_INTENT.equals(action)) {
                    int status = mIntent.getIntExtra(Registration.Intents.EXTRA_CONNECTION_STATUS, -1);
                    onConnectionChanged(status == Registration.AccessoryConnectionStatus.STATUS_CONNECTED);
                    if (status == Registration.AccessoryConnectionStatus.STATUS_DISCONNECTED) {
                        // Accessory disconnected.
                        stopSelfCheck();
                    } else {
                        stopSelfCheck(true);
                    }
                } else if (Notification.Intents.VIEW_EVENT_INTENT.equals(action)
                        || Notification.Intents.REFRESH_REQUEST_INTENT.equals(action)) {
                    handleNotificationIntent(mIntent);
                    // Check if service shall be stopped.
                    // Assume accessory connected as it sent something to us.
                    stopSelfCheck(true);
                } else if (Widget.Intents.WIDGET_START_REFRESH_IMAGE_INTENT.equals(action)
                        || Widget.Intents.WIDGET_STOP_REFRESH_IMAGE_INTENT.equals(action)
                        || Widget.Intents.WIDGET_ONTOUCH_INTENT.equals(action)
                        || WidgetExtension.SCHEDULED_REFRESH_INTENT.equals(action)) {
                    handleWidgetIntent(mIntent);

                    // Check if service shall be stopped.
                    // Assume accessory connected as it sent something to us.
                    stopSelfCheck(true);
                } else if (Control.Intents.CONTROL_START_INTENT.equals(action)
                        || Control.Intents.CONTROL_STOP_INTENT.equals(action)
                        || Control.Intents.CONTROL_RESUME_INTENT.equals(action)
                        || Control.Intents.CONTROL_PAUSE_INTENT.equals(action)
                        || Control.Intents.CONTROL_ERROR_INTENT.equals(action)
                        || Control.Intents.CONTROL_KEY_EVENT_INTENT.equals(action)
                        || Control.Intents.CONTROL_TOUCH_EVENT_INTENT.equals(action)
                        || Control.Intents.CONTROL_SWIPE_EVENT_INTENT.equals(action)) {
                    handleControlIntent(mIntent);
                    // Check if service shall be stopped.
                    // Assume accessory connected as it sent something to us.
                    stopSelfCheck(true);
                }
            }
        };
        // post on handler to return quicker since started from broadcast receiver
        mHandler.post(runner);
    }

    return START_STICKY;
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:61,代码来源:ExtensionService.java

示例4: handleIntent

import com.sonyericsson.extras.liveware.extension.util.widget.WidgetExtension; //导入依赖的package包/类
/**
 * Handle intent received by extension service.
 * @param intent The intent.
 */
protected void handleIntent(Intent intent) {

    String action = intent.getAction();
    if (Registration.Intents.EXTENSION_REGISTER_REQUEST_INTENT.equals(action)) {
        onRegisterRequest();
        // Registration done in async task.
        // Stopped when task is completed
    } else if (Intent.ACTION_LOCALE_CHANGED.equals(action)) {
        onLocaleChanged();
        stopSelfCheck();
    } else if (Registration.Intents.ACCESSORY_CONNECTION_INTENT.equals(action)) {
        int status = intent.getIntExtra(
                Registration.Intents.EXTRA_CONNECTION_STATUS, -1);
        onConnectionChanged(status == Registration.AccessoryConnectionStatus.STATUS_CONNECTED);
        if (status == Registration.AccessoryConnectionStatus.STATUS_DISCONNECTED) {
            // Accessory disconnected.
            stopSelfCheck();
        } else {
            stopSelfCheck(true);
        }
    } else if (Notification.Intents.VIEW_EVENT_INTENT.equals(action)
            || Notification.Intents.REFRESH_REQUEST_INTENT.equals(action)) {
        handleNotificationIntent(intent);
        // Check if service shall be stopped.
        // Assume accessory connected as it sent something to
        // us.
        stopSelfCheck(true);
    } else if (Widget.Intents.WIDGET_START_REFRESH_IMAGE_INTENT.equals(action)
            || Widget.Intents.WIDGET_STOP_REFRESH_IMAGE_INTENT.equals(action)
            || Widget.Intents.WIDGET_ONTOUCH_INTENT.equals(action)
            || Widget.Intents.WIDGET_OBJECT_CLICK_EVENT_INTENT.equals(action)
            || WidgetExtension.SCHEDULED_REFRESH_INTENT.equals(action)) {
        handleWidgetIntent(intent);

        // Check if service shall be stopped.
        // Assume accessory connected as it sent something to
        // us.
        stopSelfCheck(true);
    } else if (Control.Intents.CONTROL_START_INTENT.equals(action)
            || Control.Intents.CONTROL_STOP_INTENT.equals(action)
            || Control.Intents.CONTROL_RESUME_INTENT.equals(action)
            || Control.Intents.CONTROL_PAUSE_INTENT.equals(action)
            || Control.Intents.CONTROL_ACTIVE_POWER_SAVE_MODE_STATUS_CHANGED_INTENT
                    .equals(action)
            || Control.Intents.CONTROL_ERROR_INTENT.equals(action)
            || Control.Intents.CONTROL_KEY_EVENT_INTENT.equals(action)
            || Control.Intents.CONTROL_TOUCH_EVENT_INTENT.equals(action)
            || Control.Intents.CONTROL_OBJECT_CLICK_EVENT_INTENT.equals(action)
            || Control.Intents.CONTROL_LIST_REQUEST_ITEM_INTENT.equals(action)
            || Control.Intents.CONTROL_LIST_ITEM_CLICK_INTENT.equals(action)
            || Control.Intents.CONTROL_LIST_REFRESH_REQUEST_INTENT.equals(action)
            || Control.Intents.CONTROL_LIST_ITEM_SELECTED_INTENT.equals(action)
            || Control.Intents.CONTROL_MENU_ITEM_SELECTED.equals(action)
            || Control.Intents.CONTROL_SWIPE_EVENT_INTENT.equals(action)
            || Control.Intents.CONTROL_TAP_EVENT_INTENT.equals(action)) {
        handleControlIntent(intent);
        // Check if service shall be stopped.
        // Assume accessory connected as it sent something to
        // us.
        stopSelfCheck(true);
    }
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:67,代码来源:ExtensionService.java

示例5: onStartCommand

import com.sonyericsson.extras.liveware.extension.util.widget.WidgetExtension; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (intent != null) {
        IntentRunner runner = new IntentRunner(intent, startId) {
            @Override
            public void run() {
                ExtensionService.this.mStartId = mRunnerStartId;
                String action = mIntent.getAction();
                if (Registration.Intents.EXTENSION_REGISTER_REQUEST_INTENT.equals(action)) {
                    onRegisterRequest();
                    // Registration done in async task.
                    // Stopped when task is completed
                } else if (Intent.ACTION_LOCALE_CHANGED.equals(action)) {
                    onLocaleChanged();
                    stopSelfCheck();
                } else if (Registration.Intents.ACCESSORY_CONNECTION_INTENT.equals(action)) {
                    int status = mIntent.getIntExtra(
                            Registration.Intents.EXTRA_CONNECTION_STATUS, -1);
                    onConnectionChanged(status == Registration.AccessoryConnectionStatus.STATUS_CONNECTED);
                    if (status == Registration.AccessoryConnectionStatus.STATUS_DISCONNECTED) {
                        // Accessory disconnected.
                        stopSelfCheck();
                    } else {
                        stopSelfCheck(true);
                    }
                } else if (Notification.Intents.VIEW_EVENT_INTENT.equals(action)
                        || Notification.Intents.REFRESH_REQUEST_INTENT.equals(action)) {
                    handleNotificationIntent(mIntent);
                    // Check if service shall be stopped.
                    // Assume accessory connected as it sent something to
                    // us.
                    stopSelfCheck(true);
                } else if (Widget.Intents.WIDGET_START_REFRESH_IMAGE_INTENT.equals(action)
                        || Widget.Intents.WIDGET_STOP_REFRESH_IMAGE_INTENT.equals(action)
                        || Widget.Intents.WIDGET_ONTOUCH_INTENT.equals(action)
                        || Widget.Intents.WIDGET_OBJECT_CLICK_EVENT_INTENT.equals(action)
                        || WidgetExtension.SCHEDULED_REFRESH_INTENT.equals(action)) {
                    handleWidgetIntent(mIntent);

                    // Check if service shall be stopped.
                    // Assume accessory connected as it sent something to
                    // us.
                    stopSelfCheck(true);
                } else if (Control.Intents.CONTROL_START_INTENT.equals(action)
                        || Control.Intents.CONTROL_STOP_INTENT.equals(action)
                        || Control.Intents.CONTROL_RESUME_INTENT.equals(action)
                        || Control.Intents.CONTROL_PAUSE_INTENT.equals(action)
                        || Control.Intents.CONTROL_ACTIVE_POWER_SAVE_MODE_STATUS_CHANGED_INTENT
                                .equals(action)
                        || Control.Intents.CONTROL_ERROR_INTENT.equals(action)
                        || Control.Intents.CONTROL_KEY_EVENT_INTENT.equals(action)
                        || Control.Intents.CONTROL_TOUCH_EVENT_INTENT.equals(action)
                        || Control.Intents.CONTROL_OBJECT_CLICK_EVENT_INTENT.equals(action)
                        || Control.Intents.CONTROL_LIST_REQUEST_ITEM_INTENT.equals(action)
                        || Control.Intents.CONTROL_LIST_ITEM_CLICK_INTENT.equals(action)
                        || Control.Intents.CONTROL_LIST_REFRESH_REQUEST_INTENT.equals(action)
                        || Control.Intents.CONTROL_LIST_ITEM_SELECTED_INTENT.equals(action)
                        || Control.Intents.CONTROL_MENU_ITEM_SELECTED.equals(action)
                        || Control.Intents.CONTROL_SWIPE_EVENT_INTENT.equals(action)) {
                    handleControlIntent(mIntent);
                    // Check if service shall be stopped.
                    // Assume accessory connected as it sent something to
                    // us.
                    stopSelfCheck(true);
                }
            }
        };
        // post on handler to return quicker since started from broadcast
        // receiver
        mHandler.post(runner);
    }

    return START_STICKY;
}
 
开发者ID:hecosire,项目名称:hecosire-androidapp,代码行数:75,代码来源:ExtensionService.java

示例6: createWidgetExtension

import com.sonyericsson.extras.liveware.extension.util.widget.WidgetExtension; //导入依赖的package包/类
@Override
public WidgetExtension createWidgetExtension(String hostAppPackageName) {
	return new WePokerWidgetExtension(this, hostAppPackageName);
}
 
开发者ID:AmbientTalk,项目名称:wePoker-smartwatch,代码行数:5,代码来源:WePokerSWService.java

示例7: doActionOnAllWidgets

import com.sonyericsson.extras.liveware.extension.util.widget.WidgetExtension; //导入依赖的package包/类
/**
 * Trigger action for all widgets. Use this method to take the same action
 * on all widgets.
 *
 * @param requestCode Code defined by the caller used to distinguish between
 *            different actions.
 * @param bundle Optional bundle with additional information.
 */
public void doActionOnAllWidgets(int requestCode, Bundle bundle) {
    Iterator<WidgetExtension> iterator = mWidgets.values().iterator();
    while (iterator.hasNext()) {
        WidgetExtension widget = iterator.next();
        widget.onDoAction(requestCode, bundle);
    }
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:16,代码来源:ExtensionService.java

示例8: doActionOnWidget

import com.sonyericsson.extras.liveware.extension.util.widget.WidgetExtension; //导入依赖的package包/类
/**
 * Trigger action on a widget.
 *
 * @param requestCode Code defined by the caller used to distinguish between
 *            different actions.
 * @param hostAppPackageName The host app package name.
 * @param bundle Optional bundle with additional information.
 *
 * @returns True if the widget exists. False otherwise.
 */
public boolean doActionOnWidget(int requestCode, String hostAppPackageName, Bundle bundle) {
    WidgetExtension widget = mWidgets.get(hostAppPackageName);
    if (widget != null) {
        widget.onDoAction(requestCode, bundle);
        return true;
    }
    return false;
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:19,代码来源:ExtensionService.java

示例9: doActionOnWidget

import com.sonyericsson.extras.liveware.extension.util.widget.WidgetExtension; //导入依赖的package包/类
/**
 * Trigger action on a widget.
 *
 * @param requestCode Code defined by the caller used to distinguish between
 *            different actions.
 * @param hostAppPackageName The host app package name.
 * @param bundle Optional bundle with additional information.
 * @returns True if the widget exists. False otherwise.
 */
public boolean doActionOnWidget(int requestCode, String hostAppPackageName, Bundle bundle) {
    WidgetExtension widget = mWidgets.get(hostAppPackageName);
    if (widget != null) {
        widget.onDoAction(requestCode, bundle);
        return true;
    }
    return false;
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:18,代码来源:ExtensionService.java

示例10: createWidgetExtension

import com.sonyericsson.extras.liveware.extension.util.widget.WidgetExtension; //导入依赖的package包/类
/**
 * Create widget extension. Override this method to provide extension
 * widgets.
 *
 * @param hostAppPackageName The host application package name.
 * @see WidgetExtension
 * @see RegistrationInformation#getRequiredWidgetApiVersion()
 *
 * @return The widget extension.
 */
public WidgetExtension createWidgetExtension(String hostAppPackageName) {
    throw new IllegalArgumentException(
            "createWidgetExtension() not implemented. Widget extensions must override this method");
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:15,代码来源:ExtensionService.java

示例11: createWidgetExtension

import com.sonyericsson.extras.liveware.extension.util.widget.WidgetExtension; //导入依赖的package包/类
/**
 * Create widget extension. Override this method to provide extension
 * widgets. This method must be implemented when implementing widgets
 * targeting widget API version 2 or lower.
 *
 * @param hostAppPackageName The package name of the host application that
 *            the widget will be shown on.
 * @see WidgetExtension
 * @see RegistrationInformation#getRequiredWidgetApiVersion()
 * @return The widget extension.
 */
public WidgetExtension createWidgetExtension(String hostAppPackageName) {
    throw new IllegalArgumentException(
            "createWidgetExtension(String) not implemented. Widget extensions must override this method");
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:16,代码来源:ExtensionService.java


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