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


Java AppWidgetProviderInfo.RESIZE_VERTICAL属性代码示例

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


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

示例1: beginResizeIfPointInRegion

public boolean beginResizeIfPointInRegion(int x, int y) {
    boolean horizontalActive = (mResizeMode & AppWidgetProviderInfo.RESIZE_HORIZONTAL) != 0;
    boolean verticalActive = (mResizeMode & AppWidgetProviderInfo.RESIZE_VERTICAL) != 0;

    mLeftBorderActive = (x < mTouchTargetWidth) && horizontalActive;
    mRightBorderActive = (x > getWidth() - mTouchTargetWidth) && horizontalActive;
    mTopBorderActive = (y < mTouchTargetWidth + mTopTouchRegionAdjustment) && verticalActive;
    mBottomBorderActive = (y > getHeight() - mTouchTargetWidth + mBottomTouchRegionAdjustment)
            && verticalActive;

    boolean anyBordersActive = mLeftBorderActive || mRightBorderActive
            || mTopBorderActive || mBottomBorderActive;

    mBaselineWidth = getMeasuredWidth();
    mBaselineHeight = getMeasuredHeight();
    mBaselineX = getLeft();
    mBaselineY = getTop();

    if (anyBordersActive) {
        mLeftHandle.setAlpha(mLeftBorderActive ? 1.0f : DIMMED_HANDLE_ALPHA);
        mRightHandle.setAlpha(mRightBorderActive ? 1.0f :DIMMED_HANDLE_ALPHA);
        mTopHandle.setAlpha(mTopBorderActive ? 1.0f : DIMMED_HANDLE_ALPHA);
        mBottomHandle.setAlpha(mBottomBorderActive ? 1.0f : DIMMED_HANDLE_ALPHA);
    }
    return anyBordersActive;
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:26,代码来源:AppWidgetResizeFrame.java

示例2: getSupportedResizeActions

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:enricocid,项目名称:LaunchEnr,代码行数:32,代码来源:LauncherAccessibilityDelegate.java

示例3: beginResizeIfPointInRegion

public boolean beginResizeIfPointInRegion(int x, int y) {
    boolean horizontalActive = (mResizeMode & AppWidgetProviderInfo.RESIZE_HORIZONTAL) != 0;
    boolean verticalActive = (mResizeMode & AppWidgetProviderInfo.RESIZE_VERTICAL) != 0;

    mLeftBorderActive = (x < mTouchTargetWidth) && horizontalActive;
    mRightBorderActive = (x > getWidth() - mTouchTargetWidth) && horizontalActive;
    mTopBorderActive = (y < mTouchTargetWidth + mTopTouchRegionAdjustment) && verticalActive;
    mBottomBorderActive = (y > getHeight() - mTouchTargetWidth + mBottomTouchRegionAdjustment)
            && verticalActive;

    boolean anyBordersActive = mLeftBorderActive || mRightBorderActive
            || mTopBorderActive || mBottomBorderActive;

    if (anyBordersActive) {
        mDragHandles[INDEX_LEFT].setAlpha(mLeftBorderActive ? 1.0f : DIMMED_HANDLE_ALPHA);
        mDragHandles[INDEX_RIGHT].setAlpha(mRightBorderActive ? 1.0f :DIMMED_HANDLE_ALPHA);
        mDragHandles[INDEX_TOP].setAlpha(mTopBorderActive ? 1.0f : DIMMED_HANDLE_ALPHA);
        mDragHandles[INDEX_BOTTOM].setAlpha(mBottomBorderActive ? 1.0f : DIMMED_HANDLE_ALPHA);
    }

    if (mLeftBorderActive) {
        mDeltaXRange.set(-getLeft(), getWidth() - 2 * mTouchTargetWidth);
    } else if (mRightBorderActive) {
        mDeltaXRange.set(2 * mTouchTargetWidth - getWidth(), mDragLayer.getWidth() - getRight());
    } else {
        mDeltaXRange.set(0, 0);
    }
    mBaselineX.set(getLeft(), getRight());

    if (mTopBorderActive) {
        mDeltaYRange.set(-getTop(), getHeight() - 2 * mTouchTargetWidth);
    } else if (mBottomBorderActive) {
        mDeltaYRange.set(2 * mTouchTargetWidth - getHeight(), mDragLayer.getHeight() - getBottom());
    } else {
        mDeltaYRange.set(0, 0);
    }
    mBaselineY.set(getTop(), getBottom());

    return anyBordersActive;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:40,代码来源:AppWidgetResizeFrame.java


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