Giter VIP home page Giter VIP logo

pageddragdropgrid's Introduction

Note: This component is not in development anymore. I will merge pull requests, but that’s about it.

====================== PagedDragDropGrid v0.2 (deprecated)

An Android ViewGroup that implements a paged grid with drag'n'drop movable items

Supports Android 2.2 (API 8) and up

Tested on a Nexus One, Galaxy Nexus and a Nexus 7

Example video:

v0.1 : http://youtu.be/FYTSRfthSuQ

v0.2 : http://youtu.be/0HI2meKKLYk

Usage

Define an adapter conforming to interface PagedDragDropGridAdapter.java

public interface PagedDragDropGridAdapter {

    // Automatic child distribution
	public final static int AUTOMATIC = -1; 
	
	// Delete drop zone location TOP
	public final static int TOP = 1;
	
	// Delete drop zone location BOTTOM
	public final static int BOTTOM = 2;
	
	/**
	 * Used to create the paging
	 * 
	 * @return the page count
	 */
	public int pageCount();

	/**
	 * Returns the count of item in a page
	 * 
	 * @param page index
	 * @return item count for page
	 */
	public int itemCountInPage(int page);
	
	/**
	 * Returns the view for the item in the page
	 * 
	 * @param page index
	 * @param item index
	 * @return the view 
	 */
	public View view(int page, int index);
	
	/**
	 * The fixed row count (AUTOMATIC for automatic computing)
	 * 
	 * @return row count or AUTOMATIC
	 */
	public int rowCount();
	
	/**
	 * The fixed column count (AUTOMATIC for automatic computing)
	 * 
	 * @return column count or AUTOMATIC
	 */
	public int columnCount();

	/**
	 * Prints the layout in Log.d();
	 */
	public void printLayout();

	/**
	 * Swaps two items in the item list in a page
	 * 
	 * @param pageIndex
	 * @param itemIndexA
	 * @param itemIndexB
	 */
	public void swapItems(int pageIndex, int itemIndexA, int itemIndexB);

	/**
	 * Moves an item in the page on the left of provided the page
	 * 
	 * @param pageIndex
	 * @param itemIndex
	 */
	public void moveItemToPreviousPage(int pageIndex, int itemIndex);

	/**
	 * Moves an item in the page on the right of provided the page
	 * 
	 * @param pageIndex
	 * @param itemIndex
	 */
	public void moveItemToNextPage(int pageIndex, int itemIndex);

	
	/**
	 * deletes the item in page and at position
	 * 
	 * @param pageIndex
	 * @param itemIndex
	 */
	public void deleteItem(int pageIndex, int itemIndex);

	/** 
	 * Returns the delete drop zone location.  
	 * 
	 * @return TOP or BOTTOM. 
	 */
	public int deleteDropZoneLocation();

	/**
	 * Tells the grid to show or not the remove drop zone when moving an item
 	 */
	public boolean showRemoveDropZone();
}

layout example.xml

<ca.laplanete.mobile.pageddragdropgrid.PagedDragDropGrid xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/gridview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>

ExampleActivity.java

setContentView(R.layout.example);
PagedDragDropGrid gridview = (PagedDragDropGrid) findViewById(R.id.gridview);		
gridview.setAdapter(new ExamplePagedDragDropGridAdapter(this));

/* Optionally set an onClickListener */
gridview.setClickListener(this);

/* Optionally set an setOnPageChangedListener */
gridview.setOnPageChangedListener(new OnPageChangedListener() {            
	@Override
	public void onPageChanged(PagedDragDropGrid sender, int newPageNumber) {
	        Toast.makeText(ExampleActivity.this, "Page changed to page " + newPageNumber, Toast.LENGTH_SHORT).show();                
	    }
	});

Inspired by

https://github.com/thquinn/DraggableGridView and http://blahti.wordpress.com/2011/10/03/drag-drop-for-android-gridview/

Changelog

0.2

  • The dragged view is now in front of the others

0.1

  • Initial version
  • Bug fixing

License

