Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiny bug + How to set the header images to scroll using "parallex" effect? #5

Closed
AndroidDeveloperLB opened this issue Mar 23, 2014 · 4 comments

Comments

@AndroidDeveloperLB
Copy link

I would like to ask how should I make the images on the header to scroll together with the listView, so that both the bottom and the top of the view will get truncated, and not just the top (as the normal scrolling does).

for example, if the image is:
11
22
33
44
55
then when you scroll, I'd like to get:
22
33
44
instead of:
33
44
55

I've tried to use ParallaxImageView instead of simple ImageViews , but it didn't help.

Also, I've found a tiny bug: you've created a function called "clamp" but its parameters don't match the operations being done there. the minimal value is 1 instead of 0, and the maximal value is 0 instead of 1 :
code before:

public static float clamp(float value, float max, float min) {
    return Math.max(Math.min(value, min), max);
    }

code that should be:
public static float clamp(final float value, final float min, final float max) {
return Math.min(Math.max(value, min), max);
}

I've also changed the order of the parameter, since it's more common to put the min value before the max value.

@AndroidDeveloperLB
Copy link
Author

OK, I've found what I had to change.

view_kenburns.xml - change the imageViews to com.flavienlaurent.notboringactionbar.ParallaxImageView

KenBurnsView.java - add function:

public void setCurrentTranslation(final int currentTranslation) {
    if (mActiveImageIndex < 0)
        return;
    final ParallaxImageView activeImageView = (ParallaxImageView) mImageViews[mActiveImageIndex];
    if (activeImageView == null)
        return;
    activeImageView.setCurrentTranslation(currentTranslation);
}

NoBoringActionBarActivity.java - add some code to onScroll:

mHeaderPicture.setCurrentTranslation((int) mHeader.getTranslationY());

Now my question is: How do I set the action bar background to slowly change its color the more you scroll, from transparent to opaque (when you scroll enough to see just the action bar) ?

@flavienlaurent
Copy link
Owner

To change the actionbar bg opacity, see https://github.com/ManuelPeinado/FadingActionBar

@AndroidDeveloperLB
Copy link
Author

This is really not about opacity.
It was about the ken-burns effect to add to the action bar in a parrallex effect while scrolling.

@droidwithme
Copy link

@AndroidDeveloperLB did you solved that? changing actionbar color when full scrolled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants