Android movement follow finger - java

I'm creating a custom menu for an Android application.
This menu is composed of two parts and at the start the first part is hidden, while the second is visible at the left of the screen.
Now what I'm trying to do, is to keep visible/invisible the hidden menu based on the user finger movement to right/left and this movement have to follow the finger.
The two menu are two LinearLayout and their root view is another LinearLayout with a vertical orientation.
I've started by using the Motion Events ACTION_DOWN and ACTION_UP, but they don't allow me to follow the finger movement.
Thanks to all:)

Related

Android swipe gesture with Layout following finger's movement

I have a problem in my Android application : in one of my activity i had to create an incremental LinearLayout dinamically, and here i had no problem.
Once this Layout has been filled with data i want to let the user to swipe left or wipe right on it with the finger and catch this movement to do something and also this was quite simple.
My problem is that I want to move this Layout as soon as the user touch it and that is not only caught the gesture (at the moment, my Layout is fixed in the middle of the screen without any movement) ; my idea is to move the Layout with the same movement as the finger to the right or left edge of the screen and then catch the right/left swipe for doing other things. I'm not so skilled with animation so I hope in you! Thanks!

Android: Creating an Item Fade Animation when Scrolling (Example Included)

I've seen this specific animation in certain apps where when scrolled, the first item on the window (most commonly an ImageView) gets faded out when scrolling down. Here's two screenshots that display the animated change:
This is from a fashion app named "Polyvore":
The image above displays an ImageView which gets faded out when scrolled. Animated more like.
And after scrolling a bit..
And it ultimately fades out along with the scrolling. Pardon me for I don't know what this 'View' or animation is called. I've seen this in the Google Play Music app as well. How do I implement this?
For anyone else looking for this specific effect. It's known as a Parallax effect. Check this link:
How to do the new PlayStore parallax effect

android complex graphic element

Good day, I would like to ask for some advice on coding up one pretty strange graphical element.
The point is - there should be a button in the middle (green), but it should be surrounded with an animated element (blue strip around green button on a sketch).
So when user clicks the button, the blue element starts rotating, when he taps again, it stops.
any ideas on that? thanks!
Easiest way is a custom view, where you overwrite onDraw to draw exactly what you want to the canvas. Rotation can be done by keeping track of how many radians of rotation you want and using a rotation matrix on the canvas. Animation can be done by using a Handler to post a delayed message to invalidate the view.
you could make use of the Animation features of android.
make the green button as ImageButton and the blue ring as static drawable.
then create an RotateAnimation which you toggle with the button press. this animation then rotates the drawable that contains the blue ring.
here is something about the rotate animation
http://developer.android.com/reference/android/view/animation/RotateAnimation.html

Java swing editable line drawing

I am writing a zigzag drawer as my school assignment. Basically what is expected is to be able to draw zigzags on a canvas, to be able to move vertices of the zigzags and to be able to move the entire zigzag. Also we can change the color and thickness of the zigzags.
I could manage to draw zigzags, a left click starts and subsequent left clicks continues the zigzag, and a right click finishes it. In this way i can draw several zigzags.
What i can not do is how i can make the vertices of the zigzags movable? I am keeping the point coordinates in an arraylist of type mypoint which consists of x, y and depth values. I am drawing all the painting on a canvas which is an extended class of JPanel. in the paintcomponent method i call drawline methode for every vertex in the list. As these are just paintings i cannot figure out how i will detect that the user is clicking on the vertex. Can i have little button like controllers when clicked will do the job i want. i tried to use labels and standard buttons, but neither can i position them appropriately nor are they too large to be just handlers for vertices.
Do you have suggestions on these?
You could have two modes of operations, which must be chosen by the user by selecting a radio button, for example: one for drawing zigzags, and the other one for selecting vertices.
While the chosen mode is "zigzag", the mouse clicks allow drawing zigzags as you have already implemented. When the chosen mode is "vertex selection", then a mouse click could find a vertex whose distance from the clicked point is less than 3 pixels, and the dragging of the mouse could move the vertex from its original position, following the mouse pointer.
You could inform the user about the selected vertex by displaying a small squere around the vertex.

Blackberry (Java) - Setting scrolling be not focused on objects on the screen

I have a mainscreen which currently scrolls (and I have the arrows on the right) but the scrolling seems to be focused on the ButtonField objects that I have on the page. Is there any way to set the scrolling to be non-focused scrolling (moving a few pixels each time). Is there a way to set this?
Other ideas I have had (which sound hacky so I want to avoid):
- Placing NullFields around to scroll
- Manually listening to the trackwheelRoll event and moving appropriately
That's not really how scrolling works on trackball BlackBerry devices. It's always based on the change of focus from one field to another. The only time the whole screen may scroll "smoothly" is when there are no fields that accept focus (or on touchscreen devices such as the Storm).
To use an analogy: just think of each focusable field on the screen as being like a line of text in a text editor. Just by moving the cursor with the arrow keys, you can get the screen to scroll but only when the cursor hits the edge of the current visible screen, and then only to the next line in a one-line increment. On trackball BlackBerrys, the trackball is the equivalent of the arrow keys -- and unfortunately there isn't an analog to "smoothly dragging the scrollbar with a mouse" in the text editor. Hope this makes sense!

Categories

Resources