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

Java AppWidgetHostView类代码示例

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

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



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

示例1: addAppWidgetImpl

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
void addAppWidgetImpl(int appWidgetId, ItemInfo info,
        AppWidgetHostView boundWidget, WidgetAddFlowHandler addFlowHandler, int delay) {
    if (!addFlowHandler.startConfigActivity(this, appWidgetId, info, REQUEST_CREATE_APPWIDGET)) {
        // If the configuration flow was not started, add the widget

        Runnable onComplete = new Runnable() {
            @Override
            public void run() {
                // Exit spring loaded mode if necessary after adding the widget
                exitSpringLoadedDragModeDelayed(true, EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT,
                        null);
            }
        };
        completeAddAppWidget(appWidgetId, info, boundWidget, addFlowHandler.getProviderInfo(this));
        mWorkspace.removeExtraEmptyScreenDelayed(true, onComplete, delay, false);
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:18,代码来源:Launcher.java


示例2: LauncherAppWidgetHostView

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
public LauncherAppWidgetHostView(Context context) {
    super(context);
    mContext = context;
    mLongPressHelper = new CheckLongPressHelper(this, this);
    mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this);
    mInflater = LayoutInflater.from(context);
    setAccessibilityDelegate(Launcher.getLauncher(context).getAccessibilityDelegate());
    setBackgroundResource(R.drawable.widget_internal_focus_bg);

    if (AndroidVersion.isAtLeastOreo()) {
        try {
            Method asyncMethod = AppWidgetHostView.class
                    .getMethod("setExecutor", Executor.class);
            asyncMethod.invoke(this, Utilities.THREAD_POOL_EXECUTOR);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:20,代码来源:LauncherAppWidgetHostView.java


示例3: getDefaultOptionsForWidget

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
public static Bundle getDefaultOptionsForWidget(Context context, PendingAddWidgetInfo info) {
    Rect rect = new Rect();
    AppWidgetResizeFrame.getWidgetSizeRanges(context, info.spanX, info.spanY, rect);
    Rect padding = AppWidgetHostView.getDefaultPaddingForWidget(context,
            info.componentName, null);

    float density = context.getResources().getDisplayMetrics().density;
    int xPaddingDips = (int) ((padding.left + padding.right) / density);
    int yPaddingDips = (int) ((padding.top + padding.bottom) / density);

    Bundle options = new Bundle();
    options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH,
            rect.left - xPaddingDips);
    options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT,
            rect.top - yPaddingDips);
    options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH,
            rect.right - xPaddingDips);
    options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT,
            rect.bottom - yPaddingDips);
    return options;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:22,代码来源:WidgetHostViewLoader.java


示例4: removeDroppedItem

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
private void removeDroppedItem(View dragObj) {
    if (mChildLock) return;

    try {
        mDragDropSource.removeView(dragObj);
        db().setAppCategoryOrder(mRevCategoryMap.get(mDragDropSource), mDragDropSource);

        if (mBeingDragged.isLink()) {
            db().deleteApp(mBeingDragged.getComponentName());
        }

        if (mBeingDragged.isWidget()) {

            db().deleteApp(mBeingDragged.getComponentName());
            AppWidgetHostView wid = mLoadedWidgets.remove(mBeingDragged.getActivityName());
            if (wid != null) {
                mWidgetHelper.widgetRemoved(wid.getAppWidgetId());
            }
        }
    } catch (Exception e) {
        Log.e(TAG, e.getMessage(), e);
    }
}
 
开发者ID:quaap,项目名称:LaunchTime,代码行数:24,代码来源:MainActivity.java


示例5: configureWidget

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
private AppWidgetHostView configureWidget(Intent data) {
    // Get the selected widget information
    Bundle extras = data.getExtras();
    int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
    AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
    if (appWidgetInfo.configure != null) {
        // If the widget wants to be configured then start its configuration activity
        Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE);
        intent.setComponent(appWidgetInfo.configure);
        intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
        mParent.startActivityForResult(intent, REQUEST_CREATE_APPWIDGET);
    } else {
        // Otherwise simply create it
        return createWidget(data);
    }
    return null;
}
 
开发者ID:quaap,项目名称:LaunchTime,代码行数:18,代码来源:Widget.java


