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


Java LauncherAppWidgetHostView类代码示例

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


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

示例1: addResizeFrame

import com.android.launcher3.LauncherAppWidgetHostView; //导入依赖的package包/类
public void addResizeFrame(ItemInfo itemInfo, LauncherAppWidgetHostView widget,
        CellLayout cellLayout) {
    AppWidgetResizeFrame resizeFrame = new AppWidgetResizeFrame(getContext(),
            widget, cellLayout, this);

    LayoutParams lp = new LayoutParams(-1, -1);
    lp.customPosition = true;

    addView(resizeFrame, lp);
    mResizeFrames.add(resizeFrame);

    resizeFrame.snapToWidget(false);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:14,代码来源:DragLayer.java

示例2: getSupportedResizeActions

import com.android.launcher3.LauncherAppWidgetHostView; //导入依赖的package包/类
private ArrayList<Integer> getSupportedResizeActions(View host, LauncherAppWidgetInfo info) {
    ArrayList<Integer> actions = new ArrayList<>();

    AppWidgetProviderInfo providerInfo = ((LauncherAppWidgetHostView) host).getAppWidgetInfo();
    if (providerInfo == null) {
        return actions;
    }

    CellLayout layout = (CellLayout) host.getParent().getParent();
    if ((providerInfo.resizeMode & AppWidgetProviderInfo.RESIZE_HORIZONTAL) != 0) {
        if (layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY) ||
                layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY)) {
            actions.add(R.string.action_increase_width);
        }

        if (info.spanX > info.minSpanX && info.spanX > 1) {
            actions.add(R.string.action_decrease_width);
        }
    }

    if ((providerInfo.resizeMode & AppWidgetProviderInfo.RESIZE_VERTICAL) != 0) {
        if (layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1) ||
                layout.isRegionVacant(info.cellX, info.cellY - 1, info.spanX, 1)) {
            actions.add(R.string.action_increase_height);
        }

        if (info.spanY > info.minSpanY && info.spanY > 1) {
            actions.add(R.string.action_decrease_height);
        }
    }
    return actions;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:33,代码来源:LauncherAccessibilityDelegate.java

示例3: performResizeAction

import com.android.launcher3.LauncherAppWidgetHostView; //导入依赖的package包/类
@Thunk void performResizeAction(int action, View host, LauncherAppWidgetInfo info) {
    CellLayout.LayoutParams lp = (CellLayout.LayoutParams) host.getLayoutParams();
    CellLayout layout = (CellLayout) host.getParent().getParent();
    layout.markCellsAsUnoccupiedForView(host);

    if (action == R.string.action_increase_width) {
        if (((host.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL)
                && layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY))
                || !layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY)) {
            lp.cellX --;
            info.cellX --;
        }
        lp.cellHSpan ++;
        info.spanX ++;
    } else if (action == R.string.action_decrease_width) {
        lp.cellHSpan --;
        info.spanX --;
    } else if (action == R.string.action_increase_height) {
        if (!layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1)) {
            lp.cellY --;
            info.cellY --;
        }
        lp.cellVSpan ++;
        info.spanY ++;
    } else if (action == R.string.action_decrease_height) {
        lp.cellVSpan --;
        info.spanY --;
    }

    layout.markCellsAsOccupiedForView(host);
    Rect sizeRange = new Rect();
    AppWidgetResizeFrame.getWidgetSizeRanges(mLauncher, info.spanX, info.spanY, sizeRange);
    ((LauncherAppWidgetHostView) host).updateAppWidgetSize(null,
            sizeRange.left, sizeRange.top, sizeRange.right, sizeRange.bottom);
    host.requestLayout();
    LauncherModel.updateItemInDatabase(mLauncher, info);
    announceConfirmation(mLauncher.getString(R.string.widget_resized, info.spanX, info.spanY));
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:39,代码来源:LauncherAccessibilityDelegate.java


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