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


Java AppWidgetManager.ACTION_APPWIDGET_BIND属性代码示例

本文整理汇总了Java中android.appwidget.AppWidgetManager.ACTION_APPWIDGET_BIND属性的典型用法代码示例。如果您正苦于以下问题:Java AppWidgetManager.ACTION_APPWIDGET_BIND属性的具体用法?Java AppWidgetManager.ACTION_APPWIDGET_BIND怎么用?Java AppWidgetManager.ACTION_APPWIDGET_BIND使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.appwidget.AppWidgetManager的用法示例。


在下文中一共展示了AppWidgetManager.ACTION_APPWIDGET_BIND属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startBindFlow

public void startBindFlow(Launcher launcher, int appWidgetId, ItemInfo info, int requestCode) {
    launcher.setWaitingForResult(PendingRequestArgs.forWidgetInfo(appWidgetId, this, info));

    Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_BIND);
    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_PROVIDER, mProviderInfo.provider);
    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_PROVIDER_PROFILE,
            mProviderInfo.getProfile());
    // TODO: we need to make sure that this accounts for the options bundle.
    // intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS, options);
    launcher.startActivityForResult(intent, requestCode);
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:12,代码来源:WidgetAddFlowHandler.java

示例2: onPlaceAutomaticallyClick

/**
 * Called when place-automatically button is clicked.
 */
public void onPlaceAutomaticallyClick(View v) {
    if (mRequest.getRequestType() == PinItemRequestCompat.REQUEST_TYPE_SHORTCUT) {
        InstallShortcutReceiver.queueShortcut(
                new ShortcutInfoCompat(mRequest.getShortcutInfo()), this);
        mRequest.accept();
        finish();
        return;
    }

    mPendingBindWidgetId = mAppWidgetHost.allocateAppWidgetId();
    boolean success = mAppWidgetManager.bindAppWidgetIdIfAllowed(
            mPendingBindWidgetId, mRequest.getAppWidgetProviderInfo(this), mWidgetOptions);
    if (success) {
        acceptWidget(mPendingBindWidgetId);
        return;
    }

    // request bind widget
    Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_BIND);
    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mPendingBindWidgetId);
    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_PROVIDER,
            mPendingWidgetInfo.componentName);
    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_PROVIDER_PROFILE,
            mRequest.getAppWidgetProviderInfo(this).getProfile());
    startActivityForResult(intent, REQUEST_BIND_APPWIDGET);
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:29,代码来源:AddItemActivity.java

示例3: addAppWidgetFromDrop

/**
 * Process a widget drop.
 */
private void addAppWidgetFromDrop(PendingAddWidgetInfo info) {
    AppWidgetHostView hostView = info.boundWidget;
    int appWidgetId;
    if (hostView != null) {
        // In the case where we've prebound the widget, we remove it from the DragLayer
        if (LOGD) {
            Log.d(TAG, "Removing widget view from drag layer and setting boundWidget to null");
        }
        getDragLayer().removeView(hostView);

        appWidgetId = hostView.getAppWidgetId();
        addAppWidgetFromDropImpl(appWidgetId, info, hostView, info.info);

        // Clear the boundWidget so that it doesn't get destroyed.
        info.boundWidget = null;
    } else {
        // In this case, we either need to start an activity to get permission to bind
        // the widget, or we need to start an activity to configure the widget, or both.
        appWidgetId = getAppWidgetHost().allocateAppWidgetId();
        Bundle options = info.bindOptions;

        boolean success = mAppWidgetManager.bindAppWidgetIdIfAllowed(
                appWidgetId, info.info, options);
        if (success) {
            addAppWidgetFromDropImpl(appWidgetId, info, null, info.info);
        } else {
            setWaitingForResult(PendingRequestArgs.forWidgetInfo(appWidgetId, info.info, info));
            Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_BIND);
            intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
            intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_PROVIDER, info.componentName);
            mAppWidgetManager.getUser(info.info)
                .addToIntent(intent, AppWidgetManager.EXTRA_APPWIDGET_PROVIDER_PROFILE);
            // TODO: we need to make sure that this accounts for the options bundle.
            // intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS, options);
            startActivityForResult(intent, REQUEST_BIND_APPWIDGET);
        }
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:41,代码来源:Launcher.java

示例4: onClick

@Override
public void onClick(View view) {
    if (view.getId() == R.id.btn_qsb_search) {
        getActivity().startSearch("", false, null, true);
    } else if (view.getId() == R.id.btn_qsb_setup) {
        // Allocate a new widget id for QSB
        sSavedWidgetId = Launcher.getLauncher(getActivity())
                .getAppWidgetHost().allocateAppWidgetId();
        // Start intent for bind the widget
        Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_BIND);
        intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, sSavedWidgetId);
        intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_PROVIDER, mWidgetInfo.provider);
        startActivityForResult(intent, REQUEST_BIND_QSB);
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:15,代码来源:QsbContainerView.java


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