示例6: onActivityResult

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
public AppWidgetHostView onActivityResult(int requestCode, int resultCode, Intent data) {

        Log.d("LaunchWidgeth", "onActivityResult: requestCode=" + requestCode + " resultCode=" + resultCode);
        // listen for widget manager response
        if (resultCode == Activity.RESULT_OK) {
            if (requestCode == REQUEST_PICK_APPWIDGET) {
                Log.d("LaunchWidgeth", "configureWidget");
                return configureWidget(data);
            } else if (requestCode == REQUEST_CREATE_APPWIDGET || requestCode == REQUEST_BIND_APPWIDGET) {
                Log.d("LaunchWidgeth", "createWidget");
                return createWidget(data);
            } else {
                Log.d("LaunchWidgeth", "unknown RESULT_OK");
            }
        } else if (resultCode == Activity.RESULT_CANCELED) {
            Log.d("LaunchWidgeth", "RESULT_CANCELED");
            if (data!=null) {
                int appWidgetId = data.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
                if (appWidgetId != -1) {
                    mAppWidgetHost.deleteAppWidgetId(appWidgetId);
                }
            }

        }
        return null;
    }
 
开发者ID:quaap,项目名称:LaunchTime,代码行数:27,代码来源:Widget.java


示例7: addAppWidgetToWorkspace

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
private void addAppWidgetToWorkspace(
        AppWidgetHostView hostView, LauncherAppWidgetInfo item,
        LauncherAppWidgetProviderInfo appWidgetInfo, boolean insert) {
    hostView.setTag(item);
    item.onBindAppWidget(this, hostView);

    hostView.setFocusable(true);
    hostView.setOnFocusChangeListener(mFocusHandler);

    mWorkspace.addInScreen(hostView, item.container, item.screenId,
            item.cellX, item.cellY, item.spanX, item.spanY, insert);

    if (!item.isCustomWidget()) {
        addWidgetToAutoAdvanceIfNeeded(hostView, appWidgetInfo);
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:17,代码来源:Launcher.java


示例8: addAppWidgetImpl

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
void addAppWidgetImpl(int appWidgetId, ItemInfo info,
        AppWidgetHostView boundWidget, LauncherAppWidgetProviderInfo appWidgetInfo,
        int delay) {
    if (appWidgetInfo.configure != null) {
        setWaitingForResult(PendingRequestArgs.forWidgetInfo(appWidgetId, appWidgetInfo, info));

        // Launch over to configure widget, if needed
        mAppWidgetManager.startConfigActivity(appWidgetInfo, appWidgetId, this,
                mAppWidgetHost, REQUEST_CREATE_APPWIDGET);
    } else {
        // Otherwise just add it
        Runnable onComplete = new Runnable() {
            @Override
            public void run() {
                // Exit spring loaded mode if necessary after adding the widget
                exitSpringLoadedDragModeDelayed(true, EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT,
                        null);
            }
        };
        completeAddAppWidget(appWidgetId, info, boundWidget, appWidgetInfo);
        mWorkspace.removeExtraEmptyScreenDelayed(true, onComplete, delay, false);
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:24,代码来源:Launcher.java


示例9: createWidgetByID

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
public void createWidgetByID(RelativeLayout widget, int  ID) {
    widget.removeAllViews();

    int appWidgetId = ID;

    int H = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 150, this.getResources().getDisplayMetrics());
    int W = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 300, this.getResources().getDisplayMetrics());

    AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
    AppWidgetHostView hostView = mAppWidgetHost.createView(this, appWidgetId, appWidgetInfo);
    hostView.setAppWidget(appWidgetId, appWidgetInfo);

    widgetWidth = appWidgetInfo.minWidth;
    widgetHeight = appWidgetInfo.minHeight;

    hostView.setMinimumWidth(widgetWidth);
    hostView.setMinimumHeight(widgetHeight);

    widget.addView(hostView);
    System.out.println(appWidgetInfo.provider.getClassName()
            + " Widget WH: " + appWidgetInfo.minWidth + "*" + appWidgetInfo.minHeight);
}
 
开发者ID:GeeksEmpireNet,项目名称:Shortcuts,代码行数:23,代码来源:WidgetHandler.java


示例10: addAppWidgetImpl

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
void addAppWidgetImpl(final int appWidgetId, final ItemInfo info,
        final AppWidgetHostView boundWidget, final LauncherAppWidgetProviderInfo appWidgetInfo,
        int delay) {
    if (appWidgetInfo.configure != null) {
        mPendingAddWidgetInfo = appWidgetInfo;
        mPendingAddWidgetId = appWidgetId;

        // Launch over to configure widget, if needed
        mAppWidgetManager.startConfigActivity(appWidgetInfo, appWidgetId, this,
                mAppWidgetHost, REQUEST_CREATE_APPWIDGET);

    } else {
        // Otherwise just add it
        Runnable onComplete = new Runnable() {
            @Override
            public void run() {
                // Exit spring loaded mode if necessary after adding the widget
                exitSpringLoadedDragModeDelayed(true, EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT,
                        null);
            }
        };
        completeAddAppWidget(appWidgetId, info.container, info.screenId, boundWidget,
                appWidgetInfo);
        mWorkspace.removeExtraEmptyScreenDelayed(true, onComplete, delay, false);
    }
}
 
开发者ID:Mr-lin930819,项目名称:SimplOS,代码行数:27,代码来源:Launcher.java


示例11: getDefaultOptionsForWidget

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
public static Bundle getDefaultOptionsForWidget(Launcher launcher, PendingAddWidgetInfo info) {
    Bundle options = null;
    Rect rect = new Rect();
    if (Utilities.ATLEAST_JB_MR1) {
        AppWidgetResizeFrame.getWidgetSizeRanges(launcher, info.spanX, info.spanY, rect);
        Rect padding = AppWidgetHostView.getDefaultPaddingForWidget(launcher,
                info.componentName, null);

        float density = launcher.getResources().getDisplayMetrics().density;
        int xPaddingDips = (int) ((padding.left + padding.right) / density);
        int yPaddingDips = (int) ((padding.top + padding.bottom) / density);

        options = new Bundle();
        options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH,
                rect.left - xPaddingDips);
        options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT,
                rect.top - yPaddingDips);
        options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH,
                rect.right - xPaddingDips);
        options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT,
                rect.bottom - yPaddingDips);
    }
    return options;
}
 
