コード例 #1
0
    public ColorSeekBar(SeekBar seekBar, TextView value, int index) {
      mSeekBar = seekBar;
      mValue = value;
      mIndex = index;

      mSeekBar.setMax(DisplayColorCalibration.getMaxValue());
      mSeekBar.setOnSeekBarChangeListener(this);
    }
コード例 #2
0
    @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));
    }