Example usage for android.widget SeekBar getKeyProgressIncrement

List of usage examples for android.widget SeekBar getKeyProgressIncrement

Introduction

In this page you can find the example usage for android.widget SeekBar getKeyProgressIncrement.

Prototype

public int getKeyProgressIncrement() 

Source Link

Document

Returns the amount of progress changed via the arrow keys.

Usage

From source file:ar.rulosoft.custompref.SeekBarCustomPreference.java

@Override
public void onBindViewHolder(final PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);

    holder.itemView.setClickable(false);

    SeekBar seekBar = (SeekBar) holder.findViewById(R.id.seekbar);
    seekBar.setOnSeekBarChangeListener(this);
    seekBar.setMax(mPreferredMax - mPreferredMin);
    seekBar.setProgress(mProgress - mPreferredMin);
    seekBar.setEnabled(isEnabled());/*from   w w w . ja  va 2  s.c  om*/

    mKeyProgressIncrement = seekBar.getKeyProgressIncrement();
    holder.itemView.setOnKeyListener(this);

    TextView info = (TextView) holder.findViewById(android.R.id.summary);
    if (info != null) {
        mInfoViews.put(info, this);
        bindInfo(info);
        mKeys.put(getKey(), this);
    }
}

From source file:net.xpece.android.support.preference.SeekBarPreference.java

@Override
public void onBindViewHolder(final PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);

    final SeekBar seekBar = (SeekBar) holder.findViewById(R.id.seekbar);

    holder.itemView.setOnKeyListener(buildSeekBarKeyListener(seekBar));

    final TextView info = (TextView) holder.findViewById(R.id.seekbar_value);
    if (info != null) {
        mInfoViews.put(info, this);
        bindInfo(info);//from   w  w  w.ja v  a  2  s .c om
    }

    if (seekBar == null) {
        Log.e(TAG, "SeekBar view is null in onBindViewHolder.");
        return;
    }
    seekBar.setOnSeekBarChangeListener(mSeekBarChangeListener);
    seekBar.setMax(mMax - mMin);
    // If the increment is not zero, use that. Otherwise, use the default mKeyProgressIncrement
    // in AbsSeekBar when it's zero. This default increment value is set by AbsSeekBar
    // after calling setMax. That's why it's important to call setKeyProgressIncrement after
    // calling setMax() since setMax() can change the increment value.
    if (mSeekBarIncrement != 0) {
        seekBar.setKeyProgressIncrement(mSeekBarIncrement);
    } else {
        mSeekBarIncrement = seekBar.getKeyProgressIncrement();
    }
    seekBar.setProgress(mSeekBarValue - mMin);
    seekBar.setEnabled(isEnabled());

    fixDrawableStateOnAndroid2(seekBar);
}