本文整理汇总了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;
}
示例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;
}
示例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;
}