Friday, October 30, 2015

Android - Creating a Dynamic Grid view

For a sample application, i was trying to include a Dynamic grid view. The git hub project that is in the reference section looked to be 
really useful. noting down few points on this. 

Below are the main things that attracted to look into it. 

- On long tap, the grid enters to edit mode
- when in edit mode, the icons jerk to give an iPhone like animation 
- On tap of the icon, it just does the action as expected. 
- When dragging an icon in edit mode, it adjusts each other nicely
- when dragged by holding, the view scrolls as well. 

Below are the main classes in the project. 

- DynamicGridView => Main View for the Grid view 
- DynamicGridUtils => Utils methods for doing the model level tasks such as reordering, swapping etc. 
- DynamicGridAdapterInterface => interface to be used with grid view 
- AbstractDynamicGridAdapter -> 
- BaseDynamicGridAdapter -> 


Below are the steps to integrate this into a new project. 

1. On the new project right click the project and select new Module 
2. On the new module window, select import existing project 
3. Specify the source directory and add the dynamic grid project from the git hub download 
4. Open module settings, and add the dynamic grid as dependancy to the new app. 


References:

No comments:

Post a Comment