Closed hjkatz closed 11 years ago
Screenshot?
It's company code, let me make another project quickly, thanks for responding :D
There is a screenshot, my entire xml is below, I am compiling all code using 4.0.3:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:id="@+id/main2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<include
android:layout_width="fill_parent"
android:layout_gravity="center_horizontal"
android:adjustViewBounds="true"
layout="@layout/main_titlebar" />
<ca.laplanete.mobile.pageddragdropgrid.PagedDragDropGrid
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout >
<include
android:layout_width="fill_parent"
android:layout_height="fill_parent"
layout="@layout/sync_account_leaf_loader" />
</FrameLayout >
OMG that's a freaking HUGE screenshot, my bad =\
Haven't seen anything like that before. Have you tried forcing GPU rendering to see if it clears it up? What happens if you don't set a background?
gpu rendering does not help.
Note: On release the artifacts disappear immediately, Also The artifacts on appear when moving down, so I can make "zig-zags" by dragging slowly down left, back tracking (thus erasing all artifacts BELOW the dragged item), then proceeding down again (as shown in screenshot)
Adding no background does not change anything
I also, could not get this to happen using your layout, so I assume it's a problem with a FrameLayout perhaps?
Sounds like a problem with FrameLayout then. You also probably shouldn't be using a FrameLayout for this/in this manner
So I removed everything and just have the gridview, still happens:
<?xml version="1.0" encoding="utf-8"?>
<ca.laplanete.mobile.pageddragdropgrid.PagedDragDropGrid xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
Does it happen on other devices?
Yes it does
It also, now only happens when there is only 1 item in the entire adapter, not one per page, just 1. Strange...
You can get it to happen in the example project, only have 1 item total. Then drag slowly...
I fixed it. During your longClick method you handle jiggling the itmes and start the dragged and movingView. Then in your touchMove method you handle moving the dragged view (clear animation, start animation) and you manage swapping, edges, and delete. However, this is all fine and dandy (starting animation, stopping animation) until nothing in the parent view ( "this" ) is animating, thus stopping all drawing. So if no redraw is called, you get artifacts. To fix this simple add one line (like most problems =P) to invalidate "this" before handling animation and events. Below is the new touchMove()
private void touchMove( MotionEvent event )
{
if ( movingView && aViewIsDragged() )
{
lastTouchX = (int) event.getX();
lastTouchY = (int) event.getY();
invalidate();
moveDraggedView( lastTouchX, lastTouchY );
manageSwapPosition( lastTouchX, lastTouchY );
manageEdgeCoordinates( lastTouchX );
manageDeleteZoneHover( lastTouchX, lastTouchY );
}
}
If you'd like I'll make a pull request, add the one line (and the ability to disable the remove bar) and request a merge. Thanks!
Yes do a pull request for the fix + the optional remove bar and i will merge it.
SOLVED SEE BELOW:
I fixed it. During your longClick method you handle jiggling the itmes and start the dragged and movingView. Then in your touchMove method you handle moving the dragged view (clear animation, start animation) and you manage swapping, edges, and delete. However, this is all fine and dandy (starting animation, stopping animation) until nothing in the parent view ( "this" ) is animating, thus stopping all drawing. So if no redraw is called, you get artifacts. To fix this simple add one line (like most problems =P) to invalidate "this" before handling animation and events. Below is the new touchMove()
If you'd like I'll make a pull request, add the one line (and the ability to disable the remove bar) and request a merge. Thanks!
When you move an item around, it leaves behind a trial. Here is my xml:
And I have 2 pages, 4 items in each, both pages are 2 x 3 allowing for 6 items max per page.
When you move the items slowly from the top down, or near the edges, you get artifacts. And if you have only 1 item on a page it leaves a ton of trailing artifacts...