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

Unable to change colors at runtime. #16

Closed
1 of 3 tasks
estebandres opened this issue May 14, 2018 · 1 comment
Closed
1 of 3 tasks

Unable to change colors at runtime. #16

estebandres opened this issue May 14, 2018 · 1 comment

Comments

@estebandres
Copy link

estebandres commented May 14, 2018

What kind of issue is this?

  • UI Bug. Please provide a Screenshot/Video/GIF of what's the problem. If you need help to record a video you can follow this guide

  • Functional Bug. Please describe the scenario of the bug. Furthermore, please spend the time to write a failing test.

  • Feature Request. Start by telling what's problem you’re trying to solve. A Pull request is welcome as well.

Details

  • Library Version. 0.3.0
  • Android Version.
  • Emulator/Device specs. **LG Q6 Android 7.1.1 **
  • Logs/Crash reports/Stacktraces.
  • Example Code/Link to repositories.

I'm working on a java based android app.
Trying to integrate this view to the project I found a problem.
I don't seem to be able to change dynamically the outer colour nor the inner either.
The slider will be displayed with not even the xml defined colours but some weird defaults as shown in the screen shot.

alt text

Am I doing something wrong?

final SlideToActView actionSlider = (SlideToActView) rowView.findViewById(R.id.slider);
actionSlider.setOuterColor(R.color.slider_outer_color);
actionSlider.setInnerColor(R.color.slider_inner_color);
actionSlider.setLocked(false);
@estebandres estebandres changed the title Unable to change colors on runtime. Unable to change colors at runtime. May 14, 2018
@cortinico
Copy link
Owner

Hey @Andresteve07

Thanks for reporting this (and using the library).
This is caused by those two lines:

actionSlider.setOuterColor(R.color.slider_outer_color);
actionSlider.setInnerColor(R.color.slider_inner_color);

You can't pass Color resources to those methods, but you must pass a Color Int.
Replace with those two lines and it should work as expected.

actionSlider.setOuterColor(ContextCompat.getColor(context, R.color.slider_outer_color));
actionSlider.setInnerColor(ContextCompat.getColor(context, R.color.slider_inner_color));

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

2 participants