janheinrichmerker / material-intro

A simple material design app intro with cool animations and a fluent API.
https://jitpack.io/#com.heinrichreimer/material-intro
MIT License
1.74k stars 307 forks source link

Wrong Button Color #154

Closed ankithjoseph closed 7 years ago

ankithjoseph commented 7 years ago

The next button and skip button colors are messed up and is changing after click only. possible bug, it would be great if corrected.

janheinrichmerker commented 7 years ago

Would you mind recording a video of this bug happening?

ankithjoseph commented 7 years ago

ezgif com-2edcfe82db Screens from your demo app.

janheinrichmerker commented 7 years ago

This is weird. Doesn't happen to me when I test it with the demo app. Did you change anything? Seems like an issue with the internal pager scroll listener but that wasn't changed a long time.

janheinrichmerker commented 7 years ago

Ok so the screenshots are from the demo app that is live on Google Play right? Or did you compile the source? If so then which library version are you using and optionally it would be useful if you could give me commit hash at which you cloned the repo.

janheinrichmerker commented 7 years ago

Closing due to inactivity and missing steps to reproduce this. Will reopen that when anyone can submit steps to reproduce that.

anaszakariyah commented 7 years ago

ezgif com-resize

Mr. Reimer. I got similiar problem. In my case, the action button always in black color and the page indicators is in white/black color. I wrote the code similiar to your sample app so I don't know where I did wrong. My step are set on like this:

  1. Add New Empty activity then extend IntroActivity from the library
  2. Edit manifest theme activity to Theme.Intro
  3. Write the code similar to sample app. Here is the code.

    public class MainIntroActivity extends IntroActivity {
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    
        setFullscreen(true);
    
        super.onCreate(savedInstanceState);
    
        //tried with and without this
        setButtonBackFunction(BUTTON_BACK_FUNCTION_SKIP);
        setButtonNextFunction(BUTTON_NEXT_FUNCTION_NEXT_FINISH);
        setButtonBackVisible(true);
        setButtonNextVisible(true);
        setButtonCtaVisible(false);
    
        setPageScrollDuration(500);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            setPageScrollInterpolator(android.R.interpolator.fast_out_slow_in);
        }
    
        addSlide(new SimpleSlide.Builder()
                .title(R.string.intro_1_title)
                .description(R.string.intro_1_description)
                .image(R.drawable.ic_book)
                .background(R.color.app_light_primary)
                .background(R.color.app_dark_primary)
                .layout(R.layout.activity_intro_slide) //i tried both with and without this
                .build());
    
        addSlide(new SimpleSlide.Builder()
                .title(R.string.intro_2_title)
                .description(R.string.intro_2_description)
                .image(R.drawable.ic_book)
                .background(R.color.app_secondary_text)
                .background(R.color.mi_icon_color_dark)
                .layout(R.layout.activity_intro_slide)
                .build());
    
        addSlide(new SimpleSlide.Builder()
                .title(R.string.intro_3_title)
                .description(R.string.intro_3_description)
                .image(R.drawable.ic_book)
                .background(R.color.app_accent)
                .background(R.color.app_accent)
                .layout(R.layout.activity_intro_slide)
                .build());
    }
    }

    Am I missing some steps? I ran the app on lollipop device and emulator nougat and get the same result.

Edit: Maybe useful information or not at all. I am using compilesdk 25 and support v25.0.1.

janheinrichmerker commented 7 years ago

Just a typo. You have to use backgroundDark() instead of background() to change the button and status bar color.

anaszakariyah commented 7 years ago

Uh oh. Sorry, my bad. I am ashamed. I didn't realize that at all. Very basic mistake. Thanks for pointing that out. It working out nicely now. :)

janheinrichmerker commented 7 years ago

No problem at all

priyankatest commented 6 years ago

Hi, I am also facing same issue with Android L (OS 5.0 and 5.1) i.e. backgroundDark() is not taking correct color effect when we click next or move back.

My app code- public class MainIntroActivity extends IntroActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setFullscreen(true);

    setButtonBackVisible(true);
    setButtonNextVisible(true);
    setButtonCtaVisible(false);

    setPageScrollDuration(500);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setPageScrollInterpolator(android.R.interpolator.fast_out_slow_in);
    }

    addSlide(new SimpleSlide.Builder()
            .description(R.string.slide_1_desc)
            .image(R.drawable.logo)
            .background(R.color.splash_back_1)                      // #981a1e
            .backgroundDark(R.color.splash_back1_dark)       //  #7c1518
            .layout(R.layout.slide_splash)
            .build());

    addSlide(new SimpleSlide.Builder()
            .description(R.string.slide_2_desc)
            .image(R.drawable.splash_car_art)
            .background(R.color.splash_back_2)           // #4a90e2
            .backgroundDark(R.color.splash_back2_dark)      //#3c76b9
            .layout(R.layout.slide_splash)
            .build());

    addSlide(new SimpleSlide.Builder()
            .description(R.string.slide_3_desc)
            .image(R.drawable.splash_art)
            .background(R.color.splash_back_3)         //#54a4af
            .backgroundDark(R.color.splash_back3_dark)    //#44868f
            .layout(R.layout.slide_splash)
            .build());

}

} Screen shot - (expected behavior)

correct

screen-shots- (incorrect appearance)

incorrect1

incorrect2

incorrect3

Kindly help me to resolve this issue. Thanks an advance.