Skip to content

Biblioteca para crear un ViewGroup similar a un GridLayout al que se le pueden añadir objetos ImageViews que se pueden reordenar con un efecto de drag and drop. También se puede establecer una zona de borrado a la que arrastrar los ImageViews para eliminarlos del grid.

Notifications You must be signed in to change notification settings

bq/drag-drop-grid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

This project provides an Android library for a drag and drop scrolling grid view and a delete zone view if you need it.

This project is mainly inspired in the DraggableGridView of thquinn, and in the PagedDragDropGrid of mrKlar for the animations and the delete zone.

drag-drop-grid

drag-drop-grid is an Android library for creating a drag and drop grid. You can add different types of views and rearrange them. Moreover, you can add a delete zone, that if you drop the view over it, you delete it.

It allows you to:

  • Add ImageViews or TextViews to the grid. It's scrollable so you can add as many as you want.
  • Rearrange the views by doing a click in an item or a long click, but you can change this default behaviour by setting a new OnItemClickListener or OnItemLongClickListener.
  • Set a delete zone view if you want. You can drop the view on the delete zone to delete it.
  • You can add views of different sizes and the grid resizes its items to the biggest one, in order to get the same number of columns and rows. If there is no more space for another view, the items are centered in the grid layout.
  • You can set a fixed number of columns (no more than the available for the limited width of the device).
  • You can center the items in the grid.
  • You can set a fixed width and height for all the views in the grid.
  • Now you can customize your delete zone with other image, background and highlight color or background

There is an example project, ExampleDragDropGrid, where you can see how can the library be used.

Usage

  1. Clone the repository:

    git clone https://github.com/bq/drag-drop-grid.git
    
  2. Install in your local repository:

    • Gradle version equal or lower than 1.10 and drag-drop-grid version equal or lower than 1.6:

      cd drag-drop-grid/drag-drop-grid
      gradle publishToMavenLocal
      
    • Gradle version greater than 1.10 and drag-drop-grid version greater than 1.6:

      cd drag-drop-grid/drag-drop-grid
      gradle install
      
  3. Add your local repository to your root project's build.gradle file:

    repositories {
        mavenLocal()
    }
    
  4. Add the drag-drop-grid dependency to your app's build.gradle file:

    • Gradle version equal or lower than 1.10 and drag-drop-grid version equal or lower than 1.6:

      dependencies {
          compile('com.bq.robotic:drag-drop-grid:1.6@jar')
      }
      
    • Gradle version greater than 1.10 and drag-drop-grid version greater than 1.6:

      dependencies {
          compile('com.bq.robotic:drag-drop-grid:1.10@aar')
      }
      

Installation

  1. Install Android Studio and Gradle.

  2. If you use a 64 bits Linux, you will need to install ia32-libs-multiarch:

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install ia32-libs-multiarch
    
  3. Clone the repository:

    git clone https://github.com/bq/drag-drop-grid.git
    
  4. Install the drag-drop-grid library in your local repository:

    • Gradle version equal or lower than 1.10 and drag-drop-grid version equal or lower than 1.6:

      cd drag-drop-grid/drag-drop-grid
      gradle publishToMavenLocal
      
    • Gradle version greater than 1.10 and drag-drop-grid version greater than 1.6:

      cd drag-drop-grid/drag-drop-grid
      gradle install
      
  5. In Android Studio go to File > Open and select the drag-drop-grid gradle project inside the previous cloned project (that with the green robot icon, the drag-drop-grid library folder not the repository one with the example project inside too).

  6. If your are going to use drag-drop-grid for one of your projects, follow the instructions of the Usage section in order to installing it in your local repository and add to it the dependency needed.

Requirements

License

drag-drop-grid is distributed in terms of LGPL license. See http://www.gnu.org/licenses/lgpl.html for more details.

About

Biblioteca para crear un ViewGroup similar a un GridLayout al que se le pueden añadir objetos ImageViews que se pueden reordenar con un efecto de drag and drop. También se puede establecer una zona de borrado a la que arrastrar los ImageViews para eliminarlos del grid.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages