Skip to content

When i get mSelectedColor in dialog.setOnColorSelectedListener ,color = mColors[ ? ]? #13

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

Open
ghost opened this issue Apr 24, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Apr 24, 2017

    int[] mColors = getResources().getIntArray(R.array.default_rainbow);

    ColorPickerDialog dialog = ColorPickerDialog.newInstance(R.string.color_picker_default_title,
            mColors,
            mSelectedColor,
            5, // Number of columns
            ColorPickerDialog.SIZE_SMALL,
            true // True or False to enable or disable the serpentine effect
            //0, // stroke width
            //Color.BLACK // stroke color
    );

    dialog.setOnColorSelectedListener(new ColorPickerSwatch.OnColorSelectedListener() {

        @Override
        public void onColorSelected(int color) {
            mSelectedColor = color;
            textView.setTextColor(mSelectedColor);
            Intent intent = new Intent(MainActivity.this, SettingsActivity.class);
            startActivity(intent);
        }

    });
@xdtianyu
Copy link
Owner

There is no index returned, the color value is returned as callback via onColorSelected.

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

1 participant