开发者ID:Mr-lin930819,项目名称:SimplOS,代码行数:25,代码来源:WidgetHostViewLoader.java


示例12: getDefaultOptionsForWidget

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
Bundle getDefaultOptionsForWidget(Launcher launcher, PendingAddWidgetInfo info) {
    Bundle options = null;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        AppWidgetResizeFrame.getWidgetSizeRanges(mLauncher, info.spanX, info.spanY, mTmpRect);
        Rect padding = AppWidgetHostView.getDefaultPaddingForWidget(mLauncher,
                info.componentName, null);

        float density = getResources().getDisplayMetrics().density;
        int xPaddingDips = (int) ((padding.left + padding.right) / density);
        int yPaddingDips = (int) ((padding.top + padding.bottom) / density);

        options = new Bundle();
        options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH,
                mTmpRect.left - xPaddingDips);
        options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT,
                mTmpRect.top - yPaddingDips);
        options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH,
                mTmpRect.right - xPaddingDips);
        options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT,
                mTmpRect.bottom - yPaddingDips);
    }
    return options;
}
 
开发者ID:Phonemetra,项目名称:TurboLauncher,代码行数:24,代码来源:AppsCustomizePagedView.java


示例13: addProvider

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
public void addProvider(MainActivity m, AppWidgetHost host, AppWidgetManager manager, AppWidgetProviderInfo provider) {
    int id = host.allocateAppWidgetId();
    boolean success;
    success = manager.bindAppWidgetIdIfAllowed(id, provider.provider);

    if (success) {
        AppWidgetHostView hostView = host.createView(getActivity(), id, provider);
        AppWidgetProviderInfo appWidgetInfo = manager.getAppWidgetInfo(id);

        LauncherAppWidgetInfo info = new LauncherAppWidgetInfo(id);
        info.setHostView(hostView);
        info.getHostView().setAppWidget(id, appWidgetInfo);

        ItemInfo launcherInfo = attachWidget(info);
        if (launcherInfo != null) {
            WidgetPersistance.addDesktopAppWidget(screen, launcherInfo);
        }

    } else {
        Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_BIND);
        intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, id);
        intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_PROVIDER, provider.provider);
        m.startActivityForResult(intent, MainActivity.REQUEST_BIND_APPWIDGET);
    }

}
 
