mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Workspace: Allow resizing any widget
Originally committed on Trebuchet: 9814de7c9a
This commit is contained in:
@@ -15,7 +15,6 @@ import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.PropertyValuesHolder;
|
||||
import android.appwidget.AppWidgetProviderInfo;
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -247,23 +246,6 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
|
||||
mWidgetPadding = getDefaultPaddingForWidget(getContext(),
|
||||
widgetView.getAppWidgetInfo().provider, null);
|
||||
|
||||
// Only show resize handles for the directions in which resizing is possible.
|
||||
InvariantDeviceProfile idp = LauncherAppState.getIDP(cellLayout.getContext());
|
||||
mVerticalResizeActive = (info.resizeMode & AppWidgetProviderInfo.RESIZE_VERTICAL) != 0
|
||||
&& mMinVSpan < idp.numRows && mMaxVSpan > 1
|
||||
&& mMinVSpan < mMaxVSpan;
|
||||
if (!mVerticalResizeActive) {
|
||||
mDragHandles[INDEX_TOP].setVisibility(GONE);
|
||||
mDragHandles[INDEX_BOTTOM].setVisibility(GONE);
|
||||
}
|
||||
mHorizontalResizeActive = (info.resizeMode & AppWidgetProviderInfo.RESIZE_HORIZONTAL) != 0
|
||||
&& mMinHSpan < idp.numColumns && mMaxHSpan > 1
|
||||
&& mMinHSpan < mMaxHSpan;
|
||||
if (!mHorizontalResizeActive) {
|
||||
mDragHandles[INDEX_LEFT].setVisibility(GONE);
|
||||
mDragHandles[INDEX_RIGHT].setVisibility(GONE);
|
||||
}
|
||||
|
||||
mReconfigureButton = (ImageButton) findViewById(R.id.widget_reconfigure_button);
|
||||
if (info.isReconfigurable()) {
|
||||
mReconfigureButton.setVisibility(VISIBLE);
|
||||
@@ -316,12 +298,10 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
|
||||
}
|
||||
|
||||
public boolean beginResizeIfPointInRegion(int x, int y) {
|
||||
mLeftBorderActive = (x < mTouchTargetWidth) && mHorizontalResizeActive;
|
||||
mRightBorderActive = (x > getWidth() - mTouchTargetWidth) && mHorizontalResizeActive;
|
||||
mTopBorderActive = (y < mTouchTargetWidth + mTopTouchRegionAdjustment)
|
||||
&& mVerticalResizeActive;
|
||||
mBottomBorderActive = (y > getHeight() - mTouchTargetWidth + mBottomTouchRegionAdjustment)
|
||||
&& mVerticalResizeActive;
|
||||
mLeftBorderActive = x < mTouchTargetWidth;
|
||||
mRightBorderActive = x > getWidth() - mTouchTargetWidth;
|
||||
mTopBorderActive = y < mTouchTargetWidth + mTopTouchRegionAdjustment;
|
||||
mBottomBorderActive = y > getHeight() - mTouchTargetWidth + mBottomTouchRegionAdjustment;
|
||||
|
||||
boolean anyBordersActive = mLeftBorderActive || mRightBorderActive
|
||||
|| mTopBorderActive || mBottomBorderActive;
|
||||
|
||||
Reference in New Issue
Block a user