Moving GridView with finger - android

I need a solution for the following problem :
i have a screen with vertical half portion having Linear Layout with content and lower half portion is having Grid View of Images(Tiled Area).
When finger makes contact with the tiled area and starts swiping upward, the tiled area moves upward at the same pace as the finger is moving - showing more picture below, while slowly covering white section above. After it cover the whole screen, the user can go scroll up and down swipes.
the opposite also applies: if the entire screen is covered with the tiles, and the top of the tile is already at the top of the screen, then further downward swipes will result in the opposite effect, ultimately shrinking(at the same pace as the finger is moving) the tiled area to its original size.
NOTE : view will move at the same pace as the finger moves. i think it will be done by gesture detector

Related

Android Slider causing small arrows to appear at the top corner of the screen

I have an android app with a settings page that is using sliders to set a dim screen timer as well as screen brightness. Everything is functioning correctly, but when I am using either one of the sliders, a small triangle appears at the top left corner of the screen and moves left and right mimicking the movement of my slider. When I take my finger off the slider, the triangle disappears. I also can notice that for the first fraction of a second that I start using the slider, the triangle will have the number value of the slider next to it. Attached is a snapshot of what my screen looks like.screenshot of the triangle

Android layout with vertical adjustment between 2 inner containers

I would like to know what kind of layout is this? top image part (A) is pinch zoom (so I guess ImageView with something like photoView implemented), bottom part (C) is vertical scroll (so this would be RecyclerView), but middle part (B) dragger can be dragged up and down, thus enlarging the portion of one container (A or C) / reducing the portion of another, depending where is dragged.

Android Studio - What are possible options to overlay two images and make only the right or left half of each image visible?

I am trying to have two images overlayed in two imageViews and when i start a swiping gesture the upper image is cropped vertically at the starting point of my touch gesture and the cropping line follows my gesture on screen to the left or right. When I move my finger to the right the cropping line should follow it and reveal more of the upper image for example, until I lift my finger from the screen. The crop should stay there then.
The goal ist to be able to compare two images with a swiping gesture.
I hope what I am trying to achieve is halfway understandable and I would be happy about any kind of input regarding that topic ;)
Thank you in advance

Logic behind startScroll in scroller?

I don´t get the idea of startScroll() in this documentation.
It says:
Positive numbers will scroll the content to the left.
I don´t get it. If 0 is always on the left why scroll positive to the left? And if negative it will scroll to the right.
But why? It´s just so hard to wrap my head around it. What´s the logic behind it? Why make positive move to left?
In game and graphics programming 0 will always be either top-left or bot-left but it will always be on the left. So it will make sense to move to right with positive numbers and move to left with negative. But why is it different on startScroll?
I´m just asking cause I´m really curios as to why designed it like this.
To illustrate what is going on, see the drawing:
The top drawings show the coordinate system: (0,0) is on the top left, and positive directions are right (x coordinate) and down (y coordinate).
The bottom illustrations show the effect of the scroll as it appears as the "view port" is moving.
On the left is the position before the call to scroll
On the right is the position after the call to scroll by x=+2, y=+3
The the light blue rectangle is the screen "view port": the scroll method is actually moving this rectangle (the representation of the screen), and not the content. See it like a camera you look on the world through.
The red dot is just an element positioned on the view, and it is not moving. Look at it as the world you look at.
You can see that moving the "view port" in positive x an y directions result on the red dot appear to be moving up and left. Just like you move a camera to the right will make the world in the video move left.
You are in fact scrolling the view to right, which result the content view to be scrolled to left.
Having |A|B|C|, now scrolling by positive value will result a scroll to right, which scroll the actual content to left: |B|C| - A is not visible anymore, because it is considered as a content and is scrolled to left.
We can imagine a scroll in two different ways. One is that the window is moving and the other is that the content is moving. According to the Android's documentation of getScrollX()
Return the scrolled left position of this view. This is the left edge of the displayed part of your view. You do not need to draw any pixels farther left, since those are outside of the frame of your view on screen.
it is clear that Android prefers the content respective scroll rather than window respective one. In content respective scrolls
Positive numbers will scroll the content to the left.
Not only startScroll(), other methods like View.scrollBy(), View.scrollTo(), etc. work with the same idea.
If you ask "which is more natural imagination, content respective or window respective?", I will say "I don't know".
Your Container View is fixed on your screen. When you scroll to right, the right items keeps flowing towards left. Thus, when you do
scroller.startScroll (int 2 /*startX */,
int startY,
int dx,
int dy,
int duration);
makes your content will scroll to the left.
Scroller is actually the horizontal or vertical side bar, which appear when there is a scrolling gesture. Think about movement in respect to scroller and observe it's behaviour in an app. You will understand why it's implement so. You are currently thinking in respect to touch position, causing the confusion.

All data disappears from graph when rightmost rendered data goes off screen

At the moment it is happening in combined chart, after I zoom into the chart and start moving to left side, as soon as the rightmost rendered shape(scatter, bar, line, whichever) goes off chart screen all other rendered shapes in current chart go invisible. Anyone know what might be the problem?

Categories

Resources