当前位置: 首页>>代码示例>>Java>>正文


Java DiscreteSeekBar类代码示例

本文整理汇总了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()));
            }));
}
 
开发者ID:Appolica,项目名称:Flubber,代码行数:26,代码来源:BindingAdapters.java

示例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:

    }
}
 
开发者ID:poldz123,项目名称:ShapeRipple,代码行数:17,代码来源:MainActivity.java

示例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);
        }
    };
}
 
开发者ID:Appolica,项目名称:Flubber,代码行数:10,代码来源:SimpleOnProgressChangeListener.java

示例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);
        }
    };
}
 
开发者ID:Appolica,项目名称:Flubber,代码行数:10,代码来源:SimpleOnProgressChangeListener.java

示例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);
        }
    };
}
 
开发者ID:Appolica,项目名称:Flubber,代码行数:10,代码来源:SimpleOnProgressChangeListener.java

示例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);
    }
}
 
开发者ID:skydoves,项目名称:MagicLight-Controller,代码行数:15,代码来源:MainActivity.java

示例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);
}
 
开发者ID:Kamshak,项目名称:BrainPhaser,代码行数:10,代码来源:TimePeriodSlider.java

示例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));
}
 
开发者ID:Kamshak,项目名称:BrainPhaser,代码行数:9,代码来源:TimePeriodSlider.java

示例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);
        }
    }
 
开发者ID:dmytroKarataiev,项目名称:EarthquakeSurvival,代码行数:34,代码来源:MaterialSeekBarController.java

示例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);
}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:13,代码来源:MainActivity.java

示例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));
        }
    });
}
 
开发者ID:poldz123,项目名称:ShapeRipple,代码行数:33,代码来源:MainActivity.java

示例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;
        }
    });
}
 
开发者ID:sathishmscict,项目名称:DiscreteSeekBar,代码行数:13,代码来源:MainActivity.java

示例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;
	}
}
 
开发者ID:PaperAirplane-Dev-Team,项目名称:Panoramic-Screenshot,代码行数:13,代码来源:DiscreteSeekBarPreference.java

示例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);
    }
}
 
开发者ID:k0shk0sh,项目名称:Filtra-StyleMe-,代码行数:10,代码来源:HomePresenter.java

示例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;
}
 
开发者ID:wardellbagby,项目名称:Sensor-Disabler,代码行数:14,代码来源:SensorSettingsFragment.java


注:本文中的org.adw.library.widgets.discreteseekbar.DiscreteSeekBar类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。