/**
   * Copyright 2012 
   * 
   * Nicolas Desjardins  
   * https://github.com/mrKlar
   * 
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to deal in the Software without restriction, including
   * without limitation the rights to use, copy, modify, merge, publish,
   * distribute, sublicense, and/or sell copies of the Software, and to
   * permit persons to whom the Software is furnished to do so, subject to
   * the following conditions:
   * 
   * The above copyright notice and this permission notice shall be
   * included in all copies or substantial portions of the Software.
   * 
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
   * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
   * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
   * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

pageddragdropgrid's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pageddragdropgrid's Issues

Preventing modifications while in drag

My application is displaying real-time data in a PDDG and if I allow it to change anything in the view hierarchy (which causes a layout) while a drag is in progress, the drag is completely messed up.

I've added a set of methods to the adapter to let the client know that a drag has started / ended. It might be better to add a listener interface and a isInDrag() method to handle the same thing, so I won't add a pull request for my changes.

Vertical Scroll Wrong Behavior

I was not able to add more than 24 items in one page. Plus, the scroll always sticks to the top part so it doesn't let you scroll down.

My Implementation to move items instead of swap

I have only updated the DragDropGrid.java and added my modifications.
I used the Item.java object in identifying page items.
It's quite messy but I've added some comments.

I updated the animateGap(); method and added rearrangePageItems();
This is just a brute force implementation.

dhagz@84fd357

Various item's sizes

Hi,
I would like to populate a page with relative layouts that have various sizes (for example, to have four items/views/buttons with various sizes on one or more pages).
I know that I can set layouts params in ExamplePagedDragDropGridAdapter like:

    public View view(int page, int index) {

        Item item = getItem(page, index);
        RelativeLayout layout = new RelativeLayout(context);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(250, 250);

        if (item.getName() == "v4")
        {
             layoutParams = new RelativeLayout.LayoutParams(500, 250);
        }
        else if (item.getName() == "v2")
        {
             layoutParams = new RelativeLayout.LayoutParams(500, 500);
        }
        else
        {
             layoutParams = new RelativeLayout.LayoutParams(250, 250);
        }

        ImageView buttonOn = new ImageView(context);
        buttonOn.setImageResource(item.getDrawableButtonOn());
        buttonOn.setPadding(0, 0, 0, 0);
        buttonOn.setLayoutParams(layoutParams);
        buttonOn.setTag("buttonOn");

        .
        .
    
        .

        layout.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        layout.addView(buttonOn);

        return layout; 
    }

but DragDropGrid.java calculate the biggest child (item/button/view) and set columns and rows size according to child's dimensions. So the question is: how to set different row and column size for each page or just get rid of columns and rows and populate all pages with items like in one big cell, but capable of dragging items, swap them, moving to next page and any other features provided by this framework.

The result should be like:
grid

Thanks in advance

Vertical Scrolling

Hi! how can I make a vertical scrolling? if it is not currently possible then tell me what and how to modify?

Question: Is there some limit to the amount of views in a page?

Hi,

When trying to add more items to a page than the screen can show there is no possible way to view the un-viewed items.

Am I missing something? I tried to change DragDropGrid to extend ScrollView but it still only showed half.

I changed the example to have only one page, with 300 items, only ~130 were viewable+scrolling in a GalaxyTab 2 and only ~30 in a Samsung Galaxy Ace.

Thanks

bug: columnCount and rowCount?

1.version 0.2 if I set columntCount to 3 then I must set rowCount to 3 or it not work!
still AUTOMATIC, and if 20 rows and 20 columns, the item of view is very small and not wrap content !

2.if i set > 35 items in one page then i can't see 36/37/38......

Example Demo
How should I do?

Get itemId

Hello, How can I get itemId when I click on item on gridview

Dragging Items in the grid causes graphical artifacts

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()

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!


When you move an item around, it leaves behind a trial. Here is my xml:

    <ca.laplanete.mobile.pageddragdropgrid.PagedDragDropGrid
            android:id="@+id/gridview"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            />

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...

Vertical Scrolling Problem

Dear mrKlar,
thank you for sharing a greate lib
But I have encounter vertical scrolling problem
I have 16 item on one page. My item contain image size (W: 150, H: 100)
When I run my app, It's show only 10 item
Please help me,
Thanks in advance!
capture

get Drag Event

Hello Sir,
Thanks for this the best library. Sir I am quite confused for drag event, from your Conversion I got that swapItems() is fired at last. Am I right? Let me inform if I am wrong. When I have draged item from Page1 to page 3 The item show perfect as on 3rd page but when I check with this method
public void swapItems(int pageIndex, int itemIndexA, int itemIndexB) {
getPage(pageIndex).swapItems(itemIndexA, itemIndexB);
for (Page page : pages) {
for (Item item : page.getItems()) {
Log.d("Item:"+item.getItemId(), item.getName());
}
}
}
My log shows me wrong output. Dragged item is showing with page 2 I mean Wrong position.My purpose is to stored item position in database. Suggest me what I mad mistake?
Thanks

Translate Animation

Hi,

I have slowed down the translation animation to a duration of 2500. Now my problem is that when I move an item over other is swapping properly, but if I release it in between the translate animation, it doesn't complete the animation, but just updates the new view with a jerk. But I want it to complete the animation if if I have released my finger from screen

Please help.

Scrolling issue

If grid item are in big size paged is not scrollable properly , some view are cut in the buttom.
Please help me.

How to Swap item view between pages?

Hi ,

when item is dragged to next page ,and dropped at that time instead of adding new view,i want to swap and next page item move to previous page.
Swapping in single screen,how can i achive the swapping in multiple pages.

thanks

Adding items dynamically is broken after merging #47

After merge #47 that fixed issue #41 I can't add new items after adapter is set. You can simply modify current pageddragdropgrid-examples project to see this issue. Before merging #47 this code was working perfectly

1 Remove adding pages and items from ExamplePagedDragDropGridAdapter constructor
2 Add new method to ExamplePagedDragDropGridAdapter

    public void addItem(final Item item) {
        boolean added = false;
        for (final Page page : pages) {
            if (page.getItems().size() < rowCount() * columnCount()) {
                page.addItem(item);
                added = true;
                break;
            }
        }
        if (!added) {
            final Page page = new Page();
            page.addItem(item);
            pages.add(page);
        }
        gridview.notifyDataSetChanged();
    }

3 Change row count and column count from AUTOMATIC to ex. 3

4 In ExampleActivity at the end of onCreate() method add

adapter.addItem(new Item(1, "item1", R.drawable.ic_launcher));
adapter.addItem(new Item(2, "item2", R.drawable.ic_launcher));

5 Exception is thrown

    java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
            at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
            at java.util.ArrayList.get(ArrayList.java:308)
            at ca.laplanete.mobile.pageddragdropgrid.DragDropGrid.layoutAChild(DragDropGrid.java:1005)
            at ca.laplanete.mobile.pageddragdropgrid.DragDropGrid.layoutPage(DragDropGrid.java:993)
            at ca.laplanete.mobile.pageddragdropgrid.DragDropGrid.onLayout(DragDropGrid.java:977)
            at android.view.View.layout(View.java:14817)
            at android.view.ViewGroup.layout(ViewGroup.java:4631)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
            at android.widget.HorizontalScrollView.onLayout(HorizontalScrollView.java:1474)
            at ca.laplanete.mobile.pageddragdropgrid.PagedDragDropGrid.onLayout(PagedDragDropGrid.java:234)
            at android.view.View.layout(View.java:14817)
            at android.view.ViewGroup.layout(ViewGroup.java:4631)
            at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
            at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
            at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
            at android.view.View.layout(View.java:14817)
            at android.view.ViewGroup.layout(ViewGroup.java:4631)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
            at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
            at android.view.View.layout(View.java:14817)
            at android.view.ViewGroup.layout(ViewGroup.java:4631)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
            at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
            at android.view.View.layout(View.java:14817)
            at android.view.ViewGroup.layout(ViewGroup.java:4631)
            at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:690)
            at android.view.View.layout(View.java:14817)
            at android.view.ViewGroup.layout(ViewGroup.java:4631)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
            at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
            at android.view.View.layout(View.java:14817)
            at android.view.ViewGroup.layout(ViewGroup.java:4631)
            at com.android.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:374)
            at android.view.View.layout(View.java:14817)
            at android.view.ViewGroup.layout(ViewGroup.java:4631)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
            at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
            at android.view.View.layout(View.java:14817)
            at android.view.ViewGroup.layout(ViewGroup.java:4631)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
            at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
            at android.view.View.layout(View.java:14817)
            at android.view.ViewGroup.layout(ViewGroup.java:4631)
            at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1987)
            at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1744)
            at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
            at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
            at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
            at android.view.Choreographer.doCallbacks(Choreographer.java:574)
            at android.view.Choreographer.doFrame(Choreographer.java:544)
            at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
            at android.os.Handler.handleCallback(Handler.java:733)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
            at dalvik.system.NativeStart.main(Native Method)

Any idea?

//edit
@anlosar Since you are author of KitKat fix, maybe you know how to fix this?

Vertical Scroll?

Would it be possible to use this vertically (without left/right pages)? I have changed PagedDragDropGrid to extend ScrollView, but I have a bit of a problem with how it computes the height of the view.

LongClick then Drop Issue

When I long click on an item, then drop it immediately, it performs an onClick event. In one way or another this might be a bug? I have managed to fix this by changing the return value of DragDropGrid#onTouch(View, MotionEvent), instead returning false directly I changed it with super.onThouchEvent(MotionEvent)

I also noticed that when I will long click on an item near (using the emulator my mouse pointer is about 5-10dip near) the delete view (not intersected with the delete view), then drop it, the item will disappear. I have also managed to fix it by calling the touchMove(event); on the first line of DragDropGrid#touchUp(MotionEvent) method.

I don't know if my fixes were correct, but it managed to fix my issues.

bring child layout in fron

when I long press a child and hover it over others it is shown beneath those child which are generated before, while I want it to be on top of all. I am using swap on touch up rather than on move, so this become a quite critical. I used .bringtofont() method, but no success.

Please help

I am not able to update data of grid view

When i fist time set adapter in gridview object but when i update it with notifyDataSetChange gridveiw data not update

I remove by removeAllView so all view gone and not set again by adapter
gridview.removeAllViews();
customSpinneradapter.notifyDataSetChanged();
gridview.notifyDataSetChanged();
adapter.notifyAll();
This update and increse the no of view if it have more view then previous but not decrese if have less and also not change the data of any view

Update view

There are a few places where I'm modifying the data my adapter is using, and I wish to display this new data.

There doesn't appear to be any way to call notifyDataSetChanged() on the adapter or the GridView.

Any ideas on how to get the updated data to be displayed?

Fallback to using screen width and height causing problems

I haven't had time to fully investigate why DragDropGrid.acknowledgeHeightSize() was being called with a 0 height, but the fallback to using the screen dimensions is probably not the way to go: it will always generate a view that is too tall, and for multi-pane layouts it will be too wide as well.

VerticalScroll

Dear mrKlar,

Thank you for sharing you knowledge with all of us.
But I have encounter vertical scrolling problem, I have read everybody's problems in the different comments, and I haven't found a solution. I know you are working on your spare time on it, but I would like to ask you for help.

My code have got just one page, and I want to add vertical scrolling in it, it is easier than adding it to several pages. I would appreciate if you could tell me what I should do.

Please help me,
Thank you.

Static Item in last position.

I want to add a static Item at the end of the Gridview. This Item should not move, it will be a static image with an action to add more Items dynamically.

Any suggestions?

example PagedDragDropGrid

Good day, I have a problem in the constructor, exemple.xml, when I connect (``ca.laplanete.mobile.pageddragdropgrid.PagedDragDropGrid vylitaet error in xml,
at com.Projects.libs.gridView.DragDropGrid.onMeasure (DragDropGrid.java: 696)
at android.view.View.measure (View.java: 12723)
at android.widget.HorizontalScrollView.measureChildWithMargins (HorizontalScrollView
. Java: 1159)
at android.widget.FrameLayout.onMeasure (FrameLayout.java: 293)
at android.widget.HorizontalScrollView.onMeasure (HorizontalScrollView.java: 303)
at android.view.View.measure (View.java: 12723)
at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java: 4698)
at android.widget.FrameLayout.onMeasure (FrameLayout.java: 293)
at android.view.View.measure (View.java: 12723)
at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java: 4698)
at android.widget.LinearLayout.measureChildBeforeLayout (LinearLayout.java: 1369)
at android.widget.LinearLayout.measureVertical (LinearLayout.java: 660)
at android.widget.LinearLayout.onMeasure (LinearLayout.java: 553)
at android.view.View.measure (View.java: 12723)
at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java: 4698)
at android.widget.LinearLayout.measureChildBeforeLayout (LinearLayout.java: 1369)
at android.widget.LinearLayout.measureVertical (LinearLayout.java: 660)
at android.widget.LinearLayout.onMeasure (LinearLayout.java: 553)
at android.view.View.measure (View.java: 12723)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.measureView (RenderSessionImp
l.java: 542)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.render (RenderSessionImpl.jav
a: 444)
at com.android.layoutlib.bridge.Bridge.createSession (Bridge.java: 326)
at com.android.ide.common.rendering.LayoutLibrary.createSession (LayoutLibrary.java:
325)
at org.jetbrains.android.uipreview.RenderService.createRenderSession (RenderService.
java: 127)
at org.jetbrains.android.uipreview.RenderUtil.renderLayout (RenderUtil.java: 151)
at
at com.intellij.openapi.application.impl.ApplicationImpl $ 6.run (ApplicationImpl.java: 465)
at java.util.concurrent.Executors $ RunnableAdapter.call (Executors.java: 471)
at java.util.concurrent.FutureTask $ Sync.innerRun (FutureTask.java: 334)
at java.util.concurrent.FutureTask.run (FutureTask.java: 166)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java: 1110)
at java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java: 603)
at java.lang.Thread.run (Thread.java: 722)
at com.intellij.openapi.application.impl.ApplicationImpl $ 1 $ 1.run (ApplicationImpl.java: 153)

Line 696
Display display = wm.getDefaultDisplay ();

@ Override
    protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec) {
        int widthMode = MeasureSpec.getMode (widthMeasureSpec);
        int heightMode = MeasureSpec.getMode (heightMeasureSpec);
        int widthSize = MeasureSpec.getSize (widthMeasureSpec);
        int heightSize = MeasureSpec.getSize (heightMeasureSpec);

        WindowManager wm = (WindowManager) getContext (). GetSystemService (Context.WINDOW_SERVICE);

        Display display = wm.getDefaultDisplay ();

        widthSize = acknowledgeWidthSize (widthMode, widthSize, display);
        heightSize = acknowledgeHeightSize (heightMode, heightSize, display);

        adaptChildrenMeasuresToViewSize (widthSize, heightSize);
        searchBiggestChildMeasures ();
        computeGridMatrixSize (widthSize, heightSize);
        computeColumnsAndRowsSizes (widthSize, heightSize);

        measureChild (deleteZone, MeasureSpec.makeMeasureSpec (gridPageWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec ((int) getPixelFromDip (40), MeasureSpec.EXACTLY));

        setMeasuredDimension (widthSize * adapter.pageCount (), heightSize);
    }`)

Please help me, and I apologize for the bad English, in the code I have not changed anything.

The Order

Hello,I find a problem existing in the project:for example, if some items displayed as the order:

"item 1, item 2, item 3, item 4, item 5, item 6, item 7"

When I move the item 7 to the position between item 2 and item 3, the items become disordered. It's not "item 1, item 2, item 7, item 3, item 4, item 5, item 6". In fact, according to the source code, I find that when item 7 is moved, it is changed with the view item7 goes by and I think it's not reasonable.

I hope the logic will be like the logic in https://github.com/thquinn/DraggableGridView. Can you sove this problem kindly?

i have problem to set design

i set design in example.xml. . i try to set 20 item in one page and set margin 5dp in between each item. . but i can't set bottom and top margin in between items... Please some one give a solutions .. .. . .. .

It's wired

most adapter have notifyDataSetChanged() to notify viewgroup to refresh
this PagedDragDropGrid notifyDataSetChanged to refresh not adapter
It's wired.

Dynamic add to gridview

HI, I would like to know, how can I dynamically insert new item to a grid? I many solutions, but they didn't work for me.
Thanks

unable to re-adjust remove bar

Hi,

code works absolutely fine. I did some changes and all are good, but I am unable to move the remove bar to top of screen.
Can you help me with it please.

Highlighting clicked view

I have a question out on SO currently, but I'll also add an issue here.

I've added selectors to highlight a clicked view to provide better feedback to the user, but for some reason all the views are highlighted instead of just the clicked one.

Edit: Some progress has been made, with this answer, but it creates other problems.

One page

Hey all, how do you implement one page, which will be on the item is 10-20, but the visible part is only 3, and you can just scroll through them without having to switch to the page.That there was one common Pag.

Thank you.

Horizontal Scroll View as a base layout for Grid

I want to have Grid View as Horizontal Scroll View with scroll bar if over flow. As far as i understand, Right now i can control layout of each item but, I'm sure how to change complete layout to Horizontal layout. I want to have a single line Grid with Scroll and allow user to re arrange elements in single line grid.

If Grid view comes with columns and row configurable like, set no.of columns or rows to 2 or 3 that wold be fantastic.

Extra pixels around each item

How can i get rid of the extra space around each item? It seems a default behaviour that i cannot override from my xml layout. In GridView I think this can be done with the property android:listSelector="@android:color/transparent".

Any ideas? Thanks in advance.

long click on item android 4.4

When i long click on item after updating my phone to kitkat, the clicked item is going to the end of the list. What should I do to fix that?

Manage max number of children per page

Hi, I was wondering how to impose a max number of children per page, so that if I try to drag a child to an already "full" page, that page will overflow excess children to the next page(s).
Is this already handled?
Thanks :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.