本文整理汇总了Java中org.adw.library.widgets.discreteseekbar.DiscreteSeekBar.setOnProgressChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java DiscreteSeekBar.setOnProgressChangeListener方法的具体用法?Java DiscreteSeekBar.setOnProgressChangeListener怎么用?Java DiscreteSeekBar.setOnProgressChangeListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.adw.library.widgets.discreteseekbar.DiscreteSeekBar
的用法示例。
在下文中一共展示了DiscreteSeekBar.setOnProgressChangeListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindToModel
import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入方法依赖的package包/类
@BindingAdapter("model")
public static void bindToModel(DiscreteSeekBar seekBar, final SeekBarModel model) {
DiscreteSeekBar.NumericTransformer transformer = seekBar.getNumericTransformer();
if (!(transformer instanceof NumericTransformer)) {
transformer = new NumericTransformer();
seekBar.setNumericTransformer(transformer);
}
final NumericTransformer customTransformer = (NumericTransformer) transformer;
customTransformer.setValues(model.getMinValue(), model.getMaxValue());
seekBar.setMin(0);
seekBar.setMax(100);
final int percentage = (int) customTransformer.transformToPercentage(model.getValue().get());
// Bug in the library
seekBar.setProgress(1);
seekBar.setProgress(percentage);
seekBar.setOnProgressChangeListener(
SimpleOnProgressChangeListener.forStopTrackingTouch(seekBar1 -> {
model.getValue().set(customTransformer.transformFromPercentage(seekBar.getProgress()));
}));
}
示例2: init
import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入方法依赖的package包/类
public void init() {
LayoutInflater.from(getContext()).inflate(R.layout.control_time_period_slider, this, true);
this.setOrientation(VERTICAL);
mSeekBar = (DiscreteSeekBar) findViewById(R.id.seekBar);
mTypeText = (TextView) findViewById(R.id.typeText);
mSeekBar.setIndicatorPopupEnabled(true);
mSeekBar.setOnProgressChangeListener(this);
}
示例3: onBindView
import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入方法依赖的package包/类
public void onBindView(@NonNull View view) {
mSeekBar = (DiscreteSeekBar) view.findViewById(com.pavelsikun.seekbarpreference.R.id.seekbar);
mSeekBar.setMin(mMinValue);
mSeekBar.setMax(mMaxValue);
mSeekBar.setOnProgressChangeListener(this);
mSeekBarValue = (EditText) view.findViewById(com.pavelsikun.seekbarpreference.R.id.seekbar_value);
mSeekBarValue.setText(String.valueOf(mCurrentValue));
mSeekBarValue.addTextChangedListener(this);
setValueTextSize(mValueTextSize);
setMaxTextLength();
mMeasurementUnitView = (TextView) view.findViewById(com.pavelsikun.seekbarpreference.R.id.measurement_unit);
mMeasurementUnitView.setText(mMeasurementUnit);
// Don't move this line
mSeekBar.setProgress(mCurrentValue);
if (!view.isEnabled()) {
mSeekBar.setEnabled(false);
mSeekBarValue.setEnabled(false);
}
mTitleTxt = (TextView) view.findViewById(android.R.id.title);
mSummaryTxt = (TextView) view.findViewById(android.R.id.summary);
if(mTitle != null || mSummary != null) {
if(mTitle != null) mTitleTxt.setText(mTitle);
if(mSummary != null) mSummaryTxt.setText(mSummary);
}
}
示例4: init
import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入方法依赖的package包/类
public void init() {
mToolbar = (Toolbar) findViewById(R.id.toolbar);
((AppCompatCheckBox) findViewById(R.id.enable_color_transition)).setOnCheckedChangeListener(this);
((AppCompatCheckBox) findViewById(R.id.enable_single_ripple)).setOnCheckedChangeListener(this);
((AppCompatCheckBox) findViewById(R.id.enable_stroke_ripple)).setOnCheckedChangeListener(this);
((AppCompatCheckBox) findViewById(R.id.enable_random_position)).setOnCheckedChangeListener(this);
((AppCompatCheckBox) findViewById(R.id.enable_random_color)).setOnCheckedChangeListener(this);
ripple = (ShapeRipple) findViewById(R.id.ripple);
ripple.setRippleShape(new Circle());
final DiscreteSeekBar rippleDuration = (DiscreteSeekBar) findViewById(R.id.ripple_duration);
final DiscreteSeekBar rippleCount = (DiscreteSeekBar) findViewById(R.id.ripple_count);
final DiscreteSeekBar rippleMaxSize = (DiscreteSeekBar) findViewById(R.id.ripple_max_size);
rippleDuration.setOnProgressChangeListener(this);
rippleCount.setOnProgressChangeListener(this);
rippleMaxSize.setOnProgressChangeListener(this);
ripple.post(new Runnable() {
@Override
public void run() {
rippleCount.setMax(ripple.getRippleCount() * 2);
rippleCount.setProgress(ripple.getRippleCount());
rippleMaxSize.setMax((int)ripple.getRippleMaximumRadius() * 3);
rippleMaxSize.setProgress((int)ripple.getRippleMaximumRadius());
rippleMaxSize.setMin((int)(ripple.getRippleMaximumRadius() * 0.25));
}
});
}
示例5: onCreate
import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_parameters);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
/** SeekBars escuhando */
DiscreteSeekBar ramSeekBar = (DiscreteSeekBar) findViewById(R.id.ram);
ramSeekBar.setOnProgressChangeListener(this);
DiscreteSeekBar cpuSeekBar = (DiscreteSeekBar) findViewById(R.id.cpu);
cpuSeekBar.setOnProgressChangeListener(this);
DiscreteSeekBar sentSeekBar = (DiscreteSeekBar) findViewById(R.id.upload);
sentSeekBar.setOnProgressChangeListener(this);
DiscreteSeekBar receivedSeekBar = (DiscreteSeekBar) findViewById(R.id.download);
receivedSeekBar.setOnProgressChangeListener(this);
DiscreteSeekBar ratingSeekBar = (DiscreteSeekBar) findViewById(R.id.ratings);
ratingSeekBar.setOnProgressChangeListener(this);
DiscreteSeekBar nDownloadsSeekBar = (DiscreteSeekBar) findViewById(R.id.number_downloads);
nDownloadsSeekBar.setOnProgressChangeListener(this);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Elaborando ranking...", Snackbar.LENGTH_LONG)
.setCallback(new Snackbar.Callback() {
@Override
public void onDismissed(Snackbar snackbar, int event) {
super.onDismissed(snackbar, event);
Intent intent = new Intent(Parameters.this, Ranking.class);
startActivity(intent);
}
}).show();
}
});
}