This repository was archived by the owner on Jul 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 222
This repository was archived by the owner on Jul 22, 2019. It is now read-only.
Undo #57
Copy link
Copy link
Open
Description
Hi. I create undoView method in library
public void undoView() {
RecyclerView.ViewHolder viewHolder = mAdapter.onCreateViewHolder(this, 0);
mAdapter.onBindViewHolder(viewHolder, getCurrentPosition() - 1);
View topView = viewHolder.itemView;
topView.setTag(R.id.new_view, true);
if (!mDisableHwAcceleration) {
topView.setLayerType(LAYER_TYPE_HARDWARE, null);
}
if (mViewRotation > 0) {
topView.setRotation(mRandom.nextInt(mViewRotation) - (mViewRotation / 2));
}
int width = getWidth() - (getPaddingLeft() + getPaddingRight());
int height = getHeight() - (getPaddingTop() + getPaddingBottom());
LayoutParams params = topView.getLayoutParams();
if (params == null) {
params = new LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
}
int measureSpecWidth = MeasureSpec.AT_MOST;
int measureSpecHeight = MeasureSpec.AT_MOST;
if (params.width == LayoutParams.MATCH_PARENT) {
measureSpecWidth = MeasureSpec.EXACTLY;
}
if (params.height == LayoutParams.MATCH_PARENT) {
measureSpecHeight = MeasureSpec.EXACTLY;
}
topView.measure(measureSpecWidth | width, measureSpecHeight | height);
addViewInLayout(topView, getChildCount(), params, true);
}
But i can't solve one problem: If I make undo button under SwipeStack (by Z) with FrameLayout - click on him works but undoView() not works. If i make undo button below/top/left/right of SwipeStack with LinearLayout - undoView() works fine. Why?
Metadata
Metadata
Assignees
Labels
No labels