开发者ID:DagW,项目名称:FragmentHomescreen,代码行数:27,代码来源:WidgetFragment.java


示例14: addAppWidgetImpl

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
void addAppWidgetImpl(final int appWidgetId, final ItemInfo info,
        final AppWidgetHostView boundWidget, final AppWidgetProviderInfo appWidgetInfo, int
        delay) {
    if (appWidgetInfo.configure != null) {
        mPendingAddWidgetInfo = appWidgetInfo;
        mPendingAddWidgetId = appWidgetId;

        // Launch over to configure widget, if needed
        mAppWidgetManager.startConfigActivity(appWidgetInfo, appWidgetId, this,
                mAppWidgetHost, REQUEST_CREATE_APPWIDGET);

    } else {
        // Otherwise just add it
        Runnable onComplete = new Runnable() {
            @Override
            public void run() {
                // Exit spring loaded mode if necessary after adding the widget
                exitSpringLoadedDragModeDelayed(true, EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT,
                        null);
            }
        };
        completeAddAppWidget(appWidgetId, info.container, info.screenId, boundWidget,
                appWidgetInfo);
        mWorkspace.removeExtraEmptyScreenDelayed(true, onComplete, delay, false);
    }
}
 
开发者ID:AndroidDeveloperLB,项目名称:LB-Launcher,代码行数:27,代码来源:Launcher.java


示例15: getDefaultOptionsForWidget

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
static Bundle getDefaultOptionsForWidget(Launcher launcher, PendingAddWidgetInfo info) {
    Bundle options = null;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        AppWidgetResizeFrame.getWidgetSizeRanges(launcher, info.spanX, info.spanY, sTmpRect);
        Rect padding = AppWidgetHostView.getDefaultPaddingForWidget(launcher,
                info.componentName, null);

        float density = launcher.getResources().getDisplayMetrics().density;
        int xPaddingDips = (int) ((padding.left + padding.right) / density);
        int yPaddingDips = (int) ((padding.top + padding.bottom) / density);

        options = new Bundle();
        options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH,
                sTmpRect.left - xPaddingDips);
        options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT,
                sTmpRect.top - yPaddingDips);
        options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH,
                sTmpRect.right - xPaddingDips);
        options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT,
                sTmpRect.bottom - yPaddingDips);
    }
    return options;
}
 
开发者ID:AndroidDeveloperLB,项目名称:LB-Launcher,代码行数:24,代码来源:AppsCustomizePagedView.java


示例16: addAppWidgetImpl

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
void addAppWidgetImpl(final int appWidgetId, final ItemInfo info,
                      final AppWidgetHostView boundWidget, final AppWidgetProviderInfo appWidgetInfo, int
                              delay) {
    if (appWidgetInfo.configure != null) {
        mPendingAddWidgetInfo = appWidgetInfo;
        mPendingAddWidgetId = appWidgetId;

        // Launch over to configure widget, if needed
        mAppWidgetManager.startConfigActivity(appWidgetInfo, appWidgetId, this,
                mAppWidgetHost, REQUEST_CREATE_APPWIDGET);

    } else {
        // Otherwise just add it
        exitSpringLoadedDragModeDelayed(true, EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT, null);
        completeAddAppWidget(appWidgetId, info.container, boundWidget, appWidgetInfo);
    }
}
 
开发者ID:krajeswaran,项目名称:LeanLauncher,代码行数:18,代码来源:Launcher.java


示例17: addAppWidgetImpl

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
void addAppWidgetImpl(final int appWidgetId, ItemInfo info, AppWidgetHostView boundWidget,
        AppWidgetProviderInfo appWidgetInfo) {
    if (appWidgetInfo.configure != null) {
        mPendingAddWidgetInfo = appWidgetInfo;

        // Launch over to configure widget, if needed
        Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE);
        intent.setComponent(appWidgetInfo.configure);
        intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
        Utilities.startActivityForResultSafely(this, intent, REQUEST_CREATE_APPWIDGET);
    } else {
        // Otherwise just add it
        completeAddAppWidget(appWidgetId, info.container, info.screenId, boundWidget,
                appWidgetInfo);
        // Exit spring loaded mode if necessary after adding the widget
        exitSpringLoadedDragModeDelayed(true, false, null);
    }
}
 
