ViewPager for matrix data - android

I want to use a view flipper which works on a matrix and not a list which allowes me to either flip vertical or horizontal - but both at the same time. I know there are similar on lists working implementations like the DirectionalViewPager but they work on a list and the user has to configure if they want to flip horizontal or vertical exclusivly. I have a situation like in the image in mind:
The blue area is the current visible element. The grey boxes are the fragments the user can navigate to and from.

Related

android: How to animate and transition images between two list (or grid) views

I have two gridviews and move images between them on a touch event. I would like to have some transition to show the image moving from one view to the other. Ideally it would appear that the images move across the screen similar to the look of a drag and drop. But instead of the user dragging, I would like the image to move from one view to another on a touch event. But any transition that communicates the idea that the image has moved from one list will do.
I've looked at Scene transitions but the doc says "The framework does not support animating changes to ListView objects, so you should not try to animate them during a transition."
Any sample code from anyone that has done something similar would be appreciated or some guidance to the best approach.

Android: detecting presses inside grid

I am making a game of Gomoku in Android. I have made a grid out with drawLine(): http://i.stack.imgur.com/Mm4HZ.jpg
I am now trying to make the app detect presses within the small squares. I was thinking perhaps I could generate buttons to be in the center of each square. I have the height/width of a single square saved to varibles so getting the center points to each square shoudln't be difficult. However, how should I dynamically generate buttons where each corresponds to a certain [i][j] in a 10 * 10 matrix where the field data is stored?
You can register an onClickEvent with any view in android. What you want is an invisible view the area of the places were you want click events. I suggest using buttons or something visual so that you can see where the areas are, register the click events for each view, then hide the views so that they are invisible.

synchronizing layers in parallax scrolling

I need to implement a scrolling layout which is loaded with images from an Adapter, and another scrolling layout on top of it (second layer of a FrameLayout) that contains text labels of individual images. The top layer should scroll with a "parallax effect": http://upload.wikimedia.org/wikipedia/commons/3/34/Parallax_scrolling_example_scene.gif -- but in our case, unlike in that animation, the items in the background and foreground layers are related to each other since the text labels obviously belong to and describe the images. The layers can be listviews with custom dynamics (top one is faster than the bottom one) but I'm not sure how to sync them; couple of ideas:
when movement stops in both layers, redraw one of them to match the visible items of the other list -- but this leads to flicker/jumps
or top layer could dynamically increase spacing between the items based on velocity so the slower background layer could keep up with its movement -- but I'm not sure of the Math required for this
Use the 2 listviews with custom dynamics and then relate their speed by the distance between the images. So, where x is the speed of the foreground listview and y is the speed of the background listview, y=x*(subimage2.y-subimage1.y)*percentile.
I have finally implemented it using a fast scrolling top layer with bigger size albums and two slower bottom layers with small albums (both layers have text and image combined together).

Endless horizontally scrolling view to draw content dynamically

I want to create the following view / set of views which behave following way:
I have huge set of points which have been stored to DB in web server.
My client application downloads those and should draw curved lines about the data.
What components should I use here to get this "infinite" scrolling view to draw content dynamically.
No snapping wanted, so it should be smooth and can stop to every X position.
Should I proceed with this by using HorizontalScrollView with horizontal LinearLayout and remove/add views based on scrolling, then translate the scrolling position and provide fling that the scrolling doesn't stop suddenly.
Or is just one canvas possible to use and draw the content to simulate the scrolling?
Maybe a horizontally scrolling ListView component?
The solution should be efficient and use minimum of memory.
Which solution do you recommend, or do you have some new ideas other than above?
All suggestions are highly appreciated. Thanks.
There is several possibilities:
Create custom View class and implement GestureDetector there. You can get movement of finger, calculate currently visible area and draw only visible part of content.
May be this solution is not the easiest to implement, but it will be fast and does not require any resources.

Android - how to build a 2d Dimension gallery with vertical and horizontal swiping

I want to build a custom gallery.
a 2d Dimension gallery , user can swiping page vertical and horizontal.
i store information like a 2d map, each page have its x and y coordinate.
========================
like first page is (0,0)
upper of first page is (0,-1)
second page is (1,0)
========================
if upper of first page swiping right , then will go second page.
but i don't know how do i go forward.
Thanks
-- update --
more detail what i want.
originally gallery only have left and right swiping.
user see photo by swiping left or right.
now user not only swiping left or right, but also swiping up and down to see the photo.
data structure is, each page have own x and y coordinate.
It is very hard to give an answer for this - you mention no programming language nor more specifics of what it is you want to do.
I guess it depends on where you want this gallery - one solution could be to make it webbased - while this is a sidescroller and I am planning to use the top buttons to change the page you should think about it...
http://globability.org/webapp/androidtest_20111105_1.html
It is a rough prototype - scrolling sideways on the Android with buttons following top and bottom.
I am not sure how you'd go about the automatic changing of pages whether you should create a button boundry, or set some sort of a listener that follows the x,y coordinates in the visible viewport and set event listeners that are triggered when the visible area reaches specific coordinates, use a different layout than me off course - but it all depends on the programming language - the example is plain old HTML but you get the idea, and the listener thing for x/y in visible viewport should be valid for most modern programming languages.
how to overlap a horizontal gallery with a vertical gallery - has some ideas for how to create similar functionality

Categories

Resources