當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。