开发者ID:Lesik,项目名称:open-gel-plus,代码行数:19,代码来源:Launcher.java


示例18: addAppWidgetImpl

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
void addAppWidgetImpl(final int appWidgetId, ItemInfo info,
		AppWidgetHostView boundWidget, AppWidgetProviderInfo appWidgetInfo) {
	if (appWidgetInfo.configure != null) {
		mPendingAddWidgetInfo = appWidgetInfo;

		// Launch over to configure widget, if needed
		Intent intent = new Intent(
				AppWidgetManager.ACTION_APPWIDGET_CONFIGURE);
		intent.setComponent(appWidgetInfo.configure);
		intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
		startActivityForResultSafely(intent, REQUEST_CREATE_APPWIDGET);
	} else {
		// Otherwise just add it
		completeAddAppWidget(appWidgetId, info.container, info.screen,
				boundWidget, appWidgetInfo);
		// Exit spring loaded mode if necessary after adding the widget
		exitSpringLoadedDragModeDelayed(true, false, null);
	}
}
 
开发者ID:Kwamecorp,项目名称:Fairphone,代码行数:20,代码来源:Launcher.java


示例19: createWidget

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
public void createWidget(Intent data) {
     Bundle extras = data.getExtras();
     RelativeLayout relativeLayout = relLayout;
     int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
     AppWidgetProviderInfo appWidgetInfo =
             mAppWidgetManager.getAppWidgetInfo(appWidgetId);
     AppWidgetHostView hostView =
             mAppWidgetHost.createView(this, appWidgetId, appWidgetInfo);
     hostView.setAppWidget(appWidgetId, appWidgetInfo);


     RelativeLayout.LayoutParams rlps = new RelativeLayout.LayoutParams(WRAP_CONTENT,WRAP_CONTENT);
     rlps.addRule(CENTER_IN_PARENT);

     relativeLayout.addView(hostView,rlps);
     mAppWidgetHost.startListening();
     Log.v("WidgetsEvery0", appWidgetInfo.label);
}
 
开发者ID:sakchhams,项目名称:widgets,代码行数:19,代码来源:FloatingWidget.java


示例20: completeTwoStageWidgetDrop

import android.appwidget.AppWidgetHostView; //导入依赖的package包/类
@Thunk void completeTwoStageWidgetDrop(
        final int resultCode, final int appWidgetId, final PendingRequestArgs requestArgs) {
    CellLayout cellLayout = mWorkspace.getScreenWithId(requestArgs.screenId);
    Runnable onCompleteRunnable = null;
    int animationType = 0;

    AppWidgetHostView boundWidget = null;
    if (resultCode == RESULT_OK) {
        animationType = Workspace.COMPLETE_TWO_STAGE_WIDGET_DROP_ANIMATION;
        final AppWidgetHostView layout = mAppWidgetHost.createView(this, appWidgetId,
                requestArgs.getWidgetHandler().getProviderInfo(this));
        boundWidget = layout;
        onCompleteRunnable = new Runnable() {
            @Override
            public void run() {
                completeAddAppWidget(appWidgetId, requestArgs, layout, null);
                exitSpringLoadedDragModeDelayed((resultCode != RESULT_CANCELED),
                        EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT, null);
            }
        };
    } else if (resultCode == RESULT_CANCELED) {
        mAppWidgetHost.deleteAppWidgetId(appWidgetId);
        animationType = Workspace.CANCEL_TWO_STAGE_WIDGET_DROP_ANIMATION;
    }
    if (mDragLayer.getAnimatedView() != null) {
        mWorkspace.animateWidgetDrop(requestArgs, cellLayout,
                (DragView) mDragLayer.getAnimatedView(), onCompleteRunnable,
                animationType, boundWidget, true);
    } else if (onCompleteRunnable != null) {
        // The animated view may be null in the case of a rotation during widget configuration
        onCompleteRunnable.run();
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:34,代码来源:Launcher.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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