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

Showing CTAButton on custom fragment slide #97

Closed
addrum opened this issue Jul 10, 2016 · 7 comments
Closed

Showing CTAButton on custom fragment slide #97

addrum opened this issue Jul 10, 2016 · 7 comments

Comments

@addrum
Copy link

addrum commented Jul 10, 2016

So far I have defined the fragment for the slide and implemented ButtonCtaFragment and it's methods, but the button doesn't show up.

I currently declare the slide:

addSlide(new FragmentSlide.Builder()
                .background(R.color.colorPrimary)
                .backgroundDark(R.color.colorPrimaryDark)
                .fragment(DownloadFrequencyFragment.newInstance())
                .build());

and have overridden the methods:

@Override
    public View.OnClickListener getButtonCtaClickListener() {
        return new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(getContext(), "button", Toast.LENGTH_LONG).show();
            }
        };
    }

    @Override
    public String getButtonCtaLabel() {
        return "Test label";
    }

    @Override
    public int getButtonCtaLabelRes() {
        return 0;
    }

What am I missing?

@heinrichreimer
Copy link
Owner

That's odd...
DownloadFrequencyFragment's class should be declared like this:

public class DownloadFrequencyFragment implements ButtonCtaFragment{
   ...
}

@heinrichreimer
Copy link
Owner

My bad...
I forgot I moved the CTA button code to ButtonCtaSlide. I'll add convenience methods to FragmentSlide.
Expect a fix this evening.
Sorry for misunderstanding you.

@heinrichreimer
Copy link
Owner

You can now either keep your code like you have it currently or use FragmentSlide.Builder.buttonCtaClickListener(), FragmentSlide.Builder.buttonCtaLabel() and FragmentSlide.Builder.buttonCtaLabelRes().

@addrum
Copy link
Author

addrum commented Jul 10, 2016

@heinrichreimer thanks! I see this will be in 1.5.6, when will that be released?

@heinrichreimer
Copy link
Owner

I could release it tomorrow.

@addrum
Copy link
Author

addrum commented Jul 12, 2016

@heinrichreimer yes please. I'm using this as part of a university project and I have a demo coming up so would like to have this stuff available.

@heinrichreimer
Copy link
Owner

Released: https://github.com/HeinrichReimer/material-intro/releases/tag/1.5.6

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

No branches or pull requests

2 participants