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

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

Related

How to achieve StatusBar effect like in Medium or Telegram X apps?

Medium: before scroll and after scrolling
Telegram X: normal if you have internet connection and otherwise
As you can see icons like Wi-Fi and others disappear; only currenct time and battery icon remain, but with 50% opacity.
Also, this effect is applied using smooth fade in and fade out animation.
EDIT: For everyone who need some info about this issue check this answer. https://stackoverflow.com/a/49182417/9342948
After searching for a while I found this. It automatically applies fadein and fadeout animation.
View decorView = getActivity().getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);

How to keep vlcj consistent when layout changes in JavaFx

I have developed one desktop application using swing under which i have used JavaFx components, i have a few camera which i drag to the 2*2 layout view, it's working fine, now as soon as i changed the layout from 2*2 to 4*4, the view gets changed, then later on the dragged camera remain same on the canvas, but the streaming coming from the camera initially stops and then starts, i just want the video stream coming from the camera to remain consistent, without restarting it, what i have did now, is to release the Media player , Created the updated Canvas and Add it into the panel, but i guess it's not a proper solution, can anyone help me out with this issue, thanks well in advance.
Any kind of help is highly appreciable.
You can not remove the media player Canvas from the frame component hierarchy, nor can you hide it.
You must do something else like minimise it's size to 0,0 use a custom layout manager and move it's position to 0,0 or -1,-1 may work.
To emulate hiding, you could use a CardLayout with a video view and a blank view and switch between them.
There's an example in the vlcj test sources that shows one approach: https://github.com/caprica/vlcj/blob/master/src/test/java/uk/co/caprica/vlcj/test/layout/AdaptiveLayoutTest.java

Fading overlay through FrameLayout foreground with specified Rect that cuts out a section of the fade

Goal: A highlighted section of an image (the image covers the whole screen). The rest of the screen needs to be faded out.
Example
So far I've got the fading working using the foreground of a FrameLayout and placing the image as the background of a RelativeLayout within the FrameLayout. The solution I'm thinking is that I need to create 2 Drawables and merge them into one that FrameLayout Foreground can consume.
I've also been reading a bit up on PorterDuff, but I think that may be overkill for what I'm trying to achieve.
The fade functionality is working fine, but the source of the fade with transparent section is not.
I suggest that you have the original image in an ImageView on top of it place 4 views which are partially dimmed and that's it!
With some basic math you can know the sizes for each view, and using RelativeLayout will allow you to easily place them on the screen.
Good Luck!
P.S. I've attached a sketch to illustrate what I'm suggesting.

Image that has multi clickable zones/surface/area

I want to have an image on the android screen where different parts of the image can be clickable. What I mean is that, If its an image of 3 circles, I want to be able to click each of these circles,
Then I can add different functionalities to each of these clickable circles.
For an instance in this image below I want to be able to click each distinct color. Is it possible to have on-touch-listener and get you the color ? and can it be an image or has to be drawn in Java OR XML ?
I found a really good widget that helps you make any image muli-clickable. They have some good notes on how to use their widget as well.
The widget has a similar approach as Image mapping in html. The good thing about this widget is that the image can be zoomed and it will not lose the coordinates or areas associated to specific clicks.
Here is the link to their website. the guy who made the widget apparently had similar problem and came up with this widget.
Another solution would have been
creating an ImageView containing the png file referenced
making the whole ImageView clickable
setting an OnTouchListener to the ImageView which overrides the onTouch method
check the colors of the image pixel at the touch position
This is often done with an invisible mask image with one color for each zone (see the popular detailed tutorial), but here the image itself has distinct colors for each zone which makes it more interesting.

One particular ImageView causing severe lag

One particular activity uses a gallery view and many images that are displayed when one item in the gallery view is clicked. When you scroll through the gallery, the scrolling is very smooth ONLY if one certain image is commented out (even if 40+ images/textviews are displayed). We've tried changing the resolution of that image, changing the scaletype, but it still lags the gallery view. This image takes up a large portion of the background. Have you ever encountered any problems similar to this? We would really appreciate any advice you have to offer.
Try loading the image with ImageIO. Then check the type of the BufferedImage it returns (BufferenImage.getType()). Most likely it is not TYPE_INT_ARGB or TYPE_INT_RGB. (Probably TYPE_CUSTOM.) When this is the case there is a conversion being performed on every paint.

Categories

Resources