本文整理汇总了Java中org.adw.library.widgets.discreteseekbar.DiscreteSeekBar类的典型用法代码示例。如果您正苦于以下问题:Java DiscreteSeekBar类的具体用法?Java DiscreteSeekBar怎么用?Java DiscreteSeekBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DiscreteSeekBar类属于org.adw.library.widgets.discreteseekbar包,在下文中一共展示了DiscreteSeekBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onProgressChanged
import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入依赖的package包/类
@Override
public void onProgressChanged(DiscreteSeekBar seekBar, int value, boolean fromUser) {
switch (seekBar.getId()) {
case R.id.ripple_duration:
ripple.setRippleDuration(seekBar.getProgress());
break;
case R.id.ripple_count:
ripple.setRippleCount(seekBar.getProgress());
break;
case R.id.ripple_max_size:
ripple.setRippleMaximumRadius(seekBar.getProgress());
break;
default:
}
}
示例3: forProgressChanged
import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入依赖的package包/类
@Contract("_ -> !null")
public static DiscreteSeekBar.OnProgressChangeListener forProgressChanged(OnProgressChangedListener listener) {
return new SimpleOnProgressChangeListener() {
@Override
public void onProgressChanged(DiscreteSeekBar seekBar, int value, boolean fromUser) {
listener.onProgressChanged(seekBar, value, fromUser);
}
};
}
示例4: forStartTrackingTouch
import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入依赖的package包/类
@Contract("_ -> !null")
public static DiscreteSeekBar.OnProgressChangeListener forStartTrackingTouch(OnStartTrackingTouchListener listener) {
return new SimpleOnProgressChangeListener() {
@Override
public void onStartTrackingTouch(DiscreteSeekBar seekBar) {
listener.onStartTrackingTouch(seekBar);
}
};
}
示例5: forStopTrackingTouch
import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入依赖的package包/类
@Contract("_ -> !null")
public static DiscreteSeekBar.OnProgressChangeListener forStopTrackingTouch(OnStopTrackingTouchListener listener) {
return new SimpleOnProgressChangeListener() {
@Override
public void onStopTrackingTouch(DiscreteSeekBar seekBar) {
listener.onStopTrackingTouch(seekBar);
}
};
}
示例6: onProgressChanged
import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入依赖的package包/类
@Override
public void onProgressChanged(DiscreteSeekBar seekBar, int value, boolean fromUser) {
if(mConnected) {
byte[] rgb = new byte[5];
rgb[0] = (byte)0xA1;
rgb[1] = ledrgb[0];
rgb[2] = ledrgb[1];
rgb[3] = ledrgb[2];
rgb[4] = ledbright;
controlLed(rgb);
ledbright = (byte)(value & 0xFF);
}
}
示例7: 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);
}
示例8: onProgressChanged
import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入依赖的package包/类
@Override
public void onProgressChanged(DiscreteSeekBar seekBar, int value, boolean fromUser) {
if (fromUser && mOnChangeListener != null) {
mOnChangeListener.onSelectionChanged(this, value);
}
mCurrentValue.setText(String.format("%d", value));
}
示例9: 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);
}
}
示例10: onProgressChanged
import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入依赖的package包/类
@Override
public void onProgressChanged(DiscreteSeekBar seekBar, int value, boolean fromUser) {
if(seekBar.getId() == sbRed.getId()){
iColor = 0xff000000 + (value<<16) + (sbGreen.getProgress()<<8) + (sbBlue.getProgress());
}else if(seekBar.getId() == sbGreen.getId()){
iColor = 0xff000000 + (sbRed.getProgress()<<16) + (value<<8) + (sbBlue.getProgress());
}else{
iColor = 0xff000000 + (sbRed.getProgress()<<16) + (sbGreen.getProgress()<<8) + (value);
}
btnSetColor.setTextColor(iColor);
}
示例11: 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));
}
});
}
示例12: onCreate
import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
DiscreteSeekBar discreteSeekBar1 = (DiscreteSeekBar) findViewById(R.id.discrete1);
discreteSeekBar1.setNumericTransformer(new DiscreteSeekBar.NumericTransformer() {
@Override
public int transform(int value) {
return value * 100;
}
});
}
示例13: onStopTrackingTouch
import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入依赖的package包/类
@Override
public void onStopTrackingTouch(DiscreteSeekBar seekBar) {
if (mTmp >= mMin && mTmp <= mMax) {
OnPreferenceChangeListener listener = getOnPreferenceChangeListener();
if (listener != null) {
listener.onPreferenceChange(this, mTmp);
}
mValue = mTmp;
mTmp = Integer.MIN_VALUE;
}
}
示例14: onProgressChanged
import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入依赖的package包/类
@Override public void onProgressChanged(DiscreteSeekBar seekBar, int value, boolean fromUser) {
if (getGpuImage().getBitmapWithFilterApplied() != null) {
if (helper != null) helper.adjust(value);
getGpuImage().requestRender();
homeModel.onFilterApplied(getGpuImage().getBitmapWithFilterApplied());
} else {
ViewHelper.animateVisibility(fromUser, seekBar);
}
}
示例15: getValues
import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; //导入依赖的package包/类
public float[] getValues() {
float[] values = new float[valueSettings.size()];
for (int i = 0; i < valueSettings.size(); i++) {
DiscreteSeekBar bar = valueSettings.get(i);
//For exact matching where we might have lost precision.
if (bar.getProgress() == bar.getMax()) {
values[i] = maximumValue;
} else {
values[i] = bar.getProgress() / 10.0f;
}
}
return values;
}