kumarkk / range-seek-bar

Automatically exported from code.google.com/p/range-seek-bar
0 stars 0 forks source link

Sliders don't reposition on setSelectedMinValue or setSelectedMaxValue #11

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a RangeSeekBar in the layout
2. Add a setOnRangeSeekBarChangeListener to the RangeSeekBar object 
3. Call setSelectedMinValue or setSelectedMaxValue on the RangeSeekBar object

What is the expected output? What do you see instead?
I expected the sliders(thumbs) to move to the correct position but nothing 
happens.

What version of the product are you using? On what operating system?
Android, no version of product found

Original issue reported on code.google.com by obog...@gmail.com on 11 Jun 2012 at 12:42

GoogleCodeExporter commented 9 years ago
What does your setOnRangeSeekBarChangeListener do?

Also, are you seeing the range bar change at all or just an incorrect position?

Could you provide some sample values or code? What are the absolute max/min? 

Original comment by grego...@gmail.com on 12 Jul 2012 at 9:13

GoogleCodeExporter commented 9 years ago
my setOnRangeSeekBarChangeListener does this:

curentSelectionLable.setText(minValue+" Euro - "+maxValue+" Euro");
                min=minValue.intValue();
                max=maxValue.intValue();
                setValues()
It updates some values.

The range bar does not change at all on setSelectedMinValue and 
setSelectedMaxValue

The solotion that I came out with is to read the rangebar each time I want to 
set the selected values. I do that in the loadCurrent method (see below).

public class MoneyPicker extends SubFilterFrame {
    RangeSeekBar<Integer> seekBar;
    TextView curentSelectionLable;
    int min, max;

    public void setValues(){
        curentFilter.pretMax=max;
        curentFilter.pretMin=min;
    }

    public MoneyPicker(FilterInterface parentFilter, View self, Context c) {
        super(parentFilter, self, c);
        curentSelectionLable=(TextView)curentSubFilter.findViewById(R.id.k_pret_lable);

    }

    @Override
    public void LoadCurent(FilterObject filter) {
        super.LoadCurent(filter);
        curentSelectionLable.setText(curentFilter.pretMin+" Euro - "+curentFilter.pretMax+" Euro");

        if(MoneyPicker.this.curentFilter==null){
            NSLog.l("double bummer");
        }

        LinearLayout layout = (LinearLayout) curentSubFilter.findViewById(R.id.k_pret_slider);
        if(seekBar!=null){
            layout.removeView(seekBar);
            seekBar=null;
        }
        seekBar = new RangeSeekBar<Integer>(40, 2500, context,200,1000);
        seekBar.setSelectedMaxValue(curentFilter.pretMax);
        seekBar.setSelectedMinValue(curentFilter.pretMin);
        min=curentFilter.pretMin;
        max=curentFilter.pretMax;
        seekBar.setOnRangeSeekBarChangeListener(new OnRangeSeekBarChangeListener<Integer>() {
            public void onRangeSeekBarValuesChanged(RangeSeekBar<?> bar, Integer minValue, Integer maxValue) {                      
                curentSelectionLable.setText(minValue+" Euro - "+maxValue+" Euro");
                min=minValue.intValue();
                max=maxValue.intValue();
                setValues();
            }
        });
        layout.addView(seekBar);
    }

}

Original comment by obog...@gmail.com on 12 Jul 2012 at 9:58