Skip to content

How to add continuous output?  #7

Open

Description

@cloydcSU

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.

Activity

  1. jeroenbeuz commented on Nov 22, 2017

    @jeroenbeuz

    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);
    }
    
  2. BennyKirschner commented on Jan 28, 2019

    @BennyKirschner

    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.

  3. BennyKirschner commented on Jan 30, 2019

    @BennyKirschner

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions