TangoAgency / material-intro-screen

Inspired by Heinrich Reimer Material Intro and developed with love from scratch
MIT License
2.71k stars 409 forks source link

Unable To Add new slide #65

Closed judemanutd closed 7 years ago

judemanutd commented 7 years ago

`public class RegisterActivity extends MaterialIntroActivity {

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

    addSlide(new RegisterFragment());

    addSlide(new SlideFragmentBuilder()
            .backgroundColor(R.color.colorAccent)
            .buttonsColor(R.color.colorPrimary)
            .title("Want more?")
            .description("Go on")
            .build());
}

}`

When i use just addSlide(new RegisterFragment()); everything works fine but when i try adding another slide the app doesn't even start.

E/AndroidRuntime: FATAL EXCEPTION: main Process: octave.politico, PID: 15101 android.content.res.Resources$NotFoundException: Resource ID #0x0 at android.content.res.Resources.getValue(Resources.java:1369) at android.content.res.MiuiResources.getValue(MiuiResources.java:145) at android.content.res.Resources.getColor(Resources.java:981) at android.content.Context.getColor(Context.java:450) at android.support.v4.content.ContextCompatApi23.getColor(ContextCompatApi23.java:32) at android.support.v4.content.ContextCompat.getColor(ContextCompat.java:432) at agency.tango.materialintroscreen.MaterialIntroActivity.color(MaterialIntroActivity.java:427) at agency.tango.materialintroscreen.MaterialIntroActivity.getBackgroundColor(MaterialIntroActivity.java:419) at agency.tango.materialintroscreen.MaterialIntroActivity.access$1200(MaterialIntroActivity.java:44) at agency.tango.materialintroscreen.MaterialIntroActivity$ColorTransitionScrollListener.setViewsColor(MaterialIntroActivity.java:444) at agency.tango.materialintroscreen.MaterialIntroActivity$ColorTransitionScrollListener.pageScrolled(MaterialIntroActivity.java:434) at agency.tango.materialintroscreen.listeners.ViewBehavioursOnPageChangeListener.onPageScrolled(ViewBehavioursOnPageChangeListener.java:54) at android.support.v4.view.CustomViewPager.dispatchOnPageScrolled(CustomViewPager.java:1922) at android.support.v4.view.CustomViewPager.onPageScrolled(CustomViewPager.java:1896) at agency.tango.materialintroscreen.widgets.SwipeableViewPager.onPageScrolled(SwipeableViewPager.java:88) at android.support.v4.view.CustomViewPager.pageScrolled(CustomViewPager.java:1834) at android.support.v4.view.CustomViewPager.scrollToItem(CustomViewPager.java:695) at android.support.v4.view.CustomViewPager.onLayout(CustomViewPager.java:1778) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1167) at android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:852) at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:871) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586) at android.widget.LinearLayout.onLayout(LinearLayout.java:1495) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586) at android.widget.LinearLayout.onLayout(LinearLayout.java:1495) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2198) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1958) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1134) at android.view

judemanutd commented 7 years ago

Found the error,for those who get it you need to necessarily override and specify your own values while creating a custom fragment.

@Override public int buttonsColor() { return R.color.custom_slide_buttons; }