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

How to add continuous output? #7

Open
cloydcSU opened this issue Apr 1, 2015 · 3 comments
Open

How to add continuous output? #7

cloydcSU opened this issue Apr 1, 2015 · 3 comments

Comments

@cloydcSU
Copy link

cloydcSU commented Apr 1, 2015

Is there a way to modify the color picker so that it continuously outputs a color value as it is changed? Similar to the function onProgressChanged that a seekBar uses.

@jeroenbeuz
Copy link

Of course you can. Just create an interface with one method that returns a ColorPicker object. Implement that same interface in your ColorActivity. Than create a method in the ColorPicker class which will let you set the listener.

This is how I did it with the MultiColorPicker:

MultiColorActivity
onCreate

 multiColorPicker = (MultiColorPicker) findViewById(R.id.multiColorPicker);
        multiColorPicker.setListener(this);

Somewhere

 @Override
    public void colorChanged(MultiColorPicker multiColorPicker) {
        for(LightPointModel lightPointModel : groupLights){
            lightPointModel.setLightColor(multiColorPicker.getColor());
        }

        createLightPointViews();
    }

MultiColorPicker.java

 public void setListener(MultiColorPickerListener listener){
        this.listener = listener;
    }

MultiColor

public interface MultiColorPickerListener {
    void colorChanged(MultiColorPicker multiColorPicker);
}

@BennyKirschner
Copy link

Would be great if an onChange listener could be implemented directly. There doesn't appear to be a direct way to get this to work on Xamarin Android by just using the NuGet package.

@BennyKirschner
Copy link

BennyKirschner commented Jan 30, 2019

By adding a choreographer I was able to solve this - just get the color every frame and safe it's value somewhere as a workaround.

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

4 participants
@cloydcSU @BennyKirschner @jeroenbeuz and others