public ColorSeekBar(SeekBar seekBar, TextView value, int index) { mSeekBar = seekBar; mValue = value; mIndex = index; mSeekBar.setMax(DisplayColorCalibration.getMaxValue()); mSeekBar.setOnSeekBarChangeListener(this); }
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) { mCurrentColors[mIndex] = String.valueOf(progress); DisplayColorCalibration.setColors(TextUtils.join(" ", mCurrentColors)); } int min = DisplayColorCalibration.getMinValue(); int max = DisplayColorCalibration.getMaxValue(); int percent = Math.round(100F * progress / (max - min)); mValue.setText(String.format("%d%%", percent)); }